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.

48 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. 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_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. gox -verbose \
  19. -ldflags "-X main.version=${VERSION}" \
  20. -os="linux darwin windows freebsd openbsd netbsd" \
  21. -arch="amd64 386 armv5 armv6 armv7 arm64" \
  22. -osarch="!darwin/arm64" \
  23. -output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" .
  24. dist: build-all
  25. cd dist && \
  26. $(DIST_DIRS) cp ../LICENSE {} \; && \
  27. $(DIST_DIRS) cp ../README.md {} \; && \
  28. $(DIST_DIRS) tar -zcf tm-monitor-${VERSION}-{}.tar.gz {} \; && \
  29. $(DIST_DIRS) zip -r tm-monitor-${VERSION}-{}.zip {} \; && \
  30. cd ..
  31. build-docker:
  32. rm -f ./tm-monitor
  33. 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
  34. docker build -t "tendermint/monitor" .
  35. clean:
  36. rm -f ./tm-monitor
  37. rm -rf ./dist
  38. .PHONY: tools get_deps build install test build-all dist clean build-docker