I am writing a custom-linking-generator class (derived from
unix-linking-generator) with generated-targets rule that wants to
remove archive sources tagged with a special property from the sources
list before invoking unix-linking-generator.generated-targets.
For such archives I add a property to the target properties list
(e.g., <include-library-whole>path/libfoo.a)
that eventually results in the link action putting

-include_whole path/libfoo.a

in the link command line.  The problem is that in removing libfoo.a
from the source list passed to unix-linking-generator.generated-targets
I lose the DEPENDS of the target on libfoo.a that would have
been set had libfoo.a not been removed from the list.  Can someone
give me a pointer on how to do that in my custom generated-targets?

The code is presently as follows.  Am I taking undue liberties in
exploiting some private internals of virtual-targets?  It's the only way
I could find to get to the information I needed.


class hptns-linking-generator : unix-linking-generator
{
    # Provides special handling for <hptns-include-whole> archives
    rule generated-targets ( sources + : property-set : project name ? )
    {
        local sources2 ;
        local properties2 ;
        
        properties2 = [ $(property-set).raw ] ;
        for local s in $(sources)
        {
            if [ type.is-derived [ $(s).type ] STATIC_LIB ]
            {
                local a = [ $(s).action ] ;
                local ps ;
                local psraw ;
                if $(a)
                {
                    ps = [ $(a).properties ] ;
                    if $(ps)
                    {
                        psraw = [ $(ps).raw ] ;
                    }
                }
                if <hptns-include-whole>yes in $(psraw)
                {
                    local path = [ $(s).path ] ;
                    local name = [ $(s).name ] ;
                    #TBD- should I grist the path here as <p$(path)> instead of raw path?
                    properties2 += <hptns-include-whole-library>$(path)/$(name) ;
                    #TBD- how to DEPENDS target on this archive source?
                    #TBD- Uncomment following after adding DEPENDS
                    #s = ;
                }
            }
            if $(s)
            {
                sources2 += $(s) ;
            }
        }
        local spawn = [ unix-linking-generator.generated-targets $(sources)
                        : [ property-set.create $(properties2) ] : $(project) $(name) ] ;
        return $(spawn) ;
    }
}