2020-03-05 17:56:07 +00:00
|
|
|
# Copyright (c) 2019-2020 Status Research & Development GmbH. Licensed under
|
2019-03-28 15:18:59 +00:00
|
|
|
# either of:
|
|
|
|
# - Apache License, version 2.0
|
|
|
|
# - MIT license
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except
|
|
|
|
# according to those terms.
|
|
|
|
|
2019-09-10 00:50:09 +00:00
|
|
|
SHELL := bash # the shell used internally by "make"
|
|
|
|
|
2019-08-21 12:45:24 +00:00
|
|
|
# used inside the included makefiles
|
|
|
|
BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2020-04-18 23:25:21 +00:00
|
|
|
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
2019-08-21 12:45:24 +00:00
|
|
|
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2020-07-09 22:41:51 +00:00
|
|
|
BUILD_LOG_LEVEL := TRACE
|
|
|
|
LOG_LEVEL := DEBUG
|
|
|
|
NODE_ID := 0
|
|
|
|
BASE_PORT := 9000
|
|
|
|
BASE_RPC_PORT := 9190
|
|
|
|
BASE_METRICS_PORT := 8008
|
|
|
|
GOERLI_WEB3_URL := "wss://goerli.infura.io/ws/v3/6224f3c792cc443fafb64e70a98f871e"
|
|
|
|
|
2019-12-04 14:40:36 +00:00
|
|
|
# unconditionally built by the default Make target
|
|
|
|
TOOLS := \
|
|
|
|
beacon_node \
|
2020-06-11 16:41:43 +00:00
|
|
|
block_sim \
|
|
|
|
deposit_contract \
|
2019-12-15 17:46:20 +00:00
|
|
|
inspector \
|
2020-03-11 00:39:58 +00:00
|
|
|
logtrace \
|
2020-06-11 16:41:43 +00:00
|
|
|
nbench \
|
|
|
|
nbench_spec_scenarios \
|
|
|
|
ncli_db \
|
2019-12-04 14:40:36 +00:00
|
|
|
ncli_hash_tree_root \
|
|
|
|
ncli_pretty \
|
2020-05-27 11:36:02 +00:00
|
|
|
ncli_query \
|
2019-12-04 14:40:36 +00:00
|
|
|
ncli_transition \
|
2020-04-28 08:08:32 +00:00
|
|
|
process_dashboard \
|
2020-05-04 05:38:14 +00:00
|
|
|
stack_sizes \
|
2020-05-01 15:51:24 +00:00
|
|
|
state_sim \
|
2020-06-23 16:49:41 +00:00
|
|
|
validator_client
|
2020-06-23 22:41:38 +00:00
|
|
|
|
|
|
|
# bench_bls_sig_agggregation TODO reenable after bls v0.10.1 changes
|
2020-06-11 16:41:43 +00:00
|
|
|
|
2019-12-04 14:40:36 +00:00
|
|
|
TOOLS_DIRS := \
|
|
|
|
beacon_chain \
|
|
|
|
benchmarks \
|
|
|
|
ncli \
|
2020-05-14 22:54:10 +00:00
|
|
|
nbench \
|
2019-12-04 14:40:36 +00:00
|
|
|
research \
|
2020-06-10 15:21:32 +00:00
|
|
|
tools
|
2019-04-12 22:15:38 +00:00
|
|
|
TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2019-12-04 14:40:36 +00:00
|
|
|
.PHONY: \
|
|
|
|
all \
|
|
|
|
deps \
|
|
|
|
update \
|
|
|
|
test \
|
|
|
|
$(TOOLS) \
|
2020-06-16 19:45:52 +00:00
|
|
|
clean_eth2_network_simulation_all \
|
2019-12-04 14:40:36 +00:00
|
|
|
eth2_network_simulation \
|
|
|
|
clean-testnet0 \
|
|
|
|
testnet0 \
|
|
|
|
clean-testnet1 \
|
|
|
|
testnet1 \
|
2020-02-13 12:19:12 +00:00
|
|
|
clean \
|
2020-05-02 14:30:34 +00:00
|
|
|
libbacktrace \
|
|
|
|
book \
|
|
|
|
publish-book
|
2019-08-21 12:45:24 +00:00
|
|
|
|
2019-12-03 18:52:54 +00:00
|
|
|
ifeq ($(NIM_PARAMS),)
|
2020-04-18 23:25:21 +00:00
|
|
|
# "variables.mk" was not included, so we update the submodules.
|
|
|
|
GIT_SUBMODULE_UPDATE := git submodule update --init --recursive
|
|
|
|
.DEFAULT:
|
|
|
|
+@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \
|
2020-04-19 11:36:11 +00:00
|
|
|
$(GIT_SUBMODULE_UPDATE) && \
|
2020-04-18 23:25:21 +00:00
|
|
|
echo
|
|
|
|
# Now that the included *.mk files appeared, and are newer than this file, Make will restart itself:
|
|
|
|
# https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles
|
|
|
|
#
|
|
|
|
# After restarting, it will execute its original goal, so we don't have to start a child Make here
|
|
|
|
# with "$(MAKE) $(MAKECMDGOALS)". Isn't hidden control flow great?
|
|
|
|
|
|
|
|
else # "variables.mk" was included. Business as usual until the end of this file.
|
|
|
|
|
|
|
|
# default target, because it's the first one that doesn't start with '.'
|
|
|
|
all: | $(TOOLS) libnfuzz.so libnfuzz.a
|
2019-08-21 12:45:24 +00:00
|
|
|
|
|
|
|
# must be included after the default target
|
|
|
|
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
|
|
|
|
2020-06-14 02:25:19 +00:00
|
|
|
ifeq ($(OS), Windows_NT)
|
|
|
|
ifeq ($(ARCH), x86)
|
|
|
|
# 32-bit Windows is not supported by libbacktrace/libunwind
|
|
|
|
USE_LIBBACKTRACE := 0
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-07-09 22:41:51 +00:00
|
|
|
CHRONICLES_PARAMS := -d:chronicles_log_level=$(BUILD_LOG_LEVEL)
|
|
|
|
|
2020-03-31 12:53:41 +00:00
|
|
|
# "--define:release" implies "--stacktrace:off" and it cannot be added to config.nims
|
2020-02-20 16:41:10 +00:00
|
|
|
ifeq ($(USE_LIBBACKTRACE), 0)
|
2020-07-09 22:41:51 +00:00
|
|
|
NIM_PARAMS := $(NIM_PARAMS) $(CHRONICLES_PARAMS) -d:debug -d:disable_libbacktrace
|
2020-02-20 16:41:10 +00:00
|
|
|
else
|
2020-07-09 22:41:51 +00:00
|
|
|
NIM_PARAMS := $(NIM_PARAMS) $(CHRONICLES_PARAMS) -d:release
|
2020-02-20 16:41:10 +00:00
|
|
|
endif
|
2020-02-13 12:19:12 +00:00
|
|
|
|
2020-06-22 14:30:14 +00:00
|
|
|
deps: | deps-common nat-libs beacon_chain.nims
|
2020-02-20 16:41:10 +00:00
|
|
|
ifneq ($(USE_LIBBACKTRACE), 0)
|
|
|
|
deps: | libbacktrace
|
|
|
|
endif
|
2019-08-21 12:45:24 +00:00
|
|
|
|
|
|
|
#- deletes and recreates "beacon_chain.nims" which on Windows is a copy instead of a proper symlink
|
|
|
|
update: | update-common
|
2019-12-04 14:40:36 +00:00
|
|
|
rm -f beacon_chain.nims && \
|
2020-04-15 22:20:27 +00:00
|
|
|
$(MAKE) beacon_chain.nims $(HANDLE_OUTPUT)
|
2019-08-21 12:45:24 +00:00
|
|
|
|
|
|
|
# symlink
|
|
|
|
beacon_chain.nims:
|
|
|
|
ln -s beacon_chain.nimble $@
|
|
|
|
|
2020-02-13 12:19:12 +00:00
|
|
|
# nim-libbacktrace
|
|
|
|
libbacktrace:
|
2020-04-18 23:25:21 +00:00
|
|
|
+ $(MAKE) -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0
|
2020-02-13 12:19:12 +00:00
|
|
|
|
2019-04-11 14:01:28 +00:00
|
|
|
# Windows 10 with WSL enabled, but no distro installed, fails if "../../nimble.sh" is executed directly
|
|
|
|
# in a Makefile recipe but works when prefixing it with `bash`. No idea how the PATH is overridden.
|
2019-11-22 13:21:16 +00:00
|
|
|
DISABLE_TEST_FIXTURES_SCRIPT := 0
|
2019-09-05 08:50:38 +00:00
|
|
|
test: | build deps
|
2019-11-22 13:21:16 +00:00
|
|
|
ifeq ($(DISABLE_TEST_FIXTURES_SCRIPT), 0)
|
2019-11-01 08:44:16 +00:00
|
|
|
V=$(V) scripts/setup_official_tests.sh
|
2019-08-14 21:53:48 +00:00
|
|
|
endif
|
2019-08-21 12:45:24 +00:00
|
|
|
$(ENV_SCRIPT) nim test $(NIM_PARAMS) beacon_chain.nims && rm -f 0000-*.json
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2019-09-05 08:50:38 +00:00
|
|
|
$(TOOLS): | build deps
|
2019-03-28 15:18:59 +00:00
|
|
|
for D in $(TOOLS_DIRS); do [ -e "$${D}/$@.nim" ] && TOOL_DIR="$${D}" && break; done && \
|
2019-03-29 17:21:14 +00:00
|
|
|
echo -e $(BUILD_MSG) "build/$@" && \
|
2020-02-14 12:35:23 +00:00
|
|
|
$(ENV_SCRIPT) nim c -o:build/$@ $(NIM_PARAMS) "$${TOOL_DIR}/$@.nim"
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2020-06-16 19:45:52 +00:00
|
|
|
clean_eth2_network_simulation_data:
|
2020-06-19 17:42:28 +00:00
|
|
|
rm -rf tests/simulation/data
|
2020-06-16 19:45:52 +00:00
|
|
|
|
|
|
|
clean_eth2_network_simulation_all:
|
2019-04-17 15:54:28 +00:00
|
|
|
rm -rf tests/simulation/{data,validators}
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2020-07-09 22:41:51 +00:00
|
|
|
GOERLI_TESTNETS_PARAMS := \
|
|
|
|
--dump \
|
|
|
|
--web3-url=$(GOERLI_WEB3_URL) \
|
|
|
|
--tcp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
|
|
|
|
--udp-port=$$(( $(BASE_PORT) + $(NODE_ID) )) \
|
|
|
|
--metrics \
|
|
|
|
--metrics-port=$$(( $(BASE_METRICS_PORT) + $(NODE_ID) )) \
|
|
|
|
--rpc \
|
|
|
|
--rpc-port=$$(( $(BASE_RPC_PORT) +$(NODE_ID) ))
|
|
|
|
|
2020-06-16 19:45:52 +00:00
|
|
|
eth2_network_simulation: | build deps clean_eth2_network_simulation_data
|
2020-06-16 18:38:51 +00:00
|
|
|
+ GIT_ROOT="$$PWD" NIMFLAGS="$(NIMFLAGS)" LOG_LEVEL="$(LOG_LEVEL)" tests/simulation/start-in-tmux.sh
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2019-03-28 22:19:12 +00:00
|
|
|
clean-testnet0:
|
2020-06-11 16:42:58 +00:00
|
|
|
rm -rf build/data/testnet0*
|
2019-03-28 22:19:12 +00:00
|
|
|
|
|
|
|
clean-testnet1:
|
2020-06-11 16:42:58 +00:00
|
|
|
rm -rf build/data/testnet1*
|
2019-03-28 22:19:12 +00:00
|
|
|
|
2020-04-24 15:28:03 +00:00
|
|
|
# - we're getting the preset from a testnet-specific .env file
|
|
|
|
# - try SCRIPT_PARAMS="--skipGoerliKey"
|
|
|
|
testnet0 testnet1: | build deps
|
|
|
|
source scripts/$@.env; \
|
2020-06-24 11:42:25 +00:00
|
|
|
NIM_PARAMS="$(NIM_PARAMS)" LOG_LEVEL="$(LOG_LEVEL)" $(ENV_SCRIPT) nim $(NIM_PARAMS) scripts/connect_to_testnet.nims $(SCRIPT_PARAMS) --const-preset=$$CONST_PRESET --dev-build $@
|
2020-05-28 04:28:10 +00:00
|
|
|
|
2020-06-19 17:42:28 +00:00
|
|
|
clean-altona:
|
|
|
|
rm -rf build/data/shared_altona*
|
2020-04-27 19:03:03 +00:00
|
|
|
|
2020-07-09 22:41:51 +00:00
|
|
|
altona-deposit: | beacon_node build deps
|
|
|
|
build/beacon_node deposits create --network=altona
|
|
|
|
|
|
|
|
altona: | beacon_node build deps
|
|
|
|
build/beacon_node \
|
|
|
|
--network=altona \
|
|
|
|
--log-level="$(LOG_LEVEL)" \
|
2020-07-10 13:23:11 +00:00
|
|
|
--data-dir=build/data/shared_altona_$(NODE_ID) \
|
2020-07-09 22:41:51 +00:00
|
|
|
$(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS)
|
|
|
|
|
|
|
|
altona-dev: | beacon_node build deps
|
|
|
|
build/beacon_node \
|
|
|
|
--network=altona \
|
|
|
|
--log-level="DEBUG; TRACE:discv5,networking; REQUIRED:none; DISABLED:none" \
|
2020-07-10 13:23:11 +00:00
|
|
|
--data-dir=build/data/shared_altona_$(NODE_ID) \
|
2020-07-09 22:41:51 +00:00
|
|
|
$(GOERLI_TESTNETS_PARAMS) $(NODE_PARAMS)
|
2020-05-28 04:28:10 +00:00
|
|
|
|
2020-06-11 16:41:43 +00:00
|
|
|
ctail: | build deps
|
|
|
|
mkdir -p vendor/.nimble/bin/
|
|
|
|
$(ENV_SCRIPT) nim -d:danger -o:vendor/.nimble/bin/ctail c vendor/nim-chronicles-tail/ctail.nim
|
|
|
|
|
|
|
|
ntu: | build deps
|
|
|
|
mkdir -p vendor/.nimble/bin/
|
|
|
|
$(ENV_SCRIPT) nim -d:danger -o:vendor/.nimble/bin/ntu c vendor/nim-testutils/ntu.nim
|
|
|
|
|
2019-08-21 12:45:24 +00:00
|
|
|
clean: | clean-common
|
2020-06-11 16:42:58 +00:00
|
|
|
rm -rf build/{$(TOOLS_CSV),all_tests,*_node,*ssz*,beacon_node_*,block_sim,state_sim,transition*}
|
2020-02-20 16:41:10 +00:00
|
|
|
ifneq ($(USE_LIBBACKTRACE), 0)
|
2020-02-13 12:19:12 +00:00
|
|
|
+ $(MAKE) -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT)
|
2020-02-20 16:41:10 +00:00
|
|
|
endif
|
2019-11-27 20:43:02 +00:00
|
|
|
|
2020-03-05 17:56:07 +00:00
|
|
|
libnfuzz.so: | build deps
|
2019-11-27 20:43:02 +00:00
|
|
|
echo -e $(BUILD_MSG) "build/$@" && \
|
2020-02-14 12:35:23 +00:00
|
|
|
$(ENV_SCRIPT) nim c -d:release --app:lib --noMain --nimcache:nimcache/libnfuzz -o:build/$@.0 $(NIM_PARAMS) nfuzz/libnfuzz.nim && \
|
2019-11-27 20:43:02 +00:00
|
|
|
rm -f build/$@ && \
|
|
|
|
ln -s $@.0 build/$@
|
|
|
|
|
2020-03-05 17:56:07 +00:00
|
|
|
libnfuzz.a: | build deps
|
2019-11-27 20:43:02 +00:00
|
|
|
echo -e $(BUILD_MSG) "build/$@" && \
|
|
|
|
rm -f build/$@ && \
|
2020-02-14 12:35:23 +00:00
|
|
|
$(ENV_SCRIPT) nim c -d:release --app:staticlib --noMain --nimcache:nimcache/libnfuzz_static -o:build/$@ $(NIM_PARAMS) nfuzz/libnfuzz.nim && \
|
2019-11-27 20:43:02 +00:00
|
|
|
[[ -e "$@" ]] && mv "$@" build/ # workaround for https://github.com/nim-lang/Nim/issues/12745
|
2020-04-18 23:25:21 +00:00
|
|
|
|
2020-05-02 14:30:34 +00:00
|
|
|
book:
|
2020-07-01 08:37:04 +00:00
|
|
|
cd docs/the_nimbus_book && \
|
2020-05-02 14:30:34 +00:00
|
|
|
mdbook build
|
|
|
|
|
|
|
|
publish-book: | book
|
|
|
|
git worktree add tmp-book gh-pages && \
|
|
|
|
rm -rf tmp-book/* && \
|
2020-07-01 08:37:04 +00:00
|
|
|
cp -a docs/the_nimbus_book/book/* tmp-book/ && \
|
2020-05-02 14:30:34 +00:00
|
|
|
cd tmp-book && \
|
2020-05-02 14:46:24 +00:00
|
|
|
git add . && { \
|
|
|
|
git commit -m "make publish-book" && \
|
|
|
|
git push origin gh-pages || true; } && \
|
|
|
|
cd .. && \
|
2020-05-02 14:30:34 +00:00
|
|
|
git worktree remove -f tmp-book && \
|
|
|
|
rm -rf tmp-book
|
|
|
|
|
2020-07-07 08:44:21 +00:00
|
|
|
auditors-book:
|
|
|
|
cd docs/the_auditors_handbook && \
|
|
|
|
mdbook build
|
|
|
|
|
|
|
|
publish-auditors-book: | auditors-book
|
|
|
|
git worktree add tmp-book gh-pages && \
|
|
|
|
mkdir -p tmp-book/auditors-book && \
|
|
|
|
rm -rf tmp-book/auditors-book/* && \
|
|
|
|
cp -a docs/the_auditors_handbook/book/* tmp-book/auditors-book/ && \
|
|
|
|
cd tmp-book && \
|
|
|
|
git add . && { \
|
|
|
|
git commit -m "make publish-auditors-book" && \
|
|
|
|
git push origin gh-pages || true; } && \
|
|
|
|
cd .. && \
|
|
|
|
git worktree remove -f tmp-book && \
|
|
|
|
rm -rf tmp-book
|
|
|
|
|
2020-04-18 23:25:21 +00:00
|
|
|
endif # "variables.mk" was not included
|