aboutsummaryrefslogtreecommitdiff
path: root/package/pkg-kconfig.mk
diff options
context:
space:
mode:
authorGravatar Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>2015-02-03 15:21:42 +0100
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2015-02-14 16:33:45 +0100
commit39867f3c8cba642cb2dc98b165992a6cc2fa1cb5 (patch)
tree218cd4f44aa622f8639fc90357fc23e699b2c1fc /package/pkg-kconfig.mk
parent23fd6e0e6ac5520391fb2e8f6c1e92eca91d865e (diff)
downloadbuildroot-39867f3c8cba642cb2dc98b165992a6cc2fa1cb5.tar.gz
buildroot-39867f3c8cba642cb2dc98b165992a6cc2fa1cb5.tar.bz2
kconfig infra: add support for defconfig files
This commit adds support for using a defconfig file instead of a full .config. This is a precondition to migrate packages like linux and barebox to the kconfig infrastructure. Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: "Yann E. Morin" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/pkg-kconfig.mk')
-rw-r--r--package/pkg-kconfig.mk17
1 files changed, 17 insertions, 0 deletions
diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk
index ef724e595f..db56b7afcb 100644
--- a/package/pkg-kconfig.mk
+++ b/package/pkg-kconfig.mk
@@ -47,8 +47,13 @@ $$($(2)_KCONFIG_FILE): | $(1)-patch
# The .config file is obtained by copying it from the specified source
# configuration file, after the package has been patched.
+# Since the file could be a defconfig file it needs to be expanded to a
+# full .config first. We use 'make oldconfig' because this can be safely
+# done even when the package does not support defconfigs.
$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE)
$$(INSTALL) -m 0644 $$($(2)_KCONFIG_FILE) $$($(2)_DIR)/.config
+ @yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
+ $$($(2)_KCONFIG_OPTS) oldconfig
# In order to get a usable, consistent configuration, some fixup may be needed.
# The exact rules are specified by the package .mk file.
@@ -68,10 +73,22 @@ $$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $$($(2)_DIR)/.stamp_kconfig_fixup_
rm -f $$($(2)_DIR)/.stamp_{kconfig_fixup_done,configured,built}
rm -f $$($(2)_DIR)/.stamp_{target,staging}_installed
+$(1)-savedefconfig: $$($(2)_DIR)/.stamp_kconfig_fixup_done
+ $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
+ $$($(2)_KCONFIG_OPTS) savedefconfig
+
# Target to copy back the configuration to the source configuration file
$(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
cp --preserve=timestamps -f $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
+# 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: $(1)-savedefconfig
+ cp -f $$($(2)_DIR)/defconfig $$($(2)_KCONFIG_FILE)
+ touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
+
endef # inner-kconfig-package
################################################################################