From 508ff6e9c3d4a55a5c0e79b69f2e5665a2267f8a Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Thu, 18 May 2017 15:52:32 +0100 Subject: [PATCH] Allow adding additional ldflags and other build flags For LinuxKit we build Go executables as static pie binaries, so need to be able to add extra build and link flags. Signed-off-by: Justin Cormack --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 88443357d..b668d5683 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ ifeq ("$(GOOS)", "windows") endif GO_TAGS=$(if $(BUILDTAGS),-tags "$(BUILDTAGS)",) -GO_LDFLAGS=-ldflags "-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG)" +GO_LDFLAGS=-ldflags "-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG) $(EXTRA_LDFLAGS)" # Flags passed to `go test` TESTFLAGS ?=-parallel 8 -race @@ -115,7 +115,7 @@ ineffassign: ## run ineffassign build: ## build the go packages @echo "$(WHALE) $@" - @go build -i -v ${GO_LDFLAGS} ${GO_GCFLAGS} ${PACKAGES} + @go build -i -v ${EXTRA_FLAGS} ${GO_LDFLAGS} ${GO_GCFLAGS} ${PACKAGES} test: ## run tests, except integration tests and tests that require root @echo "$(WHALE) $@"