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.
# we don't want an error here, so we can explain things later, in the sanity-checks target
- i n c l u d e . . / . . / c o m m o n . m k
ENV_SCRIPT := "../../env.sh"
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-04-18 00:02:14 +00:00
.PHONY : all sanity -checks deps nat -libs test $( TOOLS ) clean_eth 2_network_simulation_files eth 2_network_simulation clean -testnet 0 testnet 0-nocleaning testnet 0 clean -testnet 1 testnet 1-nocleaning testnet 1 clean
2019-03-28 15:18:59 +00:00
all : | $( TOOLS )
2019-03-29 17:21:14 +00:00
$(SILENT_TARGET_PREFIX).SILENT :
2019-03-28 15:18:59 +00:00
sanity-checks :
@ [ [ " $$ PWD " = ~ /vendor/nim-beacon-chain$ && -e ../../Makefile && -e ../../common.mk ] ] || \
2019-03-29 17:21:14 +00:00
{ echo -e "This Makefile can only be used from the corresponding Git submodule in the Nimbus repository.\nDetailed instructions available in README.md or online at https://github.com/status-im/nim-beacon-chain/#building-and-testing" ; exit 1; }
2019-04-19 20:11:24 +00:00
@+ $( MAKE) --silent -C ../../ sanity-checks
2019-03-28 15:18:59 +00:00
deps : | sanity -checks
2019-03-29 17:21:14 +00:00
@+ $( MAKE) --silent -C ../../ deps
2019-03-28 15:18:59 +00:00
build :
mkdir $@
2019-04-18 00:02:14 +00:00
nat-libs : | deps
+ $( MAKE) --silent -C ../../ nat-libs
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-04-18 00:02:14 +00:00
test : | build deps nat -libs
2019-04-11 14:01:28 +00:00
bash ../../nimble.sh test $( NIM_PARAMS)
2019-03-28 15:18:59 +00:00
2019-04-18 00:02:14 +00:00
$(TOOLS) : | build deps nat -libs
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_eth 2_network_simulation_files
SKIP_BUILDS = 1 GIT_ROOT = " $$ PWD " BUILD_OUTPUTS_DIR = "./build" tests/simulation/start.sh
2019-04-18 00:02:14 +00:00
testnet0 testnet1 : | build deps nat -libs
../../env.sh scripts/build_testnet_node.sh $@
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-03-28 15:18:59 +00:00
clean :
2019-04-12 22:15:38 +00:00
rm -rf build/{ $( TOOLS_CSV) ,all_tests,*_node,*.exe} nimcache
2019-03-28 15:18:59 +00:00