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.4 KiB

  1. DIST_DIRS := find * -type d -exec
  2. VERSION := $(shell perl -ne '/^var version.*"([^"]+)".*$$/ && print "v$$1\n"' main.go)
  3. GOTOOLS = \
  4. github.com/Masterminds/glide \
  5. github.com/mitchellh/gox
  6. PACKAGES=$(shell go list ./... | grep -v '/vendor/')
  7. tools:
  8. go get -v $(GOTOOLS)
  9. get_vendor_deps: tools
  10. glide install
  11. build:
  12. go build -ldflags "-X main.version=${VERSION}"
  13. install:
  14. go install -ldflags "-X main.version=${VERSION}"
  15. test:
  16. @go test $(PACKAGES)
  17. build-all: tools
  18. rm -rf ./dist
  19. gox -verbose \
  20. -ldflags "-X main.version=${VERSION}" \
  21. -os="linux darwin windows" \
  22. -arch="amd64 386 armv6 arm64" \
  23. -osarch="!darwin/arm64" \
  24. -output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" .
  25. dist: build-all
  26. cd dist && \
  27. $(DIST_DIRS) cp ../LICENSE {} \; && \
  28. $(DIST_DIRS) cp ../README.rst {} \; && \
  29. $(DIST_DIRS) tar -zcf tm-monitor-${VERSION}-{}.tar.gz {} \; && \
  30. shasum -a256 ./*.tar.gz > "./tm-monitor_${VERSION}_SHA256SUMS" && \
  31. cd ..
  32. build-docker:
  33. rm -f ./tm-monitor
  34. 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 "-X main.version=${VERSION}" -o tm-monitor
  35. docker build -t "tendermint/monitor" .
  36. clean:
  37. rm -f ./tm-monitor
  38. rm -rf ./dist
  39. .PHONY: tools get_vendor_deps build install test build-all dist clean build-docker