-
Notifications
You must be signed in to change notification settings - Fork 85
/
Makefile
78 lines (57 loc) · 2.14 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
75
76
77
78
GOTOOLS = github.com/mitchellh/gox \
github.com/Masterminds/glide \
github.com/rigelrozanski/shelldown/cmd/shelldown
INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
all: get_vendor_deps install test
build: gen_version
go build ./cmd/...
go build ./integration/...
# Build binaries for Linux platform.
linux: gen_version
integration/docker/build/build.sh force
docker:
integration/docker/node/build.sh force
install: gen_version release
# Cross compile AMD64 binaries on Apple Silicon (M1/M2 chips, etc)
install_as: gen_version
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o ${GOBIN}/theta ./cmd/theta/
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o ${GOBIN}/thetacli ./cmd/thetacli/
exe:
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -o theta.exe ./cmd/theta/
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -o thetacli.exe ./cmd/thetacli/
release:
go install ./cmd/...
go install ./integration/...
debug:
go install -race ./cmd/...
go install -race ./integration/...
test: test_unit #test_integration test_cluster_deployment
test_unit:
go test -timeout 45s `glide novendor` -tags=unit
test_integration:
go test `glide novendor` -tags=integration
test_experimental:
go test -race `glide novendor` -tags=experimental
test_cluster_deployment:
go test -race `glide novendor` -tags=cluster_deployment
get_vendor_deps: tools
glide install
tools:
@go get $(GOTOOLS)
clean:
@rm -rf ./vendor
@rm -rf ./build
gen_doc:
cd ./docs/commands/;go build -o generator.exe; ./generator.exe
BUILD_DATE := `date -u`
GIT_HASH := `git rev-parse HEAD`
VERSION_NUMER := `cat version/version_number.txt`
VERSIONFILE := version/version_generated.go
gen_version:
@echo "package version" > $(VERSIONFILE)
@echo "const (" >> $(VERSIONFILE)
@echo " Timestamp = \"$(BUILD_DATE)\"" >> $(VERSIONFILE)
@echo " Version = \"$(VERSION_NUMER)\"" >> $(VERSIONFILE)
@echo " GitHash = \"$(GIT_HASH)\"" >> $(VERSIONFILE)
@echo ")" >> $(VERSIONFILE)
.PHONY: all build install test test_unit get_vendor_deps clean tools