Boost logo

Boost-Build :

Subject: Re: [Boost-build] Partial linking
From: Nogradi, Chris (Chris.Nogradi_at_[hidden])
Date: 2012-01-23 14:03:19


Thanks Phillip for your quick response. I am however needing to create a partially linked object file that contains a list of compiled files. For my compiler this looks something like this:

Compile file.c into file.o
Compile file2.c into file2.o
Compile file3.c into file3.o

Partial Link inputs <file.o file2.o file3.o> into partial_output.o

Chris

-----Original Message-----
From: boost-build-bounces_at_[hidden] [mailto:boost-build-bounces_at_[hidden]] On Behalf Of Phillip Seaver
Sent: Monday, January 23, 2012 12:55 PM
To: boost-build_at_[hidden]
Subject: Re: [Boost-build] Partial linking

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
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies.

Thank you for your cooperation.


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