From: Arnaud Lacombe <lacombar@gmail.com>
To: linux-kbuild@vger.kernel.org
Cc: Michal Marek <mmarek@suse.cz>, Arnaud Lacombe <lacombar@gmail.com>
Subject: [RFC 7/9] kbuild: merge parser generation rules
Date: Wed, 4 May 2011 22:03:22 -0400 [thread overview]
Message-ID: <1304561004-2684-8-git-send-email-lacombar@gmail.com> (raw)
In-Reply-To: <1304561004-2684-1-git-send-email-lacombar@gmail.com>
---
scripts/Makefile.lib | 31 ++++++++++++++++++++++++++++++-
scripts/genksyms/Makefile | 20 --------------------
scripts/kconfig/Makefile | 25 -------------------------
3 files changed, 30 insertions(+), 46 deletions(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 1c702ca..74a73de 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -160,13 +160,42 @@ ld_flags = $(LDFLAGS) $(ldflags-y)
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)
+
+# LEX
+# ---------------------------------------------------------------------------
+quiet_cmd_flex = LEX $@
+ cmd_flex = flex -L -P$(notdir $*) -o$@ $<
+$(src)/lex.%.c_shipped: $(src)/%.l
+ $(call cmd,flex)
+
+# YACC
+# ---------------------------------------------------------------------------
+quiet_cmd_bison = YACC $@
+ cmd_bison = bison -o$@ -l -b $* -p $(notdir $*) $<
+$(src)/%.tab.c_shipped: $(src)/%.y
+ $(call cmd,bison)
+endif
+
# Shipped files
# ===========================================================================
quiet_cmd_shipped = SHIPPED $@
cmd_shipped = cat $< > $@
-$(obj)/%:: $(src)/%_shipped
+$(obj)/%.tab.c: $(src)/%.tab.c_shipped
+ $(call cmd,shipped)
+
+$(obj)/lex.%.c: $(src)/lex.%.c_shipped
+ $(call cmd,shipped)
+
+$(obj)/%.hash.c: $(src)/%.hash.c_shipped
$(call cmd,shipped)
# Commands useful for building a boot image
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index de6675d..e3295a8 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -14,23 +14,3 @@ clean-files := genksyms.tab.c lex.genksyms.c genksyms.hash.c
$(obj)/genksyms.tab.o: $(obj)/lex.genksyms.c $(obj)/genksyms.hash.c
-ifdef GENKSYMS_GENPARSER
-
-$(obj)/genksyms.tab.c: $(src)/genksyms.y
-$(obj)/lex.genksyms.c: $(src)/genksyms.l
-$(obj)/genksyms.hash.c: $(src)/genksyms.gperf
-
-%.tab.c: %.y
- bison -l -b $* -p $(notdir $*) $<
- cp $@ $@_shipped
-
-lex.%.c: %.l
- flex -L -P$(notdir $*) -o$@ $<
- cp $@ $@_shipped
-
-%.hash.c: %.gperf
- gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $<
- cp $@ $@_shipped
-
-endif
-
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 368ae30..c9ec4d6 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -327,28 +327,3 @@ $(obj)/lkc_defs.h: $(src)/lkc_proto.h
$(obj)/gconf.glade.h: $(obj)/gconf.glade
intltool-extract --type=gettext/glade $(obj)/gconf.glade
-###
-# The following requires flex/bison/gperf
-# By default we use the _shipped versions, uncomment the following line if
-# you are modifying the flex/bison src.
-# LKC_GENPARSER := 1
-
-ifdef LKC_GENPARSER
-
-$(obj)/zconf.tab.c: $(src)/zconf.y
-$(obj)/lex.zconf.c: $(src)/zconf.l
-$(obj)/zconf.hash.c: $(src)/zconf.gperf
-
-%.tab.c: %.y
- bison -l -b $* -p $(notdir $*) $<
- cp $@ $@_shipped
-
-lex.%.c: %.l
- flex -L -P$(notdir $*) -o$@ $<
- cp $@ $@_shipped
-
-%.hash.c: %.gperf
- gperf < $< > $@
- cp $@ $@_shipped
-
-endif
--
1.7.3.4.574.g608b.dirty
next prev parent reply other threads:[~2011-05-05 2:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-05 2:03 [RFC 0/9] Kbuild: factor parser rules Arnaud Lacombe
2011-05-05 2:03 ` [RFC 2/9] genksyms: finalize rename Arnaud Lacombe
2011-05-05 2:06 ` Arnaud Lacombe
2011-05-05 14:23 ` Michal Marek
2011-05-23 2:17 ` Arnaud Lacombe
2011-05-23 3:32 ` Arnaud Lacombe
2011-05-05 2:03 ` [RFC 3/9] genksyms: pass hash and lookup functions name and target language though the input file Arnaud Lacombe
2011-05-05 2:03 ` [RFC 4/9] genksyms: regen parser Arnaud Lacombe
2011-05-05 2:03 ` [RFC 5/9] kconfig: constify `kconf_id_lookup' Arnaud Lacombe
2011-05-05 2:03 ` [RFC 6/9] kconfig: regen parsers Arnaud Lacombe
2011-05-05 2:03 ` Arnaud Lacombe [this message]
2011-05-05 13:32 ` [RFC 7/9] kbuild: merge parser generation rules Michal Marek
2011-05-05 14:50 ` Arnaud Lacombe
2011-05-05 2:03 ` [RFC 8/9] kconfig: regen parser Arnaud Lacombe
2011-05-05 2:03 ` [RFC 9/9] genksyms: " Arnaud Lacombe
[not found] ` <1304561004-2684-2-git-send-email-lacombar@gmail.com>
2011-05-05 14:18 ` [RFC 1/9] genksyms: rename parser files Michal Marek
2011-05-23 2:06 ` Arnaud Lacombe
2011-05-23 5:48 ` Arnaud Lacombe
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=1304561004-2684-8-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