build/Makefile.subsystem
changeset 26 dc7c549001d5
parent 21 2a9601315dfc
child 35 85266cc22c7f
child 46 4376525cdefb
--- a/build/Makefile.subsystem	Fri May 14 15:47:24 2010 +0300
+++ b/build/Makefile.subsystem	Thu May 27 12:49:31 2010 +0300
@@ -100,6 +100,26 @@
 	$(call RMFILES,$(COMPONENT_NAME).pro)
 
 
+# If REMOVE_NOTBUILT_EXCLUDING is defined, the remove_notbuilt removes all subdirectories
+# not participating in the built, except the ones listed
+DEFAULT_EXCLUDES = inc tsrc
+DIRECTORIES = $(foreach d,$(wildcard *),$(if $(wildcard $(d)/*),$(d),))
+BUILTDIRECTORIES = $(foreach t,$(REALTARGETS),$(firstword $(subst /, ,$(t))))
+REMOVEDIRECORIES = $(filter-out $(REMOVE_NOTBUILT_EXCLUDING) $(DEFAULT_EXCLUDES) $(BUILTDIRECTORIES),$(DIRECTORIES))
+remove_notbuilt:
+ifdef REMOVE_NOTBUILT_EXCLUDING
+ifdef SIMULATE
+	echo Remove not-built directories at $(CURDIR): $(REMOVEDIRECORIES)
+else
+ifneq ($(REMOVEDIRECORIES),)
+	echo Removing not-built directories at $(CURDIR): $(REMOVEDIRECORIES) \
+	$(foreach d,$(REMOVEDIRECORIES),&& $(call DELTREE,$(d)))
+endif
+endif
+endif	
+	$(MAKE) -f subsystem.mk TARGET_PHASE=$@ subtargets
+
+
 # Symbian ----------------------------------
 ifeq ($(BUILDENV),symbian)