tendermint/Makefile

85 lines
2.2 KiB
Makefile
Raw Normal View History

GOTOOLS = \
github.com/mitchellh/gox \
2017-09-26 03:46:36 -07:00
github.com/tcnksm/ghr \
github.com/Masterminds/glide \
honnef.co/go/tools/cmd/megacheck
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
BUILD_TAGS?=tendermint
2017-03-27 04:17:10 -07:00
TMHOME = $${TMHOME:-$$HOME/.tendermint}
all: install test
2015-07-13 11:49:09 -07:00
install: get_vendor_deps
2017-05-09 02:39:46 -07:00
@go install --ldflags '-extldflags "-static"' \
--ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse HEAD`" ./cmd/tendermint
2014-12-28 16:26:53 -08:00
build:
2017-05-09 02:39:46 -07:00
go build \
--ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse HEAD`" -o build/tendermint ./cmd/tendermint/
build_race:
go build -race -o build/tendermint ./cmd/tendermint
2014-12-28 17:10:03 -08:00
# dist builds binaries for all platforms and packages them for distribution
dist:
@BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/dist.sh'"
test:
@echo "--> Running go test"
@go test $(PACKAGES)
test_race:
@echo "--> Running go test --race"
@go test -v -race $(PACKAGES)
2014-12-28 16:26:53 -08:00
test_integrations:
@bash ./test/test.sh
2016-07-23 09:48:30 -07:00
test100:
@for i in {1..100}; do make test; done
2016-04-29 15:32:50 -07:00
draw_deps:
# requires brew install graphviz or apt-get install graphviz
go get github.com/RobotsAndPencils/goviz
@goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
2014-12-28 16:26:53 -08:00
list_deps:
@go list -f '{{join .Deps "\n"}}' ./... | \
2016-06-11 20:14:44 -07:00
grep -v /vendor/ | sort | uniq | \
xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
2014-12-28 16:26:53 -08:00
get_deps:
2017-02-24 01:30:46 -08:00
@echo "--> Running go get"
@go get -v -d $(PACKAGES)
@go list -f '{{join .TestImports "\n"}}' ./... | \
2016-06-11 20:14:44 -07:00
grep -v /vendor/ | sort | uniq | \
2017-02-24 01:30:46 -08:00
xargs go get -v -d
2015-03-16 03:51:24 -07:00
get_vendor_deps: ensure_tools
@rm -rf vendor/
@echo "--> Running glide install"
@glide install
2016-07-05 12:40:53 -07:00
update_deps: tools
@echo "--> Updating dependencies"
@go get -d -u ./...
2016-02-15 17:29:52 -08:00
2015-07-10 08:50:58 -07:00
revision:
2017-03-27 04:17:10 -07:00
-echo `git rev-parse --verify HEAD` > $(TMHOME)/revision
-echo `git rev-parse --verify HEAD` >> $(TMHOME)/revision_history
tools:
go get -u -v $(GOTOOLS)
ensure_tools:
go get $(GOTOOLS)
### Formatting, linting, and vetting
megacheck:
@for pkg in ${PACKAGES}; do megacheck "$$pkg"; done
.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