4.3.1 Environments

An Environment includes:

All build targets must be registered within an Environment. If the user does not specify a name for the environment, any build artifacts (e.g. dependency files, object files) will be located in a common directory underneath the build root which is shared by all unnamed environments. For example, for the Rsconscript:

env "myproj" do |env|
  env.Program("myprog.exe", glob("src/**/*.c"))
end

Rscons will place an object file and dependency file corresponding to each C source file under the Environment's build root. Assuming a top-level build directory of "build", the Environment's build root would be "build/myproj". This keeps the intermediate generated build artifacts separate from the source files. Source and target paths passed to a Builder (e.g. Program) can begin with "^/" to indicate that Rscons should expand those paths to be relative to the Environment's build root. If a source or target path passed to a Builder begins with "^^/", it is expanded to be relative to the Rscons top-level build directory (but outside the Environment's build root).