forked from blocktree/openwallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (32 loc) · 1.26 KB
/
Makefile
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
.PHONY: all clean
.PHONY: wmd
.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
# wmd
WMDVERSION = $(shell git describe --tags `git rev-list --tags --max-count=1`)
WMDBINARY = wmd
WMDMAIN = cmd/wmd/main.go
BUILDDIR = build
GITREV = $(shell git rev-parse --short HEAD)
BUILDTIME = $(shell date +'%Y-%m-%d_%T')
WMDLDFLAGS="-X github.com/blocktree/openwallet/cmd/wmd/commands.Version=${WMDVERSION} \
-X github.com/blocktree/openwallet/cmd/wmd/commands.GitRev=${GITREV} \
-X github.com/blocktree/openwallet/cmd/wmd/commands.BuildTime=${BUILDTIME}"
# 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"
deps:
go get -u github.com/gythialy/xgo
build:
GO111MODULE=on go build -ldflags $(WMDLDFLAGS) -i -o $(shell pwd)/$(BUILDDIR)/$(WMDBINARY) $(shell pwd)/$(WMDMAIN)
@echo "Build $(WMDBINARY) done."
all: wmd
clean:
rm -rf $(shell pwd)/$(BUILDDIR)/
wmd:
xgo --dest=$(BUILDDIR) --ldflags=$(WMDLDFLAGS) --out=$(WMDBINARY)-$(WMDVERSION)-$(GITREV) --targets=$(TARGETS) \
--pkg=$(WMDMAIN) .