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

In most cases and with most tool sets, SCons can use sources directly from the source directory without duplicating them into the variant directory before building, and everything will work just fine. You can disable the default SCons duplication behavior by specifying duplicate=False when you call the SConscript function:

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

When this flag is specified, the results of a build look more like the mental model people may have from other build systems - that is, the output files end up in the variant directory while the source files do not.

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

If disabling duplication causes any problems, just return to the more cautious approach by letting SCons go back to duplicating files.