Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from do-something-for-fun/master
Browse files Browse the repository at this point in the history
promote: use Makefile and support cross-compile
  • Loading branch information
CoolSpring8 authored Jul 4, 2020
2 parents 3c11d78 + 89f793f commit 17b59ad
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@
# Other Runtime-Generated Files
*.crt
*.key

# Binary
rwppa*

35 changes: 35 additions & 0 deletions Makefile
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

0 comments on commit 17b59ad

Please sign in to comment.