@ -6,6 +6,7 @@ LD_FLAGS = -X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse
BUILD_FLAGS = -mod= readonly -ldflags " $( LD_FLAGS) "
BUILD_FLAGS = -mod= readonly -ldflags " $( LD_FLAGS) "
all : check build test install
all : check build test install
.PHONY : all
# The below include contains the tools.
# The below include contains the tools.
i n c l u d e t o o l s . m k
i n c l u d e t o o l s . m k
@ -17,24 +18,30 @@ include tests.mk
build :
build :
CGO_ENABLED = 0 go build $( BUILD_FLAGS) -tags $( BUILD_TAGS) -o $( OUTPUT) ./cmd/tendermint/
CGO_ENABLED = 0 go build $( BUILD_FLAGS) -tags $( BUILD_TAGS) -o $( OUTPUT) ./cmd/tendermint/
.PHONY : build
build_c :
build_c :
CGO_ENABLED = 1 go build $( BUILD_FLAGS) -tags " $( BUILD_TAGS) cleveldb " -o $( OUTPUT) ./cmd/tendermint/
CGO_ENABLED = 1 go build $( BUILD_FLAGS) -tags " $( BUILD_TAGS) cleveldb " -o $( OUTPUT) ./cmd/tendermint/
.PHONY : build_c
build_race :
build_race :
CGO_ENABLED = 1 go build -race $( BUILD_FLAGS) -tags $( BUILD_TAGS) -o $( OUTPUT) ./cmd/tendermint
CGO_ENABLED = 1 go build -race $( BUILD_FLAGS) -tags $( BUILD_TAGS) -o $( OUTPUT) ./cmd/tendermint
.PHONY : build_race
install :
install :
CGO_ENABLED = 0 go install $( BUILD_FLAGS) -tags $( BUILD_TAGS) ./cmd/tendermint
CGO_ENABLED = 0 go install $( BUILD_FLAGS) -tags $( BUILD_TAGS) ./cmd/tendermint
.PHONY : install
install_c :
install_c :
CGO_ENABLED = 1 go install $( BUILD_FLAGS) -tags " $( BUILD_TAGS) cleveldb " ./cmd/tendermint
CGO_ENABLED = 1 go install $( BUILD_FLAGS) -tags " $( BUILD_TAGS) cleveldb " ./cmd/tendermint
.PHONY : install_c
###############################################################################
###############################################################################
### Protobuf ###
### Protobuf ###
###############################################################################
###############################################################################
proto-all : proto -gen proto -lint proto -check -breaking
proto-all : proto -gen proto -lint proto -check -breaking
.PHONY : proto -all
proto-gen :
proto-gen :
## If you get the following error,
## If you get the following error,
@ -43,14 +50,15 @@ proto-gen:
## Note the $< here is substituted for the %.proto
## Note the $< here is substituted for the %.proto
## Note the $@ here is substituted for the %.pb.go
## Note the $@ here is substituted for the %.pb.go
@sh scripts/protocgen.sh
@sh scripts/protocgen.sh
.PHONY : proto -gen
proto-lint :
proto-lint :
@buf check lint --error-format= json
@buf check lint --error-format= json
.PHONY : proto -lint
proto-check-breaking :
proto-check-breaking :
@buf check breaking --against-input '.git#branch=master'
@buf check breaking --against-input '.git#branch=master'
.PHONY : proto -all proto -gen proto -lint proto -check -breaking
.PHONY : proto -check -breaking
###############################################################################
###############################################################################
### Build ABCI ###
### Build ABCI ###
@ -58,9 +66,11 @@ proto-check-breaking:
build_abci :
build_abci :
@go build -mod= readonly -i ./abci/cmd/...
@go build -mod= readonly -i ./abci/cmd/...
.PHONY : build_abci
install_abci :
install_abci :
@go install -mod= readonly ./abci/cmd/...
@go install -mod= readonly ./abci/cmd/...
.PHONY : install_abci
###############################################################################
###############################################################################
### Distribution ###
### Distribution ###
@ -70,6 +80,7 @@ install_abci:
# TODO add abci to these scripts
# TODO add abci to these scripts
dist :
dist :
@BUILD_TAGS= $( BUILD_TAGS) sh -c " ' $( CURDIR) /scripts/dist.sh' "
@BUILD_TAGS= $( BUILD_TAGS) sh -c " ' $( CURDIR) /scripts/dist.sh' "
.PHONY : dist
go-mod-cache : go .sum
go-mod-cache : go .sum
@echo "--> Download go modules to local cache"
@echo "--> Download go modules to local cache"
@ -85,12 +96,14 @@ draw_deps:
@# requires brew install graphviz or apt-get install graphviz
@# requires brew install graphviz or apt-get install graphviz
go get github.com/RobotsAndPencils/goviz
go get github.com/RobotsAndPencils/goviz
@goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
@goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
.PHONY : draw_deps
get_deps_bin_size :
get_deps_bin_size :
@# Copy of build recipe with additional flags to perform binary size analysis
@# Copy of build recipe with additional flags to perform binary size analysis
$( eval $( shell go build -work -a $( BUILD_FLAGS) -tags $( BUILD_TAGS) -o $( OUTPUT) ./cmd/tendermint/ 2>& 1) )
$( eval $( shell go build -work -a $( BUILD_FLAGS) -tags $( BUILD_TAGS) -o $( OUTPUT) ./cmd/tendermint/ 2>& 1) )
@find $( WORK) -type f -name "*.a" | xargs -I{ } du -hxs "{}" | sort -rh | sed -e s:${ WORK } /::g > deps_bin_size.log
@find $( WORK) -type f -name "*.a" | xargs -I{ } du -hxs "{}" | sort -rh | sed -e s:${ WORK } /::g > deps_bin_size.log
@echo " Results can be found here: $( CURDIR) /deps_bin_size.log "
@echo " Results can be found here: $( CURDIR) /deps_bin_size.log "
.PHONY : get_deps_bin_size
###############################################################################
###############################################################################
### Libs ###
### Libs ###
@ -104,11 +117,13 @@ gen_certs: clean_certs
mv out/server.crt rpc/lib/server/test.crt
mv out/server.crt rpc/lib/server/test.crt
mv out/server.key rpc/lib/server/test.key
mv out/server.key rpc/lib/server/test.key
rm -rf out
rm -rf out
.PHONY : gen_certs
# deletes generated certificates
# deletes generated certificates
clean_certs :
clean_certs :
rm -f rpc/lib/server/test.crt
rm -f rpc/lib/server/test.crt
rm -f rpc/lib/server/test.key
rm -f rpc/lib/server/test.key
.PHONY : clean_certs
###############################################################################
###############################################################################
### Formatting, linting, and vetting ###
### Formatting, linting, and vetting ###
@ -116,10 +131,12 @@ clean_certs:
fmt :
fmt :
@go fmt ./...
@go fmt ./...
.PHONY : fmt
lint :
lint :
@echo "--> Running linter"
@echo "--> Running linter"
@golangci-lint run
@golangci-lint run
.PHONY : lint
DESTINATION = ./index.html.md
DESTINATION = ./index.html.md
@ -135,6 +152,7 @@ build-docs:
cp -r .vuepress/dist/* ~/output/$$ { p} / ; \
cp -r .vuepress/dist/* ~/output/$$ { p} / ; \
cp ~/output/$$ { p} /index.html ~/output ; \
cp ~/output/$$ { p} /index.html ~/output ; \
done < versions ;
done < versions ;
.PHONY : build -docs
sync-docs :
sync-docs :
cd ~/output && \
cd ~/output && \
@ -152,6 +170,7 @@ build-docker:
cp $( OUTPUT) DOCKER/tendermint
cp $( OUTPUT) DOCKER/tendermint
docker build --label= tendermint --tag= "tendermint/tendermint" DOCKER
docker build --label= tendermint --tag= "tendermint/tendermint" DOCKER
rm -rf DOCKER/tendermint
rm -rf DOCKER/tendermint
.PHONY : build -docker
###############################################################################
###############################################################################
### Local testnet using docker ###
### Local testnet using docker ###
@ -160,9 +179,11 @@ build-docker:
# Build linux binary on other platforms
# Build linux binary on other platforms
build-linux : tools
build-linux : tools
GOOS = linux GOARCH = amd64 $( MAKE) build
GOOS = linux GOARCH = amd64 $( MAKE) build
.PHONY : build -linux
build-docker-localnode :
build-docker-localnode :
@cd networks/local && make
@cd networks/local && make
.PHONY : build -docker -localnode
# Runs `make build_c` from within an Amazon Linux (v2)-based Docker build
# Runs `make build_c` from within an Amazon Linux (v2)-based Docker build
# container in order to build an Amazon Linux-compatible binary. Produces a
# container in order to build an Amazon Linux-compatible binary. Produces a
@ -170,15 +191,18 @@ build-docker-localnode:
build_c-amazonlinux :
build_c-amazonlinux :
$( MAKE) -C ./DOCKER build_amazonlinux_buildimage
$( MAKE) -C ./DOCKER build_amazonlinux_buildimage
docker run --rm -it -v ` pwd ` :/tendermint tendermint/tendermint:build_c-amazonlinux
docker run --rm -it -v ` pwd ` :/tendermint tendermint/tendermint:build_c-amazonlinux
.PHONY : build_c -amazonlinux
# Run a 4-node testnet locally
# Run a 4-node testnet locally
localnet-start : localnet -stop build -docker -localnode
localnet-start : localnet -stop build -docker -localnode
@if ! [ -f build/node0/config/genesis.json ] ; then docker run --rm -v $( CURDIR) /build:/tendermint:Z tendermint/localnode testnet --config /etc/tendermint/config-template.toml --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2; fi
@if ! [ -f build/node0/config/genesis.json ] ; then docker run --rm -v $( CURDIR) /build:/tendermint:Z tendermint/localnode testnet --config /etc/tendermint/config-template.toml --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2; fi
docker-compose up
docker-compose up
.PHONY : localnet -start
# Stop testnet
# Stop testnet
localnet-stop :
localnet-stop :
docker-compose down
docker-compose down
.PHONY : localnet -stop
# Build hooks for dredd, to skip or add information on some steps
# Build hooks for dredd, to skip or add information on some steps
build-contract-tests-hooks :
build-contract-tests-hooks :
@ -187,6 +211,7 @@ ifeq ($(OS),Windows_NT)
e l s e
e l s e
go build -mod= readonly $( BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
go build -mod= readonly $( BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
e n d i f
e n d i f
.PHONY : build -contract -tests -hooks
# Run a nodejs tool to test endpoints against a localnet
# Run a nodejs tool to test endpoints against a localnet
# The command takes care of starting and stopping the network
# The command takes care of starting and stopping the network
@ -195,12 +220,4 @@ endif
# The binaries should be built beforehand
# The binaries should be built beforehand
contract-tests :
contract-tests :
dredd
dredd
# 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 : check build build_race build_abci dist install install_abci check_tools tools update_tools draw_deps \
protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver fmt build-linux localnet-start \
localnet-stop build-docker build-docker-localnode protoc_grpc protoc_all \
build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests \
build_c-amazonlinux
.PHONY : contract -tests