From 4e05f1809159396c2b089d88408df002b92928bd Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Fri, 18 Oct 2024 15:59:17 -0700 Subject: [PATCH] Add multiarch targets --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index e699e33..22587b3 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,17 @@ TARGETS = $(addprefix dist/,$(TARGET_ALIAS)) .PHONY: all all: $(TARGETS) +## Multi-arch targets +$(TARGETS): $(GOFILES) + mkdir -p ./dist + GOOS=$(word 2, $(subst -, ,$(@))) GOARCH=$(word 3, $(subst -, ,$(@))) CGO_ENABLED=0 \ + go build -ldflags '-X "main.version=${VERSION}"' -a -installsuffix nocgo \ + -o $@ + +.PHONY: $(TARGET_ALIAS) +$(TARGET_ALIAS): + $(MAKE) $(addprefix dist/,$@) + # Build app for the current machine $(APP_NAME): $(GOFILES) @echo Version: $(VERSION)