Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-10-18 08:53:28


badyaev_alexey <leemouse <at> mail.ru> writes:

> Sorry for my terrible English.

No problem.

> I need build some project with very complicated source file generators.
> I have file with grammar:
> parser.lemon
> I write simple generator lemon.jam and he work good.
> At that we get two files: parser.h and parser.c

I am assuming you are using BBv2...

You can look at the lex.jam and bison.jam files in the tools
directory (boost/tools/build/v2/tools/bison.jam).

generators.register-standard lemon.lemon : LEMON
: C H C(%_opcodes) H(%_opcodes) ;

Here
$(>) refers to the input file (parser.lemon)
$(<[1]) and $(<[2]) refer to parser.c and parser.h respectively
$(<[3]) and $(<[4]) refer to parser_opcodes.c and parser_opcodes.h
respectively

If you want to retain the opcodes.[h/c] names you could try

: C H C(opcodes) H(opcodes) ;

Then you have:

actions lemon
{
do_lemon -o $(<[1]) $(>)
...
}

> Then i use second command for generate header file:
> cat parse.h vdbe.c | awk -f mkopcodeh.awk >opcodes.h

In actions lemon, add:
cat $(<[2]) vdbe.c | awk -f mkopcodeh.awk > $(<[4])

> Then i use second command for generate source file:
> sort -n -b +2 opcodes.h | awk -f mkopcodec.awk >opcodes.c

In actions lemon, add:
sort -n -b +2 $(<[4]) | awk -f mkopcodec.awk > $(<[3])

> At last I want include produced soure file (opcodes.c) in my main
> target.

Doing:

exe citrus : main.c parser.lemon ;

should be enough - bjam will pick up and compile both parser.c and
parser_opcodes.c.

> How I can do it??? Help me please.

HTH,
Reece

 


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