Skip to content

Commit 820a16c

Browse files
authored
Merge pull request #203 from ronald-cron-arm/deprecate-make
Preparation for the deprecation of Make
2 parents 460af03 + b5a1095 commit 820a16c

File tree

5 files changed

+59
-34
lines changed

5 files changed

+59
-34
lines changed

scripts/all-core.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ pre_initialize_variables () {
188188
files_to_back_up="$config_files"
189189
if in_mbedtls_repo; then
190190
# Files clobbered by in-tree cmake
191-
files_to_back_up="$files_to_back_up Makefile library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile"
191+
if [ -e Makefile ]; then
192+
files_to_back_up="$files_to_back_up Makefile"
193+
fi
194+
files_to_back_up="$files_to_back_up library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile"
192195
fi
193196

194197
append_outcome=0
@@ -228,6 +231,12 @@ pre_initialize_variables () {
228231
: ${CLANG_EARLIEST:="clang-earliest"}
229232
: ${GCC_LATEST:="gcc-latest"}
230233
: ${GCC_EARLIEST:="gcc-earliest"}
234+
: ${MAKE_COMMAND:="make"}
235+
236+
if [ -e "scripts/legacy.make" ]; then
237+
MAKE_COMMAND="${MAKE_COMMAND} -f ./scripts/legacy.make"
238+
fi
239+
231240
# if MAKEFLAGS is not set add the -j option to speed up invocations of make
232241
if [ -z "${MAKEFLAGS+set}" ]; then
233242
export MAKEFLAGS="-j$(all_sh_nproc)"
@@ -366,7 +375,7 @@ EOF
366375
cleanup()
367376
{
368377
if in_mbedtls_repo; then
369-
command make clean
378+
command $MAKE_COMMAND clean
370379
fi
371380
372381
# Remove CMake artefacts
@@ -877,11 +886,11 @@ pre_check_tools () {
877886
pre_generate_files() {
878887
# since make doesn't have proper dependencies, remove any possibly outdate
879888
# file that might be around before generating fresh ones
880-
make neat
889+
$MAKE_COMMAND neat
881890
if [ $QUIET -eq 1 ]; then
882-
make generated_files >/dev/null
891+
$MAKE_COMMAND generated_files >/dev/null
883892
else
884-
make generated_files
893+
$MAKE_COMMAND generated_files
885894
fi
886895
}
887896
@@ -920,7 +929,7 @@ pseudo_component_error_test () {
920929
# Expected error: '! grep -q . tests/scripts/all.sh -> 1'
921930
not grep -q . "$0"
922931
# Expected error: 'make unknown_target -> 2'
923-
make unknown_target
932+
$MAKE_COMMAND unknown_target
924933
false "this should not be executed"
925934
}
926935

scripts/all-helpers.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ helper_libtestdriver1_make_main() {
122122
# we need flags both with and without the LIBTESTDRIVER1_ prefix
123123
loc_accel_flags=$( echo "$loc_accel_list" | sed 's/[^ ]* */-DLIBTESTDRIVER1_MBEDTLS_PSA_ACCEL_&/g' )
124124
loc_accel_flags="$loc_accel_flags $( echo "$loc_accel_list" | sed 's/[^ ]* */-DMBEDTLS_PSA_ACCEL_&/g' )"
125-
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" "$@"
125+
$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" "$@"
126126
}
127127

128128
################################################################
@@ -265,9 +265,9 @@ helper_armc6_build_test()
265265

266266
msg "build: ARM Compiler 6 ($FLAGS)"
267267

268-
make clean
268+
$MAKE_COMMAND clean
269269
ARM_TOOL_VARIANT="ult" CC="$ARMC6_CC" AR="$ARMC6_AR" CFLAGS="$FLAGS" \
270-
WARNING_CFLAGS='-Werror -xc -std=c99' make lib
270+
WARNING_CFLAGS='-Werror -xc -std=c99' $MAKE_COMMAND lib
271271

272272
msg "size: ARM Compiler 6 ($FLAGS)"
273273
"$ARMC6_FROMELF" -z library/*.o

scripts/apidoc_full.sh

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ if in_mbedtls_repo; then
2222
if ! in_3_6_branch; then
2323
CRYPTO_CONFIG_H='tf-psa-crypto/include/psa/crypto_config.h'
2424
fi
25+
CONFIG_BAK=${CONFIG_H}.bak
26+
cp -p $CONFIG_H $CONFIG_BAK
2527
fi
2628

2729
if in_tf_psa_crypto_repo; then
@@ -37,21 +39,29 @@ if in_tf_psa_crypto_repo || (in_mbedtls_repo && ! in_3_6_branch); then
3739
cp -p $CRYPTO_CONFIG_H $CRYPTO_CONFIG_BAK
3840
fi
3941

40-
if in_mbedtls_repo; then
41-
CONFIG_BAK=${CONFIG_H}.bak
42-
cp -p $CONFIG_H $CONFIG_BAK
42+
if in_mbedtls_repo && in_3_6_branch; then
4343
scripts/config.py realfull
4444
make apidoc
45-
mv $CONFIG_BAK $CONFIG_H
46-
elif in_tf_psa_crypto_repo; then
45+
else
4746
scripts/config.py realfull
48-
TF_PSA_CRYPTO_ROOT_DIR=$PWD
47+
ROOT_DIR=$PWD
4948
rm -rf doxygen/build-apidoc-full
5049
mkdir doxygen/build-apidoc-full
5150
cd doxygen/build-apidoc-full
52-
cmake -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON $TF_PSA_CRYPTO_ROOT_DIR
53-
make tfpsacrypto-apidoc
54-
cd $TF_PSA_CRYPTO_ROOT_DIR
51+
cmake -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON $ROOT_DIR
52+
if in_mbedtls_repo; then
53+
cmake --build . --target mbedtls-apidoc
54+
else
55+
cmake --build . --target tfpsacrypto-apidoc
56+
fi
57+
cd $ROOT_DIR
58+
# The documentation is built in the source tree thus we can delete the
59+
# build tree.
60+
rm -rf doxygen/build-apidoc-full
61+
fi
62+
63+
if in_mbedtls_repo; then
64+
mv $CONFIG_BAK $CONFIG_H
5565
fi
5666

5767
if in_tf_psa_crypto_repo || (in_mbedtls_repo && ! in_3_6_branch); then

scripts/check_names.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ def parse_symbols(self):
810810
check=True
811811
)
812812
subprocess.run(
813-
["make"],
813+
["cmake", "--build", "."],
814814
env=my_environment,
815815
universal_newlines=True,
816816
stdout=subprocess.PIPE,
@@ -971,15 +971,17 @@ def parse_symbols(self):
971971
)
972972
my_environment = os.environ.copy()
973973
my_environment["CFLAGS"] = "-fno-asynchronous-unwind-tables"
974-
# Run make clean separately to lib to prevent unwanted behavior when
975-
# make is invoked with parallelism.
974+
975+
source_dir = os.getcwd()
976+
build_dir = tempfile.mkdtemp()
977+
os.chdir(build_dir)
976978
subprocess.run(
977-
["make", "clean"],
979+
["cmake", "-DGEN_FILES=ON", source_dir],
978980
universal_newlines=True,
979981
check=True
980982
)
981983
subprocess.run(
982-
["make", "lib"],
984+
["cmake", "--build", "."],
983985
env=my_environment,
984986
universal_newlines=True,
985987
stdout=subprocess.PIPE,
@@ -988,17 +990,21 @@ def parse_symbols(self):
988990
)
989991

990992
# Perform object file analysis using nm
991-
symbols = self.parse_symbols_from_nm([
992-
"library/libmbedcrypto.a",
993-
"library/libmbedtls.a",
994-
"library/libmbedx509.a"
995-
])
993+
if build_tree.is_mbedtls_3_6():
994+
symbols = self.parse_symbols_from_nm([
995+
"library/libmbedcrypto.a",
996+
"library/libmbedtls.a",
997+
"library/libmbedx509.a"
998+
])
999+
else:
1000+
symbols = self.parse_symbols_from_nm([
1001+
"library/libtfpsacrypto.a",
1002+
"library/libmbedtls.a",
1003+
"library/libmbedx509.a"
1004+
])
9961005

997-
subprocess.run(
998-
["make", "clean"],
999-
universal_newlines=True,
1000-
check=True
1001-
)
1006+
os.chdir(source_dir)
1007+
shutil.rmtree(build_dir)
10021008
except subprocess.CalledProcessError as error:
10031009
self.log.debug(error.output)
10041010
raise error

scripts/doxygen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if grep -E "(warning|error):" doc.filtered; then
3030
exit 1;
3131
fi
3232

33-
if in_mbedtls_repo; then
33+
if in_mbedtls_repo && in_3_6_branch; then
3434
make apidoc_clean
3535
fi
3636

0 commit comments

Comments
 (0)