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.

112 lines
2.8 KiB

9 years ago
7 years ago
8 years ago
7 years ago
7 years ago
7 years ago
9 years ago
8 years ago
9 years ago
7 years ago
7 years ago
7 years ago
9 years ago
8 years ago
7 years ago
7 years ago
7 years ago
  1. GOTOOLS = \
  2. github.com/mitchellh/gox \
  3. github.com/Masterminds/glide \
  4. github.com/alecthomas/gometalinter \
  5. github.com/ckaznocha/protoc-gen-lint \
  6. github.com/gogo/protobuf/protoc-gen-gogo \
  7. github.com/gogo/protobuf/gogoproto
  8. INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
  9. all: install test
  10. PACKAGES=$(shell go list ./... | grep -v '/vendor/')
  11. install_protoc:
  12. # https://github.com/google/protobuf/releases
  13. curl -L https://github.com/google/protobuf/releases/download/v3.4.1/protobuf-cpp-3.4.1.tar.gz | tar xvz && \
  14. cd protobuf-3.4.1 && \
  15. DIST_LANG=cpp ./configure && \
  16. make && \
  17. make install && \
  18. cd .. && \
  19. rm -rf protobuf-3.4.1
  20. protoc:
  21. ## Note to self:
  22. ## On "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
  23. ## ldconfig (may require sudo)
  24. ## https://stackoverflow.com/a/25518702
  25. protoc $(INCLUDE) --gogo_out=plugins=grpc:. --lint_out=. types/*.proto
  26. install:
  27. @ go install ./cmd/...
  28. build:
  29. @ go build -i ./cmd/...
  30. dist:
  31. @ bash scripts/dist.sh
  32. @ bash scripts/publish.sh
  33. test:
  34. @ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
  35. @ echo "==> Running linter"
  36. @ make metalinter_test
  37. @ echo "==> Running go test"
  38. @ go test $(PACKAGES)
  39. test_race:
  40. @ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
  41. @ echo "==> Running go test --race"
  42. @go test -v -race $(PACKAGES)
  43. test_integrations:
  44. @ bash test.sh
  45. fmt:
  46. @ go fmt ./...
  47. get_deps:
  48. @ go get -d $(PACKAGES)
  49. ensure_tools:
  50. go get -u -v $(GOTOOLS)
  51. @gometalinter --install
  52. get_vendor_deps: ensure_tools
  53. @rm -rf vendor/
  54. @echo "--> Running glide install"
  55. @ glide install
  56. metalinter:
  57. protoc $(INCLUDE) --lint_out=. types/*.proto
  58. gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...
  59. metalinter_test:
  60. protoc $(INCLUDE) --lint_out=. types/*.proto
  61. gometalinter --vendor --deadline=600s --disable-all \
  62. --enable=maligned \
  63. --enable=deadcode \
  64. --enable=goconst \
  65. --enable=goimports \
  66. --enable=gosimple \
  67. --enable=ineffassign \
  68. --enable=megacheck \
  69. --enable=misspell \
  70. --enable=staticcheck \
  71. --enable=safesql \
  72. --enable=structcheck \
  73. --enable=unconvert \
  74. --enable=unused \
  75. --enable=varcheck \
  76. --enable=vetshadow \
  77. ./...
  78. #--enable=gas \
  79. #--enable=dupl \
  80. #--enable=errcheck \
  81. #--enable=gocyclo \
  82. #--enable=golint \ <== comments on anything exported
  83. #--enable=gotype \
  84. #--enable=interfacer \
  85. #--enable=unparam \
  86. #--enable=vet \
  87. build-docker:
  88. docker build -t "tendermint/abci-dev" -f Dockerfile.develop .
  89. run-docker:
  90. docker run -it --rm -v "$PWD:/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" "tendermint/abci-dev" /bin/bash
  91. .PHONY: all build test fmt get_deps ensure_tools protoc install_protoc build-docker run-docker