Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-01-10 07:05:44


Felix E. Klee wrote:
> Hi,
>
> I found another discrepancy between Boost 1.29.0 Jam and Perforce Jam 2.4. My
> Jamfile contains
> rule copy-it {
> DEPENDS all : $(1) ;
> }
> actions copy-it {
> cp $(1:S=.src) $(1)
> }
> copy-it foo.dst ;
> When calling it with Perforce Jam I get
> jam-2.4/bin.linuxx86/jam -d2 -sBOOST_ROOT=$HOME/local/lib/boost#
> ...found 8 target(s)...
> ...updating 1 target(s)...
> copy-it foo.dst
>
> cp foo.src foo.dst
>
> ...updated 1 target(s)...

In this case, default build system ("Jambase") is used, which loads Jamfile
and produces the effect you see. I believe that "-sBOOST_ROOT" has no effect.

> but when calling it with Boost Jam I get
> jam -d2 -sBOOST_ROOT=$HOME/local/lib/boost
> ...found 9 targets...
> ...updating 1 target...
> copy-it foo.dst
>
> cp foo.src foo.dst
>
> copy-it foo.dst
>
> cp foo.src foo.dst
>
> ...updated 1 target...

In this case, Boost.Build v1 is being used. It loads Jamfile *twice* and
it causes the effect you see.

> So, with Perfoce Jam the copy-it actions get called twice. Why is that?

Jamfile is loaded twice in this case for some impelementation reasons.
More generally, any given Jamfile may be loaded first when it's build,
and second when targets in it are used by other Jamfile.

> What am I doing wrong?

You should wrap every code which should not be executed twice in

if ! $(gIN_LIB_INCLUDE)
{
}

In Boost.Build V2 Jamfiles will be purely declarative, and we'll be able to
include them exactly once.

- Volodya

 


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