From a92b2699a669fa3fb5d35cf334118dd8c583f38c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Woimb=C3=A9e?= Date: Fri, 20 Aug 2021 12:09:29 +0200 Subject: [PATCH] improve makefile --- Makefile | 58 +++++++++++++++----------------------------------------- 1 file changed, 15 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index a3799fc..f34a7d7 100644 --- a/Makefile +++ b/Makefile @@ -1,49 +1,21 @@ VERSION = 1.0.7 LDFLAGS = -ldflags '-s -w' -gcflags=-trimpath=${PWD} -asmflags=-trimpath=${PWD} -GOARCH = amd64 -linux: export GOOS=linux -linux_arm: export GOOS=linux -linux_arm: export GOARCH=arm -linux_arm: export GOARM=6 -linux_arm64: export GOOS=linux -linux_arm64: export GOARCH=arm64 -darwin: export GOOS=darwin -windows: export GOOS=windows +.PHONY: all linux_amd64 linux_arm64 darwin_amd64 darwin_arm64 windows_amd64 clean _build -.PHONY: all linux linux_arm linux_arm64 darwin windows clean - -all: linux linux_arm linux_arm64 darwin windows - -linux: - go build $(LDFLAGS) - mkdir -p release - rm -f release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip - zip release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip aws-rotate-key - -linux_arm: - go build $(LDFLAGS) - mkdir -p release - rm -f release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip - zip release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip aws-rotate-key +all: linux_amd64 linux_arm64 darwin_amd64 darwin_arm64 windows_amd64 +_build: + go build $(LDFLAGS) -o aws-rotate-key-$(GOOS)-$(GOARCH) +linux_amd64: + $(MAKE) _build GOOS=linux GOARCH=amd64 linux_arm64: - go build $(LDFLAGS) - mkdir -p release - rm -f release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip - zip release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip aws-rotate-key - -darwin: - go build $(LDFLAGS) - mkdir -p release - rm -f release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip - zip release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip aws-rotate-key - -windows: - go build $(LDFLAGS) - mkdir -p release - rm -f release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip - zip release/aws-rotate-key-${VERSION}-${GOOS}_${GOARCH}.zip aws-rotate-key.exe - + $(MAKE) _build GOOS=linux GOARCH=arm64 +darwin_amd64: + $(MAKE) _build GOOS=darwin GOARCH=amd64 +darwin_arm64: + $(MAKE) _build GOOS=darwin GOARCH=arm64 +windows_amd64: + $(MAKE) _build GOOS=windows GOARCH=amd64 + NAME='aws-rotate-key-windows-amd64' && mv $$NAME $${NAME}.exe clean: - rm -rf release - rm -f aws-rotate-key aws-rotate-key.exe + rm -f aws-rotate-key-*