build: prevent spurious package rebuilds under CONFIG_AUTOREMOVE
[openwrt/openwrt.git] / include / package.mk
index 9912c86d6b34207e0698feacf49e4a995dd32f76..2473eecb922074e415496e1add86cf2c9c47cccb 100644 (file)
@@ -228,7 +228,7 @@ define Build/CoreTargets
 
   ifneq ($(CONFIG_AUTOREMOVE),)
     compile:
-               -touch $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
+               -touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
                $(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
                        $(XARGS) rm -rf
   endif