[Buildroot] [PATCH v2] Makefile: Add target-clean target

Angelo Compagnucci angelo.compagnucci at gmail.com
Wed Jul 30 09:20:57 UTC 2014


This makefile target wipes the target folder and forces buildroot into rebuild it.
It's useful when you have changed the list of packages and the target
tree remains out of sync keeping old installed packages no longer needed.

Signed-off-by: Angelo Compagnucci <angelo.compagnucci at gmail.com>
---

* Print a big fat warning at the end of target-clean execution

 Makefile | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/Makefile b/Makefile
index 022beea..b6467e0 100644
--- a/Makefile
+++ b/Makefile
@@ -829,6 +829,25 @@ clean:
 		$(BUILD_DIR) $(BASE_DIR)/staging \
 		$(LEGAL_INFO_DIR)
 
+target-clean:
+	rm -rf $(TARGET_DIR)
+	find $(BUILD_DIR) -name ".stamp_target_installed" -exec rm {} \;
+	rm -rf $(BUILD_DIR)/.root
+	@echo ''
+	@echo "***********************************************************"
+	@echo "*                    !!! WARNING !!!                      *"
+	@echo "*                                                         *"
+	@echo "*  Cleaning and rebuilding your rootfs won't rebuild      *"
+	@echo "*  your packages.                                         *"
+	@echo "*  If you changed something on packages configurations    *"
+	@echo "*  or their dependencies, you'll have to rebuilt them     *"
+	@echo "*  manually with:                                         *"
+	@echo "*   \"make <package>-reconfigure\"                          *"
+	@echo "*  If something goes wrong, do a full rebuild with:       *"
+	@echo "*   \"make clean\".                                         *"
+	@echo "*                                                         *"
+	@echo "***********************************************************"
+
 distclean: clean
 ifeq ($(DL_DIR),$(TOPDIR)/dl)
 	rm -rf $(DL_DIR)
@@ -842,6 +861,7 @@ help:
 	@echo 'Cleaning:'
 	@echo '  clean                  - delete all files created by build'
 	@echo '  distclean              - delete all non-source files (including .config)'
+	@echo '  target-clean           - delete all target files and forces reinstall'
 	@echo
 	@echo 'Build:'
 	@echo '  all                    - make world'
-- 
2.0.3




More information about the buildroot mailing list