diff --git a/Makefile b/Makefile index 9b8c964..c81ace2 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,13 @@ else OPEN := xdg-open endif +BINARY_NAME=get-next-version +MODULE_PATH=github.com/thenativeweb/${BINARY_NAME} + +COMMON_FLAGS=-ldflags="-X '$(MODULE_PATH)/appversion.AppVersion=$(VERSION)'" + +BUILD_DIR=./build + qa: analyze test analyze: @@ -35,16 +42,16 @@ build-auto: qa clean detect-version @go build -ldflags="-X 'github.com/thenativeweb/get-next-version/version.Version=$(VERSION)'" -o ./build/get-next-version build-darwin-amd64: qa clean detect-version - @GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'github.com/thenativeweb/get-next-version/version.Version=$(VERSION)'" -o ./build/get-next-version-darwin-amd64 + @GOOS=darwin GOARCH=amd64 go build $(COMMON_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 build-darwin-arm64: qa clean detect-version - @GOOS=darwin GOARCH=arm64 go build -ldflags="-X 'github.com/thenativeweb/get-next-version/version.Version=$(VERSION)'" -o ./build/get-next-version-darwin-arm64 + @GOOS=darwin GOARCH=arm64 go build $(COMMON_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 build-linux-amd64: qa clean detect-version - @GOOS=linux GOARCH=amd64 go build -ldflags="-X 'github.com/thenativeweb/get-next-version/version.Version=$(VERSION)'" -o ./build/get-next-version-linux-amd64 + @GOOS=linux GOARCH=amd64 go build $(COMMON_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 build-windows-amd64: qa clean detect-version - @GOOS=windows GOARCH=amd64 go build -ldflags="-X 'github.com/thenativeweb/get-next-version/version.Version=$(VERSION)'" -o ./build/get-next-version-windows-amd64.exe + @GOOS=windows GOARCH=amd64 go build $(COMMON_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe build: build-auto