From: Vladimir Prus (ghost_at_[hidden])
Date: 2008-04-02 00:40:43
On Wednesday 02 April 2008 04:14:24 Khassapov, Alex wrote:
> Thanks to Volodya, I have dtrace generator working!
Ah, I see you've solved the duplicate target issue by explicitly
creating objs and then passing them on EXE generator.
I was going to sketch some code to make that unnecessary, but that was
going to be hacking for the time being.
> The generator produces an executable modified by dtrace. Now I realised
> that we also need a dtrace library generator. I could simply copy and
> modify the code from dtarce.jam (attached), but I wonder how to do it
> properly (bjam way)?
Well, I don't think "proper" way here is anyway different than in any language.
I think you can extract most of the code into a separate function, and then
the body of the 'run' method will be just:
return [ generators.construct $(project) $(name)
: EXE : $(property-set) : $(.libs)
[ process-objs ..... ] ] ;
and the lib generator would do the same. In fact, to make things even less
1. Define the generators __init__ rule as:
rule __init__ ( * : * )
generator.__init__ $(1) : $(2) : $(3) ;
self.supertype = $(4) ;
2. Instead of hardcoding EXE, use
3. Declare two generators like:
generators.register [ new dtrace-binary-generator dtrace.binary : : EXE : DTRACE_EXE ] ;
generators.register [ new dtrace-binary-generator dtrace.binary : : LIB : DTRACE_LIB ] ;
But I think that starting with two generators, and a common function extracted from current
'run' method should be fine.
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