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.

50 lines
1.3 KiB

  1. DIST_DIRS := find * -type d -exec
  2. VERSION := $(shell perl -ne '/^var version.*"([^"]+)".*$$/ && print "v$$1\n"' main.go)
  3. all: build test install
  4. ########################################
  5. ### Build
  6. build:
  7. @go build
  8. install:
  9. @go install
  10. test:
  11. @go test -race
  12. build-all: check_tools
  13. rm -rf ./dist
  14. gox -verbose \
  15. -ldflags "-s -w" \
  16. -arch="amd64 386 arm arm64" \
  17. -os="linux darwin windows freebsd" \
  18. -osarch="!darwin/arm !darwin/arm64" \
  19. -output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" .
  20. dist: build-all
  21. cd dist && \
  22. $(DIST_DIRS) cp ../LICENSE {} \; && \
  23. $(DIST_DIRS) cp ../README.rst {} \; && \
  24. $(DIST_DIRS) tar -zcf tm-bench-${VERSION}-{}.tar.gz {} \; && \
  25. shasum -a256 ./*.tar.gz > "./tm-bench_${VERSION}_SHA256SUMS" && \
  26. cd ..
  27. ########################################
  28. ### Docker
  29. build-docker:
  30. rm -f ./tm-bench
  31. docker run -it --rm -v "$(PWD):/go/src/app" -w "/go/src/app" -e "CGO_ENABLED=0" golang:alpine go build -ldflags "-s -w" -o tm-bench
  32. docker build -t "tendermint/bench" .
  33. clean:
  34. rm -f ./tm-bench
  35. rm -rf ./dist
  36. # To avoid unintended conflicts with file names, always add to .PHONY
  37. # unless there is a reason not to.
  38. # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
  39. .PHONY: check check_tools get_tools update_tools get_vendor_deps build install test build-all dist fmt metalinter metalinter_all build-docker clean