Skip to content

Commit 79123b1

Browse files
committed
kconfig: create directories needed for syncconfig by itself
'make syncconfig' creates some files such as include/config/auto.conf, include/generate/autoconf.h, etc. but the necessary directory creation relies on scripts/kconfig/Makefile. To make Kconfig self-contained, create directories as needed in conf_write_autoconf(). This change allows scripts/kconfig/Makefile cleanups; syncconfig can be merged into simple-targets. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent adc18ac commit 79123b1

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

‎scripts/kconfig/Makefile‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# Kernel configuration targets
44
# These targets are used from top-level makefile
55

6-
PHONY += xconfig gconfig menuconfig config syncconfig \
7-
localmodconfig localyesconfig
6+
PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig
87

98
ifdef KBUILD_KCONFIG
109
Kconfig := $(KBUILD_KCONFIG)
@@ -34,12 +33,6 @@ config: $(obj)/conf
3433
nconfig: $(obj)/nconf
3534
$< $(silent) $(Kconfig)
3635

37-
# This has become an internal implementation detail and is now deprecated
38-
# for external use.
39-
syncconfig: $(obj)/conf
40-
$(Q)mkdir -p include/config include/generated
41-
$< $(silent) --$@ $(Kconfig)
42-
4336
localyesconfig localmodconfig: $(obj)/conf
4437
$(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
4538
$(Q)if [ -f .config ]; then \
@@ -55,8 +48,12 @@ localyesconfig localmodconfig: $(obj)/conf
5548
$(Q)rm -f .tmp.config
5649

5750
# These targets map 1:1 to the commandline options of 'conf'
51+
#
52+
# Note:
53+
# syncconfig has become an internal implementation detail and is now
54+
# deprecated for external use
5855
simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
59-
alldefconfig randconfig listnewconfig olddefconfig
56+
alldefconfig randconfig listnewconfig olddefconfig syncconfig
6057
PHONY += $(simple-targets)
6158

6259
$(simple-targets): $(obj)/conf

‎scripts/kconfig/confdata.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,9 @@ static int conf_write_dep(const char *name)
899899

900900
fprintf(out, "\n$(deps_config): ;\n");
901901
fclose(out);
902+
903+
if (make_parent_dir(name))
904+
return 1;
902905
rename("..config.tmp", name);
903906
return 0;
904907
}
@@ -915,6 +918,8 @@ static int conf_split_config(void)
915918
conf_read_simple(name, S_DEF_AUTO);
916919
sym_calc_value(modules_sym);
917920

921+
if (make_parent_dir("include/config/foo.h"))
922+
return 1;
918923
if (chdir("include/config"))
919924
return 1;
920925

@@ -991,6 +996,7 @@ static int conf_split_config(void)
991996
res = 1;
992997
goto out;
993998
}
999+
9941000
/* Try it again. */
9951001
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
9961002
if (fd == -1) {
@@ -1063,14 +1069,22 @@ int conf_write_autoconf(void)
10631069
name = getenv("KCONFIG_AUTOHEADER");
10641070
if (!name)
10651071
name = "include/generated/autoconf.h";
1072+
if (make_parent_dir(name))
1073+
return 1;
10661074
if (rename(".tmpconfig.h", name))
10671075
return 1;
1076+
10681077
name = getenv("KCONFIG_TRISTATE");
10691078
if (!name)
10701079
name = "include/config/tristate.conf";
1080+
if (make_parent_dir(name))
1081+
return 1;
10711082
if (rename(".tmpconfig_tristate", name))
10721083
return 1;
1084+
10731085
name = conf_get_autoconfig_name();
1086+
if (make_parent_dir(name))
1087+
return 1;
10741088
/*
10751089
* This must be the last step, kbuild has a dependency on auto.conf
10761090
* and this marks the successful completion of the previous steps.

0 commit comments

Comments
 (0)