Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-02-15 04:53:13


On Saturday 12 February 2005 23:31, David Abrahams wrote:
> testing.jam now contains a new rule called "time" that can be used to
> measure the length of a build step (including a step that runs an
> executable). For example:
>
> import testing ;
>
> compile c.cpp ;
> obj c-obj : c.cpp ;
> compile-fail c-f.cpp ;
> run r.cpp : : dir/input.txt ;
> run-fail r-f.cpp ;
> time execution : r ; # <- here
> time compilation : c-obj ; # <- here

Cool. Do I understand that it only measures the time to build the top-level
target (here, 'r' and 'c-obj' and does not include any dependencies?). E.g.
for

time build_time : program_options ;

I get:

user: [program_options-gcc-d_1.32.0.so.1.32.0] 0.000023
system: [program_options-gcc-d_1.32.0.so.1.32.0] 0.000015

which is time for linking, not for full build.

> Volodya, regarding the above, I found it impossible to time the
> compilation of the object file created as a result of
>
> compile c.cpp
>
> because there was no way to name the intermediate OBJ target
> produced. Adding
>
> obj c : c.cpp ;
> time c-compilation : c.obj ;
>
> doesn't work, and neither does
>
> time c-compilation : c ;

For a Jamroot that contains only:

obj c : c.cpp ;
time c-compilation : c ;

I get:

gcc.compile.c++ bin/gcc/debug/c.o
testing.time bin/gcc/debug/c-compilation.time
user: [c.o] 0.000002
system: [c.o] 0.000002

What does not work in your case.

> I'm a little confused about what's going on here -- it seems as though
> we're being stopped by the built-in limitation that says two main
> targets can't have the same name. But surely it ought to be possible
> to write
>
> obj c : c.cpp ;
> exe c : c.obj ;
>
> or something very similar and simple. No?

It's hard to guess if user meant two alternatives or two independent targets.
I though we need to allow some 'grist' in this cases, say:

obj c.obj : c.cpp ; <- note 'obj' here.
exe c : c.obj ;

When calling generator, we should strip the ".obj" from "c.obj" so that suffix
can actually vary between platforms. What do you think?

- 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