17.3. Telling SCons to Not Duplicate Source Files in the Variant Directory Tree

In most cases and with most tool sets, SCons can place its target files in a build subdirectory without duplicating the source files and everything will work just fine. You can disable the default SCons behavior by specifying duplicate=0 when you call the SConscript function:


      SConscript('src/SConscript', variant_dir='build', duplicate=0)
    

When this flag is specified, SCons uses the variant directory like most people expect--that is, the output files are placed in the variant directory while the source files stay in the source directory:


      % ls src
      SConscript
      hello.c
      % scons -Q
      cc -c src/hello.c -o build/hello.o
      cc -o build/hello build/hello.o
      % ls build
      hello
      hello.o