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.

84 lines
2.2 KiB

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