This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


[snip]

> .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.

I have seen this problem as well.
 
> 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?

The documentation indicates that this feature is supposed to already exist
(I assume that this behaviour is a regression of some sort.)  In fact, I
assumed it would also turn on the "-+" flag for me given the way it
currently reads.  As it stands I had to supply my own rules for running
flex.

Take care,
     Dale
-- 
Dale E. Martin, Clifton Labs, Inc.
Senior Computer Engineer
dmartin@cliftonlabs.com
http://www.cliftonlabs.com
pgp key available



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]