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 <chriscool@tuxfamily.org>
Christian Couder committed
Apr 4, 2015 at 11:59 UTC
7edfc784ac45bc0715a9e2ca63ce8d78a1a3827f
1 file changed
+19
-9
test/Makefile
+19
-9
@@ -6,6 +6,9 @@ RANDOM_SRC = ../Godeps/_workspace/src/github.com/jbenet/go-random
6
MULTIHASH_SRC = ../Godeps/_workspace/src/github.com/jbenet/go-multihash
7
POLLENDPOINT_SRC= ../thirdparty/pollEndpoint
8
9
+# User might want to override those on the command line
10
+GOFLAGS =
11
+
12
all: deps
13
14
deps: bins
@@ -15,17 +18,21 @@ clean:
18
19
bins: $(BINS)
20
18
-bin/random: $(RANDOM_SRC)/**/*.go
19
- go build -o bin/random $(RANDOM_SRC)/random
21
+bin/random: $(RANDOM_SRC)/**/*.go IPFS-BUILD-OPTIONS
22
+ @echo "*** installing $@ ***"
23
+ go build $(GOFLAGS) -o bin/random $(RANDOM_SRC)/random
24
21
-bin/multihash: $(MULTIHASH_SRC)/**/*.go
22
- go build -o bin/multihash $(MULTIHASH_SRC)/multihash
25
+bin/multihash: $(MULTIHASH_SRC)/**/*.go IPFS-BUILD-OPTIONS
26
+ @echo "*** installing $@ ***"
27
+ go build $(GOFLAGS) -o bin/multihash $(MULTIHASH_SRC)/multihash
28
24
-bin/ipfs: $(IPFS_ROOT)/**/*.go
25
- go build -o bin/ipfs $(IPFS_CMD)
29
+bin/ipfs: $(IPFS_ROOT)/**/*.go IPFS-BUILD-OPTIONS
30
+ @echo "*** installing $@ ***"
31
+ go build $(GOFLAGS) -o bin/ipfs $(IPFS_CMD)
32
27
-bin/pollEndpoint: $(POLLENDPOINT_SRC)/*.go
28
- go build -o bin/pollEndpoint $(POLLENDPOINT_SRC)
33
+bin/pollEndpoint: $(POLLENDPOINT_SRC)/*.go IPFS-BUILD-OPTIONS
34
+ @echo "*** installing $@ ***"
35
+ go build $(GOFLAGS) -o bin/pollEndpoint $(POLLENDPOINT_SRC)
36
37
test: test_expensive
38
@@ -38,4 +45,7 @@ test_cheap:
45
cd sharness && make
46
cd 3nodetest && make
47
41
-.PHONY: all clean
48
+IPFS-BUILD-OPTIONS: FORCE
49
+ @bin/checkflags '$@' '$(GOFLAGS)' '*** new Go flags ***'
50
+
51
+.PHONY: all clean FORCE