]> Git Repo - buildroot-mgba.git/blame - package/pkg-kconfig.mk
kconfig infra: remove all install stamp files
[buildroot-mgba.git] / package / pkg-kconfig.mk
CommitLineData
abb8a8da
TDS
1################################################################################
2# Kconfig package infrastructure
3#
4# This file implements an infrastructure that eases development of
5# package .mk files for packages that use kconfig for configuration files.
6# It is based on the generic-package infrastructure, and inherits all of its
7# features.
8#
9# See the Buildroot documentation for details on the usage of this
10# infrastructure.
11#
12################################################################################
13
14################################################################################
15# inner-kconfig-package -- generates the make targets needed to support a
16# kconfig package
17#
18# argument 1 is the lowercase package name
19# argument 2 is the uppercase package name, including a HOST_ prefix
20# for host packages
21# argument 3 is the uppercase package name, without the HOST_ prefix
22# for host packages
23# argument 4 is the type (target or host)
24################################################################################
25
26define inner-kconfig-package
27
28# Call the generic package infrastructure to generate the necessary
29# make targets.
30# Note: this must be done _before_ attempting to use $$($(2)_DIR) in a
31# dependency expression
32$(call inner-generic-package,$(1),$(2),$(3),$(4))
33
34# Default values
abb8a8da 35$(2)_KCONFIG_EDITORS ?= menuconfig
146f7dc4 36$(2)_KCONFIG_OPTS ?=
abb8a8da
TDS
37$(2)_KCONFIG_FIXUP_CMDS ?=
38
39# FOO_KCONFIG_FILE is required
abb8a8da
TDS
40ifndef $(2)_KCONFIG_FILE
41$$(error Internal error: no value specified for $(2)_KCONFIG_FILE)
42endif
43
23fd6e0e
TDS
44# The config file could be in-tree, so before depending on it the package should
45# be extracted (and patched) first
46$$($(2)_KCONFIG_FILE): | $(1)-patch
47
abb8a8da
TDS
48# The .config file is obtained by copying it from the specified source
49# configuration file, after the package has been patched.
39867f3c
TDS
50# Since the file could be a defconfig file it needs to be expanded to a
51# full .config first. We use 'make oldconfig' because this can be safely
52# done even when the package does not support defconfigs.
23fd6e0e 53$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE)
abb8a8da 54 $$(INSTALL) -m 0644 $$($(2)_KCONFIG_FILE) $$($(2)_DIR)/.config
39867f3c
TDS
55 @yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
56 $$($(2)_KCONFIG_OPTS) oldconfig
abb8a8da
TDS
57
58# In order to get a usable, consistent configuration, some fixup may be needed.
59# The exact rules are specified by the package .mk file.
abb8a8da
TDS
60$$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/.config
61 $$($(2)_KCONFIG_FIXUP_CMDS)
fdc5ad15 62 @yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
146f7dc4 63 $$($(2)_KCONFIG_OPTS) oldconfig
abb8a8da
TDS
64 $$(Q)touch $$@
65
66# Before running configure, the configuration file should be present and fixed
abb8a8da
TDS
67$$($(2)_TARGET_CONFIGURE): $$($(2)_DIR)/.stamp_kconfig_fixup_done
68
69# Configuration editors (menuconfig, ...)
abb8a8da
TDS
70$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $$($(2)_DIR)/.stamp_kconfig_fixup_done
71 $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
146f7dc4 72 $$($(2)_KCONFIG_OPTS) $$(subst $(1)-,,$$@)
abb8a8da 73 rm -f $$($(2)_DIR)/.stamp_{kconfig_fixup_done,configured,built}
d9fec0ad 74 rm -f $$($(2)_DIR)/.stamp_{target,staging,images}_installed
abb8a8da 75
39867f3c
TDS
76$(1)-savedefconfig: $$($(2)_DIR)/.stamp_kconfig_fixup_done
77 $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
78 $$($(2)_KCONFIG_OPTS) savedefconfig
79
abb8a8da 80# Target to copy back the configuration to the source configuration file
1941386c
TDS
81# Even though we could use 'cp --preserve-timestamps' here, the separate
82# cp and 'touch --reference' is used for symmetry with $(1)-update-defconfig.
abb8a8da 83$(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
1941386c
TDS
84 cp -f $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
85 touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
abb8a8da 86
39867f3c
TDS
87# Note: make sure the timestamp of the stored configuration is not newer than
88# the .config to avoid a useless rebuild. Note that, contrary to
89# $(1)-update-config, the reference for 'touch' is _not_ the file from which
90# we copy.
91$(1)-update-defconfig: $(1)-savedefconfig
92 cp -f $$($(2)_DIR)/defconfig $$($(2)_KCONFIG_FILE)
93 touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
94
abb8a8da
TDS
95endef # inner-kconfig-package
96
97################################################################################
98# kconfig-package -- the target generator macro for kconfig packages
99################################################################################
100
101kconfig-package = $(call inner-kconfig-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
This page took 0.380134 seconds and 4 git commands to generate.