2019-03-28 15:18:59 +00:00
|
|
|
# Copyright (c) 2019 Status Research & Development GmbH. Licensed under
|
|
|
|
# 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-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
|
|
|
|
2019-08-21 12:45:24 +00:00
|
|
|
# we don't want an error here, so we can handle things later, in the build-system-checks target
|
|
|
|
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
2019-03-28 15:18:59 +00:00
|
|
|
|
|
|
|
TOOLS := beacon_node validator_keygen bench_bls_sig_agggregation state_sim
|
|
|
|
TOOLS_DIRS := beacon_chain benchmarks research
|
2019-04-12 22:15:38 +00:00
|
|
|
TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2019-08-21 12:45:24 +00:00
|
|
|
.PHONY: all build-system-checks deps update go-checks p2pd test $(TOOLS) clean_eth2_network_simulation_files eth2_network_simulation clean-testnet0 testnet0 clean-testnet1 testnet1 clean
|
|
|
|
|
|
|
|
all: | build-system-checks $(TOOLS)
|
|
|
|
|
|
|
|
# must be included after the default target
|
|
|
|
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
|
|
|
|
|
|
|
GIT_SUBMODULE_UPDATE := export GIT_LFS_SKIP_SMUDGE=1; git submodule update --init --recursive
|
|
|
|
build-system-checks:
|
|
|
|
@[[ -e "$(BUILD_SYSTEM_DIR)/makefiles" ]] || { \
|
|
|
|
echo -e "'$(BUILD_SYSTEM_DIR)/makefiles' not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \
|
|
|
|
$(GIT_SUBMODULE_UPDATE); \
|
|
|
|
echo -e "\nYou can now run '$(MAKE)' again."; \
|
|
|
|
exit 1; \
|
|
|
|
}
|
|
|
|
|
|
|
|
deps: | deps-common beacon_chain.nims
|
|
|
|
|
|
|
|
#- deletes and recreates "beacon_chain.nims" which on Windows is a copy instead of a proper symlink
|
|
|
|
update: | update-common
|
|
|
|
rm -rf beacon_chain.nims && \
|
|
|
|
$(MAKE) beacon_chain.nims
|
|
|
|
|
|
|
|
# symlink
|
|
|
|
beacon_chain.nims:
|
|
|
|
ln -s beacon_chain.nimble $@
|
|
|
|
|
|
|
|
MIN_GO_VER := 1.12
|
|
|
|
DISABLE_GO_CHECKS := 0
|
|
|
|
go-checks:
|
|
|
|
ifeq ($(DISABLE_GO_CHECKS), 0)
|
|
|
|
which go &>/dev/null || { echo "Go compiler not installed. Aborting."; exit 1; }
|
|
|
|
GO_VER="$$(go version | sed -E 's/^.*go([0-9.]+).*$$/\1/')"; \
|
|
|
|
[[ $$(echo -e "$${GO_VER}\n$(MIN_GO_VER)" | sort -t '.' -k 1,1 -k 2,2 -g | head -n 1) == "$(MIN_GO_VER)" ]] || \
|
|
|
|
{ echo "Minimum Go compiler version required: $(MIN_GO_VER). Version available: $$GO_VER. Aborting."; exit 1; }
|
|
|
|
endif
|
2019-04-18 00:02:14 +00:00
|
|
|
|
2019-08-21 12:45:24 +00:00
|
|
|
P2PD_CACHE :=
|
|
|
|
p2pd: | go-checks
|
|
|
|
BUILD_MSG="$(BUILD_MSG) $@" \
|
|
|
|
V=$(V) \
|
2019-08-25 13:44:45 +00:00
|
|
|
$(ENV_SCRIPT) $(BUILD_SYSTEM_DIR)/scripts/build_p2pd.sh "$(P2PD_CACHE)"
|
2019-07-11 02:36:07 +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-08-21 12:45:24 +00:00
|
|
|
DISABLE_LFS_SCRIPT := 0
|
|
|
|
test: | build deps nat-libs p2pd
|
2019-08-14 21:53:48 +00:00
|
|
|
ifeq ($(DISABLE_LFS_SCRIPT), 0)
|
2019-08-24 01:54:04 +00:00
|
|
|
V=$(V) scripts/process_lfs.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-07-23 15:28:04 +00:00
|
|
|
$(TOOLS): | build deps nat-libs p2pd
|
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/$@" && \
|
|
|
|
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -o:build/$@ "$${TOOL_DIR}/$@.nim"
|
2019-03-28 15:18:59 +00:00
|
|
|
|
|
|
|
clean_eth2_network_simulation_files:
|
2019-04-17 15:54:28 +00:00
|
|
|
rm -rf tests/simulation/{data,validators}
|
2019-03-28 15:18:59 +00:00
|
|
|
|
|
|
|
eth2_network_simulation: | beacon_node validator_keygen clean_eth2_network_simulation_files
|
2019-08-21 12:45:24 +00:00
|
|
|
SKIP_BUILDS=1 GIT_ROOT="$$PWD" BUILD_OUTPUTS_DIR="./build" $(ENV_SCRIPT) tests/simulation/start.sh
|
2019-03-28 15:18:59 +00:00
|
|
|
|
2019-07-11 02:36:07 +00:00
|
|
|
testnet0 testnet1: | build deps nat-libs p2pd
|
2019-08-21 12:45:24 +00:00
|
|
|
NIM_PARAMS="$(NIM_PARAMS)" $(ENV_SCRIPT) scripts/build_testnet_node.sh $@
|
2019-04-18 00:02:14 +00:00
|
|
|
|
2019-03-28 22:19:12 +00:00
|
|
|
clean-testnet0:
|
|
|
|
rm -rf ~/.cache/nimbus/BeaconNode/testnet0
|
|
|
|
|
|
|
|
clean-testnet1:
|
|
|
|
rm -rf ~/.cache/nimbus/BeaconNode/testnet1
|
|
|
|
|
2019-08-21 12:45:24 +00:00
|
|
|
clean: | clean-common
|
|
|
|
rm -rf build/{$(TOOLS_CSV),all_tests,*_node}
|
2019-03-28 15:18:59 +00:00
|
|
|
|