站点更新:2018-11-01 18:38:58
This commit is contained in:
parent
4bb4f6e097
commit
15797d1823
14
Makefile
14
Makefile
@ -1,8 +1,8 @@
|
|||||||
.PHONY: default init build install release dep get_deps clean build_amd64 build_386 upx
|
.PHONY: default init build install release dep get_deps clean build_amd64 build_386 upx
|
||||||
|
|
||||||
# https://golang.org/doc/install/source#environment
|
# https://golang.org/doc/install/source#environment
|
||||||
GOOS := $(shell go2 env | awk -F= '$$1=="GOOS" {print $$2}' | awk -F '"' '{print $$2}') # 此处 awk 需使用两个 $
|
GOOS := $(shell goenv | awk -F= '$$1=="GOOS" {print $$2}' | awk -F '"' '{print $$2}') # 此处 awk 需使用两个 $
|
||||||
GOARCH := $(shell go2 env | awk -F= '$$1=="GOARCH" {print $$2}' | awk -F '"' '{print $$2}')
|
GOARCH := $(shell go env | awk -F= '$$1=="GOARCH" {print $$2}' | awk -F '"' '{print $$2}')
|
||||||
OSS = darwin dragonfly freebsd linux netbsd openbsd plan9 solaris windows
|
OSS = darwin dragonfly freebsd linux netbsd openbsd plan9 solaris windows
|
||||||
PKG =
|
PKG =
|
||||||
# ifeq ($(strip $(GOOS)), windows)
|
# ifeq ($(strip $(GOOS)), windows)
|
||||||
@ -14,31 +14,31 @@ default:
|
|||||||
@echo "available target: build install release clean build_amd64 build_386 upx"
|
@echo "available target: build install release clean build_amd64 build_386 upx"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@ go2 build -ldflags "-s -w" -o dist/hc_$(strip $(GOOS))_$(strip $(if \
|
@ go build -ldflags "-s -w" -o dist/hc_$(strip $(GOOS))_$(strip $(if \
|
||||||
$(findstring windows,$(GOOS)),\
|
$(findstring windows,$(GOOS)),\
|
||||||
$(strip $(GOARCH)).exe,\
|
$(strip $(GOARCH)).exe,\
|
||||||
$(strip $(GOARCH))\
|
$(strip $(GOARCH))\
|
||||||
))
|
))
|
||||||
|
|
||||||
install:
|
install:
|
||||||
go2 install -ldflags "-s -w"
|
go install -ldflags "-s -w"
|
||||||
|
|
||||||
release: build_amd64 build_386 upx
|
release: build_amd64 build_386 upx
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
go2 clean -i
|
go clean -i
|
||||||
rm -rf dist/hc* hc* hex-convert
|
rm -rf dist/hc* hc* hex-convert
|
||||||
|
|
||||||
build_amd64:
|
build_amd64:
|
||||||
@ $(foreach OS,\
|
@ $(foreach OS,\
|
||||||
$(OSS),\
|
$(OSS),\
|
||||||
$(shell CGO_ENABLED=0 GOOS=$(OS) GOARCH=amd64 go2 build -ldflags "-s -w" -o dist/hc_$(OS)_amd64$(if $(findstring windows,$(OS)),.exe)))
|
$(shell CGO_ENABLED=0 GOOS=$(OS) GOARCH=amd64 go build -ldflags "-s -w" -o dist/hc_$(OS)_amd64$(if $(findstring windows,$(OS)),.exe)))
|
||||||
@ echo done
|
@ echo done
|
||||||
|
|
||||||
build_386:
|
build_386:
|
||||||
@ $(foreach OS,\
|
@ $(foreach OS,\
|
||||||
$(OSS),\
|
$(OSS),\
|
||||||
$(shell CGO_ENABLED=0 GOOS=$(OS) GOARCH=386 go2 build -ldflags "-s -w" -o dist/hc_$(OS)_386$(if $(findstring windows,$(OS)),.exe)))
|
$(shell CGO_ENABLED=0 GOOS=$(OS) GOARCH=386 go build -ldflags "-s -w" -o dist/hc_$(OS)_386$(if $(findstring windows,$(OS)),.exe)))
|
||||||
@ echo done
|
@ echo done
|
||||||
|
|
||||||
# 压缩。需要安装 https://github.com/upx/upx
|
# 压缩。需要安装 https://github.com/upx/upx
|
||||||
|
Loading…
Reference in New Issue
Block a user