-ifneq ($(CONFIG_AUTOREBUILD),)
- define Build/Autoclean
- $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
- $(call rdep,${CURDIR},$(STAMP_PREPARED),$(TMP_DIR)/.packagedir_$(shell echo "${CURDIR}" | md5s))
- $(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*")
- endef
+ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
+ ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
+ define Build/Autoclean
+ $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
+ $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED),$(PKG_BUILD_DIR)/.dep_files,-x "*/.dep_*")
+ $(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),,-x "*/.dep_*" -x "*/ipkg*"))
+ endef
+ endif