From 618307046a03056dfbaf1ecdb2816f8b8dbe01dc Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 31 Jul 2025 14:15:27 +0200 Subject: [PATCH] Also test `make clean` in library Don't test `make clean` at the toplevel, that would be too much work (we'd need to support `$(RM)` in all makefiles, and arrange for `find` as well for `clean_more_on_top`). Signed-off-by: Gilles Peskine --- library/Makefile | 8 +++++--- tests/scripts/components-build-system.sh | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/library/Makefile b/library/Makefile index a2d35fea7a..6692a81f61 100644 --- a/library/Makefile +++ b/library/Makefile @@ -389,10 +389,12 @@ $(GENERATED_WRAPPER_FILES): psa_crypto.o:psa_crypto_driver_wrappers.h +RM ?= rm + clean: ifndef WINDOWS - rm -f *.o *.s libmbed* - rm -f $(THIRDPARTY_CRYPTO_OBJECTS) $(THIRDPARTY_CRYPTO_OBJECTS:.o=.s) + $(RM) -f *.o *.s libmbed* + $(RM) -f $(THIRDPARTY_CRYPTO_OBJECTS) $(THIRDPARTY_CRYPTO_OBJECTS:.o=.s) else if exist *.o del /Q /F *.o if exist *.s del /Q /F *.s @@ -402,7 +404,7 @@ endif neat: clean ifndef WINDOWS - rm -f $(GENERATED_FILES) + $(RM) -f $(GENERATED_FILES) else for %f in ($(subst /,\,$(GENERATED_FILES))) if exist %f del /Q /F %f endif diff --git a/tests/scripts/components-build-system.sh b/tests/scripts/components-build-system.sh index fb24872ecc..0ba5aafd8c 100644 --- a/tests/scripts/components-build-system.sh +++ b/tests/scripts/components-build-system.sh @@ -50,6 +50,8 @@ component_build_make_no_gen_files () { # GCC needs "as" in $PATH by default. To use GCC, we need to tell it where # to find the assembler. Or we can use clang which just works. CC="$(command -v clang)" + # For cleaning. + RM="$(command -v rm)" # Test the build with make. # Preferably we should also test with CMake. Note that a CMake test