This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from do-something-for-fun/master
promote: use Makefile and support cross-compile
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
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 |
---|---|---|
|
@@ -24,3 +24,7 @@ | |
# Other Runtime-Generated Files | ||
*.crt | ||
*.key | ||
|
||
# Binary | ||
rwppa* | ||
|
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Binary name | ||
BINARY=rwppa | ||
VERSION=1.0 | ||
|
||
# Builds | ||
build: | ||
GO111MODULE=on go build -o ${BINARY} -ldflags "-X main.Version=${VERSION}" | ||
GO111MODULE=on go test -v | ||
|
||
# Installs to $GOPATH/bin | ||
install: | ||
GO111MODULE=on go install | ||
|
||
release_mac: | ||
go clean | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 GO111MODULE=on go build -ldflags "-s -w -X main.Version=${VERSION}" | ||
mv ./${BINARY} ${BINARY}-mac64 | ||
|
||
release_linux: | ||
go clean | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-s -w -X main.Version=${VERSION}" | ||
mv ./${BINARY} ${BINARY}-linux64 | ||
|
||
release_windows: | ||
go clean | ||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 GO111MODULE=on go build -ldflags "-s -w -X main.Version=${VERSION}" | ||
mv ./${BINARY}.exe ${BINARY}-win64.exe | ||
|
||
# Release for different platforms | ||
release: release_mac release_linux release_windows | ||
|
||
clean: | ||
go clean | ||
rm ${BINARY}* | ||
.PHONY: clean build release_mac release_linux release_windows |