From ee2c70e6a242cf11347688be1fd89d04419ec054 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 4 Jul 2020 18:28:22 +0200 Subject: [PATCH] Makefile: make add EXTRA_GOFLAG to GOFLAGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some commands (`go generate`) only support taking `GOFLAGS` from the environment but setting `GOFLAGS` environment variable is ineffectual because the variable of the same name defined in the Makefile shadows it. We also have a custom `EXTRA_GOFLAGS` variable but we only pass that to `go build`. Let’s add `EXTRA_GOFLAGS` to the `GOFLAGS` variable in the Makefile to allow passing custom flags to Go through `EXTRA_GOFLAGS` environment variable. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ea159b1ac..e5f29413a 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ endif GOFILES := $(shell find . -name "*.go" -type f ! -path "*/bindata.go") GOFMT ?= gofmt -s -GOFLAGS := -v EXTRA_GOFLAGS ?= +GOFLAGS := -v $(EXTRA_GOFLAGS) LDFLAGS := -X "code.vikunja.io/api/pkg/version.Version=$(shell git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')" -X "main.Tags=$(TAGS)" @@ -105,7 +105,7 @@ generate: go generate code.vikunja.io/api/pkg/static $(EXECUTABLE): $(SOURCES) - go build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ + go build $(GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ .PHONY: compress-build compress-build: -- 2.40.1