#
################################################################################
+# Macro to update back the custom (def)config file
+# $(1): file to copy from
+define kconfig-package-update-config
+ @$(if $($(PKG)_KCONFIG_FRAGMENT_FILES), \
+ echo "Unable to perform $(@) when fragment files are set"; exit 1)
+ @$(if $($(PKG)_KCONFIG_DEFCONFIG), \
+ echo "Unable to perform $(@) when using a defconfig rule"; exit 1)
+ cp -f $($(PKG)_DIR)/$(1) $($(PKG)_KCONFIG_FILE)
+ touch --reference $($(PKG)_DIR)/$($(PKG)_KCONFIG_DOTCONFIG) $($(PKG)_KCONFIG_FILE)
+endef
+
################################################################################
# inner-kconfig-package -- generates the make targets needed to support a
# kconfig package
# Target to copy back the configuration to the source configuration file
# Even though we could use 'cp --preserve-timestamps' here, the separate
# cp and 'touch --reference' is used for symmetry with $(1)-update-defconfig.
+$(1)-update-config: PKG=$(2)
$(1)-update-config: $(1)-check-configuration-done
- @$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
- echo "Unable to perform $(1)-update-config when fragment files are set"; exit 1)
- @$$(if $$($(2)_KCONFIG_DEFCONFIG), \
- echo "Unable to perform $(1)-update-config when using a defconfig rule"; exit 1)
- cp -f $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG) $$($(2)_KCONFIG_FILE)
- touch --reference $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG) $$($(2)_KCONFIG_FILE)
+ $$(call kconfig-package-update-config,$$($(2)_KCONFIG_DOTCONFIG))
# Note: make sure the timestamp of the stored configuration is not newer than
# the .config to avoid a useless rebuild. Note that, contrary to
# $(1)-update-config, the reference for 'touch' is _not_ the file from which
# we copy.
+$(1)-update-defconfig: PKG=$(2)
$(1)-update-defconfig: $(1)-savedefconfig
- @$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
- echo "Unable to perform $(1)-update-defconfig when fragment files are set"; exit 1)
- @$$(if $$($(2)_KCONFIG_DEFCONFIG), \
- echo "Unable to perform $(1)-update-defconfig when using a defconfig rule"; exit 1)
- cp -f $$($(2)_DIR)/defconfig $$($(2)_KCONFIG_FILE)
- touch --reference $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG) $$($(2)_KCONFIG_FILE)
+ $$(call kconfig-package-update-config,defconfig)
endif # package enabled