Makefile 650 B

1234567891011121314
  1. version := $(shell /bin/date "+%Y-%m-%d %H:%M")
  2. build:
  3. go build -ldflags="-s -w" -ldflags="-X 'main.BuildTime=$(version)'" goctl.go
  4. command -v upx &> /dev/null && upx goctl
  5. mac:
  6. GOOS=darwin go build -ldflags="-s -w" -ldflags="-X 'main.BuildTime=$(version)'" -o goctl-darwin goctl.go
  7. command -v upx &> /dev/null && upx goctl-darwin
  8. win:
  9. GOOS=windows go build -ldflags="-s -w" -ldflags="-X 'main.BuildTime=$(version)'" -o goctl.exe goctl.go
  10. command -v upx &> /dev/null && upx goctl.exe
  11. linux:
  12. GOOS=linux go build -ldflags="-s -w" -ldflags="-X 'main.BuildTime=$(version)'" -o goctl-linux goctl.go
  13. command -v upx &> /dev/null && upx goctl-linux