How is SCons Making Its Decisions? the --taskmastertrace Option

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: 'prog': children:
          ['prog.o']
          waiting on unstarted children:
          ['prog.o']
      Taskmaster: 'prog.o': children:
          ['inc.h', 'prog.c']
          evaluating prog.o
      cc -o prog.o -c -I. prog.c
      Taskmaster: 'prog': children:
          ['prog.o']
          evaluating prog
      cc -o prog prog.o
      Taskmaster: 'prog': already handled (executed)
    

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.