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)