build: skip download for host build with AUTOREMOVE if already compiled
[openwrt/openwrt.git] / include / host-build.mk
index 22fcc31f15c7586a52f208509a8ae2949f33b71a..2cc1ec5842f6e55761a41e359dd3adf43bf7af7b 100644 (file)
@@ -206,5 +206,9 @@ endif
 
 define HostBuild
   $(HostBuild/Core)
-  $(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
+  $(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),,
+       $(if $(and $(CONFIG_AUTOREMOVE), $(wildcard $(HOST_STAMP_INSTALLED), $(wildcard $(HOST_STAMP_BUILT)))),,
+               $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
+       )
+  )
 endef