From ad9fbf7b6d56d7b3f4739bc4d0a1f669aa94087a Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sat, 7 Oct 2023 15:45:59 +0000 Subject: [PATCH] build: generic _impl target to run a make target for all GOOS/GOARCH combinations --- Makefile | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 6b0b55c..5385c20 100644 --- a/Makefile +++ b/Makefile @@ -191,19 +191,25 @@ download-circleci-release: ##################### BINARIES ##################### .PHONY: bins-all lint test-go test-platform cover-merge cover-html vet zrepl-bin test-platform-bin generate-platform-test-list -BINS_ALL_TARGETS := zrepl-bin test-platform-bin bins-all: - $(MAKE) $(BINS_ALL_TARGETS) GOOS=freebsd GOARCH=amd64 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=freebsd GOARCH=386 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=freebsd GOARCH=arm GOARM=7 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=freebsd GOARCH=arm64 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=linux GOARCH=amd64 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=linux GOARCH=arm64 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=linux GOARCH=arm GOARM=7 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=linux GOARCH=386 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=darwin GOARCH=amd64 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=solaris GOARCH=amd64 - $(MAKE) $(BINS_ALL_TARGETS) GOOS=illumos GOARCH=amd64 + $(MAKE) _run_make_foreach_target_tuple RUN_MAKE_FOREACH_TARGET_TUPLE_ARG="zrepl-bin test-platform-bin" + +_run_make_foreach_target_tuple: + if [ "$(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG)" = "" ]; then \ + echo "RUN_MAKE_FOREACH_TARGET_TUPLE_ARG must be set"; \ + exit 1; \ + fi + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=freebsd GOARCH=amd64 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=freebsd GOARCH=386 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=freebsd GOARCH=arm GOARM=7 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=freebsd GOARCH=arm64 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=linux GOARCH=amd64 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=linux GOARCH=arm64 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=linux GOARCH=arm GOARM=7 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=linux GOARCH=386 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=darwin GOARCH=amd64 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=solaris GOARCH=amd64 + $(MAKE) $(RUN_MAKE_FOREACH_TARGET_TUPLE_ARG) GOOS=illumos GOARCH=amd64 lint: $(GO_ENV_VARS) $(GOLANGCI_LINT) run ./...