The internal SCons subsystem that handles walking the dependency graph and controls the decision-making about what to rebuild is the Taskmaster. SCons supports a --taskmastertrace option that tells the Taskmaster to print information about the children (dependencies) of the various Nodes on its walk down the graph, which specific dependent Nodes are being evaluated, and in what order.
The --taskmastertrace option takes as an argument the name of a file in which to put the trace output, with - (a single hyphen) indicating that the trace messages should be printed to the standard output:
env = Environment(CPPPATH = ['.']) env.Program('prog.c')
% scons -Q --taskmastertrace=- prog Taskmaster: Looking for a node to evaluate Taskmaster: Considering node <no_state 0 'prog'> and its children: Taskmaster: <no_state 0 'prog.o'> Taskmaster: adjusting ref count: <pending 1 'prog'> Taskmaster: Considering node <no_state 0 'prog.o'> and its children: Taskmaster: <no_state 0 'prog.c'> Taskmaster: <no_state 0 'inc.h'> Taskmaster: adjusting ref count: <pending 1 'prog.o'> Taskmaster: adjusting ref count: <pending 2 'prog.o'> Taskmaster: Considering node <no_state 0 'prog.c'> and its children: Taskmaster: Evaluating <pending 0 'prog.c'> Taskmaster: Looking for a node to evaluate Taskmaster: Considering node <no_state 0 'inc.h'> and its children: Taskmaster: Evaluating <pending 0 'inc.h'> Taskmaster: Looking for a node to evaluate Taskmaster: Considering node <pending 0 'prog.o'> and its children: Taskmaster: <up_to_date 0 'prog.c'> Taskmaster: <up_to_date 0 'inc.h'> Taskmaster: Evaluating <pending 0 'prog.o'> cc -o prog.o -c -I. prog.c Taskmaster: Looking for a node to evaluate Taskmaster: Considering node <pending 0 'prog'> and its children: Taskmaster: <executed 0 'prog.o'> Taskmaster: Evaluating <pending 0 'prog'> cc -o prog prog.o Taskmaster: Looking for a node to evaluate Taskmaster: No candidate anymore.
The --taskmastertrace option doesn't provide information about the actual calculations involved in deciding if a file is up-to-date, but it does show all of the dependencies it knows about for each Node, and the order in which those dependencies are evaluated. This can be useful as an alternate way to determine whether or not your SCons configuration, or the implicit dependency scan, has actually identified all the correct dependencies you want it to.