automake
[Top][All Lists]
Advanced

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

RE: lex & yacc with C++ projects


From: Robert Collins
Subject: RE: lex & yacc with C++ projects
Date: Fri, 26 Apr 2002 21:59:50 +1000

> -----Original Message-----
> From: Guido Draheim [mailto:address@hidden 
> Sent: Friday, April 26, 2002 9:49 PM

> aaaahhh. even though I need some enlightment what's wrong with a
> libstdc++ dependency for a c++ compiled source - so your project
> uses c++ files without libstdc++ and you want to include a parser 
> but that would bring you an unwanted lib-dependency?

Yes.
 
> anyway, since I'm thinking about it, I am wondering if the 
> following could work - what do you think about such rules...
> 
> .lo.tab.c :
>    $(LTCXXCOMPILE) -c $<
> 
> .o.tab.c :
>    $(CXXCOMPILE) -c $<
> 
> ... or does that not work with `make`? hmmm, just wondering...

These are the current rules:

fooparse.cc fooparse.h: fooparse.y
        bison -d -o fooparse.cc $(srcdir)/fooparse.y
        @mv fooparse.cc.h fooparse.h 2>/dev/null || mv fooparse.hh
fooparse.h

foolex.cc: foolex.l fooparse.h
        flex -8 $(srcdir)/foolex.l
        mv lex.yy.c foolex.cc

BUILT_SOURCES = fooparse.cc foolex.cc

... and in the PROGRAMS fooparse.cc foolex.cc fooparse.h

what would be great would be

in the _PROGRAMS fooparse.y foolex.l

LEX_LANG = CXX
YACC_LANG = CXX

or something similar (with the explicit behaviour that the lexx and yacc
mode will still be std C output.)

Rob



reply via email to

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