26.7. 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: Looking for a node to evaluate
      Taskmaster:     Considering node <no_state   'prog'> and its children:
      Taskmaster:        <no_state   'prog.o'>
      Taskmaster:     Considering node <no_state   'prog.o'> and its children:
      Taskmaster:        <no_state   'prog.c'>
      Taskmaster:        <no_state   'inc.h'>
      Taskmaster:     Considering node <no_state   'prog.c'> and its children:
      Taskmaster: Evaluating <pending    'prog.c'>
      
      Taskmaster: Looking for a node to evaluate
      Taskmaster:     Considering node <no_state   'inc.h'> and its children:
      Taskmaster: Evaluating <pending    'inc.h'>
      
      Taskmaster: Looking for a node to evaluate
      Taskmaster:     Considering node <pending    'prog.o'> and its children:
      Taskmaster:        <up_to_date 'prog.c'>
      Taskmaster:        <up_to_date 'inc.h'>
      Taskmaster: Evaluating <pending    'prog.o'>
      cc -o prog.o -c -I. prog.c
      
      Taskmaster: Looking for a node to evaluate
      Taskmaster:     Considering node <pending    'prog'> and its children:
      Taskmaster:        <executed   'prog.o'>
      Taskmaster: Evaluating <pending    '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.