[Scons-users] Re-2: Re-2: Code generation dependency problem

Dirk Bächle tshortik at gmx.de
Mon Dec 8 14:22:32 EST 2014

Hi Roman,

 > Apart from that, after reading the thread, I'm a bit confused why 
scons finds the generated *.cpp file in my case.
 > I'm confused because I collect the source files with the Glob() 
function, but the generated file actually does not
 > already exist when the parsing is done (this is my understanding at 
 > What's the magic that is happening here?

there's no real magic involved. SCons internally keeps track of all 
"Nodes" (targets/sources) in a separate structure, which I like to refer 
to as Virtual File System.
A "Node" is an abstraction of a file or directory, and it's used to 
track all information about it...like whether it's up-to-date, how it's 
rebuilt if required, and so on. The dependencies between targets and 
sources are defined on this "net of nodes", if you will...and that's why 
the files don't have to exist physically in the "reading phase" of an 
SCons run. There are exceptions, like when you generate a C header that 
then includes even more headers. That's handled during the "build 
phase", because you obviously can't scan the header file unles it 
physically exists.
But for the simple dependencies target->source, that get defined by 
calling a Builder (which internally invokes its Emitter), SCons simply 
knows that the target Node "will exist at some point in time later 
on"...so you can already link a dependency to it, or use it as a source 
file for another build step.

Am I right in assuming that you're German? Then you might want to have a 
look at my talk 
http://pyvideo.org/video/2409/scons-software-bauen-in-python (see also 
the http://www.scons.org/wiki/TalksAndSlides page for links to the 
slides). It contains a graphic that shows the processing inside SCons in 
some detail.



P.S.: The video to my latest talk ( 
http://www.pycon.fr/2014/schedule/presentation/25/ ) hasn't been 
published yet. :(

More information about the Scons-users mailing list