OSDN Git Service

This changes the executable file of bytom
[bytom/bytom.git] / Makefile
1 GOTOOLS = \
2                                         github.com/mitchellh/gox \
3                                         github.com/Masterminds/glide
4 PACKAGES=$(shell go list ./... | grep -v '/vendor/')
5 BUILD_TAGS?=bytom
6 TMHOME = $${TMHOME:-$$HOME/.bytom}
7
8 all: install test
9
10 install: get_vendor_deps copy
11         @go install --ldflags '-extldflags "-static"' \
12                 --ldflags "-X github.com/Bytom/blockchain/version.GitCommit=`git rev-parse HEAD`" ./node/
13
14 build: copy
15         go build \
16                 --ldflags "-X github.com/Bytom/blockchain/version.GitCommit=`git rev-parse HEAD`"  -o build/node ./node/
17
18 copy:
19         cp -r vendor/github.com/golang/crypto vendor/golang.org/x/crypto
20         cp -r vendor/github.com/golang/net vendor/golang.org/x/net
21         cp -r vendor/github.com/golang/text vendor/golang.org/x/text
22         cp -r vendor/github.com/golang/tools vendor/golang.org/x/tools
23
24 # dist builds binaries for all platforms and packages them for distribution
25 dist:
26         @BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/dist.sh'"
27
28 test:
29         @echo "--> Running go test"
30         @go test $(PACKAGES)
31
32 test_race:
33         @echo "--> Running go test --race"
34         @go test -v -race $(PACKAGES)
35
36 test_integrations:
37         @bash ./test/test.sh
38
39 test100:
40         @for i in {1..100}; do make test; done
41
42 draw_deps:
43         # requires brew install graphviz or apt-get install graphviz
44         go get github.com/RobotsAndPencils/goviz
45         @goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
46
47 list_deps:
48         @go list -f '{{join .Deps "\n"}}' ./... | \
49                 grep -v /vendor/ | sort | uniq | \
50                 xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
51
52 get_deps:
53         @echo "--> Running go get"
54         @go get -v -d $(PACKAGES)
55         @go list -f '{{join .TestImports "\n"}}' ./... | \
56                 grep -v /vendor/ | sort | uniq | \
57                 xargs go get -v -d
58
59 get_vendor_deps: ensure_tools
60         @rm -rf vendor/
61         @echo "--> Running glide install"
62         @glide install
63
64 update_deps: tools
65         @echo "--> Updating dependencies"
66         @go get -d -u ./...
67
68 revision:
69         -echo `git rev-parse --verify HEAD` > $(TMHOME)/revision
70         -echo `git rev-parse --verify HEAD` >> $(TMHOME)/revision_history
71
72 tools:
73         go get -u -v $(GOTOOLS)
74
75 ensure_tools:
76         go get $(GOTOOLS)
77
78
79 .PHONY: install build build_race dist test test_race test_integrations test100 draw_deps list_deps get_deps get_vendor_deps update_deps revision tools