Thanks Gary -

After some exploration down this path, Bill Deegan pointed out that using a
generator would achieve the hoped for behavior without so much difficulty,
if we paid attention to the for_signature flag. I've implemented that and
it works well. You can see an example of the code here:

https://github.com/acmorrow/mongo/commit/d6135693efc098df145e52a3ef2b259b16f33505

Thanks,
Andrew

On Sun, Mar 25, 2018 at 2:28 PM, Gary Oberbrunner <ga...@oberbrunner.com>
wrote:

> From a quick perusal of the source, I think the function you're looking
> for is SCons/Node/__init__.py, Node.add_source(). That's called from
> Builder._execute().
>
> On Sun, Mar 25, 2018 at 2:05 PM, Andrew C. Morrow <
> andrew.c.mor...@gmail.com> wrote:
>
>>
>> Could you point me to where in the SCons sources that connection between
>> foo.o and foo.c is made, exactly? I'd like to understand how it happens.
>>
>> Regarding pseudo-builders: they don't compose, unfortunately. Once
>> something becomes a pseudo-builder it no longer exposes the attributes that
>> normal builders do. So I'd prefer to achieve this by injecting
>> scanners/emitters into the existing builders, if possible.
>>
>> On Sun, Mar 25, 2018 at 1:52 PM, Gary Oberbrunner <ga...@oberbrunner.com>
>> wrote:
>>
>>> The builder, in this case Object(), sets up the dependency between foo.o
>>> and foo.c. The simplest way to do what you want is to create a
>>> pseudo-builder that calls Object() and also calls Depends().
>>>
>>> -- Gary
>>>
>>> On Sun, Mar 25, 2018 at 1:07 PM, Andrew C. Morrow <
>>> andrew.c.mor...@gmail.com> wrote:
>>>
>>>>
>>>> I'm fairly clear on where SCons learns of the dependencies for source
>>>> files: that is in the CScanner attached to the SourceFileScanner in T
>>>> ool/__init__.py.
>>>>
>>>> But where does SCons determine the dependencies of object files, such
>>>> that those dependencies are checked to see if the object file needs to be
>>>> rebuilt?
>>>>
>>>> More concretely, If I have libfoo.so made from foo.o made from foo.c
>>>> which depends on foo.h, the CScanner in SourceScanner takes care of
>>>> scanning for dependences in foo.c and finds foo.h. But what scans for
>>>> dependences of foo.o and identifies foo.c?
>>>>
>>>> I ask because I would like to sometimes inject a new source-like
>>>> dependency into compilations, such that foo.o will depend on not just
>>>> foo.c but also some other file magic, such that if magic is changed
>>>> then foo.o will need to be rebuilt.
>>>>
>>>> With such a mechanism, it would be possible to teach SCons that if an
>>>> AddressSanitizer blacklist file known to be on the compile line like
>>>> -fsanitize-blacklist=path/to/magic is referring to a blacklist file
>>>> that is more up to date than the object file, then the object file should
>>>> be rebuilt.
>>>>
>>>> Thanks,
>>>> Andrew
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-dev mailing list
>>>> Scons-dev@scons.org
>>>> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Gary
>>>
>>> _______________________________________________
>>> Scons-dev mailing list
>>> Scons-dev@scons.org
>>> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>>>
>>>
>>
>> _______________________________________________
>> Scons-dev mailing list
>> Scons-dev@scons.org
>> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>>
>>
>
>
> --
> Gary
>
> _______________________________________________
> Scons-dev mailing list
> Scons-dev@scons.org
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>
>
_______________________________________________
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev

Reply via email to