tendermint/tm-monitor/Makefile

50 lines
1.4 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/Masterminds/glide \
github.com/mitchellh/gox
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
2017-02-24 06:54:36 -08:00
tools:
go get -v $(GOTOOLS)
get_vendor_deps: tools
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:
go build -ldflags "-X main.version=${VERSION}"
install:
go install -ldflags "-X main.version=${VERSION}"
test:
@go test $(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 \
-ldflags "-X main.version=${VERSION}" \
-os="linux darwin windows" \
-arch="amd64 386 armv6 arm64" \
2017-03-02 10:03:35 -08:00
-osarch="!darwin/arm64" \
-output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" .
dist: build-all
cd dist && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.rst {} \; && \
2017-03-02 10:03:35 -08:00
$(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-03-20 07:41:38 -07: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 "-X main.version=${VERSION}" -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