![Yann E. MORIN](/assets/img/avatar_default.png)
When saving (aka updating) the configuration file of a kconfig package, a subsequent call to "make" would rebuild the package, even though the configuration did not actually change. It took quite a while to understand why. But the reason is so simple and obvious, when you think about it: - $(@D)/.config depends on the config file $(BUSYBOX_CONFIG_FILE) - busybox-update-config then copies $(@D)/.config back to the config file $(BUSYBOX_CONFIG_FILE) - so the config file is newer than $(@D)/.config So, in the next run, pkg-kconfig believes that it has to rebuild busybox. Bummer... :-/ So, the fix is very trivial, and just requires asking "cp" to preserve timestamps, so the dependency does not kick in at the next run. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com> Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
78 lines
3.1 KiB
Makefile
78 lines
3.1 KiB
Makefile
################################################################################
|
|
# Kconfig package infrastructure
|
|
#
|
|
# This file implements an infrastructure that eases development of
|
|
# package .mk files for packages that use kconfig for configuration files.
|
|
# It is based on the generic-package infrastructure, and inherits all of its
|
|
# features.
|
|
#
|
|
# See the Buildroot documentation for details on the usage of this
|
|
# infrastructure.
|
|
#
|
|
################################################################################
|
|
|
|
################################################################################
|
|
# inner-kconfig-package -- generates the make targets needed to support a
|
|
# kconfig package
|
|
#
|
|
# argument 1 is the lowercase package name
|
|
# argument 2 is the uppercase package name, including a HOST_ prefix
|
|
# for host packages
|
|
# argument 3 is the uppercase package name, without the HOST_ prefix
|
|
# for host packages
|
|
# argument 4 is the type (target or host)
|
|
################################################################################
|
|
|
|
define inner-kconfig-package
|
|
|
|
# Call the generic package infrastructure to generate the necessary
|
|
# make targets.
|
|
# Note: this must be done _before_ attempting to use $$($(2)_DIR) in a
|
|
# dependency expression
|
|
$(call inner-generic-package,$(1),$(2),$(3),$(4))
|
|
|
|
# Default values
|
|
$(2)_KCONFIG_EDITORS ?= menuconfig
|
|
$(2)_KCONFIG_OPTS ?=
|
|
$(2)_KCONFIG_FIXUP_CMDS ?=
|
|
|
|
# FOO_KCONFIG_FILE is required
|
|
ifndef $(2)_KCONFIG_FILE
|
|
$$(error Internal error: no value specified for $(2)_KCONFIG_FILE)
|
|
endif
|
|
|
|
# The .config file is obtained by copying it from the specified source
|
|
# configuration file, after the package has been patched.
|
|
$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE) | $(1)-patch
|
|
$$(INSTALL) -m 0644 $$($(2)_KCONFIG_FILE) $$($(2)_DIR)/.config
|
|
|
|
# In order to get a usable, consistent configuration, some fixup may be needed.
|
|
# The exact rules are specified by the package .mk file.
|
|
$$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/.config
|
|
$$($(2)_KCONFIG_FIXUP_CMDS)
|
|
@yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
|
|
$$($(2)_KCONFIG_OPTS) oldconfig
|
|
$$(Q)touch $$@
|
|
|
|
# Before running configure, the configuration file should be present and fixed
|
|
$$($(2)_TARGET_CONFIGURE): $$($(2)_DIR)/.stamp_kconfig_fixup_done
|
|
|
|
# Configuration editors (menuconfig, ...)
|
|
$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $$($(2)_DIR)/.stamp_kconfig_fixup_done
|
|
$$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
|
|
$$($(2)_KCONFIG_OPTS) $$(subst $(1)-,,$$@)
|
|
rm -f $$($(2)_DIR)/.stamp_{kconfig_fixup_done,configured,built}
|
|
rm -f $$($(2)_DIR)/.stamp_{target,staging}_installed
|
|
|
|
# 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)
|
|
|
|
endef # inner-kconfig-package
|
|
|
|
################################################################################
|
|
# kconfig-package -- the target generator macro for kconfig packages
|
|
################################################################################
|
|
|
|
kconfig-package = $(call inner-kconfig-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
|