summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/confdata.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-07-20 16:46:31 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-07-25 23:25:30 +0900
commit00c864f8903dd357471e8ee48f4d57aaa9a1a0de (patch)
tree33fc5d65590715b39de4d8fca569bd15eadd41ee /scripts/kconfig/confdata.c
parent16952b77d8b542fe5f3d73065a50842885b2ba0b (diff)
downloadlinux-00c864f8903dd357471e8ee48f4d57aaa9a1a0de.tar.gz
linux-00c864f8903dd357471e8ee48f4d57aaa9a1a0de.tar.bz2
linux-00c864f8903dd357471e8ee48f4d57aaa9a1a0de.zip
kconfig: allow all config targets to write auto.conf if missing
Currently, only syncconfig creates or updates include/config/auto.conf and some other files. Other config targets create or update only the .config file. When you configure and build the kernel from a pristine source tree, any config target is followed by syncconfig in the build stage since include/config/auto.conf is missing. We are moving compiler tests from Makefile to Kconfig. It means that parsing Kconfig files will be more costly since Kconfig invokes the compiler commands internally. Thus, we want to avoid invoking Kconfig twice (one for *config to create the .config, and one for syncconfig to synchronize the auto.conf). If auto.conf does not exist, we can generate all configuration files in the first configuration stage, which will save the syncconfig in the build stage. Please note this should be done only when auto.conf is missing. If *config blindly did this, time stamp files under include/config/ would be unnecessarily touched, triggering unneeded rebuild of objects. I assume a scenario like this: 1. You have a source tree that has already been built with CONFIG_FOO disabled 2. Run "make menuconfig" to enable CONFIG_FOO 3. CONFIG_FOO turns out to be unnecessary. Run "make menuconfig" again to disable CONFIG_FOO 4. Run "make" In this case, include/config/foo.h should not be touched since there is no change in CONFIG_FOO. The sync process should be delayed until the user really attempts to build the kernel. This commit has another motivation; I want to suppress the 'No such file or directory' warning from the 'include' directive. The top-level Makefile includes auto.conf with '-include' directive, like this: ifeq ($(dot-config),1) -include include/config/auto.conf endif This looks strange because auto.conf is mandatory when dot-config is 1. I guess only the reason of using '-include' is to suppress the warning 'include/config/auto.conf: No such file or directory' when building from a clean tree. However, this has a side-effect; Make considers the files included by '-include' are optional. Hence, Make continues to build even if it fails to generate include/config/auto.conf. I will change this in the next commit, but the warning message is annoying. (At least, kbuild test robot reports it as a regression.) With this commit, Kconfig will generate all configuration files together with the .config and I guess it is a solution good enough to suppress the warning. Note: GNU Make 4.2 or later does not display the warning from the 'include' directive if include files are successfully generated. See GNU Make commit 87a5f98d248f ("[SV 102] Don't show unnecessary include file errors.") However, older GNU Make versions are still widely used. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r--scripts/kconfig/confdata.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index fad403dfa508..91d0a5c014ac 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -1013,13 +1013,17 @@ out:
return res;
}
-int conf_write_autoconf(void)
+int conf_write_autoconf(int overwrite)
{
struct symbol *sym;
const char *name;
+ const char *autoconf_name = conf_get_autoconfig_name();
FILE *out, *tristate, *out_h;
int i;
+ if (!overwrite && is_present(autoconf_name))
+ return 0;
+
sym_clear_all_valid();
conf_write_dep("include/config/auto.conf.cmd");
@@ -1082,14 +1086,13 @@ int conf_write_autoconf(void)
if (rename(".tmpconfig_tristate", name))
return 1;
- name = conf_get_autoconfig_name();
- if (make_parent_dir(name))
+ if (make_parent_dir(autoconf_name))
return 1;
/*
* This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps.
*/
- if (rename(".tmpconfig", name))
+ if (rename(".tmpconfig", autoconf_name))
return 1;
return 0;