util/cbfstool: Revise lex/yacc (bison) generation
Revise the Makefile.inc rules for generating FMD parser files. - lex: If --header-file is supported then the lex (usually flex) should also support '-o' so we don't need to do redirection (-t). - yacc: Bison is already required by bincfg and sconfig so we can change the default parser compiler to Bison. That also allows us to use -o and --defines to override the output files. - both: Line directives are only helpful when debugging the scanner and the parser, so we should remove them to get better git diff results (-L for lex, -l for bison). Also regenerated the shipped files with latest version of flex (2.6.4) and bison (3.8.2). Change-Id: I15b58ff65dcd9f3f3a6095aa004091ff733ffec3 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/75851 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
committed by
Martin L Roth
parent
a421ae99fb
commit
8cb45aadf7
@@ -267,20 +267,18 @@ $(objutil)/cbfstool/%: $(top)/util/cbfstool/%_shipped
|
||||
|
||||
ifeq ($(CONFIG_FMD_GENPARSER),y)
|
||||
TOOLLEX := lex
|
||||
TOOLYACC := yacc
|
||||
TOOLYACC := bison
|
||||
|
||||
# the .c rule also creates .h
|
||||
$(top)/util/cbfstool/fmd_scanner.h_shipped: $(top)/util/cbfstool/fmd_scanner.c_shipped
|
||||
$(top)/util/cbfstool/fmd_scanner.c_shipped: $(top)/util/cbfstool/fmd_scanner.l
|
||||
echo " LEX util/cbfstool/fmd_scanner.[ch]"
|
||||
$(TOOLLEX) -t --header-file=$(top)/util/cbfstool/fmd_scanner.h_shipped $< >$(top)/util/cbfstool/fmd_scanner.c_shipped
|
||||
$(TOOLLEX) -L -o $@ --header-file=$(patsubst %.c_shipped,%.h_shipped,$@) $<
|
||||
|
||||
# the .c rule also creates .h
|
||||
$(top)/util/cbfstool/fmd_parser.h_shipped: $(top)/util/cbfstool/fmd_parser.c_shipped
|
||||
$(top)/util/cbfstool/fmd_parser.c_shipped: $(top)/util/cbfstool/fmd_parser.y
|
||||
echo " YACC util/cbfstool/fmd_parser.[ch]"
|
||||
$(TOOLYACC) -d $<
|
||||
mv -f y.tab.c $(top)/util/cbfstool/fmd_parser.c_shipped
|
||||
mv -f y.tab.h $(top)/util/cbfstool/fmd_parser.h_shipped
|
||||
$(TOOLYACC) -l -o $@ --defines=$(patsubst %.c_shipped,%.h_shipped,$@) $<
|
||||
|
||||
endif # CONFIG_FMD_GENPARSER
|
||||
|
Reference in New Issue
Block a user