erigon-pulse/Makefile

175 lines
6.0 KiB
Makefile
Raw Normal View History

GO = go
2020-09-30 09:28:36 +00:00
GOBIN = $(CURDIR)/build/bin
GOTEST = GODEBUG=cgocheck=0 $(GO) test ./... -p 2
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
GIT_TAG ?= $(shell git describe --tags `git rev-list --tags="v*" --max-count=1`)
GOBUILD = $(GO) build -trimpath -ldflags "-X github.com/ledgerwatch/erigon/params.GitCommit=${GIT_COMMIT} -X github.com/ledgerwatch/erigon/params.GitBranch=${GIT_BRANCH} -X github.com/ledgerwatch/erigon/params.GitTag=${GIT_TAG}"
GO_DBG_BUILD = $(GO) build -trimpath -tags=debug -ldflags "-X github.com/ledgerwatch/erigon/params.GitCommit=${GIT_COMMIT} -X github.com/ledgerwatch/erigon/params.GitBranch=${GIT_BRANCH} -X github.com/ledgerwatch/erigon/params.GitTag=${GIT_TAG}" -gcflags=all="-N -l" # see delve docs
GO_MAJOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
GO_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
2021-04-19 10:54:56 +00:00
2021-10-31 00:39:47 +00:00
all: erigon hack rpctest state pics rpcdaemon integration db-tools sentry txpool
2020-08-21 12:38:11 +00:00
2021-04-19 10:54:56 +00:00
go-version:
@if [ $(GO_MINOR_VERSION) -lt 16 ]; then \
echo "minimum required Golang version is 1.16"; \
exit 1 ;\
fi
2020-08-21 12:38:11 +00:00
docker:
2021-07-27 02:39:21 +00:00
DOCKER_BUILDKIT=1 docker build -t erigon:latest --build-arg git_commit='${GIT_COMMIT}' --build-arg git_branch='${GIT_BRANCH}' --build-arg git_tag='${GIT_TAG}' .
2020-08-21 12:38:11 +00:00
xdg_data_home := ~/.local/share
ifdef XDG_DATA_HOME
xdg_data_home = $(XDG_DATA_HOME)
endif
2020-08-21 12:38:11 +00:00
docker-compose:
mkdir -p $(xdg_data_home)/erigon $(xdg_data_home)/erigon-grafana $(xdg_data_home)/erigon-prometheus; \
docker-compose up
# debug build allows see C stack traces, run it with GOTRACEBACK=crash. You don't need debug build for C pit for profiling. To profile C code use SETCGOTRCKEBACK=1
dbg:
$(GO_DBG_BUILD) -o $(GOBIN)/ ./cmd/...
2021-05-31 10:20:56 +00:00
geth: erigon
2021-06-18 03:35:11 +00:00
erigon: go-version
@echo "Building Erigon"
rm -f $(GOBIN)/tg # Remove old binary to prevent confusion where users still use it because of the scripts
git submodule update --init --recursive --force
$(GOBUILD) -o $(GOBIN)/erigon ./cmd/erigon
@echo "Done building."
@echo "Run \"$(GOBIN)/erigon\" to launch Erigon."
hack:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/hack ./cmd/hack
@echo "Done building."
@echo "Run \"$(GOBIN)/hack\" to launch hack."
rpctest:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/rpctest ./cmd/rpctest
@echo "Done building."
@echo "Run \"$(GOBIN)/rpctest\" to launch rpctest."
state:
$(GOBUILD) -o $(GOBIN)/state ./cmd/state
@echo "Done building."
@echo "Run \"$(GOBIN)/state\" to launch state."
2020-02-09 10:31:52 +00:00
2020-10-28 03:18:10 +00:00
pics:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/pics ./cmd/pics
@echo "Done building."
@echo "Run \"$(GOBIN)/pics\" to launch pics."
rpcdaemon:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/rpcdaemon ./cmd/rpcdaemon
@echo "Done building."
@echo "Run \"$(GOBIN)/rpcdaemon\" to launch rpcdaemon."
2021-10-31 00:39:47 +00:00
txpool:
$(GOBUILD) -o $(GOBIN)/txpool ./cmd/txpool
@echo "Done building."
@echo "Run \"$(GOBIN)/txpool\" to launch txpool."
integration:
2021-03-01 04:02:06 +00:00
$(GOBUILD) -o $(GOBIN)/integration ./cmd/integration
@echo "Done building."
@echo "Run \"$(GOBIN)/integration\" to launch integration tests."
2021-05-31 10:20:56 +00:00
sentry:
2021-06-01 09:00:10 +00:00
$(GOBUILD) -o $(GOBIN)/sentry ./cmd/sentry
2021-06-03 07:36:30 +00:00
rm -f $(GOBIN)/headers # Remove old binary to prevent confusion where users still use it because of the scripts
@echo "Done building."
2021-06-01 09:00:10 +00:00
@echo "Run \"$(GOBIN)/sentry\" to run sentry"
cons:
$(GOBUILD) -o $(GOBIN)/cons ./cmd/cons
@echo "Done building."
@echo "Run \"$(GOBIN)/cons\" to run consensus engine PoC."
evm:
$(GOBUILD) -o $(GOBIN)/evm ./cmd/evm
@echo "Done building."
@echo "Run \"$(GOBIN)/evm\" to run EVM"
downloader:
git submodule update --init --recursive --force
$(GOBUILD) -o $(GOBIN)/downloader ./cmd/downloader
@echo "Done building."
@echo "Run \"$(GOBIN)/downloader\" to download and seed snapshots."
devnettest:
$(GOBUILD) -o $(GOBIN)/devnettest ./cmd/devnettest
@echo "Done building."
@echo "Run \"$(GOBIN)/devnettest\" to launch devnettest."
2021-11-15 03:14:19 +00:00
db-tools:
@echo "Building db-tools"
# hub.docker.com setup incorrect gitpath for git modules. Just remove it and re-init submodule.
rm -rf libmdbx
rm -rf cmd/downloader/trackers/trackerslist
rm -rf turbo/snapshotsync/snapshothashes/erigon-snapshots
2021-11-15 03:14:19 +00:00
git submodule update --init --recursive --force
cd libmdbx && MDBX_BUILD_TIMESTAMP=unknown make tools
cp libmdbx/mdbx_chk $(GOBIN)
cp libmdbx/mdbx_copy $(GOBIN)
cp libmdbx/mdbx_dump $(GOBIN)
cp libmdbx/mdbx_drop $(GOBIN)
cp libmdbx/mdbx_load $(GOBIN)
cp libmdbx/mdbx_stat $(GOBIN)
@echo "Run \"$(GOBIN)/mdbx_stat -h\" to get info about mdbx db file."
2020-10-08 07:11:36 +00:00
2021-06-18 03:35:11 +00:00
test:
2021-06-15 12:41:38 +00:00
$(GOTEST) --timeout 30m
lint:
@./build/bin/golangci-lint run --config ./.golangci.yml
2021-06-18 03:35:11 +00:00
lintci:
2021-03-29 23:17:19 +00:00
@echo "--> Running linter for code"
@./build/bin/golangci-lint run --config ./.golangci.yml
lintci-deps:
2019-11-06 12:34:35 +00:00
rm -f ./build/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.42.1
clean:
go clean -cache
2020-10-28 03:18:10 +00:00
rm -fr build/*
cd libmdbx/ && make clean
2021-12-26 03:54:26 +00:00
./build/bin/golangci-lint cache clean
2017-02-26 22:52:10 +00:00
# The devtools target installs tools required for 'go generate'.
# You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
devtools:
2020-10-02 03:56:13 +00:00
# Notice! If you adding new binary - add it also to cmd/hack/binary-deps/main.go file
$(GOBUILD) -o $(GOBIN)/stringer golang.org/x/tools/cmd/stringer
$(GOBUILD) -o $(GOBIN)/go-bindata github.com/kevinburke/go-bindata/go-bindata
$(GOBUILD) -o $(GOBIN)/gencodec github.com/fjl/gencodec
$(GOBUILD) -o $(GOBIN)/codecgen github.com/ugorji/go/codec/codecgen
$(GOBUILD) -o $(GOBIN)/abigen ./cmd/abigen
PATH=$(GOBIN):$(PATH) go generate ./common
PATH=$(GOBIN):$(PATH) go generate ./core/types
PATH=$(GOBIN):$(PATH) go generate ./consensus/aura/...
@type "npm" 2> /dev/null || echo 'Please install node.js and npm'
@type "solc" 2> /dev/null || echo 'Please install solc'
@type "protoc" 2> /dev/null || echo 'Please install protoc'
2017-02-26 22:52:10 +00:00
bindings:
2020-10-02 03:56:13 +00:00
PATH=$(GOBIN):$(PATH) go generate ./tests/contracts/
PATH=$(GOBIN):$(PATH) go generate ./core/state/contracts/
2020-04-29 10:51:07 +00:00
prometheus:
2020-08-01 15:05:48 +00:00
docker-compose up prometheus grafana
escape:
2020-06-15 16:39:34 +00:00
cd $(path) && go test -gcflags "-m -m" -run none -bench=BenchmarkJumpdest* -benchmem -memprofile mem.out