tendermint/tm-monitor/Makefile

49 lines
1.2 KiB
Makefile
Raw Normal View History

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
GOTOOLS = \
2017-03-02 10:03:35 -08:00
github.com/mitchellh/gox
2017-12-06 12:21:02 -08:00
PACKAGES=$(shell go list ./... | grep -v '/vendor')
2017-02-24 06:54:36 -08:00
tools:
2017-12-06 12:21:02 -08:00
go get $(GOTOOLS)
2017-02-24 06:54:36 -08:00
2017-12-06 12:21:02 -08:00
get_vendor_deps:
@hash glide 2>/dev/null || go get github.com/Masterminds/glide
2017-03-02 10:03:35 -08:00
glide install
2017-02-24 06:54:36 -08:00
2017-03-02 10:03:35 -08:00
build:
2017-12-06 12:21:02 -08:00
go build
2017-03-02 10:03:35 -08:00
install:
2017-12-06 12:21:02 -08: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
build-all: tools
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 {} \; && \
shasum -a256 ./*.tar.gz > "./tm-monitor_${VERSION}_SHA256SUMS" && \
2017-03-02 10:03:35 -08:00
cd ..
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
docker build -t "tendermint/monitor" .
2017-03-02 10:03:35 -08:00
clean:
rm -f ./tm-monitor
rm -rf ./dist
.PHONY: tools get_vendor_deps build install test build-all dist clean build-docker