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.

116 lines
2.9 KiB

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/alecthomas/gometalinter
  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. 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. update_deps:
  48. @echo "--> Updating dependencies"
  49. @go get -d -u ./...
  50. get_vendor_deps:
  51. @hash glide 2>/dev/null || go get github.com/Masterminds/glide
  52. @rm -rf vendor/
  53. @echo "--> Running glide install"
  54. @glide install
  55. update_tools:
  56. @echo "--> Updating tools"
  57. @go get -u $(GOTOOLS)
  58. tools:
  59. @echo "--> Installing tools"
  60. @go get $(GOTOOLS)
  61. @gometalinter --install
  62. ### Formatting, linting, and vetting
  63. metalinter:
  64. @gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...
  65. metalinter_test:
  66. @gometalinter --vendor --deadline=600s --disable-all \
  67. --enable=deadcode \
  68. --enable=misspell \
  69. --enable=safesql \
  70. ./...
  71. # --enable=gas \
  72. #--enable=maligned \
  73. #--enable=dupl \
  74. #--enable=errcheck \
  75. #--enable=goconst \
  76. #--enable=gocyclo \
  77. #--enable=goimports \
  78. #--enable=golint \ <== comments on anything exported
  79. #--enable=gosimple \
  80. #--enable=gotype \
  81. #--enable=ineffassign \
  82. #--enable=interfacer \
  83. #--enable=megacheck \
  84. #--enable=staticcheck \
  85. #--enable=structcheck \
  86. #--enable=unconvert \
  87. #--enable=unparam \
  88. #--enable=unused \
  89. #--enable=varcheck \
  90. #--enable=vet \
  91. #--enable=vetshadow \
  92. .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