user guide: document an Environment a bit more

This commit is contained in:
Josh Holtrop 2019-06-14 15:08:42 -04:00
parent dbd8b47bf9
commit 5b67ad88d3

View File

@ -369,13 +369,32 @@ source files found recursively under the `src` directory.
### Environments
An Environment is a collection of:
An Environment includes:
- construction variables
- build hooks
- registered build targets
- a collection of construction variables
- a collection of build hooks
- a collection of user-registered build targets
- a build root
All build targets must be registered within an `Environment`.
The Environment's build root is a directory created within the top-level
Rscons build directory.
By default it holds all intermediate files generated by Rscons that are needed
to produce a user-specified build target.
For example, for the `Rsconscript`:
```ruby
build do
Environment.new do |env|
env.Program("myprog.exe", glob("src/**/*.c"))
end
end
```
Rscons will place an object file and dependency file corresponding to each C
source file under the Environment's build root.
This keeps the intermediate generated build artifacts separate from the source
files.
### Specifying Source Files: The glob Method