mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-06-06 05:25:18 +00:00
Only clean CMake artifacts in-tree
Don't recurse into every subdirectory: that also removed files from out-of-tree builds that the user may have placed into subdirectories. With make as the build tool, the cleanup is mostly recoverable, but with ninja as the build tool, you have to manually run `cmake` again after running `all.sh`. Instead, look for things to clean only in directories managed by git. This also has the benefit of not touching `**/Makefile` if there hasn't been an in-tree CMake build. Fixes https://github.com/Mbed-TLS/mbedtls-framework/issues/252 Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
+18
-19
@@ -378,25 +378,24 @@ cleanup()
|
||||
command $MAKE_COMMAND clean
|
||||
fi
|
||||
|
||||
# Remove CMake artefacts
|
||||
find . -name .git -prune -o \
|
||||
-iname CMakeFiles -exec rm -rf {} \+ -o \
|
||||
\( -iname cmake_install.cmake -o \
|
||||
-iname CTestTestfile.cmake -o \
|
||||
-iname CMakeCache.txt -o \
|
||||
-path './cmake/*.cmake' \) -exec rm -f {} \+
|
||||
# Remove Makefiles generated by in-tree CMake builds
|
||||
# (Not all files will exist in all branches, but that's OK.)
|
||||
rm -f 3rdparty/Makefile 3rdparty/*/Makefile
|
||||
rm -f pkgconfig/Makefile framework/Makefile
|
||||
rm -f include/Makefile programs/!(fuzz)/Makefile
|
||||
rm -f tf-psa-crypto/Makefile tf-psa-crypto/include/Makefile
|
||||
rm -f tf-psa-crypto/core/Makefile tf-psa-crypto/drivers/Makefile
|
||||
rm -f tf-psa-crypto/tests/Makefile
|
||||
rm -f tf-psa-crypto/drivers/everest/Makefile
|
||||
rm -f tf-psa-crypto/drivers/p256-m/Makefile
|
||||
rm -f tf-psa-crypto/drivers/builtin/Makefile
|
||||
rm -f tf-psa-crypto/drivers/builtin/src/Makefile
|
||||
# Remove files left over by an in-tree CMake build.
|
||||
# Take care to only hit in-tree builds, not out-of-tree builds in
|
||||
# subdirectories.
|
||||
# Remove **/Makefile only if it looks like it was created by an in-tree
|
||||
# CMake build.
|
||||
local cmake_dirs=($(git ls-files --recurse-submodules \
|
||||
'CMakeLists.txt' '**/CMakeLists.txt' |
|
||||
sed -e 's![^/]*$!!'))
|
||||
for d in "${cmake_dirs[@]}"; do
|
||||
if [ -d "$d/CMakeFiles" ]; then
|
||||
rm -rf "$d/CMakeFiles" \
|
||||
"$d/cmake_install.cmake" \
|
||||
"$d/CTestTestfile.cmake" \
|
||||
"$d/CMakeCache.txt" \
|
||||
"$d/Makefile"
|
||||
rm -rf "$d/cmake"/*.cmake
|
||||
fi
|
||||
done
|
||||
|
||||
# Remove any artifacts from the component_test_cmake_as_subdirectory test.
|
||||
rm -rf programs/test/cmake_subproject/build
|
||||
|
||||
Reference in New Issue
Block a user