-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile: add targets for macOS-arm64 and linux-amd64
- Loading branch information
Showing
1 changed file
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
VERSION ?= dev | ||
BINARY_NAME = puff | ||
RELEASE_DIR = dist | ||
RELEASE_BUILD_FLAGS=-v -ldflags "-w -s -X main.version=$(VERSION)" -trimpath | ||
|
||
build: | ||
go vet ./... | ||
go build -ldflags "-X main.version=$(VERSION)" -o $(BINARY_NAME) | ||
go build -o $(BINARY_NAME) | ||
|
||
release-darwin-arm64: require-version | ||
@echo "Building for darwin-arm64" | ||
rm -rf $(RELEASE_DIR) | ||
go vet ./... | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ${RELEASE_BUILD_FLAGS} -o $(RELEASE_DIR)/$(BINARY_NAME) | ||
tar -czvf $(BINARY_NAME)-$(VERSION)-darwin-arm64.tar.gz -C $(RELEASE_DIR) $(BINARY_NAME) | ||
|
||
release-linux-amd64: require-version | ||
@echo "Building for linux-amd64" | ||
rm -rf $(RELEASE_DIR) | ||
go vet ./... | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${RELEASE_BUILD_FLAGS} -o $(RELEASE_DIR)/$(BINARY_NAME) | ||
tar -czvf $(BINARY_NAME)-$(VERSION)-linux-amd64.tar.gz -C $(RELEASE_DIR) $(BINARY_NAME) | ||
|
||
require-version: | ||
@if [ "$(VERSION)" = "dev" ]; then \ | ||
echo "You must set the VERSION"; \ | ||
exit 1; \ | ||
fi | ||
|
||
clean: | ||
git clean -fd |