@cryptotaxi247 / kubo / commits / 650eeee7c

Rework tags and flags passing in Makefile

License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Dec 6, 2016 at 17:34 UTC 650eeee7cc04156d8251440d90d778f0a7b98d07
2 files changed +31 -14
Makefile
+26 -6
@@ -3,19 +3,28 @@ IPFS_MIN_GO_VERSION = 1.7
3 IPFS_MIN_GX_VERSION = 0.6
4 IPFS_MIN_GX_GO_VERSION = 1.1
5
6 +GOTAGS =
7 +GOTAGS += "" # we have to have always at least one tag, empty tag works well
8 +
9 +GOFLAGS =
10 +GOTFLAGS =
11
12 export IPFS_REUSEPORT=false
13 +export GOFLAGS
14 +export GOTFLAGS
15 +
16 +GOFLAGS += -tags $(call join-with,$(comma),$(GOTAGS))
17
18 ifneq ($(COVERALLS_TOKEN), )
19 covertools_rule = covertools
11 - GOT = overalls -project=github.com/ipfs/go-ipfs -covermode atomic -ignore=.git,Godeps,thirdparty,test,core/commands,cmd -- $(GOTFLAGS)
20 + GOT = overalls -project=github.com/ipfs/go-ipfs -covermode atomic -ignore=.git,Godeps,thirdparty,test,core/commands,cmd -- $(GOFLAGS) $(GOTFLAGS)
21 else
13 - covertools_rule = $()
14 - GOT = go test $(GOTFLAGS) ./...
22 + covertools_rule =
23 + GOT = go test $(GOFLAGS) $(GOTFLAGS) ./...
24 endif
25
26 ifeq ($(TEST_NO_FUSE),1)
18 - GOTFLAGS += -tags nofuse
27 + GOTAGS += nofuse
28 endif
29
30 ifeq ($(OS),Windows_NT)
@@ -28,6 +37,13 @@ dist_root=/ipfs/QmNZL8wNsvAGdVYr8uGeUE9aGfHjFpHegAWywQFEdSaJbp
37 gx_bin=bin/gx-v0.9.0
38 gx-go_bin=bin/gx-go-v1.3.0
39
40 +
41 +# util functions
42 +
43 +space =
44 +space +=
45 +comma =,
46 +join-with = $(subst $(space),$1,$(strip $2))
47 # use things in our bin before any other system binaries
48 export PATH := bin:$(PATH)
49 export IPFS_API ?= v04x.ipfs.io
@@ -58,7 +74,7 @@ path_check:
74 @bin/check_go_path $(realpath $(shell pwd)) $(realpath $(addsuffix /src/github.com/ipfs/go-ipfs,$(subst $(GOPATH_DELIMITER), ,$(GOPATH))))
75
76 deps: go_check gx_check path_check $(covertools_rule)
61 - ${gx_bin} --verbose install --global
77 + ${gx_bin} --verbose install --global >/dev/null 2>&1
78
79 covertools:
80 go get -u github.com/mattn/goveralls
@@ -71,7 +87,11 @@ covertools:
87 vendor: godep
88 godep save -r ./...
89
74 -install build nofuse: deps
90 +nofuse: GOTAGS += nofuse
91 +nofuse: deps
92 + $(MAKE) -C cmd/ipfs install
93 +
94 +install build: deps
95 $(MAKE) -C cmd/ipfs $@
96
97 clean:
cmd/ipfs/Makefile
+5 -8
@@ -1,19 +1,16 @@
1 COMMIT := $(shell git rev-parse --short HEAD)
2 -ldflags = "-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(COMMIT)"
2 +GOFLAGS += -ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(COMMIT)"
3
4 all: install
5
6 install:
7 - go install -ldflags=$(ldflags)
7 + go install $(GOFLAGS)
8
9 build:
10 - go build -i -ldflags=$(ldflags)
11 -
12 -nofuse:
13 - go install -tags nofuse -ldflags=$(ldflags)
10 + go build -i $(GOFLAGS)
11
12 clean:
16 - go clean -ldflags=$(ldflags)
13 + go clean $(GOFLAGS)
14
15 uninstall:
19 - go clean -i -ldflags=$(ldflags)
16 + go clean -i $(GOFLAGS)