From 6917d2f08f5877258f7ca7f26d466b0d473d27ba Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 30 Nov 2017 22:03:28 -0800 Subject: [PATCH] build for all supported platforms when testing fixes #4427 License: MIT Signed-off-by: Steven Allen --- cmd/ipfs/Rules.mk | 13 ++++++++++++- mk/golang.mk | 4 ++++ mk/util.mk | 11 +++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/cmd/ipfs/Rules.mk b/cmd/ipfs/Rules.mk index d6bcbbb4d76..a42b12a92f4 100644 --- a/cmd/ipfs/Rules.mk +++ b/cmd/ipfs/Rules.mk @@ -2,6 +2,7 @@ include mk/header.mk IPFS_BIN_$(d) := $(call go-curr-pkg-tgt) TGT_BIN += $(IPFS_BIN_$(d)) +TEST += $(d)-try-build CLEAN += $(IPFS_BIN_$(d)) PATH := $(realpath $(d)):$(PATH) @@ -14,12 +15,22 @@ PATH := $(realpath $(d)):$(PATH) $(d)_flags =-ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(shell git rev-parse --short HEAD)" -$(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags) +$(d)-try-build $(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags) # uses second expansion to collect all $(DEPS_GO) $(IPFS_BIN_$(d)): $(d) $$(DEPS_GO) ALWAYS #| $(DEPS_OO_$(d)) $(go-build) +TRY_BUILD_$(d)=$(addprefix $(d)-try-build-,$(SUPPORTED_PLATFORMS)) +$(d)-try-build: $(TRY_BUILD_$(d)) +.PHONY: $(d)-try-build + +$(TRY_BUILD_$(d)): private PLATFORM = $(subst -, ,$(patsubst $<-try-build-%,%,$@)) +$(TRY_BUILD_$(d)): private GOOS = $(word 1,$(PLATFORM)) +$(TRY_BUILD_$(d)): private GOARCH = $(word 2,$(PLATFORM)) +$(TRY_BUILD_$(d)): $(d) $$(DEPS_GO) ALWAYS + GOOS=$(GOOS) GOARCH=$(GOARCH) $(go-try-build) +.PHONY: $(TRY_BUILD_$(d)) $(d)-install: GOFLAGS += $(cmd/ipfs_flags) $(d)-install: $(d) $$(DEPS_GO) ALWAYS diff --git a/mk/golang.mk b/mk/golang.mk index 1abf4eac8b0..71c6ace0b81 100644 --- a/mk/golang.mk +++ b/mk/golang.mk @@ -23,6 +23,10 @@ define go-build $(GOCC) build -i $(go-flags-with-tags) -o "$@" "$(call go-pkg-name,$<)" endef +define go-try-build +$(GOCC) build $(go-flags-with-tags) -o /dev/null "$(call go-pkg-name,$<)" +endef + test_go_short: GOTFLAGS += -test.short test_go_short: test_go_expensive .PHONY: test_go_short diff --git a/mk/util.mk b/mk/util.mk index 67b94f9520c..c531d912369 100644 --- a/mk/util.mk +++ b/mk/util.mk @@ -9,6 +9,17 @@ else PATH_SEP :=: endif +# SUPPORTED_PLATFORM += windows/386 FIXME: #4438 (badger bug) +SUPPORTED_PLATFORMS += windows-amd64 + +SUPPORTED_PLATFORMS += linux-arm +SUPPORTED_PLATFORMS += linux-arm64 +SUPPORTED_PLATFORMS += linux-386 +SUPPORTED_PLATFORMS += linux-amd64 + +SUPPORTED_PLATFORMS += darwin-386 +SUPPORTED_PLATFORMS += darwin-amd64 + space:= space+= comma:=,