update JetBrains License Server Makefile

This commit is contained in:
ehlxr 2018-01-23 13:53:31 +08:00
parent c3fa7856e8
commit 00ed960c51

View File

@ -1,27 +1,39 @@
# https://golang.org/doc/install/source#environment
GOOS := $(shell go env | awk -F= '$$1=="GOOS" {print $$2}' | awk -F '"' '{print $$2}') # 此处 awk 需使用两个 $ GOOS := $(shell go env | awk -F= '$$1=="GOOS" {print $$2}' | awk -F '"' '{print $$2}') # 此处 awk 需使用两个 $
GOARCH := $(shell go 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
PKG =
# ifeq ($(strip $(GOOS)), windows)
# GOARCH := $(strip $(GOARCH)).exe
# endif
.PHONY: build .PHONY: build
build: build:
@go build -ldflags "-s -w" -o JetBrainsLicenseServer_$(strip $(GOOS))_$(strip $(GOARCH)) @ go build -ldflags "-s -w" -o JetBrainsLicenseServer_$(strip $(GOOS))_$(strip $(if \
$(findstring windows,$(GOOS)),\
$(strip $(GOARCH)).exe,\
$(strip $(GOARCH))\
))
.PHONY: amd64 .PHONY: amd64
amd64: amd64:
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o JetBrainsLicenseServer_darwin_amd64 @ $(foreach OS,\
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o JetBrainsLicenseServer_linux_amd64 $(OSS),\
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o JetBrainsLicenseServer_windows_amd64.exe $(shell CGO_ENABLED=0 GOOS=$(OS) GOARCH=amd64 go build -ldflags "-s -w" -o JetBrainsLicenseServer_$(OS)_amd64$(if $(findstring windows,$(OS)),.exe)))
@ echo done
.PHONY: 386 .PHONY: 386
386: 386:
@CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -ldflags "-s -w" -o JetBrainsLicenseServer_darwin_386 @ $(foreach OS,\
@CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w" -o JetBrainsLicenseServer_linux_386 $(OSS),\
@CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w" -o JetBrainsLicenseServer_windows_386.exe $(shell CGO_ENABLED=0 GOOS=$(OS) GOARCH=386 go build -ldflags "-s -w" -o JetBrainsLicenseServer_$(OS)_386$(if $(findstring windows,$(OS)),.exe)))
@ echo done
.PHONY: clean .PHONY: clean
clean: clean:
@rm -rf JetBrainsLicenseServer* idea @ rm -rf JetBrainsLicenseServer* idea
# 压缩。需要安装 https://github.com/upx/upx # 压缩。需要安装 https://github.com/upx/upx
.PHONY: upx .PHONY: upx
upx: upx:
@upx JetBrainsLicenseServer* @ upx $(if $(PKG),$(PKG),JetBrainsLicenseServer*)