You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.2 KiB

7 years ago
7 years ago
8 years ago
9 years ago
  1. GOTOOLS = \
  2. github.com/mitchellh/gox \
  3. github.com/tcnksm/ghr \
  4. github.com/Masterminds/glide \
  5. PACKAGES=$(shell go list ./... | grep -v '/vendor/')
  6. BUILD_TAGS?=tendermint
  7. TMHOME = $${TMHOME:-$$HOME/.tendermint}
  8. all: install test
  9. install: get_vendor_deps
  10. @go install --ldflags '-extldflags "-static"' \
  11. --ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse HEAD`" ./cmd/tendermint
  12. build:
  13. go build \
  14. --ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse HEAD`" -o build/tendermint ./cmd/tendermint/
  15. build_race:
  16. go build -race -o build/tendermint ./cmd/tendermint
  17. # dist builds binaries for all platforms and packages them for distribution
  18. dist:
  19. @BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/dist.sh'"
  20. test:
  21. @echo "--> Running go test"
  22. @go test $(PACKAGES)
  23. test_race:
  24. @echo "--> Running go test --race"
  25. @go test -v -race $(PACKAGES)
  26. test_integrations:
  27. @bash ./test/test.sh
  28. release:
  29. @go test -tags release $(PACKAGES)
  30. test100:
  31. @for i in {1..100}; do make test; done
  32. draw_deps:
  33. # requires brew install graphviz or apt-get install graphviz
  34. go get github.com/RobotsAndPencils/goviz
  35. @goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
  36. list_deps:
  37. @go list -f '{{join .Deps "\n"}}' ./... | \
  38. grep -v /vendor/ | sort | uniq | \
  39. xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
  40. get_deps:
  41. @echo "--> Running go get"
  42. @go get -v -d $(PACKAGES)
  43. @go list -f '{{join .TestImports "\n"}}' ./... | \
  44. grep -v /vendor/ | sort | uniq | \
  45. xargs go get -v -d
  46. get_vendor_deps: ensure_tools
  47. @rm -rf vendor/
  48. @echo "--> Running glide install"
  49. @glide install
  50. update_deps: tools
  51. @echo "--> Updating dependencies"
  52. @go get -d -u ./...
  53. revision:
  54. -echo `git rev-parse --verify HEAD` > $(TMHOME)/revision
  55. -echo `git rev-parse --verify HEAD` >> $(TMHOME)/revision_history
  56. tools:
  57. go get -u -v $(GOTOOLS)
  58. ensure_tools:
  59. go get $(GOTOOLS)
  60. ### Formatting, linting, and vetting
  61. megacheck:
  62. @for pkg in ${PACKAGES}; do megacheck "$$pkg"; done
  63. .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