@cryptotaxi247 / kubo / commits / 00590fd29

mk: option to pass custom go executable

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Aug 22, 2017 at 19:47 UTC 00590fd293ae67e403265a94b2e9664eb4472e11
3 files changed +12 -11
cmd/ipfs/Rules.mk
+4 -4
@@ -23,7 +23,7 @@ $(IPFS_BIN_$(d)): $(d) $$(DEPS_GO) ALWAYS #| $(DEPS_OO_$(d))
23
24 $(d)-install: GOFLAGS += $(cmd/ipfs_flags)
25 $(d)-install: $(d) $$(DEPS_GO) ALWAYS
26 - go install $(go-flags-with-tags) ./cmd/ipfs
26 + $(GOCC) install $(go-flags-with-tags) ./cmd/ipfs
27 .PHONY: $(d)-install
28
29 COVER_BIN_$(d) := $(d)/ipfs-test-cover
@@ -31,9 +31,9 @@ CLEAN += $(COVER_BIN_$(d))
31
32 $(COVER_BIN_$(d)): GOTAGS += testrunmain
33 $(COVER_BIN_$(d)): $(d) $$(DEPS_GO) ALWAYS
34 - $(eval TMP_PKGS := $(shell go list -f '{{range .Deps}}{{.}} {{end}}' $(go-flags-with-tags) ./cmd/ipfs | sed 's/ /\n/g' | grep ipfs/go-ipfs | grep -v ipfs/go-ipfs/Godeps) $(call go-pkg-name,$<))
34 + $(eval TMP_PKGS := $(shell $(GOCC) list -f '{{range .Deps}}{{.}} {{end}}' $(go-flags-with-tags) ./cmd/ipfs | sed 's/ /\n/g' | grep ipfs/go-ipfs | grep -v ipfs/go-ipfs/Godeps) $(call go-pkg-name,$<))
35 $(eval TMP_LIST := $(call join-with,$(comma),$(TMP_PKGS)))
36 - @echo go test $@ -c -covermode atomic -coverpkg ... $(go-flags-with-tags) ./$(@D) # for info
37 - @go test -o $@ -c -covermode atomic -coverpkg $(TMP_LIST) $(go-flags-with-tags) ./$(@D) 2>&1 | (grep -v 'warning: no packages being tested' || true)
36 + @echo $(GOCC) test $@ -c -covermode atomic -coverpkg ... $(go-flags-with-tags) ./$(@D) # for info
37 + @$(GOCC) test -o $@ -c -covermode atomic -coverpkg $(TMP_LIST) $(go-flags-with-tags) ./$(@D) 2>&1 | (grep -v 'warning: no packages being tested' || true)
38
39 include mk/footer.mk
mk/golang.mk
+6 -5
@@ -2,6 +2,7 @@
2 GO_MIN_VERSION = 1.8
3
4 # pre-definitions
5 +GOCC ?= go
6 GOTAGS ?=
7 GOFLAGS ?=
8 GOTFLAGS ?=
@@ -10,16 +11,16 @@ DEPS_GO :=
11 TEST_GO :=
12 CHECK_GO :=
13
13 -go-pkg-name=$(shell go list $(go-tags) github.com/ipfs/go-ipfs/$(1))
14 +go-pkg-name=$(shell $(GOCC) list $(go-tags) github.com/ipfs/go-ipfs/$(1))
15 go-main-name=$(notdir $(call go-pkg-name,$(1)))$(?exe)
16 go-curr-pkg-tgt=$(d)/$(call go-main-name,$(d))
16 -go-pkgs-novendor=$(shell go list github.com/ipfs/go-ipfs/... | grep -v /Godeps/)
17 +go-pkgs-novendor=$(shell $(GOCC) list github.com/ipfs/go-ipfs/... | grep -v /Godeps/)
18
19 go-tags=$(if $(GOTAGS), -tags="$(call join-with,$(space),$(GOTAGS))")
20 go-flags-with-tags=$(GOFLAGS)$(go-tags)
21
22 define go-build
22 -go build -i $(go-flags-with-tags) -o "$@" "$(call go-pkg-name,$<)"
23 +$(GOCC) build -gcflags "-N -l" -i $(go-flags-with-tags) -o "$@" "$(call go-pkg-name,$<)"
24 endef
25
26 test_go_short: GOTFLAGS += -test.short
@@ -31,7 +32,7 @@ test_go_race: test_go_expensive
32 .PHONY: test_go_race
33
34 test_go_expensive: $$(DEPS_GO)
34 - go test $(go-flags-with-tags) $(GOTFLAGS) ./...
35 + $(GOCC) test $(go-flags-with-tags) $(GOTFLAGS) ./...
36 .PHONY: test_go_expensive
37 TEST_GO += test_go_expensive
38
@@ -41,7 +42,7 @@ test_go_fmt:
42 TEST_GO += test_go_fmt
43
44 test_go_megacheck:
44 - @go get honnef.co/go/tools/cmd/megacheck
45 + @$(GOCC) get honnef.co/go/tools/cmd/megacheck
46 @for pkg in $(go-pkgs-novendor); do megacheck "$$pkg"; done
47 .PHONY: megacheck
48
plugin/plugins/Rules.mk
+2 -2
@@ -8,11 +8,11 @@ $(d)_plugins_main:=$(addsuffix /main/main.go,$($(d)_plugins))
8 $($(d)_plugins_main): d:=$(d)
9 $($(d)_plugins_main):
10 $(d)/gen_main.sh "$(dir $@).." "$(call go-pkg-name,$(dir $@)/..)"
11 - go fmt $@ >/dev/null
11 + $(GOCC) fmt $@ >/dev/null
12
13 $($(d)_plugins_so): %.so : %/main/main.go
14 $($(d)_plugins_so): $$(DEPS_GO) ALWAYS
15 - go build -buildmode=plugin -i -pkgdir "$(GOPATH)/pkg/linux_amd64_dynlink" $(go-flags-with-tags) -o "$@" "$(call go-pkg-name,$(basename $@))/main"
15 + $(GOCC) build -buildmode=plugin -i -pkgdir "$(GOPATH)/pkg/linux_amd64_dynlink" $(go-flags-with-tags) -o "$@" "$(call go-pkg-name,$(basename $@))/main"
16 chmod +x "$@"
17
18 CLEAN += $($(d)_plugins_so)