From 7709115afe01048431c23900c9a091472d6c36eb Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 1 Aug 2017 16:43:42 +0100 Subject: [PATCH 1/2] Allow setting of compiler options To allow e.g. building a static binary with: make binaries GO_GCFLAGS="--ldflags '-extldflags \"-fno-PIC -static\"'" Signed-off-by: Ian Campbell --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 630e4851b..3d82c5f34 100644 --- a/Makefile +++ b/Makefile @@ -70,10 +70,11 @@ boiler: cri-containerd: check-gopath $(GO) build -o $(BUILD_DIR)/$@ \ $(BUILD_TAGS) \ + $(GO_LDFLAGS) $(GO_GCFLAGS) \ $(PROJECT)/cmd/cri-containerd test: - go test -timeout=10m -race ./pkg/... $(BUILD_TAGS) + go test -timeout=10m -race ./pkg/... $(BUILD_TAGS) $(GO_LDFLAGS) $(GO_GCFLAGS) test-cri: @./hack/test-cri.sh From 7008be890fc8adec3447bd92fc7e3c52a4fb4083 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 7 Aug 2017 13:50:34 +0100 Subject: [PATCH 2/2] Add `static-binaries` target Signed-off-by: Ian Campbell --- Makefile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 3d82c5f34..0a9dcd590 100644 --- a/Makefile +++ b/Makefile @@ -32,16 +32,17 @@ default: help help: @echo "Usage: make " @echo - @echo " * 'install' - Install binaries to system locations" - @echo " * 'binaries' - Build cri-containerd" - @echo " * 'test' - Test cri-containerd" - @echo " * 'test-cri' - Test cri-containerd with cri validation test" - @echo " * 'clean' - Clean artifacts" - @echo " * 'verify' - Execute the source code verification tools" - @echo " * 'install.tools' - Install tools used by verify" - @echo " * 'install.deps' - Install dependencies of cri-containerd (containerd, runc, cni)" - @echo " * 'uninstall' - Remove installed binaries from system locations" - @echo " * 'version' - Print current cri-containerd release version" + @echo " * 'install' - Install binaries to system locations" + @echo " * 'binaries' - Build cri-containerd" + @echo " * 'static-binaries - Build static cri-containerd" + @echo " * 'test' - Test cri-containerd" + @echo " * 'test-cri' - Test cri-containerd with cri validation test" + @echo " * 'clean' - Clean artifacts" + @echo " * 'verify' - Execute the source code verification tools" + @echo " * 'install.tools' - Install tools used by verify" + @echo " * 'install.deps' - Install dependencies of cri-containerd (containerd, runc, cni)" + @echo " * 'uninstall' - Remove installed binaries from system locations" + @echo " * 'version' - Print current cri-containerd release version" .PHONY: check-gopath @@ -84,6 +85,9 @@ clean: binaries: cri-containerd +static-binaries: GO_LDFLAGS=--ldflags '-extldflags "-fno-PIC -static"' +static-binaries: cri-containerd + install: check-gopath install -D -m 755 $(BUILD_DIR)/cri-containerd $(BINDIR)/cri-containerd @@ -118,6 +122,7 @@ install.tools: .install.gitvalidation .install.gometalinter .PHONY: \ binaries \ + static-binaries \ boiler \ clean \ default \