[source] build: fix CONFIG_AUTOREMOVE for packages with multiple variants

LEDE Commits lede-commits at lists.infradead.org
Sun Jan 22 08:41:29 PST 2017


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

commit 0e22d6377569cea4ba00b81d6ec64a1582a2cea4
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sun Jan 22 17:40:29 2017 +0100

    build: fix CONFIG_AUTOREMOVE for packages with multiple variants
    
    Calling the clean target removes all .ipk files and un-stages the
    package. Add a new target just for clearing the build dir and call that
    one instead of the full clean target
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/host-build.mk | 9 +++++++--
 include/package.mk    | 6 ++++--
 include/subdir.mk     | 2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/include/host-build.mk b/include/host-build.mk
index 6a335fc..d96cc94 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -176,15 +176,20 @@ ifndef DUMP
       $(t): host-$(t)
       .$(t): .host-$(t)
     )
+    clean-build: host-clean-build
   endif
 
   $(_host_target)host-prepare: $(HOST_STAMP_PREPARED)
   $(_host_target)host-configure: $(HOST_STAMP_CONFIGURED)
   $(_host_target)host-compile: $(HOST_STAMP_BUILT) $(HOST_STAMP_INSTALLED)
-  host-clean: FORCE
+
+  host-clean-build: FORCE
+	rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_BUILT)
+
+  host-clean: host-clean-build
 	$(call Host/Clean)
 	$(call Host/Uninstall)
-	rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_BUILT)
+	rm -rf $(HOST_STAMP_INSTALLED)
 
     ifneq ($(CONFIG_AUTOREMOVE),)
       host-compile:
diff --git a/include/package.mk b/include/package.mk
index 95b5f76..fc27339 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -300,12 +300,14 @@ compile: prepare-package-install
 .install: .compile
 install: compile
 
-clean: FORCE
+clean-build: FORCE
+	rm -rf $(PKG_BUILD_DIR)
+
+clean: clean-build
 	$(CleanStaging)
 	$(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST))
 	$(Build/Clean)
 	rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) $(STAGING_DIR_HOST)/packages/$(STAGING_FILES_LIST)
-	rm -rf $(PKG_BUILD_DIR)
 
 dist:
 	$(Build/Dist)
diff --git a/include/subdir.mk b/include/subdir.mk
index e76a01e..6bbf23a 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -52,7 +52,7 @@ rebuild_check = \
 		$(if $(BUILD_LOG),mkdir -p $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4));) \
 		$$(NO_TRACE_MAKE) $(if $(BUILD_LOG),-d) -q $(subdir_make_opts) .$(if $(3),$(3)-)$(2) \
 			> $(if $(BUILD_LOG),$(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4))/check-$(if $(3),$(3)-)$(2).txt,/dev/null) 2>&1 || \
-			$$(SUBMAKE) $(subdir_make_opts) clean >/dev/null 2>/dev/null
+			$$(SUBMAKE) $(subdir_make_opts) clean-build >/dev/null 2>/dev/null
 
 endif
 



More information about the lede-commits mailing list