Makefile: clean and distclean updates

- update clean to recurse all build directories and use build system clean
 - git clean is used to remove submodule generated build artifacts that
are left in the source tree
 - distclean now discards all build directories and any gitignored
filess that were generated in source directories (but not top level)
This commit is contained in:
Daniel Agar 2021-05-06 09:58:11 -04:00 committed by Lorenz Meier
parent f15eefcc95
commit dfb4ec56b1
1 changed files with 8 additions and 7 deletions

View File

@ -468,26 +468,27 @@ validate_module_configs:
.PHONY: clean submodulesclean submodulesupdate gazeboclean distclean
clean:
@rm -rf "$(SRC_DIR)"/build
@git submodule foreach git clean -df
@find "$(SRC_DIR)/build" -mindepth 1 -maxdepth 1 -type d -exec sh -c "echo {}; cmake --build {} -- clean || rm -rf {}" \; # use generated build system to clean, wipe build directory if it fails
@git submodule foreach git clean -dX --force # some submodules generate build artifacts in source
submodulesclean:
@git submodule foreach --quiet --recursive git clean -ff -x -d
@git submodule update --quiet --init --recursive --force || true
@git submodule sync --recursive
@git submodule update --init --recursive --force
@git submodule update --init --recursive --force --jobs 4
submodulesupdate:
@git submodule update --quiet --init --recursive || true
@git submodule update --quiet --init --recursive --jobs 4 || true
@git submodule sync --recursive
@git submodule update --init --recursive
@git submodule update --init --recursive --jobs 4
gazeboclean:
@rm -rf ~/.gazebo/*
distclean: gazeboclean
@git submodule deinit -f .
@git clean -ff -x -d -e ".cproject" -e ".idea" -e ".project" -e ".settings" -e ".vscode"
@git submodule deinit --force $(SRC_DIR)
@rm -rf "$(SRC_DIR)/build"
@git clean --force -X "$(SRC_DIR)/msg/" "$(SRC_DIR)/platforms/" "$(SRC_DIR)/posix-configs/" "$(SRC_DIR)/ROMFS/" "$(SRC_DIR)/src/" "$(SRC_DIR)/test/" "$(SRC_DIR)/Tools/"
# Help / Error
# --------------------------------------------------------------------