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 <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron
2025-08-22 14:51:56 +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"
}
+3 -3
View File
@@ -122,7 +122,7 @@ helper_libtestdriver1_make_main() {
# we need flags both with and without the LIBTESTDRIVER1_ prefix
loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' )
loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )"
make CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -I../tests/include -I../framework/tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS" "$@"
$MAKE_COMMAND CC=$ASAN_CC CFLAGS="$ASAN_CFLAGS -I../tests/include -I../framework/tests/include -I../tests -I../../tests -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_TEST_LIBTESTDRIVER1 $loc_accel_flags" LDFLAGS="-ltestdriver1 $ASAN_CFLAGS" "$@"
}
################################################################
@@ -263,9 +263,9 @@ helper_armc6_build_test()
msg "build: ARM Compiler 6 ($FLAGS)"
make clean
$MAKE_COMMAND clean
ARM_TOOL_VARIANT="ult" CC="$ARMC6_CC" AR="$ARMC6_AR" CFLAGS="$FLAGS" \
WARNING_CFLAGS='-Werror -xc -std=c99' make lib
WARNING_CFLAGS='-Werror -xc -std=c99' $MAKE_COMMAND lib
msg "size: ARM Compiler 6 ($FLAGS)"
"$ARMC6_FROMELF" -z library/*.o