yaxc/Makefile

52 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

# default
compileAll: compileDarwin compileLinux compileFreeBSD compileWindows
# dir
mkdirs: clean
2021-04-06 06:50:35 +08:00
mkdir -p bin/
.PHONY: clean
clean:
rm -r bin/
#
# compile
compileDarwin: mkdirs
@echo ""
@echo "🍏 Compile for Darwin"
@echo ""
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o ./bin/yaxc-darwin-amd64 ./main.go
compileLinux: mkdirs
@echo ""
2021-04-06 06:50:35 +08:00
@echo "🐧 Compile for Linux"
@echo ""
2021-05-14 02:05:31 +08:00
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ./bin/yaxc-linux-amd64 ./main.go
GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o ./bin/yaxc-linux-386 ./main.go
GOOS=linux GOARCH=arm go build -ldflags="-s -w" -o ./bin/yaxc-linux-arm ./main.go
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o ./bin/yaxc-linux-arm64 ./main.go
2021-04-06 06:50:35 +08:00
compileFreeBSD: mkdirs
@echo ""
@echo "🐡 Compile for FreeBSD"
@echo ""
GOOS=freebsd GOARCH=amd64 go build -ldflags="-s -w" -o ./bin/yaxc-freebsd-amd64 ./main.go
GOOS=freebsd GOARCH=386 go build -ldflags="-s -w" -o ./bin/yaxc-freebsd-386 ./main.go
GOOS=freebsd GOARCH=arm go build -ldflags="-s -w" -o ./bin/yaxc-freebsd-arm ./main.go
2021-04-06 06:50:35 +08:00
compileWindows: mkdirs
@echo ""
2021-04-06 06:50:35 +08:00
@echo "🪟 Compile for Windows"
@echo ""
2021-05-14 02:05:31 +08:00
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o ./bin/yaxc-windows-amd64.exe ./main.go
GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o ./bin/yaxc-windows-386.exe ./main.go
2021-04-06 06:50:35 +08:00
# compress
compileAndCompress: compileAll
@echo ""
@echo "📦 Compress binaries"
@echo ""
upx -1 -k bin/yaxc-linux-*
upx -1 -k bin/yaxc-darwin-*
upx -1 -k bin/yaxc-windows-*