2017-03-02 10:03:35 -08:00
|
|
|
DIST_DIRS := find * -type d -exec
|
|
|
|
VERSION := $(shell perl -ne '/^var version.*"([^"]+)".*$$/ && print "v$$1\n"' main.go)
|
2017-02-24 06:54:36 -08:00
|
|
|
|
2018-07-24 07:02:32 -07:00
|
|
|
all: build test install
|
2018-04-03 02:05:28 -07:00
|
|
|
|
|
|
|
########################################
|
|
|
|
### Build
|
2017-02-24 06:54:36 -08:00
|
|
|
|
2017-03-02 10:03:35 -08:00
|
|
|
build:
|
2018-04-03 02:05:28 -07:00
|
|
|
@go build
|
2017-03-02 10:03:35 -08:00
|
|
|
|
|
|
|
install:
|
2018-04-03 02:05:28 -07:00
|
|
|
@go install
|
2017-03-02 10:03:35 -08:00
|
|
|
|
|
|
|
test:
|
2017-12-06 12:21:02 -08:00
|
|
|
@go test -race $(PACKAGES)
|
2017-03-02 10:03:35 -08:00
|
|
|
|
2018-07-24 07:02:32 -07:00
|
|
|
build-all:
|
2017-10-06 03:54:59 -07:00
|
|
|
rm -rf ./dist
|
2017-03-02 10:03:35 -08:00
|
|
|
gox -verbose \
|
2017-12-06 12:21:02 -08:00
|
|
|
-ldflags "-s -w" \
|
2017-12-07 12:13:29 -08:00
|
|
|
-arch="amd64 386 arm arm64" \
|
|
|
|
-os="linux darwin windows freebsd" \
|
|
|
|
-osarch="!darwin/arm !darwin/arm64" \
|
2017-03-02 10:03:35 -08:00
|
|
|
-output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" .
|
|
|
|
|
|
|
|
dist: build-all
|
|
|
|
cd dist && \
|
|
|
|
$(DIST_DIRS) cp ../LICENSE {} \; && \
|
|
|
|
$(DIST_DIRS) tar -zcf tm-monitor-${VERSION}-{}.tar.gz {} \; && \
|
2017-10-06 03:54:59 -07:00
|
|
|
shasum -a256 ./*.tar.gz > "./tm-monitor_${VERSION}_SHA256SUMS" && \
|
2017-03-02 10:03:35 -08:00
|
|
|
cd ..
|
|
|
|
|
2018-04-03 02:05:28 -07:00
|
|
|
########################################
|
|
|
|
### Docker
|
|
|
|
|
2017-03-02 10:03:35 -08:00
|
|
|
build-docker:
|
|
|
|
rm -f ./tm-monitor
|
2017-12-06 12:21:02 -08:00
|
|
|
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
|
2017-03-06 10:29:06 -08:00
|
|
|
docker build -t "tendermint/monitor" .
|
2017-03-02 10:03:35 -08:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f ./tm-monitor
|
|
|
|
rm -rf ./dist
|
|
|
|
|
2018-04-03 02:05:28 -07:00
|
|
|
# To avoid unintended conflicts with file names, always add to .PHONY
|
|
|
|
# unless there is a reason not to.
|
|
|
|
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
|
2018-07-24 07:02:32 -07:00
|
|
|
.PHONY: build install test build-all dist build-docker clean
|