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. $(if $(shell command -v upx), upx goctl)
  5. mac:
  6. GOOS=darwin go build -ldflags="-s -w" -ldflags="-X 'main.BuildTime=$(version)'" -o goctl-darwin goctl.go
  7. $(if $(shell command -v upx), upx goctl-darwin)
  8. win:
  9. GOOS=windows go build -ldflags="-s -w" -ldflags="-X 'main.BuildTime=$(version)'" -o goctl.exe goctl.go
  10. $(if $(shell command -v upx), upx goctl.exe)
  11. linux:
  12. GOOS=linux go build -ldflags="-s -w" -ldflags="-X 'main.BuildTime=$(version)'" -o goctl-linux goctl.go
  13. $(if $(shell command -v upx), upx goctl-linux)