From 7edfc784ac45bc0715a9e2ca63ce8d78a1a3827f Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 4 Apr 2015 11:59:45 +0200 Subject: [PATCH] test: add GOFLAGS variable to the Makefile This makes it possible to build binaries with different flags. The content of the GOFLAGS variable is stored in a IPFS-BUILD-OPTIONS file, so that if GOFLAGS changes a rebuild of the binaries with the new flags is forced. License: MIT Signed-off-by: Christian Couder --- test/Makefile | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/test/Makefile b/test/Makefile index 868eac731..648b3a439 100644 --- a/test/Makefile +++ b/test/Makefile @@ -6,6 +6,9 @@ RANDOM_SRC = ../Godeps/_workspace/src/github.com/jbenet/go-random MULTIHASH_SRC = ../Godeps/_workspace/src/github.com/jbenet/go-multihash POLLENDPOINT_SRC= ../thirdparty/pollEndpoint +# User might want to override those on the command line +GOFLAGS = + all: deps deps: bins @@ -15,17 +18,21 @@ clean: bins: $(BINS) -bin/random: $(RANDOM_SRC)/**/*.go - go build -o bin/random $(RANDOM_SRC)/random +bin/random: $(RANDOM_SRC)/**/*.go IPFS-BUILD-OPTIONS + @echo "*** installing $@ ***" + go build $(GOFLAGS) -o bin/random $(RANDOM_SRC)/random -bin/multihash: $(MULTIHASH_SRC)/**/*.go - go build -o bin/multihash $(MULTIHASH_SRC)/multihash +bin/multihash: $(MULTIHASH_SRC)/**/*.go IPFS-BUILD-OPTIONS + @echo "*** installing $@ ***" + go build $(GOFLAGS) -o bin/multihash $(MULTIHASH_SRC)/multihash -bin/ipfs: $(IPFS_ROOT)/**/*.go - go build -o bin/ipfs $(IPFS_CMD) +bin/ipfs: $(IPFS_ROOT)/**/*.go IPFS-BUILD-OPTIONS + @echo "*** installing $@ ***" + go build $(GOFLAGS) -o bin/ipfs $(IPFS_CMD) -bin/pollEndpoint: $(POLLENDPOINT_SRC)/*.go - go build -o bin/pollEndpoint $(POLLENDPOINT_SRC) +bin/pollEndpoint: $(POLLENDPOINT_SRC)/*.go IPFS-BUILD-OPTIONS + @echo "*** installing $@ ***" + go build $(GOFLAGS) -o bin/pollEndpoint $(POLLENDPOINT_SRC) test: test_expensive @@ -38,4 +45,7 @@ test_cheap: cd sharness && make cd 3nodetest && make -.PHONY: all clean +IPFS-BUILD-OPTIONS: FORCE + @bin/checkflags '$@' '$(GOFLAGS)' '*** new Go flags ***' + +.PHONY: all clean FORCE