forked from xuperchain/xuperchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·53 lines (45 loc) · 1.21 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
45
46
47
48
49
50
51
52
53
# init project PATH
HOMEDIR := $(shell pwd)
OUTDIR := $(HOMEDIR)/output
COMPILECACHEDIR := $(HOMEDIR)/.compile_cache
XVMDIR := $(COMPILECACHEDIR)/xvm
TESTNETDIR := $(HOMEDIR)/testnet
VERSION:=$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo unknown)
COMMIT_ID:=$(shell git rev-parse --short HEAD 2>/dev/null ||echo unknown)
# init command params
export GO111MODULE=on
X_ROOT_PATH := $(HOMEDIR)
export X_ROOT_PATH
export PATH := $(OUTDIR)/bin:$(XVMDIR):$(PATH)
# make, make all
all: clean compile
# make compile, go build
compile: xvm xchain
xchain:
VERSION=$(VERSION) COMMIT_ID=$(COMMIT_ID) bash $(HOMEDIR)/auto/build.sh
prepare:
go env -w GOPROXY=https://goproxy.cn,direct
go mod download
# make xvm
xvm:
bash $(HOMEDIR)/auto/build_xvm.sh
# make test, test your code
test: xvm unit
unit:
go test -coverprofile=coverage.txt -covermode=atomic ./...
# make clean
cleanall: clean cleantest cleancache
clean:
rm -rf $(OUTDIR)
cleantest:
rm -rf $(TESTNETDIR)
cleancache:
rm -rf $(COMPILECACHEDIR)
# deploy test network
testnet:
bash $(HOMEDIR)/auto/deploy_testnet.sh
# Docker related tasks
build-image:
docker build -t xchain:dev .
# avoid filename conflict and speed up build
.PHONY: all compile test clean