fi
$(Q)mkdir -p $(dir $($(PKG)_KCONFIG_FILE))
cp -f $($(PKG)_DIR)/$(1) $($(PKG)_KCONFIG_FILE)
- $(Q)touch --reference $($(PKG)_DIR)/$($(PKG)_KCONFIG_DOTCONFIG) $($(PKG)_KCONFIG_FILE)
+ $(Q)touch --reference $($(PKG)_DIR)/$($(PKG)_KCONFIG_STAMP_DOTCONFIG) $($(PKG)_KCONFIG_FILE)
endef
PKG_KCONFIG_COMMON_OPTS = \
$(2)_KCONFIG_FRAGMENT_FILES ?=
$(2)_KCONFIG_DOTCONFIG ?= .config
+# Do not use $(2)_KCONFIG_DOTCONFIG as stamp file, because the package
+# buildsystem (e.g. linux >= 4.19) may touch it, thus rendering our
+# timestamps out of date, thus re-trigerring the build of the package.
+# Instead, use a specific file of our own as timestamp.
+$(2)_KCONFIG_STAMP_DOTCONFIG = .stamp_dotconfig
+
# The config file as well as the fragments could be in-tree, so before
# depending on them the package should be extracted (and patched) first.
#
# fragments are merged together to .config, after the package has been patched.
# Since the file could be a defconfig file it needs to be expanded to a
# full .config first.
-$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
+$$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
$$(Q)$$(if $$($(2)_KCONFIG_DEFCONFIG), \
$$($(2)_KCONFIG_MAKE) $$($(2)_KCONFIG_DEFCONFIG), \
- $$(INSTALL) -m 0644 -D $$($(2)_KCONFIG_FILE) $$(@))
+ $$(INSTALL) -m 0644 -D $$($(2)_KCONFIG_FILE) $$(@D)/$$($(2)_KCONFIG_DOTCONFIG))
$$(Q)support/kconfig/merge_config.sh -m -O $$(@D) \
- $$(@) $$($(2)_KCONFIG_FRAGMENT_FILES)
+ $$(@D)/$$($(2)_KCONFIG_DOTCONFIG) $$($(2)_KCONFIG_FRAGMENT_FILES)
$$($(2)_REGEN_DOT_CONFIG)
+ $$(Q)touch $$(@D)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
# If _KCONFIG_FILE or _KCONFIG_FRAGMENT_FILES exists, this dependency is
# already implied, but if we only have a _KCONFIG_DEFCONFIG we have to add
# it explicitly. It doesn't hurt to always have it though.
-$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $(1)-patch
+$$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): | $(1)-patch
# Some packages may need additional tools to be present by the time their
# kconfig structure is parsed (e.g. the linux kernel may need to call to
# the compiler to test its features).
-$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $$($(2)_KCONFIG_DEPENDENCIES)
+$$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG): | $$($(2)_KCONFIG_DEPENDENCIES)
# In order to get a usable, consistent configuration, some fixup may be needed.
# The exact rules are specified by the package .mk file.
$$(Q)touch $$($(2)_DIR)/.stamp_kconfig_fixup_done
endef
-$$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG)
+$$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
$$($(2)_FIXUP_DOT_CONFIG)
# Before running configure, the configuration file should be present and fixed