50 lines
1.3 KiB
Makefile
Raw Normal View History

2017-03-02 22:03:35 +04:00
DIST_DIRS := find * -type d -exec
VERSION := $(shell perl -ne '/^TMCoreSemVer = "([^"]+)"$$/ && print "v$$1\n"' ../../version/version.go)
2017-02-24 18:54:36 +04:00
all: build test install
2018-04-03 11:05:28 +02:00
########################################
### Build
2017-02-24 18:54:36 +04:00
2017-03-02 22:03:35 +04:00
build:
2018-04-03 11:05:28 +02:00
@go build
2017-03-02 22:03:35 +04:00
install:
2018-04-03 11:05:28 +02:00
@go install
2017-03-02 22:03:35 +04:00
test:
2017-12-06 14:21:02 -06:00
@go test -race $(PACKAGES)
2017-03-02 22:03:35 +04:00
build-all:
rm -rf ./dist
2017-03-02 22:03:35 +04:00
gox -verbose \
2017-12-06 14:21:02 -06:00
-ldflags "-s -w" \
2017-12-07 14:13:29 -06:00
-arch="amd64 386 arm arm64" \
-os="linux darwin windows freebsd" \
-osarch="!darwin/arm !darwin/arm64" \
2017-03-02 22:03:35 +04: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 22:03:35 +04:00
cd ..
2018-04-03 11:05:28 +02:00
########################################
### Docker
2017-03-02 22:03:35 +04:00
build-docker:
rm -f ./tm-monitor
docker run -it --rm -v "$(PWD)/../../:/go/src/github.com/tendermint/tendermint" -w "/go/src/github.com/tendermint/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 22:03:35 +04:00
clean:
rm -f ./tm-monitor
rm -rf ./dist
2018-04-03 11:05:28 +02: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
.PHONY: build install test build-all dist build-docker clean