diff --git a/Makefile b/Makefile index ad597100b..3a9a7ac9d 100644 --- a/Makefile +++ b/Makefile @@ -156,117 +156,105 @@ TEST_BINARIES := \ test_fixture_const_sanity_check_minimal: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "tests/official/test_fixture_const_sanity_check.nim" \ - $(NIM_PARAMS) -d:const_preset=minimal -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:const_preset=minimal -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" test_fixture_const_sanity_check_mainnet: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "tests/official/test_fixture_const_sanity_check.nim" \ - $(NIM_PARAMS) -d:const_preset=mainnet -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:const_preset=mainnet -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" # Generic SSZ test, doesn't use consensus objects minimal/mainnet presets test_fixture_ssz_generic_types: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "tests/official/$@.nim" \ - $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" # Consensus object SSZ tests test_fixture_ssz_consensus_objects: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "tests/official/$@.nim" \ - $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" # EF tests all_fixtures_require_ssz: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "tests/official/$@.nim" \ - $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" # EIP-3076 - Slashing interchange test_official_interchange_vectors: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "tests/slashing_protection/$@.nim" \ - $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" # Mainnet config proto_array: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "beacon_chain/fork_choice/$@.nim" \ - $(NIM_PARAMS) -d:const_preset=mainnet -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:const_preset=mainnet -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" fork_choice: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "beacon_chain/fork_choice/$@.nim" \ - $(NIM_PARAMS) -d:const_preset=mainnet -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:const_preset=mainnet -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" all_tests: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "tests/$@.nim" \ - $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" # TODO `test_keystore` is extracted from the rest of the tests because it uses conflicting BLST headers test_keystore: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "tests/$@.nim" \ - $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]" \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:chronicles_log_level=TRACE -d:const_preset=mainnet -d:chronicles_sinks="json[file]" && \ echo -e $(BUILD_END_MSG) "build/$@" # State and block sims; getting to 4th epoch triggers consensus checks state_sim: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "research/$@.nim" \ - $(NIM_PARAMS) -d:const_preset=mainnet \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:const_preset=mainnet && \ echo -e $(BUILD_END_MSG) "build/$@" block_sim: | build deps + echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ $@ \ "research/$@.nim" \ - $(NIM_PARAMS) -d:const_preset=mainnet \ - $(HANDLE_OUTPUT) && \ + $(NIM_PARAMS) -d:const_preset=mainnet && \ echo -e $(BUILD_END_MSG) "build/$@" DISABLE_TEST_FIXTURES_SCRIPT := 0 @@ -302,7 +290,7 @@ build/generate_makefile: tools/generate_makefile.nim | deps-common $(TOOLS): | build deps + for D in $(TOOLS_DIRS); do [ -e "$${D}/$@.nim" ] && TOOL_DIR="$${D}" && break; done && \ echo -e $(BUILD_MSG) "build/$@" && \ - MAKE="$(MAKE)" $(ENV_SCRIPT) scripts/compile_nim_program.sh $@ "$${TOOL_DIR}/$@.nim" $(NIM_PARAMS) $(HANDLE_OUTPUT) && \ + MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh $@ "$${TOOL_DIR}/$@.nim" $(NIM_PARAMS) && \ echo -e $(BUILD_END_MSG) "build/$@" clean_eth2_network_simulation_data: diff --git a/scripts/compile_nim_program.sh b/scripts/compile_nim_program.sh index b9ffbbe9f..fbdfd9127 100755 --- a/scripts/compile_nim_program.sh +++ b/scripts/compile_nim_program.sh @@ -6,8 +6,12 @@ cd "$(dirname "${BASH_SOURCE[0]}")"/.. BINARY="$1" SOURCE="$2" +# the rest are NIM_PARAMS shift 2 +# verbosity level +[[ -z "$V" ]] && V=0 + # According to the Nim compiler, the project name comes from the main source # file, not the output binary. PROJECT_NAME="$(basename ${SOURCE%.nim})" @@ -19,5 +23,6 @@ PROJECT_NAME="$(basename ${SOURCE%.nim})" # LTO on macOS, in "config.nims" nim c --compileOnly -o:build/${BINARY} "$@" -d:nimCachePathOverride=nimcache/release/${BINARY} "${SOURCE}" build/generate_makefile "nimcache/release/${BINARY}/${PROJECT_NAME}.json" "nimcache/release/${BINARY}/${BINARY}.makefile" +[[ "$V" == "0" ]] && exec &>/dev/null "${MAKE}" -f "nimcache/release/${BINARY}/${BINARY}.makefile" --no-print-directory build