Boost logo

Boost-Build :

From: Thomas Rolfs (thomas.rolfs_at_[hidden])
Date: 2004-07-07 17:27:00


I'm having a hard time trying to do a very simple build rule. I've been evaluating boost.jam for a few days now and like it a lot. However, documentation and examples are very terse and I haven't found any explicit examples of what I'm trying to do.

I'm using a tool called ANTLR. It's like lex and yacc in that it generates lexer and parser code from a grammar file:

grammar.g ---> lexer.cpp parser.cpp

I then try to create a rule to generate the lexer.cpp and parser.cpp:

rule antlr ( lexer parser : grammar )
{
Depends $(lexer) $(parser) : $(grammar) ;
}

actions antlr
{
java -cp antlr/antlr-2.7.3/antlr.jar antlr.Tool -o src/antlr $(<)
}

# apply the antlr rule to lexer.cpp and parser.cpp
antlr src/antlr/lexer.cpp src/antlr/parser.cpp : antlr/csl.g ;

The generated cpp files belong in a library.

lib mylib
: src/antlr/lexer.cpp
src/antlr/parser.cpp
src/antlr/other.cpp
src/other.cpp
: <link>static
<include>src
;

However, when I build the library it says:

error: Unable to resolve target-id src/antlr/lexer.cpp

I tried making a generator but it is not suitable for what I want. Even if the generator could generate two files I need the generated files to placedin src/antlr not in the build-dir tree.

I'm using Boost.Build V2 (M9.1) Boost.Jam 03.01.08 on windows.

Any pointers on how to get this to work would be greatly appreciated.

- Tommy. ------=_NextPart_000_0018_01C46436.D8E73860 Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I'm having a hard time trying to do a verysimple
build rule. I've been evaluating boost.jam for a few days now and like it alot.
However, documentation and examples are very terse and I haven't found any
explicit examples of what I'm trying to do.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I'm using a tool called ANTLR. It's like lex and
yacc in that it generates lexer and parser code&nbsp;from a grammar
file:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>grammar.g ---&gt; lexer.cpp parser.cpp</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>I then try to create a rule to generate the
lexer.cpp and parser.cpp:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>rule antlr ( lexer parser : grammar
)<BR>{<BR>&nbsp;&nbsp;&nbsp; Depends $(lexer) $(parser) : $(grammar)
;<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>actions antlr<BR>{<BR>&nbsp;&nbsp;&nbsp; java -cp
antlr/antlr-2.7.3/antlr.jar antlr.Tool -o src/antlr $(&lt;)<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2># apply the antlr rule to lexer.cpp and
parser.cpp</FONT></DIV>
<DIV><FONT face=Arial size=2>antlr&nbsp;src/antlr/lexer.cpp
src/antlr/parser.cpp&nbsp; : antlr/csl.g&nbsp; ;<BR></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>The generated cpp files&nbsp;belong in&nbsp;a library.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>lib mylib</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp; :&nbsp; src/antlr/lexer.cpp</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;
src/antlr/parser.cpp</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;
src/antlr/other.cpp</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp; src/other.cpp</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp; : &lt;link&gt;static</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &lt;include&gt;src</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp; ;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>However, when I build the library it
says:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>error: Unable to resolve target-id
src/antlr/lexer.cpp</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I tried making a generator but it is not suitable
for what I want. Even if the generator could generate two files I need the
generated files to placed in src/antlr not in the build-dir tree.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I'm using Boost.Build V2 (M9.1) Boost.Jam 03.01.08
on windows.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Any pointers on how to get this to work would be
greatly appreciated.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>- Tommy.</FONT></DIV></BODY></HTML>
 ------=_NextPart_000_0018_01C46436.D8E73860--


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk