Makefile: make add EXTRA_GOFLAG to GOFLAGS (#605)
Makefile: make add EXTRA_GOFLAG to GOFLAGS 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. Co-authored-by: Jan Tojnar <jtojnar@gmail.com> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/605 Reviewed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
parent
ae12871bd7
commit
158d98c2bd
1 changed files with 2 additions and 2 deletions
4
Makefile
4
Makefile
|
@ -16,8 +16,8 @@ endif
|
||||||
GOFILES := $(shell find . -name "*.go" -type f ! -path "*/bindata.go")
|
GOFILES := $(shell find . -name "*.go" -type f ! -path "*/bindata.go")
|
||||||
GOFMT ?= gofmt -s
|
GOFMT ?= gofmt -s
|
||||||
|
|
||||||
GOFLAGS := -v
|
|
||||||
EXTRA_GOFLAGS ?=
|
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)"
|
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
|
go generate code.vikunja.io/api/pkg/static
|
||||||
|
|
||||||
$(EXECUTABLE): $(SOURCES)
|
$(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
|
.PHONY: compress-build
|
||||||
compress-build:
|
compress-build:
|
||||||
|
|
Loading…
Reference in a new issue