summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorArnaud Lacombe <lacombar@gmail.com>2011-05-23 00:04:43 -0400
committerArnaud Lacombe <lacombar@gmail.com>2011-06-09 14:04:38 -0400
commit7373f4f83c71d50f0aece6d94309ab7fde42180f (patch)
tree328b386b2251c0d8ecca19fcde3dc03409de3142 /scripts
parente0318d85be66ff1ff55c4cbc832cb3ee9e669da8 (diff)
downloadlinux-7373f4f83c71d50f0aece6d94309ab7fde42180f.tar.bz2
kbuild: add implicit rules for parser generation
Cc: David Gibson <david@gibson.dropbear.id.au> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 93b2b5938a2e..b0d0c7a189f7 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -160,6 +160,44 @@ 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
+# ---------------------------------------------------------------------------
+LEX_PREFIX = $(if $(LEX_PREFIX_${baseprereq}),$(LEX_PREFIX_${baseprereq}),yy)
+
+quiet_cmd_flex = LEX $@
+ cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $<
+
+$(src)/%.lex.c_shipped: $(src)/%.l
+ $(call cmd,flex)
+
+# YACC
+# ---------------------------------------------------------------------------
+YACC_PREFIX = $(if $(YACC_PREFIX_${baseprereq}),$(YACC_PREFIX_${baseprereq}),yy)
+
+quiet_cmd_bison = YACC $@
+ cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $<
+
+$(src)/%.tab.c_shipped: $(src)/%.y
+ $(call cmd,bison)
+
+quiet_cmd_bison_h = YACC $@
+ cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $<
+
+$(src)/%.tab.h_shipped: $(src)/%.y
+ $(call cmd,bison_h)
+
+endif
+
# Shipped files
# ===========================================================================