public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Lacombe <lacombar@gmail.com>
To: linux-kbuild@vger.kernel.org
Cc: Michal Marek <mmarek@suse.cz>, Arnaud Lacombe <lacombar@gmail.com>
Subject: [RFCv4] Kbuild: factor parser rules
Date: Tue,  7 Jun 2011 16:52:11 -0400	[thread overview]
Message-ID: <1307479931-10424-1-git-send-email-lacombar@gmail.com> (raw)
In-Reply-To: <20110607152950.GA4612@sepie.suse.cz>

Hi Michal,

Here is some update concerning the parser generation merge. I do not repost the
whole serie as it may be overkill. You can find the latest branch at:

git://github.com/lacombar/linux-2.6.git kbuild-implicit-parser-rule

For the record, I did full test build in the following environment:

% cat allno.config 
CONFIG_SCSI=y
CONFIG_SCSI_LOWLEVEL=y
CONFIG_SCSI_AIC7XXX=y
CONFIG_SCSI_AIC79XX=y
CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
CONFIG_AIC79XX_REG_PRETTY_PRINT=y
CONFIG_NETDEVICES=y
CONFIG_NET=y
CONFIG_HDLC=y
CONFIG_EISA=y
CONFIG_PCI=y
CONFIG_VT=y
CONFIG_HW_CONSOLE=y
CONFIG_WAN=y
CONFIG_WANXL=y

% gmake CONFIG_DTC=y CONFIG_MODVERSIONS=y REGENERATE_PARSERS=1 \
    scripts allnoconfig vmlinux

finalize without error.

Then, re-started after having updated the parsers:

