Skip to content

Commit

Permalink
kbuild: add implicit rules for parser generation
Browse files Browse the repository at this point in the history
Cc: David Gibson <[email protected]>
Cc: Michal Marek <[email protected]>
Signed-off-by: Arnaud Lacombe <[email protected]>
  • Loading branch information
lacombar committed Jun 9, 2011
1 parent e0318d8 commit 7373f4f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ===========================================================================

Expand Down

0 comments on commit 7373f4f

Please sign in to comment.