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.2 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. tools:
  7. go get -v $(GOTOOLS)
  8. get_deps: tools
  9. glide install
  10. build:
  11. go build -ldflags "-X main.version=${VERSION}"
  12. install:
  13. go install -ldflags "-X main.version=${VERSION}"
  14. test:
  15. go test
  16. build-all: tools
  17. gox -verbose \
  18. -ldflags "-X main.version=${VERSION}" \
  19. -os="linux darwin windows freebsd openbsd netbsd" \
  20. -arch="amd64 386 armv5 armv6 armv7 arm64" \
  21. -osarch="!darwin/arm64" \
  22. -output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" .
  23. dist: build-all
  24. cd dist && \
  25. $(DIST_DIRS) cp ../LICENSE {} \; && \
  26. $(DIST_DIRS) cp ../README.md {} \; && \
  27. $(DIST_DIRS) tar -zcf tm-monitor-${VERSION}-{}.tar.gz {} \; && \
  28. $(DIST_DIRS) zip -r tm-monitor-${VERSION}-{}.zip {} \; && \
  29. cd ..
  30. build-docker:
  31. rm -f ./tm-monitor
  32. docker run -it --rm -v "$(PWD):/go/src/app" -w "/go/src/app" -e "CGO_ENABLED=0" golang:alpine go build -ldflags "-X main.version=${VERSION}" -o tm-monitor
  33. docker build -t "tendermint/tm-monitor" .
  34. clean:
  35. rm -f ./tm-monitor.log
  36. rm -f ./tm-monitor
  37. rm -rf ./dist
  38. .PHONY: tools get_deps build install test build-all dist clean build-docker