title: Configuring SCons to use separate tools for code generation and assembly
body: <p>I am trying to prepare a build system using SCons. I want to use <code>clang</code> for the code generation phase and a custom compiler toolchain for everything else.</p>
  
  <p>By default, the SCons configuration does not have an explicit step in which the assembly <code>(.s)</code> files are generated.</p>
  
  <p>In order to get around this, I created my own <code>Builder</code> which emits assembly files.</p>
  
  <pre><code>code_generator = Builder(action = '$CC -$LOTS_OF_FLAGS -S $SOURCE -o $TARGET', suffix = '.s')
  env.Append(BUILDERS = {'CodeGenerator':code_generator})
  </code></pre>
  
  <p>I then use this <code>Builder</code> on my source files and pass the resulting <code>NodeList</code> to the <code>Program</code>.</p>
  
  <pre><code>for file in Glob('*.c'):
    sources += env.CodeGenerator(file)
  
  env.Program('say_hello', sources) 
  </code></pre>
  
  <p>This works well when I do not modify any variables. I get an executable using <code>gcc</code>.</p>
  
  <p>However, when I try to replace the appropriate variables so that SCons uses the custom toolchain (using <code>env.Replace(CC='clang')...</code>),  only one assembly file is generated. My custom <code>Builder</code> is not called on any other file and SCons tries to link with only one object file (which obviously fails)</p>
  
  <ol>
  <li>How can I make SCons run the builder on all files and include those
  object files for linking?</li>
  <li>Is there a better way to accomplish what I
  am trying to do? I am just beginning to work with SCons.</li>
  </ol>