From c6375e414dde1b789589247306774602e87d4e5d Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Sun, 22 Jan 2017 18:03:20 +0400 Subject: [PATCH] refactor Makefile - mute most of the commands - replace github.com/tendermint/tendermint with just "." - introduce PACKAGES variable - delete unused NEWLINE --- Makefile | 56 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 8835722b8..554b8a5b4 100644 --- a/Makefile +++ b/Makefile @@ -1,59 +1,65 @@ -.PHONY: get_deps build all list_deps install - -all: get_deps install test - +GOTOOLS = \ + github.com/mitchellh/gox \ + github.com/Masterminds/glide +PACKAGES=$(shell go list ./... | grep -v '/vendor/') +BUILD_TAGS?=tendermint TMROOT = $${TMROOT:-$$HOME/.tendermint} -define NEWLINE - -endef -NOVENDOR = go list github.com/tendermint/tendermint/... | grep -v /vendor/ +all: get_deps install test install: get_deps - go install github.com/tendermint/tendermint/cmd/tendermint + @go install ./cmd/tendermint build: - go build -o build/tendermint github.com/tendermint/tendermint/cmd/tendermint + go build -o build/tendermint ./cmd/tendermint build_race: - go build -race -o build/tendermint github.com/tendermint/tendermint/cmd/tendermint + go build -race -o build/tendermint ./cmd/tendermint test: build - go test `${NOVENDOR}` + @echo "--> Running go test" + @go test $(PACKAGES) test_race: build - go test -race `${NOVENDOR}` + @echo "--> Running go test --race" + @go test -race $(PACKAGES) test_integrations: - bash ./test/test.sh + @bash ./test/test.sh test100: build - for i in {1..100}; do make test; done + @for i in {1..100}; do make test; done draw_deps: # requires brew install graphviz go get github.com/hirokidaichi/goviz - goviz -i github.com/tendermint/tendermint/cmd/tendermint | dot -Tpng -o huge.png + goviz -i ./cmd/tendermint | dot -Tpng -o huge.png list_deps: - go list -f '{{join .Deps "\n"}}' github.com/tendermint/tendermint/... | \ + @go list -f '{{join .Deps "\n"}}' ./... | \ grep -v /vendor/ | sort | uniq | \ - xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' + xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' get_deps: - go get -d `${NOVENDOR}` - go list -f '{{join .TestImports "\n"}}' github.com/tendermint/tendermint/... | \ + @go get -d $(PACKAGES) + @go list -f '{{join .TestImports "\n"}}' ./... | \ grep -v /vendor/ | sort | uniq | \ xargs go get -get_vendor_deps: - go get github.com/Masterminds/glide - rm -rf vendor/ - glide install +get_vendor_deps: tools + @rm -rf vendor/ + @echo "--> Running glide install" + @glide install update_deps: - go get -d -u github.com/tendermint/tendermint/... + @echo "--> Updating dependencies" + @go get -d -u ./... revision: -echo `git rev-parse --verify HEAD` > $(TMROOT)/revision -echo `git rev-parse --verify HEAD` >> $(TMROOT)/revision_history + +tools: + go get -u -v $(GOTOOLS) + +.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