Subject: Re: [Boost-build] Re-link target
From: John Bito (jwbito_at_[hidden])
Date: 2009-08-14 12:07:57
I have a target rule that I call 'relinkable' that produces a .o file
by linking obj and static lib options together. Maybe you can get
something useful starting from that.
The key is to create a generator that either creates something that
can be consumed by the existing EXE generators or consumes an EXE. My
approach was to generate a subtype of OBJ so it can (I think) be
consumed by an EXE generator.
My code's below. Note that it's still a hack-stage, so the action code
is non-portable and it doesn't inherit options like debug flags.
=== relinkable.jam ===
import toolset : flags ;
import "class" : new ;
import type ;
import targets ;
import project ;
import unix ;
import generators ;
type.register RELINKABLE_OBJ : : OBJ ;
generators.register [ new unix-linking-generator relinkable.link : OBJ
STATIC_LIB : RELINKABLE_OBJ : <toolset>sun ] ;
rule relinkable ( target-name : sources * : requirements * : default-build * )
local project = [ project.current ] ;
[ new typed-target $(target-name) : $(project) : RELINKABLE_OBJ
: [ targets.main-target-sources $(sources) : $(target-name) ]
: [ targets.main-target-requirements $(requirements) : $(project) ]
: [ targets.main-target-default-build $(default-build) : $(project) ]
flags relinkable.link LIBRARIES <library-file> ;
actions link bind LIBRARIES
/usr/ccs/bin/ld -r -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)"
On Thu, Aug 13, 2009 at 12:19, Craig Bosma<craig.bosma_at_[hidden]> wrote:
> I've read the documentation and have been using boost-build for a
> while now, but haven't found a way to re-link an executable without
> recompiling (-a) or deleting the build products. Is there a better way
> to make bjam/boost-build re-execute the linking stage only?
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
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