Boost logo

Boost-Build :

From: David Abrahams (dave_at_[hidden])
Date: 2005-02-15 14:03:55


Vladimir Prus <ghost_at_[hidden]> writes:

> On Tuesday 15 February 2005 17:39, David Abrahams wrote:
>
>> > What does not work in your case.
>>
>> compile c.cpp ;
>> obj c : c.cpp ;
>> time c-compilation : c.obj ;
>
> Quite reasonable, there's no main target called "c.obj".

I didn't exactly expect it to work, but I was trying to say that there
ought to be a way to get that effect.

Forget main targets for a moment. In BBv1, a jam target would be
created with that name, and it would depend on all the <whatever>c.obj
targets that existed. It is very useful, at least from the
command-line. For example, if you have

exe a : b.cpp c.cpp d.cpp ;

you can request

bjam c.obj

(on windows) and it will just try to compile c.cpp.

>> >> 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?
>>
>> That sounds reasonable. But then all of the following build requests
>> should also be possible:
>>
>> bjam c.obj
>> bjam c.exe
>
> Hmm... there's no main target named "c.exe".

We ought to automatically create the alias, or something.

>> bjam c # builds the exe
>>
>> and on unix,
>>
>> bjam c.o
>>
>> should probably work.
>
> I think this is overly smart. The '.obj' in main target name is not necessary
> related to file name. I should be able to write:
>
> obj c.object : c.cpp ; <- note 'obj' here.
> exe c : c.object ;
>
> or use any other suffix of my liking. Or, to avoid confusion, we can use
> 'grist':
>
> obj <object>c : c.cpp ; <- note 'obj' here.
> exe c : <object>object ;
>
>> So to translate that into what I'm doing, this should work:
>>
>> compile c.cpp ;
>> obj c.obj : c.cpp ;
>> time c-compilation : c.obj ;
>>
>> and only one copy of c.obj (or c.o if on Unix) should be built.
>
> Understood. I'll see how hard will be to implement this part (without allowing
> "c.o" in build request on Unix, I mean).

Well, I can live without the other feature for a while, but it does
come up as very useful in BBv1.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com
 

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