Skip to content
This repository was archived by the owner on Apr 29, 2026. It is now read-only.

Commit 17b59ad

Browse files
authored
Merge pull request #1 from do-something-for-fun/master
promote: use Makefile and support cross-compile
2 parents 3c11d78 + 89f793f commit 17b59ad

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@
2424
# Other Runtime-Generated Files
2525
*.crt
2626
*.key
27+
28+
# Binary
29+
rwppa*
30+

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Binary name
2+
BINARY=rwppa
3+
VERSION=1.0
4+
5+
# Builds
6+
build:
7+
GO111MODULE=on go build -o ${BINARY} -ldflags "-X main.Version=${VERSION}"
8+
GO111MODULE=on go test -v
9+
10+
# Installs to $GOPATH/bin
11+
install:
12+
GO111MODULE=on go install
13+
14+
release_mac:
15+
go clean
16+
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 GO111MODULE=on go build -ldflags "-s -w -X main.Version=${VERSION}"
17+
mv ./${BINARY} ${BINARY}-mac64
18+
19+
release_linux:
20+
go clean
21+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-s -w -X main.Version=${VERSION}"
22+
mv ./${BINARY} ${BINARY}-linux64
23+
24+
release_windows:
25+
go clean
26+
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 GO111MODULE=on go build -ldflags "-s -w -X main.Version=${VERSION}"
27+
mv ./${BINARY}.exe ${BINARY}-win64.exe
28+
29+
# Release for different platforms
30+
release: release_mac release_linux release_windows
31+
32+
clean:
33+
go clean
34+
rm ${BINARY}*
35+
.PHONY: clean build release_mac release_linux release_windows

0 commit comments

Comments
 (0)