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.

49 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 $(PACKAGES)
  12. build-all:
  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) tar -zcf tm-monitor-${VERSION}-{}.tar.gz {} \; && \
  24. shasum -a256 ./*.tar.gz > "./tm-monitor_${VERSION}_SHA256SUMS" && \
  25. cd ..
  26. ########################################
  27. ### Docker
  28. build-docker:
  29. rm -f ./tm-monitor
  30. docker run -it --rm -v "$(PWD):/go/src/github.com/tendermint/tools/tm-monitor" -w "/go/src/github.com/tendermint/tools/tm-monitor" -e "CGO_ENABLED=0" golang:alpine go build -ldflags "-s -w" -o tm-monitor
  31. docker build -t "tendermint/monitor" .
  32. clean:
  33. rm -f ./tm-monitor
  34. rm -rf ./dist
  35. # To avoid unintended conflicts with file names, always add to .PHONY
  36. # unless there is a reason not to.
  37. # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
  38. .PHONY: build install test build-all dist build-docker clean