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.

122 lines
3.1 KiB

8 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. list_deps:
  43. @go list -f '{{join .Deps "\n"}}' ./... | \
  44. grep -v /vendor/ | sort | uniq | \
  45. xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
  46. get_deps:
  47. @echo "--> Running go get"
  48. @go get -v -d $(PACKAGES)
  49. @go list -f '{{join .TestImports "\n"}}' ./... | \
  50. grep -v /vendor/ | sort | uniq | \
  51. xargs go get -v -d
  52. update_deps:
  53. @echo "--> Updating dependencies"
  54. @go get -d -u ./...
  55. get_vendor_deps:
  56. @hash glide 2>/dev/null || go get github.com/Masterminds/glide
  57. @rm -rf vendor/
  58. @echo "--> Running glide install"
  59. $(GOPATH)/bin/glide install
  60. update_tools:
  61. @echo "--> Updating tools"
  62. @go get -u $(GOTOOLS)
  63. tools:
  64. @echo "--> Installing tools"
  65. @go get $(GOTOOLS)
  66. $(GOPATH)/bin/gometalinter.v2 --install
  67. ### Formatting, linting, and vetting
  68. metalinter:
  69. $(GOPATH)/bin/gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
  70. metalinter_test:
  71. $(GOPATH)/bin/gometalinter.v2 --vendor --deadline=600s --disable-all \
  72. --enable=deadcode \
  73. --enable=gosimple \
  74. --enable=misspell \
  75. --enable=safesql \
  76. ./...
  77. #--enable=gas \
  78. #--enable=maligned \
  79. #--enable=dupl \
  80. #--enable=errcheck \
  81. #--enable=goconst \
  82. #--enable=gocyclo \
  83. #--enable=goimports \
  84. #--enable=golint \ <== comments on anything exported
  85. #--enable=gotype \
  86. #--enable=ineffassign \
  87. #--enable=interfacer \
  88. #--enable=megacheck \
  89. #--enable=staticcheck \
  90. #--enable=structcheck \
  91. #--enable=unconvert \
  92. #--enable=unparam \
  93. #--enable=unused \
  94. #--enable=varcheck \
  95. #--enable=vet \
  96. #--enable=vetshadow \
  97. .PHONY: install build build_race dist test test_race test_integrations test100 draw_deps list_deps get_deps get_vendor_deps update_deps update_tools tools test_release