-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (35 loc) · 1.53 KB
/
Makefile
File metadata and controls
46 lines (35 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
.PHONY: all clean
.PHONY: openw-cli
.PHONY: deps
# Check for required command tools to build or stop immediately
EXECUTABLES = git go find pwd
K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH)))
GO ?= latest
# openw-cli
OPENWCLIVERSION = $(shell git describe --tags `git rev-list --tags --max-count=1`)
OPENWCLIBINARY = openw-cli
OPENWCLIMAIN = main.go
BUILDDIR = build
GITREV = $(shell git rev-parse --short HEAD)
BUILDTIME = $(shell date +'%Y-%m-%d_%T')
OPENWCLILDFLAGS="-X github.com/blocktree/go-openw-cli/v2/openwcli.Version=${OPENWCLIVERSION} \
-X github.com/blocktree/go-openw-cli/v2/openwcli.GitRev=${GITREV} \
-X github.com/blocktree/go-openw-cli/v2/openwcli.BuildTime=${BUILDTIME} \
-X github.com/blocktree/go-openw-cli/v2/openwcli.FixAppID=${APPID} \
-X github.com/blocktree/go-openw-cli/v2/openwcli.FixAppKey=${APPKEY}"
# OS platfom
# options: windows-6.0/*,darwin-10.10/amd64,linux/amd64,linux/386,linux/arm64,linux/mips64, linux/mips64le
TARGETS="darwin-10.10/amd64,linux/amd64,windows-6.0/*"
deps:
#go get -u github.com/gythialy/xgo
go get -u src.techknowlogick.com/xgo
build:
GO111MODULE=on go build -ldflags $(OPENWCLILDFLAGS) -i -o $(shell pwd)/$(BUILDDIR)/$(OPENWCLIBINARY) $(shell pwd)/$(OPENWCLIMAIN)
@echo "Build $(OPENWCLIBINARY) done."
all: openw-cli
clean:
rm -rf $(shell pwd)/$(BUILDDIR)/
openw-cli:
xgo --dest=$(BUILDDIR) --ldflags=$(OPENWCLILDFLAGS) --out=$(OPENWCLIBINARY)-$(OPENWCLIVERSION)-$(GITREV) --targets=$(TARGETS) \
--pkg=$(OPENWCLIMAIN) .