Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79123b13 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent adc18acf
Loading
Loading
Loading
Loading
+6 −9
Original line number Original line Diff line number Diff line
@@ -3,8 +3,7 @@
# Kernel configuration targets
# Kernel configuration targets
# These targets are used from top-level makefile
# These targets are used from top-level makefile


PHONY += xconfig gconfig menuconfig config syncconfig \
PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig
	localmodconfig localyesconfig


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


# This has become an internal implementation detail and is now deprecated
# for external use.
syncconfig: $(obj)/conf
	$(Q)mkdir -p include/config include/generated
	$< $(silent) --$@ $(Kconfig)

localyesconfig localmodconfig: $(obj)/conf
localyesconfig localmodconfig: $(obj)/conf
	$(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
	$(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
	$(Q)if [ -f .config ]; then 					\
	$(Q)if [ -f .config ]; then 					\
@@ -55,8 +48,12 @@ localyesconfig localmodconfig: $(obj)/conf
	$(Q)rm -f .tmp.config
	$(Q)rm -f .tmp.config


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


$(simple-targets): $(obj)/conf
$(simple-targets): $(obj)/conf
+14 −0
Original line number Original line Diff line number Diff line
@@ -899,6 +899,9 @@ static int conf_write_dep(const char *name)


	fprintf(out, "\n$(deps_config): ;\n");
	fprintf(out, "\n$(deps_config): ;\n");
	fclose(out);
	fclose(out);

	if (make_parent_dir(name))
		return 1;
	rename("..config.tmp", name);
	rename("..config.tmp", name);
	return 0;
	return 0;
}
}
@@ -915,6 +918,8 @@ static int conf_split_config(void)
	conf_read_simple(name, S_DEF_AUTO);
	conf_read_simple(name, S_DEF_AUTO);
	sym_calc_value(modules_sym);
	sym_calc_value(modules_sym);


	if (make_parent_dir("include/config/foo.h"))
		return 1;
	if (chdir("include/config"))
	if (chdir("include/config"))
		return 1;
		return 1;


@@ -991,6 +996,7 @@ static int conf_split_config(void)
				res = 1;
				res = 1;
				goto out;
				goto out;
			}
			}

			/* Try it again. */
			/* Try it again. */
			fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
			fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
			if (fd == -1) {
			if (fd == -1) {
@@ -1063,14 +1069,22 @@ int conf_write_autoconf(void)
	name = getenv("KCONFIG_AUTOHEADER");
	name = getenv("KCONFIG_AUTOHEADER");
	if (!name)
	if (!name)
		name = "include/generated/autoconf.h";
		name = "include/generated/autoconf.h";
	if (make_parent_dir(name))
		return 1;
	if (rename(".tmpconfig.h", name))
	if (rename(".tmpconfig.h", name))
		return 1;
		return 1;

	name = getenv("KCONFIG_TRISTATE");
	name = getenv("KCONFIG_TRISTATE");
	if (!name)
	if (!name)
		name = "include/config/tristate.conf";
		name = "include/config/tristate.conf";
	if (make_parent_dir(name))
		return 1;
	if (rename(".tmpconfig_tristate", name))
	if (rename(".tmpconfig_tristate", name))
		return 1;
		return 1;

	name = conf_get_autoconfig_name();
	name = conf_get_autoconfig_name();
	if (make_parent_dir(name))
		return 1;
	/*
	/*
	 * This must be the last step, kbuild has a dependency on auto.conf
	 * This must be the last step, kbuild has a dependency on auto.conf
	 * and this marks the successful completion of the previous steps.
	 * and this marks the successful completion of the previous steps.