SCons User Guide 0.93

Steven Knight

version 0.93

Table of Contents
Preface
SCons Principles
Acknowledgements
Contact
Simple Builds
The SConstruct File
Making the Output Less Verbose
Compiling Multiple Source Files
Keeping SConstruct Files Easy to Read
Keyword Arguments
Compiling Multiple Programs
Sharing Source Files Between Multiple Programs
Building and Linking with Libraries
Building Libraries
Linking with Libraries
Finding Libraries: the LIBPATH Construction Variable
Dependencies
Source File Signatures
MD5 Source File Signatures
Source File Time Stamps
Target File Signatures
Build Signatures
File Contents
Implicit Dependencies: The CPPPATH Construction Variable
Caching Implicit Dependencies
The --implicit-deps-changed Option
The --implicit-deps-unchanged Option
The Ignore Method
The Depends Method
Construction Environments
Multiple Construction Environments
Copying Construction Environments
Fetching Values From a Construction Environment
Modifying a Construction Environment
Replacing Values in a Construction Environment
Appending to the End of Values in a Construction Environment
Appending to the Beginning of Values in a Construction Environment
Default Targets
Providing Build Help
Installing Files in Other Directories
Installing Multiple Files in a Directory
Installing a File Under a Different Name
Installing Multiple Files Under Different Names
Preventing Removal of Targets
Hierarchical Builds
SConscript Files
Path Names Are Relative to the SConscript Directory
Top-Level Path Names in Subsidiary SConscript Files
Absolute Path Names
Sharing Environments (and Other Variables) Between SConscript Files
Exporting Variables
Importing Variables
Returning Values From an SConscript File
Separating Source and Build Directories
Specifying a Build Directory as Part of an SConscript Call
Why SCons Duplicates Source Files in a Build Directory
Telling SCons to Not Duplicate Source Files in the Build Directory
The BuildDir Function
Using BuildDir With an SConscript File
Variant Builds
Writing Your Own Builders
Writing Builders That Execute External Commands
Attaching a Builder to a Construction Environment
Letting SCons Handle The File Suffixes
Builders That Execute Python Functions
Builders That Create Actions Using a Generator
Builders That Modify the Target or Source Lists Using an Emitter
Not Writing a Builder: The Command Builder
Writing Scanners
A Simple Scanner Example
Building From Code Repositories
The Repository Method
Finding source files in repositories
Finding the SConstruct file in repositories
Finding derived files in repositories
Guaranteeing local copies of files
Caching Built Files
Specifying the Shared Cache Directory
Keeping Build Output Consistent
Not Retrieving Files From a Shared Cache
Populating a Shared Cache With Already-Built Files
Alias Targets