automake
[Top][All Lists]
Advanced

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

Re: How to use flex and bison with the C++ interface ?


From: Stefano Lattarini
Subject: Re: How to use flex and bison with the C++ interface ?
Date: Sat, 16 Jun 2012 11:40:24 +0200

On 06/15/2012 03:19 PM, Timothy Madden wrote:
> Hello
> 
> Can automake use flex and bison to generate .cc files from lexer.ll and 
> parser.yy files ?
>
Yes (with some limitations in the use of more advanced Bison features, sadly).

> I currently get this error from the make command:
> 
>     address@hidden code-formatter]$ make
>     /bin/sh ./ylwrap code-formatter.ll lex.yy.c code-formatter.cc \
>                                 -- flex
>
>     make: *** [code-formatter.cc] Error 1
>     address@hidden code-formatter]$
>
> I am new to automake and as you can see the message really doesn't tell me
> anything about what is going wrong.
>
> This is my Makefile.am:
> 
>     bin_PROGRAMS=code-formatter
>     code_formatter_SOURCES=code-formatter.ll code-formatter.yy
> 
This is wrong: it means the Automake-generated rules will try to generate
'code-formatter.cc' from both 'code-formatter.ll' and 'code-formatter.yy'.
Chaos will ensue.

You should use something like this instead:

    bin_PROGRAMS = code-formatter
    code_formatter_SOURCES = lexer.ll parser.yy

In case this suggestion doesn't solve your problem, please answer the
following questions (the details you've given would be too few for us
to attempt a proper diagnosis otherwise):

  - Which automake version are you using?
  - Which ylwrap version exactly?
  - On which system you are on?
  - What flex version are you using?
  - How do the relevant parts of the generated Makefile.in appear?
    (You can find this with "grep -C4 ylwrap Makefile.in").

Also, if you run this commands after the failure above:

  $ ls -la
  $ /bin/sh -x ./ylwrap code-formatter.ll lex.yy.c code-formatter.cc -- flex
  $ ls -la

what is their output?

> Am I missing something ? Do I need to write explicit makefile
> rules to use the C++ interface ?
> 
> Thank you,
> Timothy Madden
> 
> 

HTH,
  Stefano



reply via email to

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