-
Notifications
You must be signed in to change notification settings - Fork 292
/
Makefile
75 lines (54 loc) · 2.17 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
GOFMT=gofmt
GC=go build
VERSION := $(shell git describe --always --tags --long)
BUILD_NODE_PAR = -ldflags "-w -X github.com/ontio/ontology/common/config.Version=$(VERSION)" #-race
ARCH=$(shell uname -m)
DBUILD=docker build
DRUN=docker run
DOCKER_NS ?= ontio
DOCKER_TAG=$(ARCH)-$(VERSION)
SRC_FILES = $(shell git ls-files | grep -e .go$ | grep -v _test.go)
TOOLS=./tools
ABI=$(TOOLS)/abi
NATIVE_ABI_SCRIPT=./cmd/abi/native_abi_script
ontology: $(SRC_FILES)
CGO_ENABLED=1 $(GC) $(BUILD_NODE_PAR) -o ontology main.go
sigsvr: $(SRC_FILES) abi
$(GC) $(BUILD_NODE_PAR) -o sigsvr cmd-tools/sigsvr/sigsvr.go
@if [ ! -d $(TOOLS) ];then mkdir -p $(TOOLS) ;fi
@mv sigsvr $(TOOLS)
abi:
@if [ ! -d $(ABI) ];then mkdir -p $(ABI) ;fi
@cp $(NATIVE_ABI_SCRIPT)/*.json $(ABI)
tools: sigsvr abi
all: ontology tools
ontology-cross: ontology-windows ontology-linux ontology-darwin
ontology-windows:
GOOS=windows GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o ontology-windows-amd64.exe main.go
ontology-linux:
GOOS=linux GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o ontology-linux-amd64 main.go
ontology-darwin:
CGO_CFLAGS=-Wno-undef-prefix GOOS=darwin GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o ontology-darwin-amd64 main.go
tools-cross: tools-windows tools-linux tools-darwin
tools-windows: abi
GOOS=windows GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o sigsvr-windows-amd64.exe cmd-tools/sigsvr/sigsvr.go
@if [ ! -d $(TOOLS) ];then mkdir -p $(TOOLS) ;fi
@mv sigsvr-windows-amd64.exe $(TOOLS)
tools-linux: abi
GOOS=linux GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o sigsvr-linux-amd64 cmd-tools/sigsvr/sigsvr.go
@if [ ! -d $(TOOLS) ];then mkdir -p $(TOOLS) ;fi
@mv sigsvr-linux-amd64 $(TOOLS)
tools-darwin: abi
CGO_CFLAGS=-Wno-undef-prefix GOOS=darwin GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o sigsvr-darwin-amd64 cmd-tools/sigsvr/sigsvr.go
@if [ ! -d $(TOOLS) ];then mkdir -p $(TOOLS) ;fi
@mv sigsvr-darwin-amd64 $(TOOLS)
all-cross: ontology-cross tools-cross abi
format:
$(GOFMT) -w main.go
docker: ontology
@echo "Building ontology docker"
docker-compose --profile nostart -f docker/docker-compose.yaml build --no-cache
@touch $@
clean:
rm -rf *.8 *.o *.out *.6 *exe coverage
rm -rf ontology ontology-* tools