[source] build: extend CONFIG_AUTOREMOVE to tools/

LEDE Commits lede-commits at lists.infradead.org
Wed Jan 18 14:57:29 PST 2017


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/d98bb7e6b96d5bb700800c797f68bf391335374d

commit d98bb7e6b96d5bb700800c797f68bf391335374d
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Jan 18 18:00:00 2017 +0100

    build: extend CONFIG_AUTOREMOVE to tools/
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/host-build.mk      | 6 ++++++
 include/toolchain-build.mk | 1 +
 tools/Makefile             | 1 +
 3 files changed, 8 insertions(+)

diff --git a/include/host-build.mk b/include/host-build.mk
index 2356553..bbf4633 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -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
 
diff --git a/include/toolchain-build.mk b/include/toolchain-build.mk
index 212923a..efc35e2 100644
--- a/include/toolchain-build.mk
+++ b/include/toolchain-build.mk
@@ -6,6 +6,7 @@
 #
 
 override CONFIG_AUTOREBUILD=
+override CONFIG_AUTOREMOVE=
 
 REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
 STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
diff --git a/tools/Makefile b/tools/Makefile
index a3bf69c..1fdf197 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -100,6 +100,7 @@ $(foreach tool, $(tools-core), $(eval $(curdir)/$(tool)/compile += $(curdir)/sed
 $(curdir)/sed/compile := $(curdir)/flock/compile
 tools-y += flock sed
 
+$(curdir)/autoremove := 1
 $(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-)
 $(curdir)/builddirs-default := $(tools-y)
 



More information about the lede-commits mailing list