build: extend CONFIG_AUTOREMOVE to tools/
[openwrt/staging/chunkeey.git] / include / host-build.mk
index 23565533bada8f7148538a0299d6adc35809cb82..bbf4633c416f78950e19a92ab8d367d106ddec4d 100644 (file)
@@ -172,6 +172,7 @@ ifndef DUMP
   ifndef STAMP_BUILT
     $(foreach t,$(DEFAULT_SUBDIR_TARGETS),
       $(t): host-$(t)
+      .$(t): .host-$(t)
     )
   endif
 
@@ -183,6 +184,11 @@ ifndef DUMP
        $(call Host/Uninstall)
        rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_BUILT)
 
+    ifneq ($(CONFIG_AUTOREMOVE),)
+      host-compile:
+               $(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' | \
+                       $(XARGS) rm -rf
+    endif
   endef
 endif