% touch scripts/*/*.[ly]

finalized without error.

Then, various combinaison of:

% git clean -fdx scripts/

% rm -f $(find . -name *_shipped | sed 's/_shipped//')

% rm -f $(find scripts/ -name '*_shipped') scripts/dtc/dtc-parser.tab.* scripts/genksyms/parse.tab.*

All build finalized without error.

You'll find an updated diff between v3 and v4 below.

Changes since v3:
 - fix the %_shipped implicit rule
 - attempt to tweak the relation between `$(src)/%.tab.c_shipped' and
   `$(src)/%.tab.h_shipped' to make it more robust. This is _very_ delicate as
   gmake has trouble to properly generate `$(obj)/%.tab.h' from
   `$(src)/%.tab.h_shipped' if it is missing and requires
   `$(src)/%.tab.c_shipped' to be created. This now survives a full deletion of
   the %_shipped files.
 - a few spacing nits
 - removes a few useless explicit dependency
 - do not degerate extra `lex.debug' file when regenerating kconfig's parser
 - removed missed occurences of YYDEBUG

Changes since v2:
 - allow a parser to specify the prefix to be used. This will allow for multiple
  parser to use the implicit rules, which was not previously possible, as it
  was using the `yy' default.
 - drop the zconf prefix changes
 - add a `baseprereq' global to kbuild, which mimics `basetarget'
 - rebase on top of v3.0-rc1

Changes since v1:
 - include scripts/dtc/' parser in the scope of the patchset
 - do not rename any parser source
 - make lexer file name consistent, ie. name it %.lex.c, not lex.%.c
 - rebase on top of v2.6.39

Regards,
 - Arnaud

Arnaud Lacombe (13):
      kbuild: add `baseprereq'
      kbuild: add implicit rules for parser generation
      kbuild: simplify the %_shipped rule
      genksyms: pass hash and lookup functions name and target language though the input file
      genksyms: migrate parser to implicit rules
      genksym: regen parser
      kconfig: constify `kconf_id_lookup'
      kconfig: kill no longer needed reference to YYDEBUG
      kconfig/zconf.l: do not ask to generate backup
      kconfig: migrate parser to implicit rules
      kconfig: regen parser
      dtc: migrate parser to implicit rules
      dtc: regen parser

---
 scripts/Makefile.lib      |   19 +++++--------------
 scripts/dtc/Makefile      |    3 +--
 scripts/genksyms/Makefile |    5 ++++-
 scripts/kconfig/zconf.l   |    4 ++--
 scripts/kconfig/zconf.y   |    2 --
 5 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index f76d9ba..ad062b7 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -161,10 +161,12 @@ modname-multi = $(sort $(foreach m,$(multi-used),\
 		$(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
 
 ifdef REGENERATE_PARSERS
+
 # GPERF
 # ---------------------------------------------------------------------------
 quiet_cmd_gperf = GPERF $@
       cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $<
+
 $(src)/%.hash.c_shipped: $(src)/%.gperf
 	$(call cmd,gperf)
 
@@ -180,10 +182,10 @@ $(src)/%.lex.c_shipped: $(src)/%.l
 # ---------------------------------------------------------------------------
 quiet_cmd_bison = YACC    $@
       cmd_bison = bison -o$@ -d -t -l -p $(if $(YACC_PREFIX_${baseprereq}),$(YACC_PREFIX_${baseprereq}),yy) $<
-$(src)/%.tab.c_shipped: $(src)/%.y
+
+$(src)/%.tab.c_shipped $(src)/%.tab.h_shipped: $(src)/%.y
 	$(call cmd,bison)
 
-$(src)/%.tab.h_shipped: $(src)/%.tab.c_shipped
 endif
 
 # Shipped files
@@ -192,20 +194,9 @@ endif
 quiet_cmd_shipped = SHIPPED $@
 cmd_shipped = cat $< > $@
 
-$(obj)/%.tab.c: $(src)/%.tab.c_shipped
-	$(call cmd,shipped)
-
-$(obj)/%.tab.h: $(src)/%.tab.h_shipped
+$(obj)/%: $(src)/%_shipped
 	$(call cmd,shipped)
 
-$(obj)/%.lex.c: $(src)/%.lex.c_shipped
-	$(call cmd,shipped)
-
-$(obj)/%.hash.c: $(src)/%.hash.c_shipped
-	$(call cmd,shipped)
-
-$(obj)/%:: $(src)/%_shipped
-
 # Commands useful for building a boot image
 # ===========================================================================
 # 
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 5bac1cb..a957ab4 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -26,7 +26,6 @@ HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
 
 # dependencies on generated files need to be listed explicitly
 $(obj)/dtc-parser.tab.o: $(obj)/dtc-parser.tab.c $(obj)/dtc-parser.tab.h
-$(obj)/dtc-lexer.lex.o:  $(obj)/dtc-lexer.lex.c $(obj)/dtc-parser.tab.h
 
-targets += dtc-parser.tab.c dtc-lexer.lex.c
+$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.c $(obj)/dtc-parser.tab.h
 
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index fdaf764..0b883e3 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -7,5 +7,8 @@ genksyms-objs	:= genksyms.o parse.tab.o lex.lex.o
 # -I needed for generated C source (shipped source)
 HOSTCFLAGS_parse.tab.o := -Wno-uninitialized -I$(src)
 
-$(obj)/lex.lex.o: $(obj)/parse.tab.h $(obj)/keywords.hash.c
+$(obj)/parse.tab.o: $(obj)/parse.tab.c $(obj)/parse.tab.h
+
+$(obj)/lex.lex.o: $(obj)/keywords.hash.c
+$(obj)/lex.lex.o: $(obj)/parse.tab.c $(obj)/parse.tab.h
 
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 98aad53..ddee5fc 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -1,5 +1,5 @@
-%option backup nostdinit noyywrap never-interactive full ecs
-%option 8bit backup nodefault perf-report perf-report
+%option nostdinit noyywrap never-interactive full ecs
+%option 8bit nodefault perf-report perf-report
 %option noinput
 %x COMMAND HELP STRING PARAM
 %{
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index f661b4c..c38cc5a 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -499,10 +499,8 @@ void conf_parse(const char *name)
 	modules_sym->flags |= SYMBOL_AUTO;
 	rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
 
-#if YYDEBUG
 	if (getenv("ZCONF_DEBUG"))
 		zconfdebug = 1;
-#endif
 	zconfparse();
 	if (zconfnerrs)
 		exit(1);

-- 
1.7.3.4.574.g608b.dirty

  parent reply	other threads:[~2011-06-07 20:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23  8:10 [RFCv2 00/13] Kbuild: factor parser rules Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 01/13] kbuild: add implicit rules for parser generation Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 02/13] genksyms: include the lexer from the parser Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 03/13] genksyms: pass hash and lookup functions name and target language though the input file Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 04/13] genksyms: migrate parser to implicit rules Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 05/13] genksym: regen parser Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 06/13] kconfig: constify `kconf_id_lookup' Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 07/13] kconfig: back-out parser prefix, from `zconf' to `yy' Arnaud Lacombe
2011-05-23  8:54   ` Yann E. MORIN
2011-05-23  9:07     ` Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 08/13] kconfig: kill no longer needed reference to YYDEBUG Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 09/13] kconfig: migrate parser to implicit rules Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 10/13] kconfig: regen parser Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 11/13] dtc: include the lexer from the parser Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 12/13] dtc: migrate parser to implicit rules Arnaud Lacombe
2011-05-23  8:10 ` [RFCv2 13/13] dtc: regen parser Arnaud Lacombe
2011-05-23  8:39 ` [RFCv2 00/13] Kbuild: factor parser rules Arnaud Lacombe
2011-05-24 10:47 ` Michal Marek
2011-05-24 14:18   ` Arnaud Lacombe
2011-06-03 17:16 ` [RFCv3] " Arnaud Lacombe
2011-06-07 15:29   ` Michal Marek
2011-06-07 15:52     ` Arnaud Lacombe
2011-06-07 20:52     ` Arnaud Lacombe [this message]
2011-06-07 21:27       ` [RFCv4] " Arnaud Lacombe
2011-06-08  5:03       ` [RFCv5] " Arnaud Lacombe
2011-06-08 15:38         ` Michal Marek
2011-06-08 16:11           ` Arnaud Lacombe
2011-06-08 20:34             ` Michal Marek
2011-06-08 21:10               ` Arnaud Lacombe
2011-06-09 12:09                 ` Michal Marek
2011-06-09 18:16                   ` Arnaud Lacombe
2011-06-23 21:07                     ` Michal Marek

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=1307479931-10424-1-git-send-email-lacombar@gmail.com \
    --to=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox