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.

87 lines
2.3 KiB

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