[Scons-users] Overriding Object to force global dependency

Kyle J Strand Kyle.Strand at beckman.com
Thu Jun 28 15:25:18 EDT 2012


The env.Object() "method" IS the Object builder (specifically, it's a
synonym for StaticObject(), according to the man page). That doesn't mean
that it's only involved in the "late" step of actually passing commands to
the compiler and linker. On the contrary, it's part of how SCons starts to
gather information for building the dependency tree, so I don't see any
reason why your proposed plan of using it to add dependencies shouldn't
work. That's not to say that this is the best way to do it, though. One
alternative might be to just use a loop or glob of some sort to feed all
the source code files to the env.Depends() function; this sounds a little
rough to me, but it may be the easiest solution. Another possibility is
that you could write your own Scanner.

-----------------------------------------------------------------------
Kyle Strand, Software Intern
Beckman Coulter, Inc., Life Sciences Division
4862 Innovation Drive, Fort Collins, Colorado, 80525
(970) 204-7036

scons-users-bounces at scons.org wrote on 06/28/2012 12:27:42 PM:


> Greg Ward <greg at gerg.ca>

> Sent by: scons-users-bounces at scons.org

>

> 06/28/2012 12:27 PM

>

> Please respond to

> SCons users mailing list <scons-users at scons.org>

>

> To

>

> SCons users mailing list <scons-users at scons.org>

>

> cc

>

> scons-users-bounces at scons.org

>

> Subject

>

> Re: [Scons-users] Overriding Object to force global dependency

>

> On 28 June 2012, Kyle J Strand said:

> > The env.AddMethod() method isn't actually what you want; try this:

> >

> > env['BUILDERS']['Object'] = Object

> >

> > I tested this by printing env.Dump('BUILDERS') before and after this

> > command, cloning the environment to env2, and printing

> > env2.Dump('BUILDERS'), and looks like it works exactly as intended.

>

> Alas, that doesn't work. I don't actually need to override the Object

> builder, because there's nothing wrong with how it calls g++. What I

> need to override is the env.Object() method that tells SCons about

> foo.cpp and foo.o in the first place.

>

> That is: I need to sneak an additional dependency into the graph

> (early), not interfere with the build itself (late).

>

> So, my original question stands: how do I artificially inject an

> additional dependency into the graph for every single *.o file? The

> dependency is known early, so there's no reason to try to inject it

> late, at build time.

>

> Greg

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users


The server made the following annotations

---------------------------------------------------------------------------------

This message contains information that may be privileged or confidential and is the property of Beckman Coulter, Inc. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

---------------------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120628/2e1bf118/attachment.htm>


More information about the Scons-users mailing list