automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lex rule doesn't work when enabling C++ scanner with GNU Flex


From: Ossama Othman
Subject: lex rule doesn't work when enabling C++ scanner with GNU Flex
Date: 03 Jul 2004 02:52:44 -0700

Hi,

The rule for generating a file with a C++ source extension from a lex
".ll" file isn't correct for the case when someone enables C++ scanner
support in GNU Flex.  For example, specifying a file "lexer.ll" in the
"foo_SOURCES" variable of a given program "foo" causes the following
rule to be generated:

.ll.cc:
        $(LEXCOMPILE) $<
        sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@
        rm -f $(LEX_OUTPUT_ROOT).c

This rule assumes that $(LEX) will always generate a file with a `.c'
extension.  This assumption doesn't hold for GNU flex C++ scanners that
are enabled by specifying the "%option c++" option in the GNU flex input
file or by using the "-+" command line option.  In those cases, the
generated scanner will have a ".cc" extension.  For example:

        $ make lexer.cc
        flex   lexer.ll
        sed '/^#/ s|lex.yy\.c|lexer.cc|' lex.yy.c >lexer.cc
        sed: can't read lex.yy.c: No such file or directory
        make: *** [lexer.cc] Error 2

`lex.yy.c' doesn't exist, but 'lex.yy.cc' does exist.

Would it be possible for Automake to tweak the lex rule if "%option c++"
is found in the lex source/input file, or if the "-+" flag is found in
the $(AM_LFLAGS) make variable?

Thanks,
-Ossama
-- 
Ossama Othman <ossama @ dre . vanderbilt . edu>
1024D/F7A394A8 - 84ED AA0B 1203 99E4 1068  70E6 5EB7 5E71 F7A3 94A8






reply via email to

[Prev in Thread] Current Thread [Next in Thread]