If the repository tree contains the complete results of a build, and we try to build from the repository without any files in our local tree, something moderately surprising happens:
% mkdir $HOME/build2 % cd $HOME/build2 % scons -Q -Y /usr/all/repository hello scons: `hello' is up-to-date.
Why does SCons say that the hello program is up-to-date when there is no hello program in the local build directory? Because the repository (not the local directory) contains the up-to-date hello program, and SCons correctly determines that nothing needs to be done to rebuild that up-to-date copy of the file.
There are, however, many times when you want to ensure that a
local copy of a file always exists.
A packaging or testing script, for example,
may assume that certain generated files exist locally.
To tell SCons to make a copy of any up-to-date repository
file in the local build directory,
use the Local
function:
env = Environment() hello = env.Program('hello.c') Local(hello)
If we then run the same command, SCons will make a local copy of the program from the repository copy, and tell you that it is doing so:
% scons -Y /usr/all/repository hello Local copy of hello from /usr/all/repository/hello scons: `hello' is up-to-date.
(Notice that, because the act of making the local copy is not considered a "build" of the hello file, SCons still reports that it is up-to-date.)