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.

109 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: tools 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. update_vendor_deps:
  48. @glide update
  49. update_tools:
  50. @echo "--> Updating tools"
  51. @go get -u $(GOTOOLS)
  52. tools:
  53. @echo "--> Installing tools"
  54. @go get $(GOTOOLS)
  55. @gometalinter.v2 --install
  56. ### Formatting, linting, and vetting
  57. metalinter:
  58. gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
  59. metalinter_test:
  60. gometalinter.v2 --vendor --deadline=600s --disable-all \
  61. --enable=deadcode \
  62. --enable=gosimple \
  63. --enable=misspell \
  64. --enable=safesql \
  65. ./...
  66. #--enable=gas \
  67. #--enable=maligned \
  68. #--enable=dupl \
  69. #--enable=errcheck \
  70. #--enable=goconst \
  71. #--enable=gocyclo \
  72. #--enable=goimports \
  73. #--enable=golint \ <== comments on anything exported
  74. #--enable=gotype \
  75. #--enable=ineffassign \
  76. #--enable=interfacer \
  77. #--enable=megacheck \
  78. #--enable=staticcheck \
  79. #--enable=structcheck \
  80. #--enable=unconvert \
  81. #--enable=unparam \
  82. #--enable=unused \
  83. #--enable=varcheck \
  84. #--enable=vet \
  85. #--enable=vetshadow \
  86. .PHONY: install build build_race dist test test_race test_integrations test100 draw_deps get_vendor_deps update_vendor_deps update_tools tools test_release