toplevel.mk: implement logic to invalidate targetinfo with some config
Implement some logic to invalidate targetinfo files in tmp with the
changing of some config.
Some config might affect DEFAULT_PACKAGES list but DEFAULT_PACKAGES is
only evaluated once. This cause the interesting scenario where someone
install feeds packages, targetinfo is evaluated in tmp and then add some
config like CONFIG_USE_APK. Using make defconfig will still select OPKG
as default package as DEFAULT_PACKAGES in targetinfo has been already
evaluated in the feeds install and is never updated.
To handle this add some logic in toplevel.mk to cache the current state
of these special config and wipe targetinfo when these change.
This cause the targetinfo to be reevaluated and handle this REALLY
corner case.
Link: https://github.com/openwrt/openwrt/pull/15543
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>