tendermint/tm-bench/Makefile

49 lines
1.1 KiB
Makefile
Raw Normal View History

2017-03-13 08:10:51 -07:00
DIST_DIRS := find * -type d -exec
VERSION := $(shell perl -ne '/^var version.*"([^"]+)".*$$/ && print "v$$1\n"' main.go)
GOTOOLS = \
github.com/mitchellh/gox
tools:
2017-12-07 11:25:35 -08:00
go get $(GOTOOLS)
2017-03-13 08:10:51 -07:00
2017-12-07 11:25:35 -08:00
get_vendor_deps:
@hash glide 2>/dev/null || go get github.com/Masterminds/glide
2017-03-13 08:10:51 -07:00
glide install
build:
2017-12-07 11:25:35 -08:00
go build
2017-03-13 08:10:51 -07:00
install:
2017-12-07 11:25:35 -08:00
go install
2017-03-13 08:10:51 -07:00
test:
2017-12-07 11:25:35 -08:00
go test -race
2017-03-13 08:10:51 -07:00
build-all: tools
rm -rf ./dist
2017-03-13 08:10:51 -07:00
gox -verbose \
2017-12-07 11:25:35 -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-13 08:10:51 -07:00
-output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" .
dist: build-all
cd dist && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.rst {} \; && \
2017-03-13 08:10:51 -07:00
$(DIST_DIRS) tar -zcf tm-bench-${VERSION}-{}.tar.gz {} \; && \
shasum -a256 ./*.tar.gz > "./tm-bench_${VERSION}_SHA256SUMS" && \
2017-03-13 08:10:51 -07:00
cd ..
build-docker:
rm -f ./tm-bench
2017-12-07 11:25:35 -08:00
docker run -it --rm -v "$(PWD):/go/src/app" -w "/go/src/app" -e "CGO_ENABLED=0" golang:alpine go build -ldflags "-s -w" -o tm-bench
2017-03-22 04:52:59 -07:00
docker build -t "tendermint/bench" .
2017-03-13 08:10:51 -07:00
clean:
rm -f ./tm-bench
rm -rf ./dist
.PHONY: tools get_vendor_deps build install test build-all dist clean build-docker