Telling SCons to Not Duplicate Source Files in the Build Directory

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', build_dir='build', duplicate=0)
    

When this flag is specified, SCons uses the build directory like most people expect--that is, the output files are placed in the build 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