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.

113 lines
2.7 KiB

9 years ago
7 years ago
7 years ago
7 years ago
  1. GOTOOLS = \
  2. github.com/mitchellh/gox \
  3. github.com/tcnksm/ghr \
  4. gopkg.in/alecthomas/gometalinter.v2
  5. PACKAGES=$(shell go list ./... | grep -v '/vendor/')
  6. BUILD_TAGS?=tendermint
  7. TMHOME = $${TMHOME:-$$HOME/.tendermint}
  8. BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short HEAD`"
  9. all: get_vendor_deps install test
  10. install:
  11. go install $(BUILD_FLAGS) ./cmd/tendermint
  12. build:
  13. go build $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint/
  14. build_race:
  15. go build -race $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint
  16. # dist builds binaries for all platforms and packages them for distribution
  17. dist:
  18. @BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/dist.sh'"
  19. test:
  20. @echo "--> Running linter"
  21. @make metalinter_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. test_release:
  30. @go test -tags release $(PACKAGES)
  31. test100:
  32. @for i in {1..100}; do make test; done
  33. vagrant_test:
  34. vagrant up
  35. vagrant ssh -c 'make install'
  36. vagrant ssh -c 'make test_race'
  37. vagrant ssh -c 'make test_integrations'
  38. draw_deps:
  39. # requires brew install graphviz or apt-get install graphviz
  40. go get github.com/RobotsAndPencils/goviz
  41. @goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
  42. get_vendor_deps:
  43. @hash glide 2>/dev/null || go get github.com/Masterminds/glide
  44. @rm -rf vendor/
  45. @echo "--> Running glide install"
  46. @glide install
  47. @make check_tools
  48. update_vendor_deps:
  49. @glide update
  50. update_tools:
  51. @echo "--> Updating tools"
  52. @go get -u $(GOTOOLS)
  53. check_tools:
  54. which gox || make tools
  55. tools:
  56. @echo "--> Installing tools"
  57. @go get $(GOTOOLS)
  58. @gometalinter.v2 --install
  59. ### Formatting, linting, and vetting
  60. metalinter:
  61. gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
  62. metalinter_test:
  63. gometalinter.v2 --vendor --deadline=600s --disable-all \
  64. --enable=deadcode \
  65. --enable=gosimple \
  66. --enable=misspell \
  67. --enable=safesql \
  68. ./...
  69. #--enable=gas \
  70. #--enable=maligned \
  71. #--enable=dupl \
  72. #--enable=errcheck \
  73. #--enable=goconst \
  74. #--enable=gocyclo \
  75. #--enable=goimports \
  76. #--enable=golint \ <== comments on anything exported
  77. #--enable=gotype \
  78. #--enable=ineffassign \
  79. #--enable=interfacer \
  80. #--enable=megacheck \
  81. #--enable=staticcheck \
  82. #--enable=structcheck \
  83. #--enable=unconvert \
  84. #--enable=unparam \
  85. #--enable=unused \
  86. #--enable=varcheck \
  87. #--enable=vet \
  88. #--enable=vetshadow \
  89. .PHONY: install build build_race check_tools dist test test_race test_integrations test100 draw_deps get_vendor_deps update_vendor_deps update_tools tools test_release