All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Dirk Gouders <dirk@gouders.net>,
	Ulf Magnusson <ulfalizer@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 04/12] kconfig: create directories needed for syncconfig by itself
Date: Thu,  5 Jul 2018 11:39:41 +0900	[thread overview]
Message-ID: <1530758389-30862-5-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1530758389-30862-1-git-send-email-yamada.masahiro@socionext.com>

'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>
---

 scripts/kconfig/Makefile   | 15 ++++++---------
 scripts/kconfig/confdata.c | 14 ++++++++++++++
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index c9e8cf5..dffe268 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -3,8 +3,7 @@
 # Kernel configuration targets
 # These targets are used from top-level makefile
 
-PHONY += xconfig gconfig menuconfig config syncconfig \
-	localmodconfig localyesconfig
+PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig
 
 ifdef KBUILD_KCONFIG
 Kconfig := $(KBUILD_KCONFIG)
@@ -34,12 +33,6 @@ config: $(obj)/conf
 nconfig: $(obj)/nconf
 	$< $(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
 	$(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
 	$(Q)if [ -f .config ]; then 					\
@@ -55,8 +48,12 @@ localyesconfig localmodconfig: $(obj)/conf
 	$(Q)rm -f .tmp.config
 
 # 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 \
-	alldefconfig randconfig listnewconfig olddefconfig
+	alldefconfig randconfig listnewconfig olddefconfig syncconfig
 PHONY += $(simple-targets)
 
 $(simple-targets): $(obj)/conf
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 881993e..38b3a6c 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -898,6 +898,9 @@ static int conf_write_dep(const char *name)
 
 	fprintf(out, "\n$(deps_config): ;\n");
 	fclose(out);
+
+	if (mkdir_p(name))
+		return 1;
 	rename("..config.tmp", name);
 	return 0;
 }
@@ -914,6 +917,8 @@ static int conf_split_config(void)
 	conf_read_simple(name, S_DEF_AUTO);
 	sym_calc_value(modules_sym);
 
+	if (mkdir_p("include/config/"))
+		return 1;
 	if (chdir("include/config"))
 		return 1;
 
@@ -990,6 +995,7 @@ static int conf_split_config(void)
 				res = 1;
 				goto out;
 			}
+
 			/* Try it again. */
 			fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
 			if (fd == -1) {
@@ -1062,14 +1068,22 @@ int conf_write_autoconf(void)
 	name = getenv("KCONFIG_AUTOHEADER");
 	if (!name)
 		name = "include/generated/autoconf.h";
+	if (mkdir_p(name))
+		return 1;
 	if (rename(".tmpconfig.h", name))
 		return 1;
+
 	name = getenv("KCONFIG_TRISTATE");
 	if (!name)
 		name = "include/config/tristate.conf";
+	if (mkdir_p(name))
+		return 1;
 	if (rename(".tmpconfig_tristate", name))
 		return 1;
+
 	name = conf_get_autoconfig_name();
+	if (mkdir_p(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.
-- 
2.7.4


  parent reply	other threads:[~2018-07-05  2:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-05  2:39 [PATCH v3 00/12] kbuild/kconfig: do not update config during installation Masahiro Yamada
2018-07-05  2:39 ` [PATCH v3 01/12] kconfig: rename file_write_dep and move it to confdata.c Masahiro Yamada
2018-07-05  2:39 ` [PATCH v3 02/12] kconfig: split out helpers to check file/directory, create directory Masahiro Yamada
2018-07-05  2:39 ` [PATCH v3 03/12] kconfig: remove unneeded directory generation from local*config Masahiro Yamada
2018-07-05  2:39 ` Masahiro Yamada [this message]
2018-07-05  2:39 ` [PATCH v3 05/12] kconfig: make syncconfig update .config regardless of sym_change_count Masahiro Yamada
2018-07-06 12:23   ` Dirk Gouders
2018-07-06 23:38     ` Dirk Gouders
2018-07-09 11:39       ` Dirk Gouders
2018-07-10 15:19         ` Kees Cook
2018-07-12  2:12         ` Masahiro Yamada
2018-07-12 11:32           ` Dirk Gouders
2018-07-12 21:06             ` Dirk Gouders
2018-07-13 14:57             ` Masahiro Yamada
2018-07-14  7:12               ` Dirk Gouders
2018-07-05  2:39 ` [PATCH v3 06/12] kconfig: allow all config targets to write auto.conf if missing Masahiro Yamada
2018-07-05  2:39 ` [PATCH v3 07/12] kbuild: use 'include' directive to load auto.conf from top Makefile Masahiro Yamada
2018-07-05  2:39 ` [PATCH v3 08/12] kbuild: add .DELETE_ON_ERROR special target Masahiro Yamada
2018-07-05  2:39 ` [PATCH v3 09/12] kbuild: do not update config when running install targets Masahiro Yamada
2018-07-05  2:39 ` [PATCH v3 10/12] kbuild: do not update config for 'make kernelrelease' Masahiro Yamada
2018-07-05  2:39 ` [PATCH v3 11/12] kbuild: remove auto.conf and tristate.conf from prerequisites Masahiro Yamada
2018-07-05  2:39 ` [PATCH v3 12/12] kbuild: replace include/config/%.conf with include/config/auto.conf Masahiro Yamada
2018-07-10 11:34 ` [PATCH v3 00/12] kbuild/kconfig: do not update config during installation Dirk Gouders
2018-07-12  8:29   ` Masahiro Yamada
2018-07-13  7:44     ` Dirk Gouders

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1530758389-30862-5-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=dirk@gouders.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=torvalds@linux-foundation.org \
    --cc=ulfalizer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.