master
mk 38 lines 1.63 KB
Raw
1 include mk/header.mk
2 IPFS_BIN_$(d) := $(call go-curr-pkg-tgt)
3
4 TGT_BIN += $(IPFS_BIN_$(d))
5 CLEAN += $(IPFS_BIN_$(d))
6
7 PATH := $(realpath $(d)):$(PATH)
8
9 # disabled for now
10 # depend on *.pb.go files in the repo as Order Only (as they shouldn't be rebuilt if exist)
11 # DPES_OO_$(d) := diagnostics/pb/diagnostics.pb.go exchange/bitswap/message/pb/message.pb.go
12 # DEPS_OO_$(d) += merkledag/pb/merkledag.pb.go namesys/pb/namesys.pb.go
13 # DEPS_OO_$(d) += pin/internal/pb/header.pb.go unixfs/pb/unixfs.pb.go
14
15 $(d)_flags =-ldflags="-X "github.com/ipfs/kubo".CurrentCommit=$(git-hash) -X "github.com/ipfs/kubo".taggedRelease=$(git-tag) -X "github.com/ipfs/kubo".buildOrigin=$(git-origin)"
16
17 $(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags)
18
19 # uses second expansion to collect all $(DEPS_GO)
20 $(IPFS_BIN_$(d)): $(d) $$(DEPS_GO) ALWAYS #| $(DEPS_OO_$(d))
21 $(go-build-relative)
22
23 $(d)-install: GOFLAGS += $(cmd/ipfs_flags)
24 $(d)-install: $(d) $$(DEPS_GO) ALWAYS
25 $(GOCC) install $(go-flags-with-tags) ./cmd/ipfs
26 .PHONY: $(d)-install
27
28 COVER_BIN_$(d) := $(d)/ipfs-test-cover
29 CLEAN += $(COVER_BIN_$(d))
30
31 $(COVER_BIN_$(d)): GOTAGS += testrunmain
32 $(COVER_BIN_$(d)): $(d) $$(DEPS_GO) ALWAYS
33 $(eval TMP_PKGS := $(shell $(GOCC) list -f '{{range .Deps}}{{.}} {{end}}' $(go-flags-with-tags) ./cmd/ipfs | sed 's/ /\n/g' | grep ipfs/kubo) $(call go-pkg-name,$<))
34 $(eval TMP_LIST := $(call join-with,$(comma),$(TMP_PKGS)))
35 @echo $(GOCC) test $@ -c -covermode atomic -coverpkg ... $(go-flags-with-tags) ./$(@D) # for info
36 @$(GOCC) test -o $@ -c -covermode atomic -coverpkg $(TMP_LIST) $(go-flags-with-tags) ./$(@D) 2>&1 | (grep -v 'warning: no packages being tested' || true)
37
38 include mk/footer.mk