From 406ab86104caf375bfce8672ea34ba2ece6e47ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Wed, 17 Aug 2016 21:31:40 +0200 Subject: [PATCH] Clean up and fix minor bugs in DEBUG/GOGCFLAGS handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use “override GOGCFLAGS+=” so that (make GOGCFLAGS=… DEBUG=1) does not ignore the appending to GOGCFLAGS * Move quoting of -gcflags from the variable to its use, so that (make GOGCFLAGS=… DEBUG=1) is correctly quoted * Now that GOGCFLAGS and DEBUG are both handled correctly when completely empty, simplify by dropping the DEBUG!=1 branch. * Beautify the command line by not using DEBUG= if DEBUG is unset. --- Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 061b23cd..b69b540d 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,7 @@ MANINSTALLDIR=${PREFIX}/share/man GO_MD2MAN ?= /usr/bin/go-md2man ifeq ($(DEBUG), 1) - GOGCFLAGS += "-N -l" -else - GOGCFLAGS ?= "" - DEBUG ?= 0 + override GOGCFLAGS += -N -l endif GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) @@ -44,11 +41,11 @@ all: binary docs binary: cmd/skopeo docker build ${DOCKER_BUILD_ARGS} -f Dockerfile.build -t skopeobuildimage . docker run --rm -v ${PWD}:/src/github.com/projectatomic/skopeo \ - skopeobuildimage make binary-local DEBUG=$(DEBUG) + skopeobuildimage make binary-local $(if $(DEBUG),DEBUG=$(DEBUG)) # Build w/o using Docker containers binary-local: - go build -ldflags "-X main.gitCommit=${GIT_COMMIT}" -gcflags $(GOGCFLAGS) -o skopeo ./cmd/skopeo + go build -ldflags "-X main.gitCommit=${GIT_COMMIT}" -gcflags "$(GOGCFLAGS)" -o skopeo ./cmd/skopeo build-container: