2017-06-15 12:11:47 -07:00
|
|
|
GOTOOLS = github.com/mitchellh/gox \
|
2017-06-28 02:16:33 -07:00
|
|
|
github.com/Masterminds/glide \
|
|
|
|
github.com/rigelrozanski/shelldown/cmd/shelldown
|
|
|
|
TUTORIALS=$(shell find docs/guide -name "*md" -type f)
|
2016-02-05 23:16:33 -08:00
|
|
|
|
2017-09-08 11:51:14 -07:00
|
|
|
EXAMPLES := counter eyes basecoin
|
2017-08-30 11:42:24 -07:00
|
|
|
INSTALL_EXAMPLES := $(addprefix install_,${EXAMPLES})
|
|
|
|
TEST_EXAMPLES := $(addprefix testex_,${EXAMPLES})
|
2017-08-30 11:22:17 -07:00
|
|
|
|
2017-08-21 14:21:42 -07:00
|
|
|
LINKER_FLAGS:="-X github.com/cosmos/cosmos-sdk/client/commands.CommitHash=`git rev-parse --short HEAD`"
|
2017-08-17 15:40:28 -07:00
|
|
|
|
2017-06-15 12:11:47 -07:00
|
|
|
all: get_vendor_deps install test
|
2017-01-28 09:29:32 -08:00
|
|
|
|
|
|
|
build:
|
2017-07-04 20:28:27 -07:00
|
|
|
@go build ./cmd/...
|
2017-01-28 09:29:32 -08:00
|
|
|
|
2017-08-30 11:42:24 -07:00
|
|
|
$(INSTALL_EXAMPLES): install_%:
|
|
|
|
cd ./examples/$* && make install
|
|
|
|
|
|
|
|
$(TEST_EXAMPLES): testex_%:
|
|
|
|
cd ./examples/$* && make test_cli
|
|
|
|
|
|
|
|
install: $(INSTALL_EXAMPLES)
|
2017-08-17 15:40:28 -07:00
|
|
|
@go install -ldflags $(LINKER_FLAGS) ./cmd/...
|
2016-02-05 23:16:33 -08:00
|
|
|
|
2017-06-01 20:51:35 -07:00
|
|
|
dist:
|
2017-07-04 20:28:27 -07:00
|
|
|
@bash publish/dist.sh
|
|
|
|
@bash publish/publish.sh
|
2017-06-01 20:51:35 -07:00
|
|
|
|
2017-07-06 07:51:40 -07:00
|
|
|
benchmark:
|
|
|
|
@go test -bench=. ./modules/...
|
|
|
|
|
2017-07-18 13:40:04 -07:00
|
|
|
#test: test_unit test_cli test_tutorial
|
|
|
|
test: test_unit test_cli
|
2017-06-15 08:16:00 -07:00
|
|
|
|
2017-06-15 12:11:47 -07:00
|
|
|
test_unit:
|
2017-10-23 12:55:37 -07:00
|
|
|
@go test `glide novendor | grep -v _attic | grep -v examples`
|
2016-02-05 23:16:33 -08:00
|
|
|
|
2017-08-30 11:42:24 -07:00
|
|
|
test_cli: $(TEST_EXAMPLES)
|
2017-06-15 12:11:47 -07:00
|
|
|
# sudo apt-get install jq
|
2017-08-30 11:33:47 -07:00
|
|
|
# wget "https://raw.githubusercontent.com/kward/shunit2/master/source/2.1/src/shunit2"
|
2017-01-11 21:07:56 -08:00
|
|
|
|
2017-08-30 11:33:47 -07:00
|
|
|
test_tutorial:
|
2017-07-04 20:28:27 -07:00
|
|
|
@shelldown ${TUTORIALS}
|
|
|
|
@for script in docs/guide/*.sh ; do \
|
2017-06-28 22:29:10 -07:00
|
|
|
bash $$script ; \
|
2017-06-28 02:16:33 -07:00
|
|
|
done
|
|
|
|
|
2017-06-02 09:06:48 -07:00
|
|
|
get_vendor_deps: tools
|
2017-07-04 20:28:27 -07:00
|
|
|
@glide install
|
2017-01-28 09:29:32 -08:00
|
|
|
|
2017-03-14 00:25:42 -07:00
|
|
|
build-docker:
|
2017-07-04 20:28:27 -07:00
|
|
|
@docker run -it --rm -v "$(PWD):/go/src/github.com/tendermint/basecoin" -w \
|
2017-06-15 12:11:47 -07:00
|
|
|
"/go/src/github.com/tendermint/basecoin" -e "CGO_ENABLED=0" golang:alpine go build ./cmd/basecoin
|
2017-07-04 20:28:27 -07:00
|
|
|
@docker build -t "tendermint/basecoin" .
|
2017-03-14 00:25:42 -07:00
|
|
|
|
2017-06-02 09:06:48 -07:00
|
|
|
tools:
|
2017-06-21 11:13:54 -07:00
|
|
|
@go get $(GOTOOLS)
|
2017-06-02 09:06:48 -07:00
|
|
|
|
2017-03-14 00:25:42 -07:00
|
|
|
clean:
|
2017-06-19 05:16:38 -07:00
|
|
|
# maybe cleaning up cache and vendor is overkill, but sometimes
|
|
|
|
# you don't get the most recent versions with lots of branches, changes, rebases...
|
|
|
|
@rm -rf ~/.glide/cache/src/https-github.com-tendermint-*
|
|
|
|
@rm -rf ./vendor
|
|
|
|
@rm -f $GOPATH/bin/{basecoin,basecli,counter,countercli}
|
2017-03-14 00:25:42 -07:00
|
|
|
|
2017-06-19 05:16:38 -07:00
|
|
|
# when your repo is getting a little stale... just make fresh
|
|
|
|
fresh: clean get_vendor_deps install
|
2017-08-08 12:09:39 -07:00
|
|
|
@if [ "$(git status -s)" ]; then echo; echo "Warning: uncommited changes"; git status -s; fi
|
2017-06-19 05:16:38 -07:00
|
|
|
|
2017-07-06 07:51:40 -07:00
|
|
|
.PHONY: all build install test test_cli test_unit get_vendor_deps build-docker clean fresh benchmark
|