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.

118 lines
3.0 KiB

8 years ago
8 years ago
9 years ago
9 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. GOTOOLS = \
  2. github.com/mitchellh/gox \
  3. github.com/tcnksm/ghr \
  4. github.com/Masterminds/glide \
  5. github.com/alecthomas/gometalinter
  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 linter"
  23. @make metalinter_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. release:
  32. @go test -tags release $(PACKAGES)
  33. test100:
  34. @for i in {1..100}; do make test; done
  35. draw_deps:
  36. # requires brew install graphviz or apt-get install graphviz
  37. go get github.com/RobotsAndPencils/goviz
  38. @goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
  39. list_deps:
  40. @go list -f '{{join .Deps "\n"}}' ./... | \
  41. grep -v /vendor/ | sort | uniq | \
  42. xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
  43. get_deps:
  44. @echo "--> Running go get"
  45. @go get -v -d $(PACKAGES)
  46. @go list -f '{{join .TestImports "\n"}}' ./... | \
  47. grep -v /vendor/ | sort | uniq | \
  48. xargs go get -v -d
  49. get_vendor_deps: ensure_tools
  50. @rm -rf vendor/
  51. @echo "--> Running glide install"
  52. @glide install
  53. update_deps: tools
  54. @echo "--> Updating dependencies"
  55. @go get -d -u ./...
  56. revision:
  57. -echo `git rev-parse --verify HEAD` > $(TMHOME)/revision
  58. -echo `git rev-parse --verify HEAD` >> $(TMHOME)/revision_history
  59. tools:
  60. go get -u -v $(GOTOOLS)
  61. ensure_tools:
  62. go get $(GOTOOLS)
  63. @gometalinter --install
  64. ### Formatting, linting, and vetting
  65. metalinter:
  66. @gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...
  67. metalinter_test:
  68. @gometalinter --vendor --deadline=600s --disable-all \
  69. --enable=deadcode \
  70. --enable=misspell \
  71. --enable=safesql \
  72. ./...
  73. # --enable=gas \
  74. #--enable=maligned \
  75. #--enable=dupl \
  76. #--enable=errcheck \
  77. #--enable=goconst \
  78. #--enable=gocyclo \
  79. #--enable=goimports \
  80. #--enable=golint \ <== comments on anything exported
  81. #--enable=gosimple \
  82. #--enable=gotype \
  83. #--enable=ineffassign \
  84. #--enable=interfacer \
  85. #--enable=megacheck \
  86. #--enable=staticcheck \
  87. #--enable=structcheck \
  88. #--enable=unconvert \
  89. #--enable=unparam \
  90. #--enable=unused \
  91. #--enable=varcheck \
  92. #--enable=vet \
  93. #--enable=vetshadow \
  94. .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