From 9e3253838113d477d2cda73242041eb8b88dfefe Mon Sep 17 00:00:00 2001 From: qfdk Date: Fri, 15 Apr 2022 19:03:32 +0200 Subject: [PATCH] fix: makefile --- .gitignore | 2 ++ Makefile | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f42049a..73a2935 100644 --- a/.gitignore +++ b/.gitignore @@ -151,3 +151,5 @@ tmp/ /nginx-proxy-manager /data.db /nginx-proxy-manager.pid + +dist/ diff --git a/Makefile b/Makefile index 9a5e640..379cc98 100644 --- a/Makefile +++ b/Makefile @@ -11,13 +11,34 @@ LDFLAGS=-ldflags "-X ${CONFIG_PATH}.BuildName=${BUILD_NAME} \ -X '${CONFIG_PATH}.GoVersion=${GoVersion}' \ -X ${CONFIG_PATH}.BuildVersion=${BUILD_VERSION}" -.PHONY: build clean help +.PHONY: build clean release help all: clean build build: go build ${LDFLAGS} -v . + +release: + # Clean + go clean + rm -rf dist + mkdir dist + rm -rf *.gz + # Build for mac + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -v . + tar czvf ${BUILD_NAME}-darwin-amd64-${BUILD_VERSION}.tar.gz ./${BUILD_NAME} + # Build for mac arm64 + go clean + CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -v . + tar czvf ${BUILD_NAME}-darwin-arm64-${BUILD_VERSION}.tar.gz ./${BUILD_NAME} + # Build for linux + go clean + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -v . + tar czvf ${BUILD_NAME}-linux64-${BUILD_VERSION}.tar.gz ./${BUILD_NAME} + go clean + mv *.gz dist + clean: rm -rf nginx-proxy-manager go clean -i .