-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (62 loc) · 2.45 KB
/
Makefile
File metadata and controls
83 lines (62 loc) · 2.45 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
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
75
76
77
78
79
80
81
82
GOFMT=gofmt
GC=go build
LAST_VERSION := $(shell git describe --match "v*" --always --tags)
VERSION_PARTS := $(subst ., ,$(LAST_VERSION))
MAJOR := $(word 1,$(VERSION_PARTS))
MINOR := $(word 2,$(VERSION_PARTS))
MICRO := $(word 3,$(VERSION_PARTS))
MICRO_PARTS := $(subst -, ,$(MICRO))
MICRO_FIRST := $(word 1,$(MICRO_PARTS))
NEXT_MICRO := $(shell echo $$(($(MICRO_FIRST)+1)))
VERSION := $(MAJOR).$(MINOR).$(NEXT_MICRO)
BUILD_NODE_PAR = -ldflags "-w -X github.com/saveio/themis/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
themis:
CGO_ENABLED=1 $(GC) $(BUILD_NODE_PAR) -o themis 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: themis tools
themis-cross: themis-windows themis-linux themis-darwin
themis-windows:
GOOS=windows GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o themis-windows-amd64.exe main.go
themis-linux:
GOOS=linux GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o themis-linux-amd64 main.go
themis-darwin:
GOOS=darwin GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o themis-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
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: themis-cross tools-cross abi
format:
$(GOFMT) -w main.go
docker: Makefile
@echo "Building themis docker"
@$(DBUILD) --no-cache -t $(DOCKER_NS)/themis:$(DOCKER_TAG) - < docker/Dockerfile
@touch $@
clean:
rm -rf *.8 *.o *.out *.6 *exe coverage
rm -rf themis themis-* tools