[Scons-users] Pulling information out of sconsign

Evan Driscoll driscoll at cs.wisc.edu
Mon May 16 22:48:55 EDT 2016


I have perhaps somewhat of a strange question. I would like to be able 
to pull information out about what SCons builds for input to other 
tools. In other words, I want what command lines are run during the 
build. Obviously something that's generated by a Python function or 
something would be out-of-scope.

There are some programs out there that can watch an arbitrary build and 
come up with that list, but I figured that it might be better for SCons 
users to grab them out of the sconsign file, since SCons "happens" to 
keep that information around anyway.

...or so I thought.

I played around with sconsign.py for a while, and from what I can tell, 
it looks like only the unexpanded command line is stored. For example:

$ scons-local/scons.py  -Q
g++ -o main.o -c main.cpp
g++ -o my-program main.o

$ scons-local/sconsign.py -a .sconsign.dblite
=== .:
SConstruct:
main.cpp:
main.o:
         f72bb500d79e0c1126b5ddbdd0d0e795 [$CXX -o $TARGET -c $CXXFLAGS 
$CCFLAGS $_CCCOMCOM $SOURCES]
my-program:
         300ad4d70c13ca0a3cd54f1fa0bcae6d [$LINK -o $TARGET $LINKFLAGS 
$__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS]
=== /usr/bin:
g++:

(The above is with scons-local 2.5.0, but that's not the only version 
I've mucked about with.)

But I don't see a way to get information about what $CXXFLAGS, etc. 
expanded to at the time of compilation.

I also tried mucking about, modifying sconsign.py to print out objects 
at a lower level and stuff like that. While very interesting, I also 
didn't seemingly make any progress on it.

I'm now thinking that what I want isn't there... but am I missing 
something and it really is?


(Alternatively, my main motivation is to spit out something like the 
Compilation Database that the LLVM folks defined. 
http://clang.llvm.org/docs/JSONCompilationDatabase.html  Is there an 
alternative way to get something that could be easily turned into that?)

Evan



More information about the Scons-users mailing list