Boost logo

Boost-Build :

Subject: Re: [Boost-build] Partial linking
From: Phillip Seaver (phil_at_[hidden])
Date: 2012-01-23 13:55:10


On 1/23/12 1:28 PM, Nogradi, Chris wrote:
>
> Has anyone used Boost.build to do partial linking? I am trying to do this:
>
> obj O : [ glob *.c ] ;
>
> to create a partially linked object that can then be used later like this:
>
> exe E : main.cpp O ;
>
> But it appears that each input produces a matching output for the obj
> rule because I get a duplicate name of actual target for O.obj
>
> There are many reasons to do this but my immediate application is in
> an embedded environment where it is especially useful to link groups
> of code at particular memory locations which I don’t think can be
> accomplished using static libs (i.e. archives).
>
> The compile.c action (for gcc for example) seems to suggest that
> multiple sources and targets can be used but I don’t understand how:
>
> rule compile.c ( targets * : sources * : properties * )
>
> The closest relevant article I could find on this in the mailing list
> is this:
>
> http://thread.gmane.org/gmane.comp.lib.boost.build/12134
>
> But no answer was provided. The suggestion in the same article for
> using multiple source inputs to the compiler seems relevant maybe?
>
> Thanks,
>
> Chris
>

I don't know if there's a built-in way to do what you want, but you can
do something like this:

    local main_objs ;
    for local s in [ glob *.c ] {
    obj $(s:B) : $(s) ;
    main_objs += $(s:B) ;
    }
    exe main : main.cpp $(main_objs) ;

Phillip


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