Prepare all-core.sh and all-helpers.sh for the deprecation of Make

The deprecation of Make will involve moving
and renaming the root Makefile as "scripts/legacy.make".
See https://github.com/Mbed-TLS/mbedtls/issues/10316.

If "scripts/legacy.make" exists, we use it and
call `make -f scripts/legacy.make` instead of
just `make` to build with Make in all.sh.

In 3.6, there will be no "scripts/legacy.make" and
the root Makefile will remain. The scripts must
continue to work in that case.

Signed-off-by: Ronald Cron <[email protected]>
This commit is contained in:
Ronald Cron
2025-09-10 16:36:09 +02:00
parent bac469cacb
commit 8408841ceb
2 changed files with 18 additions and 9 deletions
+15 -6
View File
@@ -188,7 +188,10 @@ pre_initialize_variables () {
files_to_back_up="$config_files"
if in_mbedtls_repo; then
# Files clobbered by in-tree cmake
files_to_back_up="$files_to_back_up Makefile library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile"
if [ -e Makefile ]; then
files_to_back_up="$files_to_back_up Makefile"
fi
files_to_back_up="$files_to_back_up library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile"
fi
append_outcome=0
@@ -228,6 +231,12 @@ pre_initialize_variables () {
: ${CLANG_EARLIEST:="clang-earliest"}
: ${GCC_LATEST:="gcc-latest"}
: ${GCC_EARLIEST:="gcc-earliest"}
: ${MAKE_COMMAND:="make"}
if [ -e "scripts/legacy.make" ]; then
MAKE_COMMAND="${MAKE_COMMAND} -f ./scripts/legacy.make"
fi
# if MAKEFLAGS is not set add the -j option to speed up invocations of make
if [ -z "${MAKEFLAGS+set}" ]; then
export MAKEFLAGS="-j$(all_sh_nproc)"
@@ -366,7 +375,7 @@ EOF
cleanup()
{
if in_mbedtls_repo; then
command make clean
command $MAKE_COMMAND clean
fi
# Remove CMake artefacts
@@ -877,11 +886,11 @@ pre_check_tools () {
pre_generate_files() {
# since make doesn't have proper dependencies, remove any possibly outdate
# file that might be around before generating fresh ones
make neat
$MAKE_COMMAND neat
if [ $QUIET -eq 1 ]; then
make generated_files >/dev/null
$MAKE_COMMAND generated_files >/dev/null
else
make generated_files
$MAKE_COMMAND generated_files
fi
}
@@ -920,7 +929,7 @@ pseudo_component_error_test () {
# Expected error: '! grep -q . tests/scripts/all.sh -> 1'
not grep -q . "$0"
# Expected error: 'make unknown_target -> 2'
make unknown_target
$MAKE_COMMAND unknown_target
false "this should not be executed"
}