[source] build: new fixes for symlinked .config handling
LEDE Commits
lede-commits at lists.infradead.org
Thu Dec 14 09:44:06 PST 2017
jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/bb9eb2c96e47b2ca6c3596cf9af1a497d3f55f23
commit bb9eb2c96e47b2ca6c3596cf9af1a497d3f55f23
Author: Sergey Ryazanov <ryazanov.s.a at gmail.com>
AuthorDate: Sun May 7 20:19:13 2017 +0300
build: new fixes for symlinked .config handling
When running "make {config|defconfig|oldconfig}" with symlinked .config
(e.g. to env/.config) it renames symlink to .config.old, creates new
.config file, and writes the updated configuration into it.
This breaks the desired workflow when changes in the configuration can
be checked using "scripts/env diff" and commited using "scripts/env
save". Since the env/.config file is not updated.
The things become even worse when working with feeds, since feeds script
quite often silently invokes "make {oldconfig|defconfig}" and breaks the
symlink.
Fix this issue by exporting KCONFIG_OVERWRITECONFIG=1, which forces
mconf to overwrite the .config content, instead of renaming it and
creating a new file. This variable is set only if .config is a symlink,
otherwise the variable is not exported and the old behaviour is
preserved.
This change uses the same behaviour as "make menucofig", which has
already been fixed in commit 5bf98b1acc3b6b178f8954c5075a58e1e6a99d6a.
Also make a tiny cosmetic update to the "make menuconfig" target code
layout to make it look like other config handling targets.
Signed-off-by: Sergey Ryazanov <ryazanov.s.a at gmail.com>
(cherry picked from commit e06d8f0f6f041c8ac1acba810eea96c32dc983e4)
---
include/toplevel.mk | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/toplevel.mk b/include/toplevel.mk
index 8f967bd..f7c0dc1 100644
--- a/include/toplevel.mk
+++ b/include/toplevel.mk
@@ -105,7 +105,8 @@ scripts/config/conf:
@$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf CC="$(HOSTCC_WRAPPER)"
config: scripts/config/conf prepare-tmpinfo FORCE
- $< Config.in
+ [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
+ $< Config.in
config-clean: FORCE
$(_SINGLE)$(NO_TRACE_MAKE) -C scripts/config clean
@@ -113,7 +114,8 @@ config-clean: FORCE
defconfig: scripts/config/conf prepare-tmpinfo FORCE
touch .config
@if [ ! -s .config -a -e $(HOME)/.openwrt/defconfig ]; then cp $(HOME)/.openwrt/defconfig .config; fi
- $< --defconfig=.config Config.in
+ [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
+ $< --defconfig=.config Config.in
confdefault-y=allyes
confdefault-m=allmod
@@ -121,13 +123,15 @@ confdefault-n=allno
confdefault:=$(confdefault-$(CONFDEFAULT))
oldconfig: scripts/config/conf prepare-tmpinfo FORCE
- $< --$(if $(confdefault),$(confdefault),old)config Config.in
+ [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
+ $< --$(if $(confdefault),$(confdefault),old)config Config.in
menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \
cp $(HOME)/.openwrt/defconfig .config; \
fi
- [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; $< Config.in
+ [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
+ $< Config.in
prepare_kernel_conf: .config FORCE
More information about the lede-commits
mailing list