build: do not auto-clean packages where the autoremove step has not run
authorFelix Fietkau <nbd@nbd.name>
Mon, 23 Jan 2017 20:53:47 +0000 (21:53 +0100)
committerFelix Fietkau <nbd@nbd.name>
Mon, 23 Jan 2017 21:04:17 +0000 (22:04 +0100)
This avoids repeatedly unpacking and rebuilding packages that are
failing the build. Re-running the failing step should be much faster.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
include/package.mk

index fc2733907ed57d1f0da9579addd71256a018ed83..01c0333b06934c8bcf81d3ac1e5dfe7a425eb34b 100644 (file)
@@ -216,6 +216,7 @@ define Build/CoreTargets
 
   ifneq ($(CONFIG_AUTOREMOVE),)
     compile:
+               touch $(PKG_BUILD_DIR)/.autoremove
                $(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
                        $(XARGS) rm -rf
   endif
@@ -300,10 +301,12 @@ compile: prepare-package-install
 .install: .compile
 install: compile
 
-clean-build: FORCE
+force-clean-build: FORCE
        rm -rf $(PKG_BUILD_DIR)
 
-clean: clean-build
+clean-build: $(if $(wildcard $(PKG_BUILD_DIR)/.autoremove),force-clean-build)
+
+clean: force-clean-build
        $(CleanStaging)
        $(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST))
        $(Build/Clean)