slackware-current/source/d/scons/scons.1
Patrick J Volkerding 98e52ba8a5 Mon Jul 20 17:37:10 UTC 2020
a/kernel-firmware-20200716_1d1c80b-noarch-1.txz:  Upgraded.
ap/mc-4.8.25-x86_64-1.txz:  Upgraded.
d/nasm-2.15.03-x86_64-1.txz:  Upgraded.
d/scons-4.0.1-x86_64-1.txz:  Upgraded.
l/imagemagick-7.0.10_24-x86_64-1.txz:  Upgraded.
l/jasper-2.0.18-x86_64-1.txz:  Upgraded.
l/libcap-2.40-x86_64-1.txz:  Upgraded.
l/libpsl-0.21.1-x86_64-2.txz:  Rebuilt.
n/dnsmasq-2.82-x86_64-1.txz:  Upgraded.
x/xev-1.2.4-x86_64-1.txz:  Upgraded.
2020-07-21 08:59:53 +02:00

19958 lines
521 KiB
Groff

'\" t
.\" Title: SCONS
.\" Author: Steven Knight
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: <pubdate>2004 - 2019</pubdate>
.\" Manual: SCons 3.1.2
.\" Source: SCons 3.1.2 version 3.1.2
.\" Language: English
.\"
.TH "SCONS" "1" "<pubdate>2004 - 2019</pubdate>" "SCons 3\&.1\&.2 version 3.1.2" "SCons 3\&.1\&.2"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
scons \- a software construction tool
.SH "SYNOPSIS"
.HP \w'\fBscons\fR\ 'u
\fBscons\fR [\fIoptions\fR...] [\fIname=val\fR...] [\fItargets\fR...]
.SH "DESCRIPTION"
.PP
The
\fBscons\fR
utility builds software (or other files) by determining which component pieces must be rebuilt and executing the necessary commands to rebuild them\&.
.PP
By default,
\fBscons\fR
searches for a file named
\fISConstruct\fR,
\fISconstruct\fR,
\fIsconstruct\fR,
\fISConstruct\&.py\fR
\fISconstruct\&.py\fR
or
\fIsconstruct\&.py\fR
(in that order) in the current directory and reads its configuration from the first file found\&. An alternate file name may be specified via the
\fB\-f\fR
option\&.
.PP
The
\fISConstruct\fR
file can specify subsidiary configuration files using the
\fBSConscript\fR() function\&. By convention, these subsidiary files are named
\fISConscript\fR, although any name may be used\&. (Because of this naming convention, the term "SConscript files" is sometimes used to refer generically to all
\fBscons\fR
configuration files, regardless of actual file name\&.)
.PP
The configuration files specify the target files to be built, and (optionally) the rules to build those targets\&. Reasonable default rules exist for building common software components (executable programs, object files, libraries), so that for most software projects, only the target and input files need be specified\&.
.PP
Before reading the
\fISConstruct\fR
file,
\fBscons\fR
looks for a directory named
\fIsite_scons\fR
in various system directories (see below) and the directory containing the
\fISConstruct\fR
file; for each of those dirs which exists,
\fIsite_scons\fR
is prepended to sys\&.path, the file
\fIsite_scons/site_init\&.py\fR, is evaluated if it exists, and the directory
\fIsite_scons/site_tools\fR
is prepended to the default toolpath if it exists\&. See the
\fB\-\-no\-site\-dir\fR
and
\fB\-\-site\-dir\fR
options for more details\&.
.PP
\fBscons\fR
reads and executes the SConscript files as Python scripts, so you may use normal Python scripting capabilities (such as flow control, data manipulation, and imported Python libraries) to handle complicated build situations\&.
\fBscons\fR, however, reads and executes all of the SConscript files
\fIbefore\fR
it begins building any targets\&. To make this obvious,
\fBscons\fR
prints the following messages about what it is doing:
.sp
.if n \{\
.RS 4
.\}
.nf
$ scons foo\&.out
scons: Reading SConscript files \&.\&.\&.
scons: done reading SConscript files\&.
scons: Building targets \&.\&.\&.
cp foo\&.in foo\&.out
scons: done building targets\&.
$
.fi
.if n \{\
.RE
.\}
.PP
The status messages (everything except the line that reads "cp foo\&.in foo\&.out") may be suppressed using the
\fB\-Q\fR
option\&.
.PP
\fBscons\fR
does not automatically propagate the external environment used to execute
\fBscons\fR
to the commands used to build target files\&. This is so that builds will be guaranteed repeatable regardless of the environment variables set at the time
\fBscons\fR
is invoked\&. This also means that if the compiler or other commands that you want to use to build your target files are not in standard system locations,
\fBscons\fR
will not find them unless you explicitly set the
\fBPATH\fR
to include those locations\&. Whenever you create an
\fBscons\fR
construction environment, you can propagate the value of
\fBPATH\fR
from your external environment as follows:
.sp
.if n \{\
.RS 4
.\}
.nf
import os
env = Environment(ENV = {\*(AqPATH\*(Aq : os\&.environ[\*(AqPATH\*(Aq]})
.fi
.if n \{\
.RE
.\}
.PP
Similarly, if the commands use external environment variables like
\fBPATH\fR,
\fBHOME\fR,
\fBJAVA_HOME\fR,
\fBLANG\fR,
\fBSHELL\fR,
\fBTERM\fR, etc\&., these variables can also be explicitly propagated:
.sp
.if n \{\
.RS 4
.\}
.nf
import os
env = Environment(ENV = {\*(AqPATH\*(Aq: os\&.environ[\*(AqPATH\*(Aq],
\*(AqHOME\*(Aq: os\&.environ[\*(AqHOME\*(Aq]})
.fi
.if n \{\
.RE
.\}
.PP
Or you may explicitly propagate the invoking user\*(Aqs complete external environment:
.sp
.if n \{\
.RS 4
.\}
.nf
import os
env = Environment(ENV = os\&.environ)
.fi
.if n \{\
.RE
.\}
.PP
This comes at the expense of making your build dependent on the user\*(Aqs environment being set correctly, but it may be more convenient for many configurations\&.
.PP
\fBscons\fR
can scan known input files automatically for dependency information (for example, #include statements in C or C++ files) and will rebuild dependent files appropriately whenever any "included" input file changes\&.
\fBscons\fR
supports the ability to define new scanners for unknown input file types\&.
.PP
\fBscons\fR
knows how to fetch files automatically from SCCS or RCS subdirectories using SCCS, RCS or BitKeeper\&.
.PP
\fBscons\fR
is normally executed in a top\-level directory containing a
\fISConstruct\fR
file, optionally specifying as command\-line arguments the target file or files to be built\&.
.PP
By default, the command
.sp
.if n \{\
.RS 4
.\}
.nf
scons
.fi
.if n \{\
.RE
.\}
.PP
will build all target files in or below the current directory\&. Explicit default targets (to be built when no targets are specified on the command line) may be defined in the SConscript file(s) using the
\fBDefault()\fR
function, described below\&.
.PP
Even when
\fBDefault()\fR
targets are specified in the SConscript file(s), all target files in or below the current directory may be built by explicitly specifying the current directory (\&.) as a command\-line target:
.sp
.if n \{\
.RS 4
.\}
.nf
scons \&.
.fi
.if n \{\
.RE
.\}
.PP
Building all target files, including any files outside of the current directory, may be specified by supplying a command\-line target of the root directory (on POSIX systems):
.sp
.if n \{\
.RS 4
.\}
.nf
scons /
.fi
.if n \{\
.RE
.\}
.PP
or the path name(s) of the volume(s) in which all the targets should be built (on Windows systems):
.sp
.if n \{\
.RS 4
.\}
.nf
scons C:\e D:\e
.fi
.if n \{\
.RE
.\}
.PP
To build only specific targets, supply them as command\-line arguments:
.sp
.if n \{\
.RS 4
.\}
.nf
scons foo bar
.fi
.if n \{\
.RE
.\}
.PP
in which case only the specified targets will be built (along with any derived files on which they depend)\&.
.PP
Specifying "cleanup" targets in SConscript files is not usually necessary\&. The
\fB\-c\fR
flag removes all files necessary to build the specified target:
.sp
.if n \{\
.RS 4
.\}
.nf
scons \-c \&.
.fi
.if n \{\
.RE
.\}
.PP
to remove all target files, or:
.sp
.if n \{\
.RS 4
.\}
.nf
scons \-c build export
.fi
.if n \{\
.RE
.\}
.PP
to remove target files under build and export\&. Additional files or directories to remove can be specified using the
\fBClean()\fR
function\&. Conversely, targets that would normally be removed by the
\fB\-c\fR
invocation can be prevented from being removed by using the
\fBNoClean\fR() function\&.
.PP
A subset of a hierarchical tree may be built by remaining at the top\-level directory (where the
\fISConstruct\fR
file lives) and specifying the subdirectory as the target to be built:
.sp
.if n \{\
.RS 4
.\}
.nf
scons src/subdir
.fi
.if n \{\
.RE
.\}
.PP
or by changing directory and invoking scons with the
\fB\-u\fR
option, which traverses up the directory hierarchy until it finds the
\fISConstruct\fR
file, and then builds targets relatively to the current subdirectory:
.sp
.if n \{\
.RS 4
.\}
.nf
cd src/subdir
scons \-u \&.
.fi
.if n \{\
.RE
.\}
.PP
\fBscons\fR
supports building multiple targets in parallel via a
\fB\-j\fR
option that takes, as its argument, the number of simultaneous tasks that may be spawned:
.sp
.if n \{\
.RS 4
.\}
.nf
scons \-j 4
.fi
.if n \{\
.RE
.\}
.PP
builds four targets in parallel, for example\&.
.PP
\fBscons\fR
can maintain a cache of target (derived) files that can be shared between multiple builds\&. When caching is enabled in a SConscript file, any target files built by
\fBscons\fR
will be copied to the cache\&. If an up\-to\-date target file is found in the cache, it will be retrieved from the cache instead of being rebuilt locally\&. Caching behavior may be disabled and controlled in other ways by the
\fB\-\-cache\-force\fR,
\fB\-\-cache\-disable\fR,
\fB\-\-cache\-readonly\fR, and
\fB\-\-cache\-show\fR
command\-line options\&. The
\fB\-\-random\fR
option is useful to prevent multiple builds from trying to update the cache simultaneously\&.
.PP
Values of variables to be passed to the SConscript file(s) may be specified on the command line:
.sp
.if n \{\
.RS 4
.\}
.nf
scons debug=1 \&.
.fi
.if n \{\
.RE
.\}
.PP
These variables are available in SConscript files through the ARGUMENTS dictionary, and can be used in the SConscript file(s) to modify the build in any way:
.sp
.if n \{\
.RS 4
.\}
.nf
if ARGUMENTS\&.get(\*(Aqdebug\*(Aq, 0):
env = Environment(CCFLAGS = \*(Aq\-g\*(Aq)
else:
env = Environment()
.fi
.if n \{\
.RE
.\}
.PP
The command\-line variable arguments are also available in the ARGLIST list, indexed by their order on the command line\&. This allows you to process them in order rather than by name, if necessary\&. ARGLIST[0] returns a tuple containing (argname, argvalue)\&. A Python exception is thrown if you try to access a list member that does not exist\&.
.PP
\fBscons\fR
requires either Python 2\&.7 or Python 3\&.5 or higher\&. There should be no other dependencies or requirements to run
\fBscons\&.\fR
.PP
By default,
\fBscons\fR
knows how to search for available programming tools on various systems\&. On Windows systems,
\fBscons\fR
searches in order for the Microsoft Visual C++ tools, the MinGW tool chain, the Intel compiler tools, and the PharLap ETS compiler\&. On OS/2 systems,
\fBscons\fR
searches in order for the OS/2 compiler, the GCC tool chain, and the Microsoft Visual C++ tools, On SGI IRIX, IBM AIX, Hewlett Packard HP\-UX, and Sun Solaris systems,
\fBscons\fR
searches for the native compiler tools (MIPSpro, Visual Age, aCC, and Forte tools respectively) and the GCC tool chain\&. On all other platforms, including POSIX (Linux and UNIX) platforms,
\fBscons\fR
searches in order for the GCC tool chain, the Microsoft Visual C++ tools, and the Intel compiler tools\&. You may, of course, override these default values by appropriate configuration of Environment construction variables\&.
.SH "OPTIONS"
.PP
In general,
\fBscons\fR
supports the same command\-line options as GNU
\fBmake\fR, and many of those supported by
\fBcons\fR\&.
.PP
\-b
.RS 4
Ignored for compatibility with non\-GNU versions of
\fBmake\&.\fR
.RE
.PP
\-c, \-\-clean, \-\-remove
.RS 4
Clean up by removing all target files for which a construction command is specified\&. Also remove any files or directories associated to the construction command using the
\fBClean\fR() function\&. Will not remove any targets specified by the
\fBNoClean\fR() function\&.
.RE
.PP
\-\-cache\-debug=\fIfile\fR
.RS 4
Print debug information about the
\fBCacheDir\fR() derived\-file caching to the specified
\fIfile\fR\&. If
\fIfile\fR
is
\fB\-\fR
(a hyphen), the debug information are printed to the standard output\&. The printed messages describe what signature file names are being looked for in, retrieved from, or written to the
\fBCacheDir\fR() directory tree\&.
.RE
.PP
\-\-cache\-disable, \-\-no\-cache
.RS 4
Disable the derived\-file caching specified by
\fBCacheDir\fR()\&.
\fBscons\fR
will neither retrieve files from the cache nor copy files to the cache\&.
.RE
.PP
\-\-cache\-force, \-\-cache\-populate
.RS 4
When using
\fBCacheDir\fR(), populate a cache by copying any already\-existing, up\-to\-date derived files to the cache, in addition to files built by this invocation\&. This is useful to populate a new cache with all the current derived files, or to add to the cache any derived files recently built with caching disabled via the
\fB\-\-cache\-disable\fR
option\&.
.RE
.PP
\-\-cache\-readonly
.RS 4
Use the cache (if enabled) for reading, but do not not update the cache with changed files\&.
.RE
.PP
\-\-cache\-show
.RS 4
When using
\fBCacheDir\fR() and retrieving a derived file from the cache, show the command that would have been executed to build the file, instead of the usual report, "Retrieved `file\*(Aq from cache\&." This will produce consistent output for build logs, regardless of whether a target file was rebuilt or retrieved from the cache\&.
.RE
.PP
\-\-config=\fImode\fR
.RS 4
This specifies how the
\fBConfigure\fR
call should use or generate the results of configuration tests\&. The option should be specified from among the following choices:
.RE
.PP
\-\-config=auto
.RS 4
scons will use its normal dependency mechanisms to decide if a test must be rebuilt or not\&. This saves time by not running the same configuration tests every time you invoke scons, but will overlook changes in system header files or external commands (such as compilers) if you don\*(Aqt specify those dependecies explicitly\&. This is the default behavior\&.
.RE
.PP
\-\-config=force
.RS 4
If this option is specified, all configuration tests will be re\-run regardless of whether the cached results are out of date\&. This can be used to explicitly force the configuration tests to be updated in response to an otherwise unconfigured change in a system header file or compiler\&.
.RE
.PP
\-\-config=cache
.RS 4
If this option is specified, no configuration tests will be rerun and all results will be taken from cache\&. Note that scons will still consider it an error if \-\-config=cache is specified and a necessary test does not yet have any results in the cache\&.
.RE
.PP
\-C\fI directory\fR, \-\-directory=\fIdirectory\fR
.RS 4
Change to the specified
\fIdirectory\fR
before searching for the
\fISConstruct\fR,
\fISconstruct\fR,
\fIsconstruct\fR,
\fISConstruct\&.py\fR
\fISconstruct\&.py\fR
or
\fIsconstruct\&.py\fR
file, or doing anything else\&. Multiple
\fB\-C\fR
options are interpreted relative to the previous one, and the right\-most
\fB\-C\fR
option wins\&. (This option is nearly equivalent to
\fB\-f directory/SConstruct\fR, except that it will search for
\fISConstruct\fR,
\fISconstruct\fR,
\fIsconstruct\fR,
\fISConstruct\&.py\fR
\fISconstruct\&.py\fR
or
\fIsconstruct\&.py\fR
in the specified directory\&.)
.RE
.PP
\-D
.RS 4
Works exactly the same way as the
\fB\-u\fR
option except for the way default targets are handled\&. When this option is used and no targets are specified on the command line, all default targets are built, whether or not they are below the current directory\&.
.RE
.PP
\-\-debug=\fItype\fR[\fI,type\fR\&.\&.\&.]
.RS 4
Debug the build process\&.
\fItype\fR
specifies the kind of debugging info to emit\&. Multiple types may be specified, separated by commas\&. The following entries show the recognized types:
.RE
.PP
\-\-debug=action\-timestamps
.RS 4
Prints additional time profiling information\&. For each command, shows the absolute start and end times\&. This may be useful in debugging parallel builds\&. Implies the
\fB\-\-debug=time\fR
option\&.
.sp
Since
scons
3\&.1\&.
.RE
.PP
\-\-debug=count
.RS 4
Print how many objects are created of the various classes used internally by SCons before and after reading the SConscript files and before and after building targets\&. This is not supported when SCons is executed with the Python
\fB\-O\fR
(optimized) option or when the SCons modules have been compiled with optimization (that is, when executing from
\fB*\&.pyo\fR
files)\&.
.RE
.PP
\-\-debug=duplicate
.RS 4
Print a line for each unlink/relink (or copy) of a variant file from its source file\&. Includes debugging info for unlinking stale variant files, as well as unlinking old targets before building them\&.
.RE
.PP
\-\-debug=explain
.RS 4
Print an explanation of precisely why
\fBscons\fR
is deciding to (re\-)build any targets\&. (Note: this does not print anything for targets that are
\fInot\fR
rebuilt\&.)
.RE
.PP
\-\-debug=findlibs
.RS 4
Instruct the scanner that searches for libraries to print a message about each potential library name it is searching for, and about the actual libraries it finds\&.
.RE
.PP
\-\-debug=includes
.RS 4
Print the include tree after each top\-level target is built\&. This is generally used to find out what files are included by the sources of a given derived file:
.sp
.if n \{\
.RS 4
.\}
.nf
$ scons \-\-debug=includes foo\&.o
.fi
.if n \{\
.RE
.\}
.RE
.PP
\-\-debug=memoizer
.RS 4
Prints a summary of hits and misses using the Memoizer, an internal subsystem that counts how often SCons uses cached values in memory instead of recomputing them each time they\*(Aqre needed\&.
.RE
.PP
\-\-debug=memory
.RS 4
Prints how much memory SCons uses before and after reading the SConscript files and before and after building targets\&.
.RE
.PP
\-\-debug=objects
.RS 4
Prints a list of the various objects of the various classes used internally by SCons\&.
.RE
.PP
\-\-debug=pdb
.RS 4
Re\-run SCons under the control of the pdb Python debugger\&.
.RE
.PP
\-\-debug=prepare
.RS 4
Print a line each time any target (internal or external) is prepared for building\&.
\fBscons\fR
prints this for each target it considers, even if that target is up to date (see also \-\-debug=explain)\&. This can help debug problems with targets that aren\*(Aqt being built; it shows whether
\fBscons\fR
is at least considering them or not\&.
.RE
.PP
\-\-debug=presub
.RS 4
Print the raw command line used to build each target before the construction environment variables are substituted\&. Also shows which targets are being built by this command\&. Output looks something like this:
.sp
.if n \{\
.RS 4
.\}
.nf
$ scons \-\-debug=presub
Building myprog\&.o with action(s):
$SHCC $SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPINCFLAGS \-c \-o $TARGET $SOURCES
\&.\&.\&.
.fi
.if n \{\
.RE
.\}
.RE
.PP
\-\-debug=stacktrace
.RS 4
Prints an internal Python stack trace when encountering an otherwise unexplained error\&.
.RE
.PP
\-\-debug=time
.RS 4
Prints various time profiling information:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The time spent executing each individual build command
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The total build time (time SCons ran from beginning to end)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The total time spent reading and executing SConscript files
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The total time spent SCons itself spend running (that is, not counting reading and executing SConscript files)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The total time spent executing all build commands
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The elapsed wall\-clock time spent executing those build commands
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The time spent processing each file passed to the
\fISConscript()\fR
function
.RE
.sp
(When
\fBscons\fR
is executed without the
\fB\-j\fR
option, the elapsed wall\-clock time will typically be slightly longer than the total time spent executing all the build commands, due to the SCons processing that takes place in between executing each command\&. When
\fBscons\fR
is executed
\fIwith\fR
the
\fB\-j\fR
option, and your build configuration allows good parallelization, the elapsed wall\-clock time should be significantly smaller than the total time spent executing all the build commands, since multiple build commands and intervening SCons processing should take place in parallel\&.)
.RE
.PP
\-\-diskcheck=\fItypes\fR
.RS 4
Enable specific checks for whether or not there is a file on disk where the SCons configuration expects a directory (or vice versa), and whether or not RCS or SCCS sources exist when searching for source and include files\&. The
\fItypes\fR
argument can be set to:
\fBall\fR, to enable all checks explicitly (the default behavior);
\fBnone\fR, to disable all such checks;
\fBmatch\fR, to check that files and directories on disk match SCons\*(Aq expected configuration;
\fBrcs\fR, to check for the existence of an RCS source for any missing source or include files;
\fBsccs\fR, to check for the existence of an SCCS source for any missing source or include files\&. Multiple checks can be specified separated by commas; for example,
\fB\-\-diskcheck=sccs,rcs\fR
would still check for SCCS and RCS sources, but disable the check for on\-disk matches of files and directories\&. Disabling some or all of these checks can provide a performance boost for large configurations, or when the configuration will check for files and/or directories across networked or shared file systems, at the slight increased risk of an incorrect build or of not handling errors gracefully (if include files really should be found in SCCS or RCS, for example, or if a file really does exist where the SCons configuration expects a directory)\&.
.RE
.PP
\-\-duplicate=\fIORDER\fR
.RS 4
There are three ways to duplicate files in a build tree: hard links, soft (symbolic) links and copies\&. The default behaviour of SCons is to prefer hard links to soft links to copies\&. You can specify different behaviours with this option\&.
\fIORDER\fR
must be one of
\fIhard\-soft\-copy\fR
(the default),
\fIsoft\-hard\-copy\fR,
\fIhard\-copy\fR,
\fIsoft\-copy\fR
or
\fIcopy\fR\&. SCons will attempt to duplicate files using the mechanisms in the specified order\&.
.RE
.PP
\-\-enable\-virtualenv
.RS 4
Import virtualenv\-related variables to SCons\&.
.RE
.PP
\-f\fI file\fR, \-\-file=\fIfile\fR, \-\-makefile=\fIfile\fR, \-\-sconstruct=\fIfile\fR
.RS 4
Use
\fIfile\fR
as the initial SConscript file\&. Multiple
\fB\-f\fR
options may be specified, in which case
\fBscons\fR
will read all of the specified files\&.
.RE
.PP
\-h, \-\-help
.RS 4
Print a local help message for this build, if one is defined in the SConscript file(s), plus a line that describes the
\fB\-H\fR
option for command\-line option help\&. If no local help message is defined, prints the standard help message about command\-line options\&. Exits after displaying the appropriate message\&.
.RE
.PP
\-H, \-\-help\-options
.RS 4
Print the standard help message about command\-line options and exit\&.
.RE
.PP
\-i, \-\-ignore\-errors
.RS 4
Ignore all errors from commands executed to rebuild files\&.
.RE
.PP
\-I\fI directory\fR, \-\-include\-dir=\fIdirectory\fR
.RS 4
Specifies a
\fIdirectory\fR
to search for imported Python modules\&. If several
\fB\-I\fR
options are used, the directories are searched in the order specified\&.
.RE
.PP
\-\-ignore\-virtualenv
.RS 4
Suppress importing virtualenv\-related variables to SCons\&.
.RE
.PP
\-\-implicit\-cache
.RS 4
Cache implicit dependencies\&. This causes
\fBscons\fR
to use the implicit (scanned) dependencies from the last time it was run instead of scanning the files for implicit dependencies\&. This can significantly speed up SCons, but with the following limitations:
.RE
.PP
\fBscons\fR
will not detect changes to implicit dependency search paths (e\&.g\&.
\fBCPPPATH\fR,
\fBLIBPATH\fR) that would ordinarily cause different versions of same\-named files to be used\&.
.PP
\fBscons\fR
will miss changes in the implicit dependencies in cases where a new implicit dependency is added earlier in the implicit dependency search path (e\&.g\&.
\fBCPPPATH\fR,
\fBLIBPATH\fR) than a current implicit dependency with the same name\&.
.PP
\-\-implicit\-deps\-changed
.RS 4
Forces SCons to ignore the cached implicit dependencies\&. This causes the implicit dependencies to be rescanned and recached\&. This implies
\fB\-\-implicit\-cache\fR\&.
.RE
.PP
\-\-implicit\-deps\-unchanged
.RS 4
Force SCons to ignore changes in the implicit dependencies\&. This causes cached implicit dependencies to always be used\&. This implies
\fB\-\-implicit\-cache\fR\&.
.RE
.PP
\-\-install\-sandbox=\fIpath\fR
.RS 4
When using the
\fBInstall\fR
functions, prepend
\fIpath\fR
to the installation paths such that all installed files will be placed underneath
\fIpath\fR\&.
.RE
.PP
\-\-interactive
.RS 4
Starts SCons in interactive mode\&. The SConscript files are read once and a
\fBscons>>>\fR
prompt is printed\&. Targets may now be rebuilt by typing commands at interactive prompt without having to re\-read the SConscript files and re\-initialize the dependency graph from scratch\&.
.sp
SCons interactive mode supports the following commands:
.PP
\fBbuild\fR\fI[OPTIONS] [TARGETS] \&.\&.\&.\fR
.RS 4
Builds the specified
\fITARGETS\fR
(and their dependencies) with the specified SCons command\-line
\fIOPTIONS\fR\&.
\fBb\fR
and
\fBscons\fR
are synonyms\&.
.sp
The following SCons command\-line options affect the
\fBbuild\fR
command:
.sp
.if n \{\
.RS 4
.\}
.nf
\-\-cache\-debug=FILE
\-\-cache\-disable, \-\-no\-cache
\-\-cache\-force, \-\-cache\-populate
\-\-cache\-readonly
\-\-cache\-show
\-\-debug=TYPE
\-i, \-\-ignore\-errors
\-j N, \-\-jobs=N
\-k, \-\-keep\-going
\-n, \-\-no\-exec, \-\-just\-print, \-\-dry\-run, \-\-recon
\-Q
\-s, \-\-silent, \-\-quiet
\-\-taskmastertrace=FILE
\-\-tree=OPTIONS
.fi
.if n \{\
.RE
.\}
.RE
.sp
Any other SCons command\-line options that are specified do not cause errors but have no effect on the
\fBbuild\fR
command (mainly because they affect how the SConscript files are read, which only happens once at the beginning of interactive mode)\&.
.PP
\fBclean\fR\fI[OPTIONS] [TARGETS] \&.\&.\&.\fR
.RS 4
Cleans the specified
\fITARGETS\fR
(and their dependencies) with the specified options\&.
\fBc\fR
is a synonym\&. This command is itself a synonym for
\fBbuild \-\-clean\fR
.RE
.PP
\fBexit\fR
.RS 4
Exits SCons interactive mode\&. You can also exit by terminating input (CTRL+D on UNIX or Linux systems, CTRL+Z on Windows systems)\&.
.RE
.PP
\fBhelp\fR\fI[COMMAND]\fR
.RS 4
Provides a help message about the commands available in SCons interactive mode\&. If
\fICOMMAND\fR
is specified,
\fBh\fR
and
\fB?\fR
are synonyms\&.
.RE
.PP
\fBshell\fR\fI[COMMANDLINE]\fR
.RS 4
Executes the specified
\fICOMMANDLINE\fR
in a subshell\&. If no
\fICOMMANDLINE\fR
is specified, executes the interactive command interpreter specified in the
\fBSHELL\fR
environment variable (on UNIX and Linux systems) or the
\fBCOMSPEC\fR
environment variable (on Windows systems)\&.
\fBsh\fR
and
\fB!\fR
are synonyms\&.
.RE
.PP
\fBversion\fR
.RS 4
Prints SCons version information\&.
.RE
.RE
.PP
An empty line repeats the last typed command\&. Command\-line editing can be used if the
\fBreadline\fR
module is available\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ scons \-\-interactive
scons: Reading SConscript files \&.\&.\&.
scons: done reading SConscript files\&.
scons>>> build \-n prog
scons>>> exit
.fi
.if n \{\
.RE
.\}
.PP
\-j\fI N\fR, \-\-jobs=\fIN\fR
.RS 4
Specifies the number of jobs (commands) to run simultaneously\&. If there is more than one
\fB\-j\fR
option, the last one is effective\&.
.RE
.PP
\-k, \-\-keep\-going
.RS 4
Continue as much as possible after an error\&. The target that failed and those that depend on it will not be remade, but other targets specified on the command line will still be processed\&.
.RE
.PP
\-m
.RS 4
Ignored for compatibility with non\-GNU versions of
\fBmake\fR\&.
.RE
.PP
\-\-max\-drift=\fISECONDS\fR
.RS 4
Set the maximum expected drift in the modification time of files to
\fISECONDS\fR\&. This value determines how long a file must be unmodified before its cached content signature will be used instead of calculating a new content signature (MD5 checksum) of the file\*(Aqs contents\&. The default value is 2 days, which means a file must have a modification time of at least two days ago in order to have its cached content signature used\&. A negative value means to never cache the content signature and to ignore the cached value if there already is one\&. A value of 0 means to always use the cached signature, no matter how old the file is\&.
.RE
.PP
\-\-md5\-chunksize=\fIKILOBYTES\fR
.RS 4
Set the block size used to compute MD5 signatures to
\fIKILOBYTES\fR\&. This value determines the size of the chunks which are read in at once when computing MD5 signatures\&. Files below that size are fully stored in memory before performing the signature computation while bigger files are read in block\-by\-block\&. A huge block\-size leads to high memory consumption while a very small block\-size slows down the build considerably\&.
.sp
The default value is to use a chunk size of 64 kilobytes, which should be appropriate for most uses\&.
.RE
.PP
\-n, \-\-just\-print, \-\-dry\-run, \-\-recon
.RS 4
No execute\&. Print the commands that would be executed to build any out\-of\-date target files, but do not execute the commands\&.
.RE
.PP
\-\-no\-site\-dir
.RS 4
Prevents the automatic addition of the standard
\fIsite_scons\fR
dirs to
\fIsys\&.path\fR\&. Also prevents loading the
\fIsite_scons/site_init\&.py\fR
modules if they exist, and prevents adding their
\fIsite_scons/site_tools\fR
dirs to the toolpath\&.
.RE
.PP
\-\-profile=\fIfile\fR
.RS 4
Run SCons under the Python profiler and save the results in the specified
\fIfile\fR\&. The results may be analyzed using the Python pstats module\&.
.RE
.PP
\-q, \-\-question
.RS 4
Do not run any commands, or print anything\&. Just return an exit status that is zero if the specified targets are already up to date, non\-zero otherwise\&.
.RE
.PP
\-Q
.RS 4
Quiets SCons status messages about reading SConscript files, building targets and entering directories\&. Commands that are executed to rebuild target files are still printed\&.
.RE
.PP
\-\-random
.RS 4
Build dependencies in a random order\&. This is useful when building multiple trees simultaneously with caching enabled, to prevent multiple builds from simultaneously trying to build or retrieve the same target files\&.
.RE
.PP
\-s, \-\-silent, \-\-quiet
.RS 4
Silent\&. Do not print commands that are executed to rebuild target files\&. Also suppresses SCons status messages\&.
.RE
.PP
\-S, \-\-no\-keep\-going, \-\-stop
.RS 4
Ignored for compatibility with GNU
\fBmake\fR\&.
.RE
.PP
\-\-site\-dir=\fIdir\fR
.RS 4
Uses the named dir as the site dir rather than the default
\fIsite_scons\fR
dirs\&. This dir will get prepended to
\fIsys\&.path\fR, the module
\fIdir\fR/site_init\&.py will get loaded if it exists, and
\fIdir\fR/site_tools will get added to the default toolpath\&.
.sp
The default set of
\fIsite_scons\fR
dirs used when
\fB\-\-site\-dir\fR
is not specified depends on the system platform, as follows\&. Note that the directories are examined in the order given, from most generic to most specific, so the last\-executed site_init\&.py file is the most specific one (which gives it the chance to override everything else), and the dirs are prepended to the paths, again so the last dir examined comes first in the resulting path\&.
.RE
.PP
Windows:
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
%ALLUSERSPROFILE/Application Data/scons/site_scons
%USERPROFILE%/Local Settings/Application Data/scons/site_scons
%APPDATA%/scons/site_scons
%HOME%/\&.scons/site_scons
\&./site_scons
.fi
.if n \{\
.RE
.\}
.RE
.PP
Mac OS X:
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
/Library/Application Support/SCons/site_scons
/opt/local/share/scons/site_scons (for MacPorts)
/sw/share/scons/site_scons (for Fink)
$HOME/Library/Application Support/SCons/site_scons
$HOME/\&.scons/site_scons
\&./site_scons
.fi
.if n \{\
.RE
.\}
.RE
.PP
Solaris:
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
/opt/sfw/scons/site_scons
/usr/share/scons/site_scons
$HOME/\&.scons/site_scons
\&./site_scons
.fi
.if n \{\
.RE
.\}
.RE
.PP
Linux, HPUX, and other Posix\-like systems:
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
/usr/share/scons/site_scons
$HOME/\&.scons/site_scons
\&./site_scons
.fi
.if n \{\
.RE
.\}
.RE
.PP
\-\-stack\-size=\fIKILOBYTES\fR
.RS 4
Set the size stack used to run threads to
\fIKILOBYTES\fR\&. This value determines the stack size of the threads used to run jobs\&. These are the threads that execute the actions of the builders for the nodes that are out\-of\-date\&. Note that this option has no effect unless the
\fBnum_jobs\fR
option, which corresponds to \-j and \-\-jobs, is larger than one\&. Using a stack size that is too small may cause stack overflow errors\&. This usually shows up as segmentation faults that cause scons to abort before building anything\&. Using a stack size that is too large will cause scons to use more memory than required and may slow down the entire build process\&.
.sp
The default value is to use a stack size of 256 kilobytes, which should be appropriate for most uses\&. You should not need to increase this value unless you encounter stack overflow errors\&.
.RE
.PP
\-t, \-\-touch
.RS 4
Ignored for compatibility with GNU
\fBmake\fR\&. (Touching a file to make it appear up\-to\-date is unnecessary when using
\fBscons\fR\&.)
.RE
.PP
\-\-taskmastertrace=\fIfile\fR
.RS 4
Prints trace information to the specified
\fIfile\fR
about how the internal Taskmaster object evaluates and controls the order in which Nodes are built\&. A file name of
\fB\-\fR
may be used to specify the standard output\&.
.RE
.PP
\-tree=\fIoptions\fR
.RS 4
Prints a tree of the dependencies after each top\-level target is built\&. This prints out some or all of the tree, in various formats, depending on the
\fIoptions\fR
specified:
.RE
.PP
\-\-tree=all
.RS 4
Print the entire dependency tree after each top\-level target is built\&. This prints out the complete dependency tree, including implicit dependencies and ignored dependencies\&.
.RE
.PP
\-\-tree=derived
.RS 4
Restricts the tree output to only derived (target) files, not source files\&.
.RE
.PP
\-\-tree=status
.RS 4
Prints status information for each displayed node\&.
.RE
.PP
\-\-tree=prune
.RS 4
Prunes the tree to avoid repeating dependency information for nodes that have already been displayed\&. Any node that has already been displayed will have its name printed in
\fB[square brackets]\fR, as an indication that the dependencies for that node can be found by searching for the relevant output higher up in the tree\&.
.RE
.PP
Multiple options may be specified, separated by commas:
.sp
.if n \{\
.RS 4
.\}
.nf
# Prints only derived files, with status information:
scons \-\-tree=derived,status
# Prints all dependencies of target, with status information
# and pruning dependencies of already\-visited Nodes:
scons \-\-tree=all,prune,status target
.fi
.if n \{\
.RE
.\}
.PP
\-u, \-\-up, \-\-search\-up
.RS 4
Walks up the directory structure until an
\fISConstruct ,\fR
\fISconstruct ,\fR
\fIsconstruct ,\fR
\fISConstruct\&.py\fR
\fISconstruct\&.py\fR
or
\fIsconstruct\&.py\fR
file is found, and uses that as the top of the directory tree\&. If no targets are specified on the command line, only targets at or below the current directory will be built\&.
.RE
.PP
\-U
.RS 4
Works exactly the same way as the
\fB\-u\fR
option except for the way default targets are handled\&. When this option is used and no targets are specified on the command line, all default targets that are defined in the SConscript(s) in the current directory are built, regardless of what directory the resultant targets end up in\&.
.RE
.PP
\-v, \-\-version
.RS 4
Print the
\fBscons\fR
version, copyright information, list of authors, and any other relevant information\&. Then exit\&.
.RE
.PP
\-w, \-\-print\-directory
.RS 4
Print a message containing the working directory before and after other processing\&.
.RE
.PP
\-\-no\-print\-directory
.RS 4
Turn off \-w, even if it was turned on implicitly\&.
.RE
.PP
\-\-warn=\fItype\fR, \-\-warn=no\-\fItype\fR
.RS 4
Enable or disable warnings\&.
\fItype\fR
specifies the type of warnings to be enabled or disabled:
.RE
.PP
\-\-warn=all, \-\-warn=no\-all
.RS 4
Enables or disables all warnings\&.
.RE
.PP
\-\-warn=cache\-version, \-\-warn=no\-cache\-version
.RS 4
Enables or disables warnings about the cache directory not using the latest configuration information
\fBCacheDir\fR()\&. These warnings are enabled by default\&.
.RE
.PP
\-\-warn=cache\-write\-error, \-\-warn=no\-cache\-write\-error
.RS 4
Enables or disables warnings about errors trying to write a copy of a built file to a specified
\fBCacheDir\fR()\&. These warnings are disabled by default\&.
.RE
.PP
\-\-warn=corrupt\-sconsign, \-\-warn=no\-corrupt\-sconsign
.RS 4
Enables or disables warnings about unfamiliar signature data in
\fB\&.sconsign\fR
files\&. These warnings are enabled by default\&.
.RE
.PP
\-\-warn=dependency, \-\-warn=no\-dependency
.RS 4
Enables or disables warnings about dependencies\&. These warnings are disabled by default\&.
.RE
.PP
\-\-warn=deprecated, \-\-warn=no\-deprecated
.RS 4
Enables or disables all warnings about use of currently deprecated features\&. These warnings are enabled by default\&. Note that the
\fB\-\-warn=no\-deprecated\fR
option does not disable warnings about absolutely all deprecated features\&. Warnings for some deprecated features that have already been through several releases with deprecation warnings may be mandatory for a release or two before they are officially no longer supported by SCons\&. Warnings for some specific deprecated features may be enabled or disabled individually; see below\&.
.RE
.PP
\-\-warn=duplicate\-environment, \-\-warn=no\-duplicate\-environment
.RS 4
Enables or disables warnings about attempts to specify a build of a target with two different construction environments that use the same action\&. These warnings are enabled by default\&.
.RE
.PP
\-\-warn=fortran\-cxx\-mix, \-\-warn=no\-fortran\-cxx\-mix
.RS 4
Enables or disables the specific warning about linking Fortran and C++ object files in a single executable, which can yield unpredictable behavior with some compilers\&.
.RE
.PP
\-\-warn=future\-deprecated, \-\-warn=no\-future\-deprecated
.RS 4
Enables or disables warnings about features that will be deprecated in the future\&. These warnings are disabled by default\&. Enabling this warning is especially recommended for projects that redistribute SCons configurations for other users to build, so that the project can be warned as soon as possible about to\-be\-deprecated features that may require changes to the configuration\&.
.RE
.PP
\-\-warn=link, \-\-warn=no\-link
.RS 4
Enables or disables warnings about link steps\&.
.RE
.PP
\-\-warn=misleading\-keywords, \-\-warn=no\-misleading\-keywords
.RS 4
Enables or disables warnings about use of the misspelled keywords
\fBtargets\fR
and
\fBsources\fR
when calling Builders\&. (Note the last
\fBs\fR
characters, the correct spellings are
\fBtarget\fR
and
\fBsource\&.)\fR
These warnings are enabled by default\&.
.RE
.PP
\-\-warn=missing\-sconscript, \-\-warn=no\-missing\-sconscript
.RS 4
Enables or disables warnings about missing SConscript files\&. These warnings are enabled by default\&.
.RE
.PP
\-\-warn=no\-object\-count, \-\-warn=no\-no\-object\-count
.RS 4
Enables or disables warnings about the
\fB\-\-debug=object\fR
feature not working when
\fBscons\fR
is run with the Python
\fB\-O\fR
option or from optimized Python (\&.pyo) modules\&.
.RE
.PP
\-\-warn=no\-parallel\-support, \-\-warn=no\-no\-parallel\-support
.RS 4
Enables or disables warnings about the version of Python not being able to support parallel builds when the
\fB\-j\fR
option is used\&. These warnings are enabled by default\&.
.RE
.PP
\-\-warn=python\-version, \-\-warn=no\-python\-version
.RS 4
Enables or disables the warning about running SCons with a deprecated version of Python\&. These warnings are enabled by default\&.
.RE
.PP
\-\-warn=reserved\-variable, \-\-warn=no\-reserved\-variable
.RS 4
Enables or disables warnings about attempts to set the reserved construction variable names
\fBCHANGED_SOURCES\fR,
\fBCHANGED_TARGETS\fR,
\fBTARGET\fR,
\fBTARGETS\fR,
\fBSOURCE\fR,
\fBSOURCES\fR,
\fBUNCHANGED_SOURCES\fR
or
\fBUNCHANGED_TARGETS\fR\&. These warnings are disabled by default\&.
.RE
.PP
\-\-warn=stack\-size, \-\-warn=no\-stack\-size
.RS 4
Enables or disables warnings about requests to set the stack size that could not be honored\&. These warnings are enabled by default\&.
.RE
.PP
\-\-warn=target_not_build, \-\-warn=no\-target_not_built
.RS 4
Enables or disables warnings about a build rule not building the expected targets\&. These warnings are not currently enabled by default\&.
.RE
.PP
\-Y\fI repository\fR, \-\-repository=\fIrepository\fR, \-\-srcdir=\fIrepository\fR
.RS 4
Search the specified repository for any input and target files not found in the local directory hierarchy\&. Multiple
\fB\-Y\fR
options may be specified, in which case the repositories are searched in the order specified\&.
.RE
.SH "CONFIGURATION FILE REFERENCE"
.SS "Construction Environments"
.PP
A construction environment is the basic means by which the SConscript files communicate build information to
\fBscons\fR\&. A new construction environment is created using the
\fBEnvironment\fR
function:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
.fi
.if n \{\
.RE
.\}
.PP
Variables, called
\fIconstruction\fR
\fIvariables\fR, may be set in a construction environment either by specifying them as keywords when the object is created or by assigning them a value after the object is created:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(FOO = \*(Aqfoo\*(Aq)
env[\*(AqBAR\*(Aq] = \*(Aqbar\*(Aq
.fi
.if n \{\
.RE
.\}
.PP
As a convenience, construction variables may also be set or modified by the
\fBparse_flags\fR
keyword argument, which applies the
\fBenv\&.MergeFlags\fR
method (described below) to the argument value after all other processing is completed\&. This is useful either if the exact content of the flags is unknown (for example, read from a control file) or if the flags are distributed to a number of construction variables\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(parse_flags=\*(Aq\-Iinclude \-DEBUG \-lm\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
This example adds \*(Aqinclude\*(Aq to
\fBCPPPATH\fR, \*(AqEBUG\*(Aq to
\fBCPPDEFINES\fR, and \*(Aqm\*(Aq to
\fBLIBS\fR\&.
.PP
By default, a new construction environment is initialized with a set of builder methods and construction variables that are appropriate for the current platform\&. An optional platform keyword argument may be used to specify that an environment should be initialized for a different platform:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(platform = \*(Aqcygwin\*(Aq)
env = Environment(platform = \*(Aqos2\*(Aq)
env = Environment(platform = \*(Aqposix\*(Aq)
env = Environment(platform = \*(Aqwin32\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
Specifying a platform initializes the appropriate construction variables in the environment to use and generate file names with prefixes and suffixes appropriate for the platform\&.
.PP
Note that the
\fBwin32\fR
platform adds the
\fBSystemDrive\fR
and
\fBSystemRoot\fR
variables from the user\*(Aqs external environment to the construction environment\*(Aqs
\fBENV\fR
dictionary\&. This is so that any executed commands that use sockets to connect with other systems (such as fetching source files from external CVS repository specifications like
\fB:pserver:anonymous@cvs\&.sourceforge\&.net:/cvsroot/scons\fR) will work on Windows systems\&.
.PP
The platform argument may be function or callable object, in which case the Environment() method will call the specified argument to update the new construction environment:
.sp
.if n \{\
.RS 4
.\}
.nf
def my_platform(env):
env[\*(AqVAR\*(Aq] = \*(Aqxyzzy\*(Aq
env = Environment(platform = my_platform)
.fi
.if n \{\
.RE
.\}
.PP
Additionally, a specific set of tools with which to initialize the environment may be specified using the optional keyword argument
\fItools\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqmsvc\*(Aq, \*(Aqlex\*(Aq])
.fi
.if n \{\
.RE
.\}
.PP
The
\fItools\fR
argument overrides the tool list, it does not add to it, so be sure to include all the tools you need\&. For example if you are building a c/c++ program you must add a tool for both compiler and linker, as in
tools=[\*(Aqclang\*(Aq, \*(Aqlink\*(Aq]\&. The tool name
\*(Aqdefault\*(Aq
can be used to retain the default list\&.
.PP
Non\-built\-in tools may be specified using the optional
\fItoolpath\fR
keyword argument:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdefault\*(Aq, \*(Aqfoo\*(Aq], toolpath=[\*(Aqtools\*(Aq])
.fi
.if n \{\
.RE
.\}
.PP
This looks for a tool specification in
tools/foo\&.py
as well as using the ordinary default tools for the platform\&.
.PP
A tool specification must include two functions:
\fBgenerate(env, **kw)\fR
and
\fBexists(env)\fR\&. The
\fBgenerate\fR
function modifies the environment referenced by
\fIenv\fR
to set up variables so that the tool can be executed; it may use any keyword arguments that the user supplies in
\fIkw\fR
(see below) to vary its initialization\&. The
\fBexists\fR
function should return a true value if the tool is available\&.
.PP
Tools in the toolpath are used before any of the built\-in ones\&. For example, adding
gcc\&.py
to the toolpath would override the built\-in gcc tool\&. Also note that the toolpath is stored in the environment for use by later calls to
\fBClone\fR() and
\fBTool\fR() methods:
.sp
.if n \{\
.RS 4
.\}
.nf
base = Environment(toolpath=[\*(Aqcustom_path\*(Aq])
derived = base\&.Clone(tools=[\*(Aqcustom_tool\*(Aq])
derived\&.CustomBuilder()
.fi
.if n \{\
.RE
.\}
.PP
The elements of the tools list may also be functions or callable objects, in which case the Environment() method will call the specified elements to update the new construction environment:
.sp
.if n \{\
.RS 4
.\}
.nf
def my_tool(env):
env[\*(AqXYZZY\*(Aq] = \*(Aqxyzzy\*(Aq
env = Environment(tools = [my_tool])
.fi
.if n \{\
.RE
.\}
.PP
The individual elements of the tools list may also themselves be two\-element lists of the form (\fItoolname\fR,
\fIkw_dict\fR)\&. SCons searches for the
\fItoolname\fR
specification file as described above, and passes
\fIkw_dict\fR, which must be a dictionary, as keyword arguments to the tool\*(Aqs
\fBgenerate\fR
function\&. The
\fBgenerate\fR
function can use the arguments to modify the tool\*(Aqs behavior by setting up the environment in different ways or otherwise changing its initialization\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# in tools/my_tool\&.py:
def generate(env, **kw):
# Sets MY_TOOL to the value of keyword argument \*(Aqarg1\*(Aq or 1\&.
env[\*(AqMY_TOOL\*(Aq] = kw\&.get(\*(Aqarg1\*(Aq, \*(Aq1\*(Aq)
def exists(env):
return True
# in SConstruct:
env = Environment(tools=[\*(Aqdefault\*(Aq, (\*(Aqmy_tool\*(Aq, {\*(Aqarg1\*(Aq: \*(Aqabc\*(Aq})],
toolpath=[\*(Aqtools\*(Aq])
.fi
.if n \{\
.RE
.\}
.PP
The tool definition (i\&.e\&. my_tool()) can use the PLATFORM variable from the environment it receives to customize the tool for different platforms\&.
.PP
If no tool list is specified, then SCons will auto\-detect the installed tools using the PATH variable in the ENV construction variable and the platform name when the Environment is constructed\&. Changing the PATH variable after the Environment is constructed will not cause the tools to be redetected\&.
.PP
One feature now present within Scons is the ability to have nested tools\&. Tools which can be located within a subdirectory in the toolpath\&. With a nested tool name the dot represents a directory seperator
.sp
.if n \{\
.RS 4
.\}
.nf
# namespaced builder
env = Environment(ENV=os\&.environ, tools=[\*(AqSubDir1\&.SubDir2\&.SomeTool\*(Aq])
env\&.SomeTool(targets, sources)
# Search Paths
# SCons\eTool\eSubDir1\eSubDir2\eSomeTool\&.py
# SCons\eTool\eSubDir1\eSubDir2\eSomeTool\e__init__\&.py
# \&.\esite_scons\esite_tools\eSubDir1\eSubDir2\eSomeTool\&.py
# \&.\esite_scons\esite_tools\eSubDir1\eSubDir2\eSomeTool\e__init__\&.py
.fi
.if n \{\
.RE
.\}
.PP
SCons supports the following tool specifications out of the box:
.PP
386asm
.RS 4
Sets construction variables for the 386ASM assembler for the Phar Lap ETS embedded operating system\&.
.sp
Sets:
\fB$AS\fR,
\fB$ASCOM\fR,
\fB$ASFLAGS\fR,
\fB$ASPPCOM\fR,
\fB$ASPPFLAGS\fR\&.
.sp
Uses:
\fB$CC\fR,
\fB$CPPFLAGS\fR,
\fB$_CPPDEFFLAGS\fR,
\fB$_CPPINCFLAGS\fR\&.
.RE
.PP
aixc++
.RS 4
Sets construction variables for the IMB xlc / Visual Age C++ compiler\&.
.sp
Sets:
\fB$CXX\fR,
\fB$CXXVERSION\fR,
\fB$SHCXX\fR,
\fB$SHOBJSUFFIX\fR\&.
.RE
.PP
aixcc
.RS 4
Sets construction variables for the IBM xlc / Visual Age C compiler\&.
.sp
Sets:
\fB$CC\fR,
\fB$CCVERSION\fR,
\fB$SHCC\fR\&.
.RE
.PP
aixf77
.RS 4
Sets construction variables for the IBM Visual Age f77 Fortran compiler\&.
.sp
Sets:
\fB$F77\fR,
\fB$SHF77\fR\&.
.RE
.PP
aixlink
.RS 4
Sets construction variables for the IBM Visual Age linker\&.
.sp
Sets:
\fB$LINKFLAGS\fR,
\fB$SHLIBSUFFIX\fR,
\fB$SHLINKFLAGS\fR\&.
.RE
.PP
applelink
.RS 4
Sets construction variables for the Apple linker (similar to the GNU linker)\&.
.sp
Sets:
\fB$APPLELINK_COMPATIBILITY_VERSION\fR,
\fB$APPLELINK_CURRENT_VERSION\fR,
\fB$APPLELINK_NO_COMPATIBILITY_VERSION\fR,
\fB$APPLELINK_NO_CURRENT_VERSION\fR,
\fB$FRAMEWORKPATHPREFIX\fR,
\fB$LDMODULECOM\fR,
\fB$LDMODULEFLAGS\fR,
\fB$LDMODULEPREFIX\fR,
\fB$LDMODULESUFFIX\fR,
\fB$LINKCOM\fR,
\fB$SHLINKCOM\fR,
\fB$SHLINKFLAGS\fR,
\fB$_APPLELINK_COMPATIBILITY_VERSION\fR,
\fB$_APPLELINK_CURRENT_VERSION\fR,
\fB$_FRAMEWORKPATH\fR,
\fB$_FRAMEWORKS\fR\&.
.sp
Uses:
\fB$FRAMEWORKSFLAGS\fR\&.
.RE
.PP
ar
.RS 4
Sets construction variables for the
ar
library archiver\&.
.sp
Sets:
\fB$AR\fR,
\fB$ARCOM\fR,
\fB$ARFLAGS\fR,
\fB$LIBPREFIX\fR,
\fB$LIBSUFFIX\fR,
\fB$RANLIB\fR,
\fB$RANLIBCOM\fR,
\fB$RANLIBFLAGS\fR\&.
.RE
.PP
as
.RS 4
Sets construction variables for the
as
assembler\&.
.sp
Sets:
\fB$AS\fR,
\fB$ASCOM\fR,
\fB$ASFLAGS\fR,
\fB$ASPPCOM\fR,
\fB$ASPPFLAGS\fR\&.
.sp
Uses:
\fB$CC\fR,
\fB$CPPFLAGS\fR,
\fB$_CPPDEFFLAGS\fR,
\fB$_CPPINCFLAGS\fR\&.
.RE
.PP
bcc32
.RS 4
Sets construction variables for the bcc32 compiler\&.
.sp
Sets:
\fB$CC\fR,
\fB$CCCOM\fR,
\fB$CCFLAGS\fR,
\fB$CFILESUFFIX\fR,
\fB$CFLAGS\fR,
\fB$CPPDEFPREFIX\fR,
\fB$CPPDEFSUFFIX\fR,
\fB$INCPREFIX\fR,
\fB$INCSUFFIX\fR,
\fB$SHCC\fR,
\fB$SHCCCOM\fR,
\fB$SHCCFLAGS\fR,
\fB$SHCFLAGS\fR,
\fB$SHOBJSUFFIX\fR\&.
.sp
Uses:
\fB$_CPPDEFFLAGS\fR,
\fB$_CPPINCFLAGS\fR\&.
.RE
.PP
cc
.RS 4
Sets construction variables for generic POSIX C compilers\&.
.sp
Sets:
\fB$CC\fR,
\fB$CCCOM\fR,
\fB$CCFLAGS\fR,
\fB$CFILESUFFIX\fR,
\fB$CFLAGS\fR,
\fB$CPPDEFPREFIX\fR,
\fB$CPPDEFSUFFIX\fR,
\fB$FRAMEWORKPATH\fR,
\fB$FRAMEWORKS\fR,
\fB$INCPREFIX\fR,
\fB$INCSUFFIX\fR,
\fB$SHCC\fR,
\fB$SHCCCOM\fR,
\fB$SHCCFLAGS\fR,
\fB$SHCFLAGS\fR,
\fB$SHOBJSUFFIX\fR\&.
.sp
Uses:
\fB$PLATFORM\fR\&.
.RE
.PP
clang
.RS 4
Set construction variables for the Clang C compiler\&.
.sp
Sets:
\fB$CC\fR,
\fB$CCVERSION\fR,
\fB$SHCCFLAGS\fR\&.
.RE
.PP
clangxx
.RS 4
Set construction variables for the Clang C++ compiler\&.
.sp
Sets:
\fB$CXX\fR,
\fB$CXXVERSION\fR,
\fB$SHCXXFLAGS\fR,
\fB$SHOBJSUFFIX\fR,
\fB$STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME\fR\&.
.RE
.PP
cvf
.RS 4
Sets construction variables for the Compaq Visual Fortran compiler\&.
.sp
Sets:
\fB$FORTRAN\fR,
\fB$FORTRANCOM\fR,
\fB$FORTRANMODDIR\fR,
\fB$FORTRANMODDIRPREFIX\fR,
\fB$FORTRANMODDIRSUFFIX\fR,
\fB$FORTRANPPCOM\fR,
\fB$OBJSUFFIX\fR,
\fB$SHFORTRANCOM\fR,
\fB$SHFORTRANPPCOM\fR\&.
.sp
Uses:
\fB$CPPFLAGS\fR,
\fB$FORTRANFLAGS\fR,
\fB$SHFORTRANFLAGS\fR,
\fB$_CPPDEFFLAGS\fR,
\fB$_FORTRANINCFLAGS\fR,
\fB$_FORTRANMODFLAG\fR\&.
.RE
.PP
cXX
.RS 4
Sets construction variables for generic POSIX C++ compilers\&.
.sp
Sets:
\fB$CPPDEFPREFIX\fR,
\fB$CPPDEFSUFFIX\fR,
\fB$CXX\fR,
\fB$CXXCOM\fR,
\fB$CXXFILESUFFIX\fR,
\fB$CXXFLAGS\fR,
\fB$INCPREFIX\fR,
\fB$INCSUFFIX\fR,
\fB$OBJSUFFIX\fR,
\fB$SHCXX\fR,
\fB$SHCXXCOM\fR,
\fB$SHCXXFLAGS\fR,
\fB$SHOBJSUFFIX\fR\&.
.sp
Uses:
\fB$CXXCOMSTR\fR\&.
.RE
.PP
cyglink
.RS 4
Set construction variables for cygwin linker/loader\&.
.sp
Sets:
\fB$IMPLIBPREFIX\fR,
\fB$IMPLIBSUFFIX\fR,
\fB$LDMODULEVERSIONFLAGS\fR,
\fB$LINKFLAGS\fR,
\fB$RPATHPREFIX\fR,
\fB$RPATHSUFFIX\fR,
\fB$SHLIBPREFIX\fR,
\fB$SHLIBSUFFIX\fR,
\fB$SHLIBVERSIONFLAGS\fR,
\fB$SHLINKCOM\fR,
\fB$SHLINKFLAGS\fR,
\fB$_LDMODULEVERSIONFLAGS\fR,
\fB$_SHLIBVERSIONFLAGS\fR\&.
.RE
.PP
default
.RS 4
Sets
construction variables
for a default list of Tool modules\&. Use
\fBdefault\fR
in the tools list to retain the original defaults, since the
\fItools\fR
parameter is treated as a literal statement of the tools to be made available in that
construction environment, not an addition\&.
.sp
The list of tools selected by default is not static, but is dependent both on the platform and on the software installed on the platform\&. Some tools will not initialize if an underlying command is not found, and some tools are selected from a list of choices on a first\-found basis\&. The finished tool list can be examined by inspecting the
\fBTOOLS\fR
construction variable
in the
construction environment\&.
.sp
On all platforms, all tools from the following list are selected whose respective conditions are met: filesystem, wix, lex, yacc, rpcgen, swig, jar, javac, javah, rmic, dvipdf, dvips, gs, tex, latex, pdflatex, pdftex, tar, zip, textfile\&.
.sp
On Linux systems, the default tools list selects (first\-found): a C compiler from gcc, intelc, icc, cc; a C++ compiler from g++, intelc, icc, cxx; an assembler from gas, nasm, masm; a linker from gnulink, ilink; a Fortran compiler from gfortran, g77, ifort, ifl, f95, f90, f77; and a static archiver \*(Aqar\*(Aq\&. It also selects all found from the list m4, rpm\&.
.sp
On Windows systems, the default tools list selects (first\-found): a C compiler from msvc, mingw, gcc, intelc, icl, icc, cc, bcc32; a C++ compiler from msvc, intelc, icc, g++, cxx, bcc32; an assembler from masm, nasm, gas, 386asm; a linker from mslink, gnulink, ilink, linkloc, ilink32; a Fortran compiler from gfortran, g77, ifl, cvf, f95, f90, fortran; and a static archiver from mslib, ar, tlib; It also selects all found from the list msvs, midl\&.
.sp
On MacOS systems, the default tools list selects (first\-found): a C compiler from gcc, cc; a C++ compiler from g++, cxx; an assembler \*(Aqas\*(Aq; a linker from applelink, gnulink; a Fortran compiler from gfortran, f95, f90, g77; and a static archiver ar\&. It also selects all found from the list m4, rpm\&.
.sp
Default lists for other platforms can be found by examining the
scons
source code (see
SCons/Tool/__init__\&.py)\&.
.RE
.PP
dmd
.RS 4
Sets construction variables for D language compiler DMD\&.
.sp
Sets:
\fB$DC\fR,
\fB$DCOM\fR,
\fB$DDEBUG\fR,
\fB$DDEBUGPREFIX\fR,
\fB$DDEBUGSUFFIX\fR,
\fB$DFILESUFFIX\fR,
\fB$DFLAGPREFIX\fR,
\fB$DFLAGS\fR,
\fB$DFLAGSUFFIX\fR,
\fB$DINCPREFIX\fR,
\fB$DINCSUFFIX\fR,
\fB$DLIB\fR,
\fB$DLIBCOM\fR,
\fB$DLIBDIRPREFIX\fR,
\fB$DLIBDIRSUFFIX\fR,
\fB$DLIBFLAGPREFIX\fR,
\fB$DLIBFLAGSUFFIX\fR,
\fB$DLIBLINKPREFIX\fR,
\fB$DLIBLINKSUFFIX\fR,
\fB$DLINK\fR,
\fB$DLINKCOM\fR,
\fB$DLINKFLAGPREFIX\fR,
\fB$DLINKFLAGS\fR,
\fB$DLINKFLAGSUFFIX\fR,
\fB$DPATH\fR,
\fB$DRPATHPREFIX\fR,
\fB$DRPATHSUFFIX\fR,
\fB$DShLibSonameGenerator\fR,
\fB$DVERPREFIX\fR,
\fB$DVERSIONS\fR,
\fB$DVERSUFFIX\fR,
\fB$SHDC\fR,
\fB$SHDCOM\fR,
\fB$SHDLIBVERSION\fR,
\fB$SHDLIBVERSIONFLAGS\fR,
\fB$SHDLINK\fR,
\fB$SHDLINKCOM\fR,
\fB$SHDLINKFLAGS\fR\&.
.RE
.PP
docbook
.RS 4
This tool tries to make working with Docbook in SCons a little easier\&. It provides several toolchains for creating different output formats, like HTML or PDF\&. Contained in the package is a distribution of the Docbook XSL stylesheets as of version 1\&.76\&.1\&. As long as you don\*(Aqt specify your own stylesheets for customization, these official versions are picked as default\&.\&.\&.which should reduce the inevitable setup hassles for you\&.
.sp
Implicit dependencies to images and XIncludes are detected automatically if you meet the HTML requirements\&. The additional stylesheet
utils/xmldepend\&.xsl
by Paul DuBois is used for this purpose\&.
.sp
Note, that there is no support for XML catalog resolving offered! This tool calls the XSLT processors and PDF renderers with the stylesheets you specified, that\*(Aqs it\&. The rest lies in your hands and you still have to know what you\*(Aqre doing when resolving names via a catalog\&.
.sp
For activating the tool "docbook", you have to add its name to the Environment constructor, like this
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
On its startup, the Docbook tool tries to find a required
xsltproc
processor, and a PDF renderer, e\&.g\&.
fop\&. So make sure that these are added to your system\*(Aqs environment
PATH
and can be called directly, without specifying their full path\&.
.sp
For the most basic processing of Docbook to HTML, you need to have installed
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
the Python
lxml
binding to
libxml2, or
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
the direct Python bindings for
libxml2/libxslt, or
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
a standalone XSLT processor, currently detected are
xsltproc,
saxon,
saxon\-xslt
and
xalan\&.
.RE
.sp
Rendering to PDF requires you to have one of the applications
fop
or
xep
installed\&.
.sp
Creating a HTML or PDF document is very simple and straightforward\&. Say
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtml(\*(Aqmanual\&.html\*(Aq, \*(Aqmanual\&.xml\*(Aq)
env\&.DocbookPdf(\*(Aqmanual\&.pdf\*(Aq, \*(Aqmanual\&.xml\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
to get both outputs from your XML source
manual\&.xml\&. As a shortcut, you can give the stem of the filenames alone, like this:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtml(\*(Aqmanual\*(Aq)
env\&.DocbookPdf(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
and get the same result\&. Target and source lists are also supported:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtml([\*(Aqmanual\&.html\*(Aq,\*(Aqreference\&.html\*(Aq], [\*(Aqmanual\&.xml\*(Aq,\*(Aqreference\&.xml\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
or even
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtml([\*(Aqmanual\*(Aq,\*(Aqreference\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
Whenever you leave out the list of sources, you may not specify a file extension! The Tool uses the given names as file stems, and adds the suffixes for target and source files accordingly\&.
.sp .5v
.RE
The rules given above are valid for the Builders
\fBDocbookHtml\fR,
\fBDocbookPdf\fR,
\fBDocbookEpub\fR,
\fBDocbookSlidesPdf\fR
and
\fBDocbookXInclude\fR\&. For the
\fBDocbookMan\fR
transformation you can specify a target name, but the actual output names are automatically set from the
refname
entries in your XML source\&.
.sp
The Builders
\fBDocbookHtmlChunked\fR,
\fBDocbookHtmlhelp\fR
and
\fBDocbookSlidesHtml\fR
are special, in that:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 1." 4.2
.\}
they create a large set of files, where the exact names and their number depend on the content of the source file, and
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP " 2." 4.2
.\}
the main target is always named
index\&.html, i\&.e\&. the output name for the XSL transformation is not picked up by the stylesheets\&.
.RE
.sp
As a result, there is simply no use in specifying a target HTML name\&. So the basic syntax for these builders is always:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtmlhelp(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
If you want to use a specific XSL file, you can set the additional
xsl
parameter to your Builder call as follows:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.DocbookHtml(\*(Aqother\&.html\*(Aq, \*(Aqmanual\&.xml\*(Aq, xsl=\*(Aqhtml\&.xsl\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Since this may get tedious if you always use the same local naming for your customized XSL files, e\&.g\&.
html\&.xsl
for HTML and
pdf\&.xsl
for PDF output, a set of variables for setting the default XSL name is provided\&. These are:
.sp
.if n \{\
.RS 4
.\}
.nf
DOCBOOK_DEFAULT_XSL_HTML
DOCBOOK_DEFAULT_XSL_HTMLCHUNKED
DOCBOOK_DEFAULT_XSL_HTMLHELP
DOCBOOK_DEFAULT_XSL_PDF
DOCBOOK_DEFAULT_XSL_EPUB
DOCBOOK_DEFAULT_XSL_MAN
DOCBOOK_DEFAULT_XSL_SLIDESPDF
DOCBOOK_DEFAULT_XSL_SLIDESHTML
.fi
.if n \{\
.RE
.\}
.sp
and you can set them when constructing your environment:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq],
DOCBOOK_DEFAULT_XSL_HTML=\*(Aqhtml\&.xsl\*(Aq,
DOCBOOK_DEFAULT_XSL_PDF=\*(Aqpdf\&.xsl\*(Aq)
env\&.DocbookHtml(\*(Aqmanual\*(Aq) # now uses html\&.xsl
.fi
.if n \{\
.RE
.\}
.sp
Sets:
\fB$DOCBOOK_DEFAULT_XSL_EPUB\fR,
\fB$DOCBOOK_DEFAULT_XSL_HTML\fR,
\fB$DOCBOOK_DEFAULT_XSL_HTMLCHUNKED\fR,
\fB$DOCBOOK_DEFAULT_XSL_HTMLHELP\fR,
\fB$DOCBOOK_DEFAULT_XSL_MAN\fR,
\fB$DOCBOOK_DEFAULT_XSL_PDF\fR,
\fB$DOCBOOK_DEFAULT_XSL_SLIDESHTML\fR,
\fB$DOCBOOK_DEFAULT_XSL_SLIDESPDF\fR,
\fB$DOCBOOK_FOP\fR,
\fB$DOCBOOK_FOPCOM\fR,
\fB$DOCBOOK_FOPFLAGS\fR,
\fB$DOCBOOK_XMLLINT\fR,
\fB$DOCBOOK_XMLLINTCOM\fR,
\fB$DOCBOOK_XMLLINTFLAGS\fR,
\fB$DOCBOOK_XSLTPROC\fR,
\fB$DOCBOOK_XSLTPROCCOM\fR,
\fB$DOCBOOK_XSLTPROCFLAGS\fR,
\fB$DOCBOOK_XSLTPROCPARAMS\fR\&.
.sp
Uses:
\fB$DOCBOOK_FOPCOMSTR\fR,
\fB$DOCBOOK_XMLLINTCOMSTR\fR,
\fB$DOCBOOK_XSLTPROCCOMSTR\fR\&.
.RE
.PP
dvi
.RS 4
Attaches the
\fBDVI\fR
builder to the construction environment\&.
.RE
.PP
dvipdf
.RS 4
Sets construction variables for the dvipdf utility\&.
.sp
Sets:
\fB$DVIPDF\fR,
\fB$DVIPDFCOM\fR,
\fB$DVIPDFFLAGS\fR\&.
.sp
Uses:
\fB$DVIPDFCOMSTR\fR\&.
.RE
.PP
dvips
.RS 4
Sets construction variables for the dvips utility\&.
.sp
Sets:
\fB$DVIPS\fR,
\fB$DVIPSFLAGS\fR,
\fB$PSCOM\fR,
\fB$PSPREFIX\fR,
\fB$PSSUFFIX\fR\&.
.sp
Uses:
\fB$PSCOMSTR\fR\&.
.RE
.PP
f03
.RS 4
Set construction variables for generic POSIX Fortran 03 compilers\&.
.sp
Sets:
\fB$F03\fR,
\fB$F03COM\fR,
\fB$F03FLAGS\fR,
\fB$F03PPCOM\fR,
\fB$SHF03\fR,
\fB$SHF03COM\fR,
\fB$SHF03FLAGS\fR,
\fB$SHF03PPCOM\fR,
\fB$_F03INCFLAGS\fR\&.
.sp
Uses:
\fB$F03COMSTR\fR,
\fB$F03PPCOMSTR\fR,
\fB$SHF03COMSTR\fR,
\fB$SHF03PPCOMSTR\fR\&.
.RE
.PP
f08
.RS 4
Set construction variables for generic POSIX Fortran 08 compilers\&.
.sp
Sets:
\fB$F08\fR,
\fB$F08COM\fR,
\fB$F08FLAGS\fR,
\fB$F08PPCOM\fR,
\fB$SHF08\fR,
\fB$SHF08COM\fR,
\fB$SHF08FLAGS\fR,
\fB$SHF08PPCOM\fR,
\fB$_F08INCFLAGS\fR\&.
.sp
Uses:
\fB$F08COMSTR\fR,
\fB$F08PPCOMSTR\fR,
\fB$SHF08COMSTR\fR,
\fB$SHF08PPCOMSTR\fR\&.
.RE
.PP
f77
.RS 4
Set construction variables for generic POSIX Fortran 77 compilers\&.
.sp
Sets:
\fB$F77\fR,
\fB$F77COM\fR,
\fB$F77FILESUFFIXES\fR,
\fB$F77FLAGS\fR,
\fB$F77PPCOM\fR,
\fB$F77PPFILESUFFIXES\fR,
\fB$FORTRAN\fR,
\fB$FORTRANCOM\fR,
\fB$FORTRANFLAGS\fR,
\fB$SHF77\fR,
\fB$SHF77COM\fR,
\fB$SHF77FLAGS\fR,
\fB$SHF77PPCOM\fR,
\fB$SHFORTRAN\fR,
\fB$SHFORTRANCOM\fR,
\fB$SHFORTRANFLAGS\fR,
\fB$SHFORTRANPPCOM\fR,
\fB$_F77INCFLAGS\fR\&.
.sp
Uses:
\fB$F77COMSTR\fR,
\fB$F77PPCOMSTR\fR,
\fB$FORTRANCOMSTR\fR,
\fB$FORTRANPPCOMSTR\fR,
\fB$SHF77COMSTR\fR,
\fB$SHF77PPCOMSTR\fR,
\fB$SHFORTRANCOMSTR\fR,
\fB$SHFORTRANPPCOMSTR\fR\&.
.RE
.PP
f90
.RS 4
Set construction variables for generic POSIX Fortran 90 compilers\&.
.sp
Sets:
\fB$F90\fR,
\fB$F90COM\fR,
\fB$F90FLAGS\fR,
\fB$F90PPCOM\fR,
\fB$SHF90\fR,
\fB$SHF90COM\fR,
\fB$SHF90FLAGS\fR,
\fB$SHF90PPCOM\fR,
\fB$_F90INCFLAGS\fR\&.
.sp
Uses:
\fB$F90COMSTR\fR,
\fB$F90PPCOMSTR\fR,
\fB$SHF90COMSTR\fR,
\fB$SHF90PPCOMSTR\fR\&.
.RE
.PP
f95
.RS 4
Set construction variables for generic POSIX Fortran 95 compilers\&.
.sp
Sets:
\fB$F95\fR,
\fB$F95COM\fR,
\fB$F95FLAGS\fR,
\fB$F95PPCOM\fR,
\fB$SHF95\fR,
\fB$SHF95COM\fR,
\fB$SHF95FLAGS\fR,
\fB$SHF95PPCOM\fR,
\fB$_F95INCFLAGS\fR\&.
.sp
Uses:
\fB$F95COMSTR\fR,
\fB$F95PPCOMSTR\fR,
\fB$SHF95COMSTR\fR,
\fB$SHF95PPCOMSTR\fR\&.
.RE
.PP
fortran
.RS 4
Set construction variables for generic POSIX Fortran compilers\&.
.sp
Sets:
\fB$FORTRAN\fR,
\fB$FORTRANCOM\fR,
\fB$FORTRANFLAGS\fR,
\fB$SHFORTRAN\fR,
\fB$SHFORTRANCOM\fR,
\fB$SHFORTRANFLAGS\fR,
\fB$SHFORTRANPPCOM\fR\&.
.sp
Uses:
\fB$FORTRANCOMSTR\fR,
\fB$FORTRANPPCOMSTR\fR,
\fB$SHFORTRANCOMSTR\fR,
\fB$SHFORTRANPPCOMSTR\fR\&.
.RE
.PP
g++
.RS 4
Set construction variables for the
gXX
C++ compiler\&.
.sp
Sets:
\fB$CXX\fR,
\fB$CXXVERSION\fR,
\fB$SHCXXFLAGS\fR,
\fB$SHOBJSUFFIX\fR\&.
.RE
.PP
g77
.RS 4
Set construction variables for the
g77
Fortran compiler\&. Calls the
f77
Tool module to set variables\&.
.RE
.PP
gas
.RS 4
Sets construction variables for the
gas
assembler\&. Calls the
as
module\&.
.sp
Sets:
\fB$AS\fR\&.
.RE
.PP
gcc
.RS 4
Set construction variables for the
gcc
C compiler\&.
.sp
Sets:
\fB$CC\fR,
\fB$CCVERSION\fR,
\fB$SHCCFLAGS\fR\&.
.RE
.PP
gdc
.RS 4
Sets construction variables for the D language compiler GDC\&.
.sp
Sets:
\fB$DC\fR,
\fB$DCOM\fR,
\fB$DDEBUG\fR,
\fB$DDEBUGPREFIX\fR,
\fB$DDEBUGSUFFIX\fR,
\fB$DFILESUFFIX\fR,
\fB$DFLAGPREFIX\fR,
\fB$DFLAGS\fR,
\fB$DFLAGSUFFIX\fR,
\fB$DINCPREFIX\fR,
\fB$DINCSUFFIX\fR,
\fB$DLIB\fR,
\fB$DLIBCOM\fR,
\fB$DLIBDIRPREFIX\fR,
\fB$DLIBDIRSUFFIX\fR,
\fB$DLIBFLAGPREFIX\fR,
\fB$DLIBFLAGSUFFIX\fR,
\fB$DLIBLINKPREFIX\fR,
\fB$DLIBLINKSUFFIX\fR,
\fB$DLINK\fR,
\fB$DLINKCOM\fR,
\fB$DLINKFLAGPREFIX\fR,
\fB$DLINKFLAGS\fR,
\fB$DLINKFLAGSUFFIX\fR,
\fB$DPATH\fR,
\fB$DRPATHPREFIX\fR,
\fB$DRPATHSUFFIX\fR,
\fB$DShLibSonameGenerator\fR,
\fB$DVERPREFIX\fR,
\fB$DVERSIONS\fR,
\fB$DVERSUFFIX\fR,
\fB$SHDC\fR,
\fB$SHDCOM\fR,
\fB$SHDLIBVERSION\fR,
\fB$SHDLIBVERSIONFLAGS\fR,
\fB$SHDLINK\fR,
\fB$SHDLINKCOM\fR,
\fB$SHDLINKFLAGS\fR\&.
.RE
.PP
gettext
.RS 4
This is actually a toolset, which supports internationalization and localization of software being constructed with SCons\&. The toolset loads following tools:
.sp
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
xgettext
\- to extract internationalized messages from source code to
POT
file(s),
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
msginit
\- may be optionally used to initialize
PO
files,
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
msgmerge
\- to update
PO
files, that already contain translated messages,
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
msgfmt
\- to compile textual
PO
file to binary installable
MO
file\&.
.RE
.sp
When you enable
gettext, it internally loads all abovementioned tools, so you\*(Aqre encouraged to see their individual documentation\&.
.sp
Each of the above tools provides its own builder(s) which may be used to perform particular activities related to software internationalization\&. You may be however interested in
\fItop\-level\fR
builder
\fBTranslate\fR
described few paragraphs later\&.
.sp
To use
gettext
tools add
\*(Aqgettext\*(Aq
tool to your environment:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment( tools = [\*(Aqdefault\*(Aq, \*(Aqgettext\*(Aq] )
.fi
.if n \{\
.RE
.\}
.RE
.PP
gfortran
.RS 4
Sets construction variables for the GNU F95/F2003 GNU compiler\&.
.sp
Sets:
\fB$F77\fR,
\fB$F90\fR,
\fB$F95\fR,
\fB$FORTRAN\fR,
\fB$SHF77\fR,
\fB$SHF77FLAGS\fR,
\fB$SHF90\fR,
\fB$SHF90FLAGS\fR,
\fB$SHF95\fR,
\fB$SHF95FLAGS\fR,
\fB$SHFORTRAN\fR,
\fB$SHFORTRANFLAGS\fR\&.
.RE
.PP
gnulink
.RS 4
Set construction variables for GNU linker/loader\&.
.sp
Sets:
\fB$LDMODULEVERSIONFLAGS\fR,
\fB$RPATHPREFIX\fR,
\fB$RPATHSUFFIX\fR,
\fB$SHLIBVERSIONFLAGS\fR,
\fB$SHLINKFLAGS\fR,
\fB$_LDMODULESONAME\fR,
\fB$_SHLIBSONAME\fR\&.
.RE
.PP
gs
.RS 4
This Tool sets the required construction variables for working with the Ghostscript command\&. It also registers an appropriate Action with the PDF Builder (\fBPDF\fR), such that the conversion from PS/EPS to PDF happens automatically for the TeX/LaTeX toolchain\&. Finally, it adds an explicit Ghostscript Builder (\fBGs\fR) to the environment\&.
.sp
Sets:
\fB$GS\fR,
\fB$GSCOM\fR,
\fB$GSFLAGS\fR\&.
.sp
Uses:
\fB$GSCOMSTR\fR\&.
.RE
.PP
hpc++
.RS 4
Set construction variables for the compilers aCC on HP/UX systems\&.
.RE
.PP
hpcc
.RS 4
Set construction variables for the
aCC
on HP/UX systems\&. Calls the
cXX
tool for additional variables\&.
.sp
Sets:
\fB$CXX\fR,
\fB$CXXVERSION\fR,
\fB$SHCXXFLAGS\fR\&.
.RE
.PP
hplink
.RS 4
Sets construction variables for the linker on HP/UX systems\&.
.sp
Sets:
\fB$LINKFLAGS\fR,
\fB$SHLIBSUFFIX\fR,
\fB$SHLINKFLAGS\fR\&.
.RE
.PP
icc
.RS 4
Sets construction variables for the
icc
compiler on OS/2 systems\&.
.sp
Sets:
\fB$CC\fR,
\fB$CCCOM\fR,
\fB$CFILESUFFIX\fR,
\fB$CPPDEFPREFIX\fR,
\fB$CPPDEFSUFFIX\fR,
\fB$CXXCOM\fR,
\fB$CXXFILESUFFIX\fR,
\fB$INCPREFIX\fR,
\fB$INCSUFFIX\fR\&.
.sp
Uses:
\fB$CCFLAGS\fR,
\fB$CFLAGS\fR,
\fB$CPPFLAGS\fR,
\fB$_CPPDEFFLAGS\fR,
\fB$_CPPINCFLAGS\fR\&.
.RE
.PP
icl
.RS 4
Sets construction variables for the Intel C/C++ compiler\&. Calls the
intelc
Tool module to set its variables\&.
.RE
.PP
ifl
.RS 4
Sets construction variables for the Intel Fortran compiler\&.
.sp
Sets:
\fB$FORTRAN\fR,
\fB$FORTRANCOM\fR,
\fB$FORTRANPPCOM\fR,
\fB$SHFORTRANCOM\fR,
\fB$SHFORTRANPPCOM\fR\&.
.sp
Uses:
\fB$CPPFLAGS\fR,
\fB$FORTRANFLAGS\fR,
\fB$_CPPDEFFLAGS\fR,
\fB$_FORTRANINCFLAGS\fR\&.
.RE
.PP
ifort
.RS 4
Sets construction variables for newer versions of the Intel Fortran compiler for Linux\&.
.sp
Sets:
\fB$F77\fR,
\fB$F90\fR,
\fB$F95\fR,
\fB$FORTRAN\fR,
\fB$SHF77\fR,
\fB$SHF77FLAGS\fR,
\fB$SHF90\fR,
\fB$SHF90FLAGS\fR,
\fB$SHF95\fR,
\fB$SHF95FLAGS\fR,
\fB$SHFORTRAN\fR,
\fB$SHFORTRANFLAGS\fR\&.
.RE
.PP
ilink
.RS 4
Sets construction variables for the
ilink
linker on OS/2 systems\&.
.sp
Sets:
\fB$LIBDIRPREFIX\fR,
\fB$LIBDIRSUFFIX\fR,
\fB$LIBLINKPREFIX\fR,
\fB$LIBLINKSUFFIX\fR,
\fB$LINK\fR,
\fB$LINKCOM\fR,
\fB$LINKFLAGS\fR\&.
.RE
.PP
ilink32
.RS 4
Sets construction variables for the Borland
ilink32
linker\&.
.sp
Sets:
\fB$LIBDIRPREFIX\fR,
\fB$LIBDIRSUFFIX\fR,
\fB$LIBLINKPREFIX\fR,
\fB$LIBLINKSUFFIX\fR,
\fB$LINK\fR,
\fB$LINKCOM\fR,
\fB$LINKFLAGS\fR\&.
.RE
.PP
install
.RS 4
Sets construction variables for file and directory installation\&.
.sp
Sets:
\fB$INSTALL\fR,
\fB$INSTALLSTR\fR\&.
.RE
.PP
intelc
.RS 4
Sets construction variables for the Intel C/C++ compiler (Linux and Windows, version 7 and later)\&. Calls the
gcc
or
msvc
(on Linux and Windows, respectively) to set underlying variables\&.
.sp
Sets:
\fB$AR\fR,
\fB$CC\fR,
\fB$CXX\fR,
\fB$INTEL_C_COMPILER_VERSION\fR,
\fB$LINK\fR\&.
.RE
.PP
jar
.RS 4
Sets construction variables for the
jar
utility\&.
.sp
Sets:
\fB$JAR\fR,
\fB$JARCOM\fR,
\fB$JARFLAGS\fR,
\fB$JARSUFFIX\fR\&.
.sp
Uses:
\fB$JARCOMSTR\fR\&.
.RE
.PP
javac
.RS 4
Sets construction variables for the
javac
compiler\&.
.sp
Sets:
\fB$JAVABOOTCLASSPATH\fR,
\fB$JAVAC\fR,
\fB$JAVACCOM\fR,
\fB$JAVACFLAGS\fR,
\fB$JAVACLASSPATH\fR,
\fB$JAVACLASSSUFFIX\fR,
\fB$JAVAINCLUDES\fR,
\fB$JAVASOURCEPATH\fR,
\fB$JAVASUFFIX\fR\&.
.sp
Uses:
\fB$JAVACCOMSTR\fR\&.
.RE
.PP
javah
.RS 4
Sets construction variables for the
javah
tool\&.
.sp
Sets:
\fB$JAVACLASSSUFFIX\fR,
\fB$JAVAH\fR,
\fB$JAVAHCOM\fR,
\fB$JAVAHFLAGS\fR\&.
.sp
Uses:
\fB$JAVACLASSPATH\fR,
\fB$JAVAHCOMSTR\fR\&.
.RE
.PP
latex
.RS 4
Sets construction variables for the
latex
utility\&.
.sp
Sets:
\fB$LATEX\fR,
\fB$LATEXCOM\fR,
\fB$LATEXFLAGS\fR\&.
.sp
Uses:
\fB$LATEXCOMSTR\fR\&.
.RE
.PP
ldc
.RS 4
Sets construction variables for the D language compiler LDC2\&.
.sp
Sets:
\fB$DC\fR,
\fB$DCOM\fR,
\fB$DDEBUG\fR,
\fB$DDEBUGPREFIX\fR,
\fB$DDEBUGSUFFIX\fR,
\fB$DFILESUFFIX\fR,
\fB$DFLAGPREFIX\fR,
\fB$DFLAGS\fR,
\fB$DFLAGSUFFIX\fR,
\fB$DINCPREFIX\fR,
\fB$DINCSUFFIX\fR,
\fB$DLIB\fR,
\fB$DLIBCOM\fR,
\fB$DLIBDIRPREFIX\fR,
\fB$DLIBDIRSUFFIX\fR,
\fB$DLIBFLAGPREFIX\fR,
\fB$DLIBFLAGSUFFIX\fR,
\fB$DLIBLINKPREFIX\fR,
\fB$DLIBLINKSUFFIX\fR,
\fB$DLINK\fR,
\fB$DLINKCOM\fR,
\fB$DLINKFLAGPREFIX\fR,
\fB$DLINKFLAGS\fR,
\fB$DLINKFLAGSUFFIX\fR,
\fB$DPATH\fR,
\fB$DRPATHPREFIX\fR,
\fB$DRPATHSUFFIX\fR,
\fB$DShLibSonameGenerator\fR,
\fB$DVERPREFIX\fR,
\fB$DVERSIONS\fR,
\fB$DVERSUFFIX\fR,
\fB$SHDC\fR,
\fB$SHDCOM\fR,
\fB$SHDLIBVERSION\fR,
\fB$SHDLIBVERSIONFLAGS\fR,
\fB$SHDLINK\fR,
\fB$SHDLINKCOM\fR,
\fB$SHDLINKFLAGS\fR\&.
.RE
.PP
lex
.RS 4
Sets construction variables for the
lex
lexical analyser\&.
.sp
Sets:
\fB$LEX\fR,
\fB$LEXCOM\fR,
\fB$LEXFLAGS\fR,
\fB$LEXUNISTD\fR\&.
.sp
Uses:
\fB$LEXCOMSTR\fR\&.
.RE
.PP
link
.RS 4
Sets construction variables for generic POSIX linkers\&. This is a "smart" linker tool which selects a compiler to complete the linking based on the types of source files\&.
.sp
Sets:
\fB$LDMODULE\fR,
\fB$LDMODULECOM\fR,
\fB$LDMODULEFLAGS\fR,
\fB$LDMODULENOVERSIONSYMLINKS\fR,
\fB$LDMODULEPREFIX\fR,
\fB$LDMODULESUFFIX\fR,
\fB$LDMODULEVERSION\fR,
\fB$LDMODULEVERSIONFLAGS\fR,
\fB$LIBDIRPREFIX\fR,
\fB$LIBDIRSUFFIX\fR,
\fB$LIBLINKPREFIX\fR,
\fB$LIBLINKSUFFIX\fR,
\fB$LINK\fR,
\fB$LINKCOM\fR,
\fB$LINKFLAGS\fR,
\fB$SHLIBSUFFIX\fR,
\fB$SHLINK\fR,
\fB$SHLINKCOM\fR,
\fB$SHLINKFLAGS\fR,
\fB$__LDMODULEVERSIONFLAGS\fR,
\fB$__SHLIBVERSIONFLAGS\fR\&.
.sp
Uses:
\fB$LDMODULECOMSTR\fR,
\fB$LINKCOMSTR\fR,
\fB$SHLINKCOMSTR\fR\&.
.RE
.PP
linkloc
.RS 4
Sets construction variables for the
LinkLoc
linker for the Phar Lap ETS embedded operating system\&.
.sp
Sets:
\fB$LIBDIRPREFIX\fR,
\fB$LIBDIRSUFFIX\fR,
\fB$LIBLINKPREFIX\fR,
\fB$LIBLINKSUFFIX\fR,
\fB$LINK\fR,
\fB$LINKCOM\fR,
\fB$LINKFLAGS\fR,
\fB$SHLINK\fR,
\fB$SHLINKCOM\fR,
\fB$SHLINKFLAGS\fR\&.
.sp
Uses:
\fB$LINKCOMSTR\fR,
\fB$SHLINKCOMSTR\fR\&.
.RE
.PP
m4
.RS 4
Sets construction variables for the
m4
macro processor\&.
.sp
Sets:
\fB$M4\fR,
\fB$M4COM\fR,
\fB$M4FLAGS\fR\&.
.sp
Uses:
\fB$M4COMSTR\fR\&.
.RE
.PP
masm
.RS 4
Sets construction variables for the Microsoft assembler\&.
.sp
Sets:
\fB$AS\fR,
\fB$ASCOM\fR,
\fB$ASFLAGS\fR,
\fB$ASPPCOM\fR,
\fB$ASPPFLAGS\fR\&.
.sp
Uses:
\fB$ASCOMSTR\fR,
\fB$ASPPCOMSTR\fR,
\fB$CPPFLAGS\fR,
\fB$_CPPDEFFLAGS\fR,
\fB$_CPPINCFLAGS\fR\&.
.RE
.PP
midl
.RS 4
Sets construction variables for the Microsoft IDL compiler\&.
.sp
Sets:
\fB$MIDL\fR,
\fB$MIDLCOM\fR,
\fB$MIDLFLAGS\fR\&.
.sp
Uses:
\fB$MIDLCOMSTR\fR\&.
.RE
.PP
mingw
.RS 4
Sets construction variables for MinGW (Minimal Gnu on Windows)\&.
.sp
Sets:
\fB$AS\fR,
\fB$CC\fR,
\fB$CXX\fR,
\fB$LDMODULECOM\fR,
\fB$LIBPREFIX\fR,
\fB$LIBSUFFIX\fR,
\fB$OBJSUFFIX\fR,
\fB$RC\fR,
\fB$RCCOM\fR,
\fB$RCFLAGS\fR,
\fB$RCINCFLAGS\fR,
\fB$RCINCPREFIX\fR,
\fB$RCINCSUFFIX\fR,
\fB$SHCCFLAGS\fR,
\fB$SHCXXFLAGS\fR,
\fB$SHLINKCOM\fR,
\fB$SHLINKFLAGS\fR,
\fB$SHOBJSUFFIX\fR,
\fB$WINDOWSDEFPREFIX\fR,
\fB$WINDOWSDEFSUFFIX\fR\&.
.sp
Uses:
\fB$RCCOMSTR\fR,
\fB$SHLINKCOMSTR\fR\&.
.RE
.PP
msgfmt
.RS 4
This scons tool is a part of scons
gettext
toolset\&. It provides scons interface to
\fBmsgfmt(1)\fR
command, which generates binary message catalog (MO) from a textual translation description (PO)\&.
.sp
Sets:
\fB$MOSUFFIX\fR,
\fB$MSGFMT\fR,
\fB$MSGFMTCOM\fR,
\fB$MSGFMTCOMSTR\fR,
\fB$MSGFMTFLAGS\fR,
\fB$POSUFFIX\fR\&.
.sp
Uses:
\fB$LINGUAS_FILE\fR\&.
.RE
.PP
msginit
.RS 4
This scons tool is a part of scons
gettext
toolset\&. It provides scons interface to
\fBmsginit(1)\fR
program, which creates new
PO
file, initializing the meta information with values from user\*(Aqs environment (or options)\&.
.sp
Sets:
\fB$MSGINIT\fR,
\fB$MSGINITCOM\fR,
\fB$MSGINITCOMSTR\fR,
\fB$MSGINITFLAGS\fR,
\fB$POAUTOINIT\fR,
\fB$POCREATE_ALIAS\fR,
\fB$POSUFFIX\fR,
\fB$POTSUFFIX\fR,
\fB$_MSGINITLOCALE\fR\&.
.sp
Uses:
\fB$LINGUAS_FILE\fR,
\fB$POAUTOINIT\fR,
\fB$POTDOMAIN\fR\&.
.RE
.PP
msgmerge
.RS 4
This scons tool is a part of scons
gettext
toolset\&. It provides scons interface to
\fBmsgmerge(1)\fR
command, which merges two Uniform style
\&.po
files together\&.
.sp
Sets:
\fB$MSGMERGE\fR,
\fB$MSGMERGECOM\fR,
\fB$MSGMERGECOMSTR\fR,
\fB$MSGMERGEFLAGS\fR,
\fB$POSUFFIX\fR,
\fB$POTSUFFIX\fR,
\fB$POUPDATE_ALIAS\fR\&.
.sp
Uses:
\fB$LINGUAS_FILE\fR,
\fB$POAUTOINIT\fR,
\fB$POTDOMAIN\fR\&.
.RE
.PP
mslib
.RS 4
Sets construction variables for the Microsoft
mslib
library archiver\&.
.sp
Sets:
\fB$AR\fR,
\fB$ARCOM\fR,
\fB$ARFLAGS\fR,
\fB$LIBPREFIX\fR,
\fB$LIBSUFFIX\fR\&.
.sp
Uses:
\fB$ARCOMSTR\fR\&.
.RE
.PP
mslink
.RS 4
Sets construction variables for the Microsoft linker\&.
.sp
Sets:
\fB$LDMODULE\fR,
\fB$LDMODULECOM\fR,
\fB$LDMODULEFLAGS\fR,
\fB$LDMODULEPREFIX\fR,
\fB$LDMODULESUFFIX\fR,
\fB$LIBDIRPREFIX\fR,
\fB$LIBDIRSUFFIX\fR,
\fB$LIBLINKPREFIX\fR,
\fB$LIBLINKSUFFIX\fR,
\fB$LINK\fR,
\fB$LINKCOM\fR,
\fB$LINKFLAGS\fR,
\fB$REGSVR\fR,
\fB$REGSVRCOM\fR,
\fB$REGSVRFLAGS\fR,
\fB$SHLINK\fR,
\fB$SHLINKCOM\fR,
\fB$SHLINKFLAGS\fR,
\fB$WIN32DEFPREFIX\fR,
\fB$WIN32DEFSUFFIX\fR,
\fB$WIN32EXPPREFIX\fR,
\fB$WIN32EXPSUFFIX\fR,
\fB$WINDOWSDEFPREFIX\fR,
\fB$WINDOWSDEFSUFFIX\fR,
\fB$WINDOWSEXPPREFIX\fR,
\fB$WINDOWSEXPSUFFIX\fR,
\fB$WINDOWSPROGMANIFESTPREFIX\fR,
\fB$WINDOWSPROGMANIFESTSUFFIX\fR,
\fB$WINDOWSSHLIBMANIFESTPREFIX\fR,
\fB$WINDOWSSHLIBMANIFESTSUFFIX\fR,
\fB$WINDOWS_INSERT_DEF\fR\&.
.sp
Uses:
\fB$LDMODULECOMSTR\fR,
\fB$LINKCOMSTR\fR,
\fB$REGSVRCOMSTR\fR,
\fB$SHLINKCOMSTR\fR\&.
.RE
.PP
mssdk
.RS 4
Sets variables for Microsoft Platform SDK and/or Windows SDK\&. Note that unlike most other Tool modules, mssdk does not set construction variables, but sets the
\fIenvironment variables\fR
in the environment
SCons
uses to execute the Microsoft toolchain:
%INCLUDE%,
%LIB%,
%LIBPATH%
and
%PATH%\&.
.sp
Uses:
\fB$MSSDK_DIR\fR,
\fB$MSSDK_VERSION\fR,
\fB$MSVS_VERSION\fR\&.
.RE
.PP
msvc
.RS 4
Sets construction variables for the Microsoft Visual C/C++ compiler\&.
.sp
Sets:
\fB$BUILDERS\fR,
\fB$CC\fR,
\fB$CCCOM\fR,
\fB$CCFLAGS\fR,
\fB$CCPCHFLAGS\fR,
\fB$CCPDBFLAGS\fR,
\fB$CFILESUFFIX\fR,
\fB$CFLAGS\fR,
\fB$CPPDEFPREFIX\fR,
\fB$CPPDEFSUFFIX\fR,
\fB$CXX\fR,
\fB$CXXCOM\fR,
\fB$CXXFILESUFFIX\fR,
\fB$CXXFLAGS\fR,
\fB$INCPREFIX\fR,
\fB$INCSUFFIX\fR,
\fB$OBJPREFIX\fR,
\fB$OBJSUFFIX\fR,
\fB$PCHCOM\fR,
\fB$PCHPDBFLAGS\fR,
\fB$RC\fR,
\fB$RCCOM\fR,
\fB$RCFLAGS\fR,
\fB$SHCC\fR,
\fB$SHCCCOM\fR,
\fB$SHCCFLAGS\fR,
\fB$SHCFLAGS\fR,
\fB$SHCXX\fR,
\fB$SHCXXCOM\fR,
\fB$SHCXXFLAGS\fR,
\fB$SHOBJPREFIX\fR,
\fB$SHOBJSUFFIX\fR\&.
.sp
Uses:
\fB$CCCOMSTR\fR,
\fB$CXXCOMSTR\fR,
\fB$PCH\fR,
\fB$PCHSTOP\fR,
\fB$PDB\fR,
\fB$SHCCCOMSTR\fR,
\fB$SHCXXCOMSTR\fR\&.
.RE
.PP
msvs
.RS 4
Sets construction variables for Microsoft Visual Studio\&.
.sp
Sets:
\fB$MSVSBUILDCOM\fR,
\fB$MSVSCLEANCOM\fR,
\fB$MSVSENCODING\fR,
\fB$MSVSPROJECTCOM\fR,
\fB$MSVSREBUILDCOM\fR,
\fB$MSVSSCONS\fR,
\fB$MSVSSCONSCOM\fR,
\fB$MSVSSCONSCRIPT\fR,
\fB$MSVSSCONSFLAGS\fR,
\fB$MSVSSOLUTIONCOM\fR\&.
.RE
.PP
mwcc
.RS 4
Sets construction variables for the Metrowerks CodeWarrior compiler\&.
.sp
Sets:
\fB$CC\fR,
\fB$CCCOM\fR,
\fB$CFILESUFFIX\fR,
\fB$CPPDEFPREFIX\fR,
\fB$CPPDEFSUFFIX\fR,
\fB$CXX\fR,
\fB$CXXCOM\fR,
\fB$CXXFILESUFFIX\fR,
\fB$INCPREFIX\fR,
\fB$INCSUFFIX\fR,
\fB$MWCW_VERSION\fR,
\fB$MWCW_VERSIONS\fR,
\fB$SHCC\fR,
\fB$SHCCCOM\fR,
\fB$SHCCFLAGS\fR,
\fB$SHCFLAGS\fR,
\fB$SHCXX\fR,
\fB$SHCXXCOM\fR,
\fB$SHCXXFLAGS\fR\&.
.sp
Uses:
\fB$CCCOMSTR\fR,
\fB$CXXCOMSTR\fR,
\fB$SHCCCOMSTR\fR,
\fB$SHCXXCOMSTR\fR\&.
.RE
.PP
mwld
.RS 4
Sets construction variables for the Metrowerks CodeWarrior linker\&.
.sp
Sets:
\fB$AR\fR,
\fB$ARCOM\fR,
\fB$LIBDIRPREFIX\fR,
\fB$LIBDIRSUFFIX\fR,
\fB$LIBLINKPREFIX\fR,
\fB$LIBLINKSUFFIX\fR,
\fB$LINK\fR,
\fB$LINKCOM\fR,
\fB$SHLINK\fR,
\fB$SHLINKCOM\fR,
\fB$SHLINKFLAGS\fR\&.
.RE
.PP
nasm
.RS 4
Sets construction variables for the
nasm
Netwide Assembler\&.
.sp
Sets:
\fB$AS\fR,
\fB$ASCOM\fR,
\fB$ASFLAGS\fR,
\fB$ASPPCOM\fR,
\fB$ASPPFLAGS\fR\&.
.sp
Uses:
\fB$ASCOMSTR\fR,
\fB$ASPPCOMSTR\fR\&.
.RE
.PP
Packaging
.RS 4
Sets construction variables for the
\fBPackage\fR
Builder\&.
.RE
.PP
packaging
.RS 4
A framework for building binary and source packages\&.
.RE
.PP
pdf
.RS 4
Sets construction variables for the Portable Document Format builder\&.
.sp
Sets:
\fB$PDFPREFIX\fR,
\fB$PDFSUFFIX\fR\&.
.RE
.PP
pdflatex
.RS 4
Sets construction variables for the
pdflatex
utility\&.
.sp
Sets:
\fB$LATEXRETRIES\fR,
\fB$PDFLATEX\fR,
\fB$PDFLATEXCOM\fR,
\fB$PDFLATEXFLAGS\fR\&.
.sp
Uses:
\fB$PDFLATEXCOMSTR\fR\&.
.RE
.PP
pdftex
.RS 4
Sets construction variables for the
pdftex
utility\&.
.sp
Sets:
\fB$LATEXRETRIES\fR,
\fB$PDFLATEX\fR,
\fB$PDFLATEXCOM\fR,
\fB$PDFLATEXFLAGS\fR,
\fB$PDFTEX\fR,
\fB$PDFTEXCOM\fR,
\fB$PDFTEXFLAGS\fR\&.
.sp
Uses:
\fB$PDFLATEXCOMSTR\fR,
\fB$PDFTEXCOMSTR\fR\&.
.RE
.PP
qt
.RS 4
Sets construction variables for building Qt applications\&.
.sp
Sets:
\fB$QTDIR\fR,
\fB$QT_AUTOSCAN\fR,
\fB$QT_BINPATH\fR,
\fB$QT_CPPPATH\fR,
\fB$QT_LIB\fR,
\fB$QT_LIBPATH\fR,
\fB$QT_MOC\fR,
\fB$QT_MOCCXXPREFIX\fR,
\fB$QT_MOCCXXSUFFIX\fR,
\fB$QT_MOCFROMCXXCOM\fR,
\fB$QT_MOCFROMCXXFLAGS\fR,
\fB$QT_MOCFROMHCOM\fR,
\fB$QT_MOCFROMHFLAGS\fR,
\fB$QT_MOCHPREFIX\fR,
\fB$QT_MOCHSUFFIX\fR,
\fB$QT_UIC\fR,
\fB$QT_UICCOM\fR,
\fB$QT_UICDECLFLAGS\fR,
\fB$QT_UICDECLPREFIX\fR,
\fB$QT_UICDECLSUFFIX\fR,
\fB$QT_UICIMPLFLAGS\fR,
\fB$QT_UICIMPLPREFIX\fR,
\fB$QT_UICIMPLSUFFIX\fR,
\fB$QT_UISUFFIX\fR\&.
.RE
.PP
rmic
.RS 4
Sets construction variables for the
rmic
utility\&.
.sp
Sets:
\fB$JAVACLASSSUFFIX\fR,
\fB$RMIC\fR,
\fB$RMICCOM\fR,
\fB$RMICFLAGS\fR\&.
.sp
Uses:
\fB$RMICCOMSTR\fR\&.
.RE
.PP
rpcgen
.RS 4
Sets construction variables for building with RPCGEN\&.
.sp
Sets:
\fB$RPCGEN\fR,
\fB$RPCGENCLIENTFLAGS\fR,
\fB$RPCGENFLAGS\fR,
\fB$RPCGENHEADERFLAGS\fR,
\fB$RPCGENSERVICEFLAGS\fR,
\fB$RPCGENXDRFLAGS\fR\&.
.RE
.PP
sgiar
.RS 4
Sets construction variables for the SGI library archiver\&.
.sp
Sets:
\fB$AR\fR,
\fB$ARCOMSTR\fR,
\fB$ARFLAGS\fR,
\fB$LIBPREFIX\fR,
\fB$LIBSUFFIX\fR,
\fB$SHLINK\fR,
\fB$SHLINKFLAGS\fR\&.
.sp
Uses:
\fB$ARCOMSTR\fR,
\fB$SHLINKCOMSTR\fR\&.
.RE
.PP
sgic++
.RS 4
Sets construction variables for the SGI C++ compiler\&.
.sp
Sets:
\fB$CXX\fR,
\fB$CXXFLAGS\fR,
\fB$SHCXX\fR,
\fB$SHOBJSUFFIX\fR\&.
.RE
.PP
sgicc
.RS 4
Sets construction variables for the SGI C compiler\&.
.sp
Sets:
\fB$CXX\fR,
\fB$SHOBJSUFFIX\fR\&.
.RE
.PP
sgilink
.RS 4
Sets construction variables for the SGI linker\&.
.sp
Sets:
\fB$LINK\fR,
\fB$RPATHPREFIX\fR,
\fB$RPATHSUFFIX\fR,
\fB$SHLINKFLAGS\fR\&.
.RE
.PP
sunar
.RS 4
Sets construction variables for the Sun library archiver\&.
.sp
Sets:
\fB$AR\fR,
\fB$ARCOM\fR,
\fB$ARFLAGS\fR,
\fB$LIBPREFIX\fR,
\fB$LIBSUFFIX\fR\&.
.sp
Uses:
\fB$ARCOMSTR\fR\&.
.RE
.PP
sunc++
.RS 4
Sets construction variables for the Sun C++ compiler\&.
.sp
Sets:
\fB$CXX\fR,
\fB$CXXVERSION\fR,
\fB$SHCXX\fR,
\fB$SHCXXFLAGS\fR,
\fB$SHOBJPREFIX\fR,
\fB$SHOBJSUFFIX\fR\&.
.RE
.PP
suncc
.RS 4
Sets construction variables for the Sun C compiler\&.
.sp
Sets:
\fB$CXX\fR,
\fB$SHCCFLAGS\fR,
\fB$SHOBJPREFIX\fR,
\fB$SHOBJSUFFIX\fR\&.
.RE
.PP
sunf77
.RS 4
Set construction variables for the Sun
f77
Fortran compiler\&.
.sp
Sets:
\fB$F77\fR,
\fB$FORTRAN\fR,
\fB$SHF77\fR,
\fB$SHF77FLAGS\fR,
\fB$SHFORTRAN\fR,
\fB$SHFORTRANFLAGS\fR\&.
.RE
.PP
sunf90
.RS 4
Set construction variables for the Sun
f90
Fortran compiler\&.
.sp
Sets:
\fB$F90\fR,
\fB$FORTRAN\fR,
\fB$SHF90\fR,
\fB$SHF90FLAGS\fR,
\fB$SHFORTRAN\fR,
\fB$SHFORTRANFLAGS\fR\&.
.RE
.PP
sunf95
.RS 4
Set construction variables for the Sun
f95
Fortran compiler\&.
.sp
Sets:
\fB$F95\fR,
\fB$FORTRAN\fR,
\fB$SHF95\fR,
\fB$SHF95FLAGS\fR,
\fB$SHFORTRAN\fR,
\fB$SHFORTRANFLAGS\fR\&.
.RE
.PP
sunlink
.RS 4
Sets construction variables for the Sun linker\&.
.sp
Sets:
\fB$RPATHPREFIX\fR,
\fB$RPATHSUFFIX\fR,
\fB$SHLINKFLAGS\fR\&.
.RE
.PP
swig
.RS 4
Sets construction variables for the SWIG interface generator\&.
.sp
Sets:
\fB$SWIG\fR,
\fB$SWIGCFILESUFFIX\fR,
\fB$SWIGCOM\fR,
\fB$SWIGCXXFILESUFFIX\fR,
\fB$SWIGDIRECTORSUFFIX\fR,
\fB$SWIGFLAGS\fR,
\fB$SWIGINCPREFIX\fR,
\fB$SWIGINCSUFFIX\fR,
\fB$SWIGPATH\fR,
\fB$SWIGVERSION\fR,
\fB$_SWIGINCFLAGS\fR\&.
.sp
Uses:
\fB$SWIGCOMSTR\fR\&.
.RE
.PP
tar
.RS 4
Sets construction variables for the
tar
archiver\&.
.sp
Sets:
\fB$TAR\fR,
\fB$TARCOM\fR,
\fB$TARFLAGS\fR,
\fB$TARSUFFIX\fR\&.
.sp
Uses:
\fB$TARCOMSTR\fR\&.
.RE
.PP
tex
.RS 4
Sets construction variables for the TeX formatter and typesetter\&.
.sp
Sets:
\fB$BIBTEX\fR,
\fB$BIBTEXCOM\fR,
\fB$BIBTEXFLAGS\fR,
\fB$LATEX\fR,
\fB$LATEXCOM\fR,
\fB$LATEXFLAGS\fR,
\fB$MAKEINDEX\fR,
\fB$MAKEINDEXCOM\fR,
\fB$MAKEINDEXFLAGS\fR,
\fB$TEX\fR,
\fB$TEXCOM\fR,
\fB$TEXFLAGS\fR\&.
.sp
Uses:
\fB$BIBTEXCOMSTR\fR,
\fB$LATEXCOMSTR\fR,
\fB$MAKEINDEXCOMSTR\fR,
\fB$TEXCOMSTR\fR\&.
.RE
.PP
textfile
.RS 4
Set construction variables for the
\fBTextfile\fR
and
\fBSubstfile\fR
builders\&.
.sp
Sets:
\fB$LINESEPARATOR\fR,
\fB$SUBSTFILEPREFIX\fR,
\fB$SUBSTFILESUFFIX\fR,
\fB$TEXTFILEPREFIX\fR,
\fB$TEXTFILESUFFIX\fR\&.
.sp
Uses:
\fB$SUBST_DICT\fR\&.
.RE
.PP
tlib
.RS 4
Sets construction variables for the Borlan
tib
library archiver\&.
.sp
Sets:
\fB$AR\fR,
\fB$ARCOM\fR,
\fB$ARFLAGS\fR,
\fB$LIBPREFIX\fR,
\fB$LIBSUFFIX\fR\&.
.sp
Uses:
\fB$ARCOMSTR\fR\&.
.RE
.PP
xgettext
.RS 4
This scons tool is a part of scons
gettext
toolset\&. It provides scons interface to
\fBxgettext(1)\fR
program, which extracts internationalized messages from source code\&. The tool provides
\fBPOTUpdate\fR
builder to make
PO
\fITemplate\fR
files\&.
.sp
Sets:
\fB$POTSUFFIX\fR,
\fB$POTUPDATE_ALIAS\fR,
\fB$XGETTEXTCOM\fR,
\fB$XGETTEXTCOMSTR\fR,
\fB$XGETTEXTFLAGS\fR,
\fB$XGETTEXTFROM\fR,
\fB$XGETTEXTFROMPREFIX\fR,
\fB$XGETTEXTFROMSUFFIX\fR,
\fB$XGETTEXTPATH\fR,
\fB$XGETTEXTPATHPREFIX\fR,
\fB$XGETTEXTPATHSUFFIX\fR,
\fB$_XGETTEXTDOMAIN\fR,
\fB$_XGETTEXTFROMFLAGS\fR,
\fB$_XGETTEXTPATHFLAGS\fR\&.
.sp
Uses:
\fB$POTDOMAIN\fR\&.
.RE
.PP
yacc
.RS 4
Sets construction variables for the
yacc
parse generator\&.
.sp
Sets:
\fB$YACC\fR,
\fB$YACCCOM\fR,
\fB$YACCFLAGS\fR,
\fB$YACCHFILESUFFIX\fR,
\fB$YACCHXXFILESUFFIX\fR,
\fB$YACCVCGFILESUFFIX\fR\&.
.sp
Uses:
\fB$YACCCOMSTR\fR\&.
.RE
.PP
zip
.RS 4
Sets construction variables for the
zip
archiver\&.
.sp
Sets:
\fB$ZIP\fR,
\fB$ZIPCOM\fR,
\fB$ZIPCOMPRESSION\fR,
\fB$ZIPFLAGS\fR,
\fB$ZIPSUFFIX\fR\&.
.sp
Uses:
\fB$ZIPCOMSTR\fR\&.
.RE
.SS "Builder Methods"
.PP
You tell
\fBscons\fR
what to build by calling Builders, functions which know to take a particular action when given files of a particular type to produce a particular result type\&.
\fBscons\fR
defines a number of builders, and you can also write your own\&. Builders are attached to a
construction environment
as methods, and the available builder methods are listed as key\-value pairs in the
\fBBUILDERS\fR
attribute of the
construction environment\&. The available builders can be displayed like this for debugging purposes:
.sp
.if n \{\
.RS 4
.\}
.nf
print("Builders:", list(env[\*(AqBUILDERS\*(Aq]))
.fi
.if n \{\
.RE
.\}
.PP
Builder methods always take two arguments:
\fItarget\fR
(a target or a list of targets to be built) and
\fIsource\fR
(a source or list of sources to be used as input when building), although in some circumstances, the target argument can actually be omitted (see below)\&. Builder methods also take a variety of keyword arguments, described below\&.
.PP
Because long lists of file names can lead to a lot of quoting,
\fBscons\fR
supplies a
\fBSplit\fR
global function and a same\-named environment method that split a single string into a list, separated on strings of white\-space characters\&. (These are similar to the Python string
\fBsplit\fR
method, but work even if the input isn\*(Aqt a string\&.)
.PP
The target and source arguments to a builder method can be specified either as positional arguments, in which case the target comes first, or as keyword arguments, using
\fItarget=\fR
and
\fIsource=\fR\&. The following are equivalent examples of calling the
\fBProgram\fR
builder method:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Program(\*(Aqbar\*(Aq, [\*(Aqbar\&.c\*(Aq, \*(Aqfoo\&.c\*(Aq])
env\&.Program(\*(Aqbar\*(Aq, Split(\*(Aqbar\&.c foo\&.c\*(Aq))
env\&.Program(\*(Aqbar\*(Aq, env\&.Split(\*(Aqbar\&.c foo\&.c\*(Aq))
env\&.Program(source=[\*(Aqbar\&.c\*(Aq, \*(Aqfoo\&.c\*(Aq], target=\*(Aqbar\*(Aq)
env\&.Program(target=\*(Aqbar\*(Aq, source=Split(\*(Aqbar\&.c foo\&.c\*(Aq))
env\&.Program(target=\*(Aqbar\*(Aq, source=env\&.Split(\*(Aqbar\&.c foo\&.c\*(Aq))
env\&.Program(\*(Aqbar\*(Aq, source=\*(Aqbar\&.c foo\&.c\*(Aq\&.split())
.fi
.if n \{\
.RE
.\}
.PP
Python follows the POSIX pathname convention for path strings: if a string begins with the operating system pathname separator (on Windows both the slash and backslash separator work, and any leading drive specifier is ignored for the determination) it is considered an absolute path, otherwise it is a relative path\&. If the path string contains no separator characters, it is searched for as a file in the current directory\&. If it contains separator characters, the search follows down from the starting point, which is the top of the directory tree for an absolute path and the current directory for a relative path\&.
.PP
\fBscons\fR
recognizes a third way to specify path strings: if the string begins with the
\fB#\fR
character it is top\-relative \- it works like a relative path but the search follows down from the directory containing the top\-level
\fBSConstruct\fR
rather than from the current directory (the # is allowed to be followed by a pathname separator, which is ignored if found in that position)\&. Top\-relative paths only work in places where
scons
will interpret the path (see some examples below)\&. To be used in other contexts the string will need to be converted to a relative or absolute path first\&.
.PP
Target and source pathnames can be absolute, relative, or top\-relative\&. Relative pathnames are searched considering the directory of the
\fBSConscript\fR
file currently being processed as the "current directory"\&.
.PP
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# The comments describing the targets that will be built
# assume these calls are in a SConscript file in the
# a subdirectory named "subdir"\&.
# Builds the program "subdir/foo" from "subdir/foo\&.c":
env\&.Program(\*(Aqfoo\*(Aq, \*(Aqfoo\&.c\*(Aq)
# Builds the program "/tmp/bar" from "subdir/bar\&.c":
env\&.Program(\*(Aq/tmp/bar\*(Aq, \*(Aqbar\&.c\*(Aq)
# An initial \*(Aq#\*(Aq or \*(Aq#/\*(Aq are equivalent; the following
# calls build the programs "foo" and "bar" (in the
# top\-level SConstruct directory) from "subdir/foo\&.c" and
# "subdir/bar\&.c", respectively:
env\&.Program(\*(Aq#foo\*(Aq, \*(Aqfoo\&.c\*(Aq)
env\&.Program(\*(Aq#/bar\*(Aq, \*(Aqbar\&.c\*(Aq)
# Builds the program "other/foo" (relative to the top\-level
# SConstruct directory) from "subdir/foo\&.c":
env\&.Program(\*(Aq#other/foo\*(Aq, \*(Aqfoo\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
When the target shares the same base name as the source and only the suffix varies, and if the builder method has a suffix defined for the target file type, then the target argument may be omitted completely, and
\fBscons\fR
will deduce the target file name from the source file name\&. The following examples all build the executable program
\fBbar\fR
(on POSIX systems) or
\fBbar\&.exe\fR
(on Windows systems) from the
bar\&.c
source file:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Program(target=\*(Aqbar\*(Aq, source=\*(Aqbar\&.c\*(Aq)
env\&.Program(\*(Aqbar\*(Aq, source=\*(Aqbar\&.c\*(Aq)
env\&.Program(source=\*(Aqbar\&.c\*(Aq)
env\&.Program(\*(Aqbar\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
As a convenience, a
\fBsrcdir\fR
keyword argument may be specified when calling a Builder\&. When specified, all source file strings that are not absolute paths or top\-relative paths will be interpreted relative to the specified
\fBsrcdir\fR\&. The following example will build the
build/prog
(or
build/prog\&.exe
on Windows) program from the files
src/f1\&.c
and
src/f2\&.c:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Program(\*(Aqbuild/prog\*(Aq, [\*(Aqf1\&.c\*(Aq, \*(Aqf2\&.c\*(Aq], srcdir=\*(Aqsrc\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
It is possible to
\fIoverride\fR
(replace or add) construction variables when calling a builder method by passing them as keyword arguments\&. These overrides will only be in effect when building that target, and will not affect other parts of the build\&. For example, if you want to specify some libraries needed by just one program:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Program(\*(Aqhello\*(Aq, \*(Aqhello\&.c\*(Aq, LIBS=[\*(Aqgl\*(Aq, \*(Aqglut\*(Aq])
.fi
.if n \{\
.RE
.\}
.PP
or generate a shared library with a non\-standard suffix:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.SharedLibrary(\*(Aqword\*(Aq, \*(Aqword\&.cpp\*(Aq,
SHLIBSUFFIX=\*(Aq\&.ocx\*(Aq,
LIBSUFFIXES=[\*(Aq\&.ocx\*(Aq])
.fi
.if n \{\
.RE
.\}
.PP
(Note that both the $SHLIBSUFFIX and $LIBSUFFIXES variables must be set if you want SCons to search automatically for dependencies on the non\-standard library names; see the descriptions of these variables, below, for more information\&.)
.PP
It is also possible to use the
\fBparse_flags\fR
keyword argument in an override, to merge command\-line style arguments into the appropriate construction variables (see
\fBenv\&.MergeFlags\fR)\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Program(\*(Aqhello\*(Aq, \*(Aqhello\&.c\*(Aq, parse_flags=\*(Aq\-Iinclude \-DEBUG \-lm\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
This example adds \*(Aqinclude\*(Aq to
\fBCPPPATH\fR, \*(AqEBUG\*(Aq to
\fBCPPDEFINES\fR, and \*(Aqm\*(Aq to
\fBLIBS\fR\&.
.PP
Although the builder methods defined by
\fBscons\fR
are, in fact, methods of a construction environment object, they may also be called without an explicit environment:
.sp
.if n \{\
.RS 4
.\}
.nf
Program(\*(Aqhello\*(Aq, \*(Aqhello\&.c\*(Aq)
SharedLibrary(\*(Aqword\*(Aq, \*(Aqword\&.cpp\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
In this case, the methods are called internally using a default construction environment that consists of the tools and values that
\fBscons\fR
has determined are appropriate for the local system\&.
.PP
Builder methods that can be called without an explicit environment may be called from custom Python modules that you import into an SConscript file by adding the following to the Python module:
.sp
.if n \{\
.RS 4
.\}
.nf
from SCons\&.Script import *
.fi
.if n \{\
.RE
.\}
.PP
All builder methods return a list\-like object containing Nodes that will be built\&. A
\fINode\fR
is an internal SCons object which represents build targets or sources\&.
.PP
The returned Node\-list object can be passed to other builder methods as source(s) or passed to any SCons function or method where a filename would normally be accepted\&. For example, if it were necessary to add a specific preprocessor define when compiling one specific object file:
.sp
.if n \{\
.RS 4
.\}
.nf
bar_obj_list = env\&.StaticObject(\*(Aqbar\&.c\*(Aq, CPPDEFINES=\*(Aq\-DBAR\*(Aq)
env\&.Program(source = [\*(Aqfoo\&.c\*(Aq, bar_obj_list, \*(Aqmain\&.c\*(Aq])
.fi
.if n \{\
.RE
.\}
.PP
Using a Node in this way makes for a more portable build by avoiding having to specify a platform\-specific object suffix when calling the
\fBProgram\fR
builder method\&.
.PP
Note that builder calls will automatically "flatten" the source and target file lists, so it\*(Aqs all right to have the
bar_obj_list
returned by the
\fBStaticObject\fR
call in the middle of the source file list\&. If you need to manipulate a list of lists returned by builders directly using Python, you can either build the list by hand:
.sp
.if n \{\
.RS 4
.\}
.nf
foo = Object(\*(Aqfoo\&.c\*(Aq)
bar = Object(\*(Aqbar\&.c\*(Aq)
objects = [\*(Aqbegin\&.o\*(Aq] + foo + [\*(Aqmiddle\&.o\*(Aq] + bar + [\*(Aqend\&.o\*(Aq]
for object in objects:
print(str(object))
.fi
.if n \{\
.RE
.\}
.PP
Or you can use the
\fBFlatten\fR
function supplied by scons to create a list containing just the Nodes, which may be more convenient:
.sp
.if n \{\
.RS 4
.\}
.nf
foo = Object(\*(Aqfoo\&.c\*(Aq)
bar = Object(\*(Aqbar\&.c\*(Aq)
objects = Flatten([\*(Aqbegin\&.o\*(Aq, foo, \*(Aqmiddle\&.o\*(Aq, bar, \*(Aqend\&.o\*(Aq])
for object in objects:
print(str(object))
.fi
.if n \{\
.RE
.\}
.PP
Note also that because builder calls return a list\-like object, not an actual Python list, you should
\fInot\fR
use the Python add operator (+
or
+=) to append builder results to a Python list\&. Because the list and the object are different types, Python will not update the original list in place, but will instead create a new Node\-list object containing the concatenation of the list elements and the builder results\&. This will cause problems for any other Python variables in your SCons configuration that still hold on to a reference to the original list\&. Instead, use the Python list
\fBextend\fR
method to make sure the list is updated in\-place\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
object_files = []
# Do NOT use += as follows:
#
# object_files += Object(\*(Aqbar\&.c\*(Aq)
#
# It will not update the object_files list in place\&.
#
# Instead, use the list extend method:
object_files\&.extend(Object(\*(Aqbar\&.c\*(Aq))
.fi
.if n \{\
.RE
.\}
.PP
The path name for a Node\*(Aqs file may be used by passing the Node to Python\*(Aqs builtin
\fBstr\fR
function:
.sp
.if n \{\
.RS 4
.\}
.nf
bar_obj_list = env\&.StaticObject(\*(Aqbar\&.c\*(Aq, CPPDEFINES=\*(Aq\-DBAR\*(Aq)
print("The path to bar_obj is:", str(bar_obj_list[0]))
.fi
.if n \{\
.RE
.\}
.PP
Note again that because the Builder call returns a list, we have to access the first element in the list ((bar_obj_list[0])) to get at the Node that actually represents the object file\&.
.PP
Builder calls support a
\fBchdir\fR
keyword argument that specifies that the Builder\*(Aqs action(s) should be executed after changing directory\&. If the
\fBchdir\fR
argument is a string or a directory Node, scons will change to the specified directory\&. If the
\fBchdir\fR
is not a string or Node and is non\-zero, then scons will change to the target file\*(Aqs directory\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# scons will change to the "sub" subdirectory
# before executing the "cp" command\&.
env\&.Command(\*(Aqsub/dir/foo\&.out\*(Aq, \*(Aqsub/dir/foo\&.in\*(Aq,
"cp dir/foo\&.in dir/foo\&.out",
chdir=\*(Aqsub\*(Aq)
# Because chdir is not a string, scons will change to the
# target\*(Aqs directory ("sub/dir") before executing the
# "cp" command\&.
env\&.Command(\*(Aqsub/dir/foo\&.out\*(Aq, \*(Aqsub/dir/foo\&.in\*(Aq,
"cp foo\&.in foo\&.out",
chdir=1)
.fi
.if n \{\
.RE
.\}
.PP
Note that scons will
\fInot\fR
automatically modify its expansion of construction variables like
\fB$TARGET\fR
and
\fB$SOURCE\fR
when using the chdir keyword argument\-\-that is, the expanded file names will still be relative to the top\-level SConstruct directory, and consequently incorrect relative to the chdir directory\&. If you use the chdir keyword argument, you will typically need to supply a different command line using expansions like
\fB${TARGET\&.file}\fR
and
\fB${SOURCE\&.file}\fR
to use just the filename portion of the targets and source\&.
.PP
\fBscons\fR
predefined the following builder methods\&. Depending on the setup of a particular
construction environment
and on the type and software installation status of the underlying system, not all builders may be available to that
construction environment\&.
.PP
\fBCFile()\fR, \fBenv\&.CFile()\fR
.RS 4
Builds a C source file given a lex (\&.l) or yacc (\&.y) input file\&. The suffix specified by the
\fB$CFILESUFFIX\fR
construction variable (\&.c
by default) is automatically added to the target if it is not already present\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
# builds foo\&.c
env\&.CFile(target = \*(Aqfoo\&.c\*(Aq, source = \*(Aqfoo\&.l\*(Aq)
# builds bar\&.c
env\&.CFile(target = \*(Aqbar\*(Aq, source = \*(Aqbar\&.y\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBCommand()\fR, \fBenv\&.Command()\fR
.RS 4
The
\fBCommand\fR
"Builder" is actually a function that looks like a Builder, but takes a required third argument, which is the action to take to construct the target from the source, used for "one\-off" builds where a full builder is not needed\&. Thus it does not follow the builder calling rules described at the start of this section\&. See instead the
\fBCommand\fR
function description for the calling syntax and details\&.
.RE
.PP
\fBCXXFile()\fR, \fBenv\&.CXXFile()\fR
.RS 4
Builds a C++ source file given a lex (\&.ll) or yacc (\&.yy) input file\&. The suffix specified by the
\fB$CXXFILESUFFIX\fR
construction variable (\&.cc
by default) is automatically added to the target if it is not already present\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
# builds foo\&.cc
env\&.CXXFile(target = \*(Aqfoo\&.cc\*(Aq, source = \*(Aqfoo\&.ll\*(Aq)
# builds bar\&.cc
env\&.CXXFile(target = \*(Aqbar\*(Aq, source = \*(Aqbar\&.yy\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBDocbookEpub()\fR, \fBenv\&.DocbookEpub()\fR
.RS 4
A pseudo\-Builder, providing a Docbook toolchain for EPUB output\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookEpub(\*(Aqmanual\&.epub\*(Aq, \*(Aqmanual\&.xml\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
or simply
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookEpub(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBDocbookHtml()\fR, \fBenv\&.DocbookHtml()\fR
.RS 4
A pseudo\-Builder, providing a Docbook toolchain for HTML output\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtml(\*(Aqmanual\&.html\*(Aq, \*(Aqmanual\&.xml\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
or simply
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtml(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBDocbookHtmlChunked()\fR, \fBenv\&.DocbookHtmlChunked()\fR
.RS 4
A pseudo\-Builder, providing a Docbook toolchain for chunked HTML output\&. It supports the
base\&.dir
parameter\&. The
chunkfast\&.xsl
file (requires "EXSLT") is used as the default stylesheet\&. Basic syntax:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtmlChunked(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
where
manual\&.xml
is the input file\&.
.sp
If you use the
root\&.filename
parameter in your own stylesheets you have to specify the new target name\&. This ensures that the dependencies get correct, especially for the cleanup via
\(lqscons \-c\(rq:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtmlChunked(\*(Aqmymanual\&.html\*(Aq, \*(Aqmanual\*(Aq, xsl=\*(Aqhtmlchunk\&.xsl\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Some basic support for the
base\&.dir
is provided\&. You can add the
base_dir
keyword to your Builder call, and the given prefix gets prepended to all the created filenames:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtmlChunked(\*(Aqmanual\*(Aq, xsl=\*(Aqhtmlchunk\&.xsl\*(Aq, base_dir=\*(Aqoutput/\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Make sure that you don\*(Aqt forget the trailing slash for the base folder, else your files get renamed only!
.RE
.PP
\fBDocbookHtmlhelp()\fR, \fBenv\&.DocbookHtmlhelp()\fR
.RS 4
A pseudo\-Builder, providing a Docbook toolchain for HTMLHELP output\&. Its basic syntax is:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtmlhelp(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
where
manual\&.xml
is the input file\&.
.sp
If you use the
root\&.filename
parameter in your own stylesheets you have to specify the new target name\&. This ensures that the dependencies get correct, especially for the cleanup via
\(lqscons \-c\(rq:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtmlhelp(\*(Aqmymanual\&.html\*(Aq, \*(Aqmanual\*(Aq, xsl=\*(Aqhtmlhelp\&.xsl\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Some basic support for the
base\&.dir
parameter is provided\&. You can add the
base_dir
keyword to your Builder call, and the given prefix gets prepended to all the created filenames:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookHtmlhelp(\*(Aqmanual\*(Aq, xsl=\*(Aqhtmlhelp\&.xsl\*(Aq, base_dir=\*(Aqoutput/\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Make sure that you don\*(Aqt forget the trailing slash for the base folder, else your files get renamed only!
.RE
.PP
\fBDocbookMan()\fR, \fBenv\&.DocbookMan()\fR
.RS 4
A pseudo\-Builder, providing a Docbook toolchain for Man page output\&. Its basic syntax is:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookMan(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
where
manual\&.xml
is the input file\&. Note, that you can specify a target name, but the actual output names are automatically set from the
refname
entries in your XML source\&.
.RE
.PP
\fBDocbookPdf()\fR, \fBenv\&.DocbookPdf()\fR
.RS 4
A pseudo\-Builder, providing a Docbook toolchain for PDF output\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookPdf(\*(Aqmanual\&.pdf\*(Aq, \*(Aqmanual\&.xml\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
or simply
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookPdf(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBDocbookSlidesHtml()\fR, \fBenv\&.DocbookSlidesHtml()\fR
.RS 4
A pseudo\-Builder, providing a Docbook toolchain for HTML slides output\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookSlidesHtml(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
If you use the
titlefoil\&.html
parameter in your own stylesheets you have to give the new target name\&. This ensures that the dependencies get correct, especially for the cleanup via
\(lqscons \-c\(rq:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookSlidesHtml(\*(Aqmymanual\&.html\*(Aq,\*(Aqmanual\*(Aq, xsl=\*(Aqslideshtml\&.xsl\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Some basic support for the
base\&.dir
parameter is provided\&. You can add the
base_dir
keyword to your Builder call, and the given prefix gets prepended to all the created filenames:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookSlidesHtml(\*(Aqmanual\*(Aq, xsl=\*(Aqslideshtml\&.xsl\*(Aq, base_dir=\*(Aqoutput/\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Make sure that you don\*(Aqt forget the trailing slash for the base folder, else your files get renamed only!
.RE
.PP
\fBDocbookSlidesPdf()\fR, \fBenv\&.DocbookSlidesPdf()\fR
.RS 4
A pseudo\-Builder, providing a Docbook toolchain for PDF slides output\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookSlidesPdf(\*(Aqmanual\&.pdf\*(Aq, \*(Aqmanual\&.xml\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
or simply
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookSlidesPdf(\*(Aqmanual\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBDocbookXInclude()\fR, \fBenv\&.DocbookXInclude()\fR
.RS 4
A pseudo\-Builder, for resolving XIncludes in a separate processing step\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookXInclude(\*(Aqmanual_xincluded\&.xml\*(Aq, \*(Aqmanual\&.xml\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBDocbookXslt()\fR, \fBenv\&.DocbookXslt()\fR
.RS 4
A pseudo\-Builder, applying a given XSL transformation to the input file\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdocbook\*(Aq])
env\&.DocbookXslt(\*(Aqmanual_transformed\&.xml\*(Aq, \*(Aqmanual\&.xml\*(Aq, xsl=\*(Aqtransform\&.xslt\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Note, that this builder requires the
xsl
parameter to be set\&.
.RE
.PP
\fBDVI()\fR, \fBenv\&.DVI()\fR
.RS 4
Builds a
\&.dvi
file from a
\&.tex,
\&.ltx
or
\&.latex
input file\&. If the source file suffix is
\&.tex,
scons
will examine the contents of the file; if the string
\edocumentclass
or
\edocumentstyle
is found, the file is assumed to be a LaTeX file and the target is built by invoking the
\fB$LATEXCOM\fR
command line; otherwise, the
\fB$TEXCOM\fR
command line is used\&. If the file is a LaTeX file, the
\fBDVI\fR
builder method will also examine the contents of the
\&.aux
file and invoke the
\fB$BIBTEX\fR
command line if the string
bibdata
is found, start
\fB$MAKEINDEX\fR
to generate an index if a
\&.ind
file is found and will examine the contents
\&.log
file and re\-run the
\fB$LATEXCOM\fR
command if the log file says it is necessary\&.
.sp
The suffix
\&.dvi
(hard\-coded within TeX itself) is automatically added to the target if it is not already present\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# builds from aaa\&.tex
env\&.DVI(target = \*(Aqaaa\&.dvi\*(Aq, source = \*(Aqaaa\&.tex\*(Aq)
# builds bbb\&.dvi
env\&.DVI(target = \*(Aqbbb\*(Aq, source = \*(Aqbbb\&.ltx\*(Aq)
# builds from ccc\&.latex
env\&.DVI(target = \*(Aqccc\&.dvi\*(Aq, source = \*(Aqccc\&.latex\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBGs()\fR, \fBenv\&.Gs()\fR
.RS 4
A Builder for explicitly calling the
gs
executable\&. Depending on the underlying OS, the different names
gs,
gsos2
and
gswin32c
are tried\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqgs\*(Aq])
env\&.Gs(\*(Aqcover\&.jpg\*(Aq,\*(Aqscons\-scons\&.pdf\*(Aq,
GSFLAGS=\*(Aq\-dNOPAUSE \-dBATCH \-sDEVICE=jpeg \-dFirstPage=1 \-dLastPage=1 \-q\*(Aq)
)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBInstall()\fR, \fBenv\&.Install()\fR
.RS 4
Installs one or more source files or directories in the specified target, which must be a directory\&. The names of the specified source files or directories remain the same within the destination directory\&. The sources may be given as a string or as a node returned by a builder\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Install(\*(Aq/usr/local/bin\*(Aq, source = [\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
If the
\fB\-\-install\-sandbox\fR
command line option is given, the target directory will be prefixed by the directory path specified\&. This is useful to test installs without installing to a "live" location in the system\&.
.sp
See also
\fBFindInstalledFiles\fR\&. For more thoughts on installation, see the User Guide (particularly the section on Command\-Line Targets and the chapters on Installing Files and on Alias Targets)\&.
.RE
.PP
\fBInstallAs()\fR, \fBenv\&.InstallAs()\fR
.RS 4
Installs one or more source files or directories to specific names, allowing changing a file or directory name as part of the installation\&. It is an error if the target and source arguments list different numbers of files or directories\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.InstallAs(target = \*(Aq/usr/local/bin/foo\*(Aq,
source = \*(Aqfoo_debug\*(Aq)
env\&.InstallAs(target = [\*(Aq\&.\&./lib/libfoo\&.a\*(Aq, \*(Aq\&.\&./lib/libbar\&.a\*(Aq],
source = [\*(AqlibFOO\&.a\*(Aq, \*(AqlibBAR\&.a\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBInstallVersionedLib()\fR, \fBenv\&.InstallVersionedLib()\fR
.RS 4
Installs a versioned shared library\&. The symlinks appropriate to the architecture will be generated based on symlinks of the source library\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.InstallVersionedLib(target = \*(Aq/usr/local/bin/foo\*(Aq,
source = \*(Aqlibxyz\&.1\&.5\&.2\&.so\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBJar()\fR, \fBenv\&.Jar()\fR
.RS 4
Builds a Java archive (\&.jar) file from the specified list of sources\&. Any directories in the source list will be searched for
\&.class
files)\&. Any
\&.java
files in the source list will be compiled to
\&.class
files by calling the
\fBJava\fR
Builder\&.
.sp
If the
\fB$JARCHDIR\fR
value is set, the
jar
command will change to the specified directory using the
\fB\-C\fR
option\&. If
\fB$JARCHDIR\fR
is not set explicitly,
SCons
will use the top of any subdirectory tree in which Java
\&.class
were built by the
\fBJava\fR
Builder\&.
.sp
If the contents any of the source files begin with the string
Manifest\-Version, the file is assumed to be a manifest and is passed to the
jar
command with the
\fBm\fR
option set\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Jar(target = \*(Aqfoo\&.jar\*(Aq, source = \*(Aqclasses\*(Aq)
env\&.Jar(target = \*(Aqbar\&.jar\*(Aq,
source = [\*(Aqbar1\&.java\*(Aq, \*(Aqbar2\&.java\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBJava()\fR, \fBenv\&.Java()\fR
.RS 4
Builds one or more Java class files\&. The sources may be any combination of explicit
\&.java
files, or directory trees which will be scanned for
\&.java
files\&.
.sp
SCons will parse each source
\&.java
file to find the classes (including inner classes) defined within that file, and from that figure out the target
\&.class
files that will be created\&. The class files will be placed underneath the specified target directory\&.
.sp
SCons will also search each Java file for the Java package name, which it assumes can be found on a line beginning with the string
package
in the first column; the resulting
\&.class
files will be placed in a directory reflecting the specified package name\&. For example, the file
Foo\&.java
defining a single public
Foo
class and containing a package name of
sub\&.dir
will generate a corresponding
sub/dir/Foo\&.class
class file\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Java(target = \*(Aqclasses\*(Aq, source = \*(Aqsrc\*(Aq)
env\&.Java(target = \*(Aqclasses\*(Aq, source = [\*(Aqsrc1\*(Aq, \*(Aqsrc2\*(Aq])
env\&.Java(target = \*(Aqclasses\*(Aq, source = [\*(AqFile1\&.java\*(Aq, \*(AqFile2\&.java\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
Java source files can use the native encoding for the underlying OS\&. Since SCons compiles in simple ASCII mode by default, the compiler will generate warnings about unmappable characters, which may lead to errors as the file is processed further\&. In this case, the user must specify the
LANG
environment variable to tell the compiler what encoding is used\&. For portibility, it\*(Aqs best if the encoding is hard\-coded so that the compile will work if it is done on a system with a different encoding\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
env[\*(AqENV\*(Aq][\*(AqLANG\*(Aq] = \*(Aqen_GB\&.UTF\-8\*(Aq
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBJavaH()\fR, \fBenv\&.JavaH()\fR
.RS 4
Builds C header and source files for implementing Java native methods\&. The target can be either a directory in which the header files will be written, or a header file name which will contain all of the definitions\&. The source can be the names of
\&.class
files, the names of
\&.java
files to be compiled into
\&.class
files by calling the
\fBJava\fR
builder method, or the objects returned from the
\fBJava\fR
builder method\&.
.sp
If the construction variable
\fB$JAVACLASSDIR\fR
is set, either in the environment or in the call to the
\fBJavaH\fR
builder method itself, then the value of the variable will be stripped from the beginning of any
\&.class
file names\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# builds java_native\&.h
classes = env\&.Java(target = \*(Aqclassdir\*(Aq, source = \*(Aqsrc\*(Aq)
env\&.JavaH(target = \*(Aqjava_native\&.h\*(Aq, source = classes)
# builds include/package_foo\&.h and include/package_bar\&.h
env\&.JavaH(target = \*(Aqinclude\*(Aq,
source = [\*(Aqpackage/foo\&.class\*(Aq, \*(Aqpackage/bar\&.class\*(Aq])
# builds export/foo\&.h and export/bar\&.h
env\&.JavaH(target = \*(Aqexport\*(Aq,
source = [\*(Aqclasses/foo\&.class\*(Aq, \*(Aqclasses/bar\&.class\*(Aq],
JAVACLASSDIR = \*(Aqclasses\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBLibrary()\fR, \fBenv\&.Library()\fR
.RS 4
A synonym for the
\fBStaticLibrary\fR
builder method\&.
.RE
.PP
\fBLoadableModule()\fR, \fBenv\&.LoadableModule()\fR
.RS 4
On most systems, this is the same as
\fBSharedLibrary\fR\&. On Mac OS X (Darwin) platforms, this creates a loadable module bundle\&.
.RE
.PP
\fBM4()\fR, \fBenv\&.M4()\fR
.RS 4
Builds an output file from an M4 input file\&. This uses a default
\fB$M4FLAGS\fR
value of
\fB\-E\fR, which considers all warnings to be fatal and stops on the first warning when using the GNU version of m4\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.M4(target = \*(Aqfoo\&.c\*(Aq, source = \*(Aqfoo\&.c\&.m4\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBMoc()\fR, \fBenv\&.Moc()\fR
.RS 4
Builds an output file from a moc input file\&. Moc input files are either header files or cxx files\&. This builder is only available after using the tool \*(Aqqt\*(Aq\&. See the
\fB$QTDIR\fR
variable for more information\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Moc(\*(Aqfoo\&.h\*(Aq) # generates moc_foo\&.cc
env\&.Moc(\*(Aqfoo\&.cpp\*(Aq) # generates foo\&.moc
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBMOFiles()\fR, \fBenv\&.MOFiles()\fR
.RS 4
This builder belongs to
msgfmt
tool\&. The builder compiles
PO
files to
MO
files\&.
.sp
\fIExample 1\fR\&. Create
pl\&.mo
and
en\&.mo
by compiling
pl\&.po
and
en\&.po:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.MOFiles([\*(Aqpl\*(Aq, \*(Aqen\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 2\fR\&. Compile files for languages defined in
LINGUAS
file:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.MOFiles(LINGUAS_FILE = 1)
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 3\fR\&. Create
pl\&.mo
and
en\&.mo
by compiling
pl\&.po
and
en\&.po
plus files for languages defined in
LINGUAS
file:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.MOFiles([\*(Aqpl\*(Aq, \*(Aqen\*(Aq], LINGUAS_FILE = 1)
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 4\fR\&. Compile files for languages defined in
LINGUAS
file (another version):
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env[\*(AqLINGUAS_FILE\*(Aq] = 1
env\&.MOFiles()
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBMSVSProject()\fR, \fBenv\&.MSVSProject()\fR
.RS 4
Builds a Microsoft Visual Studio project file, and by default builds a solution file as well\&.
.sp
This builds a Visual Studio project file, based on the version of Visual Studio that is configured (either the latest installed version, or the version specified by
\fB$MSVS_VERSION\fR
in the Environment constructor)\&. For Visual Studio 6, it will generate a
\&.dsp
file\&. For Visual Studio 7, 8, and 9, it will generate a
\&.vcproj
file\&. For Visual Studio 10 and later, it will generate a
\&.vcxproj
file\&.
.sp
By default, this also generates a solution file for the specified project, a
\&.dsw
file for Visual Studio 6 or a
\&.sln
file for Visual Studio 7 and later\&. This behavior may be disabled by specifying
auto_build_solution=0
when you call
\fBMSVSProject\fR, in which case you presumably want to build the solution file(s) by calling the
\fBMSVSSolution\fR
Builder (see below)\&.
.sp
The
\fBMSVSProject\fR
builder takes several lists of filenames to be placed into the project file\&. These are currently limited to
srcs,
incs,
localincs,
resources, and
misc\&. These are pretty self\-explanatory, but it should be noted that these lists are added to the
\fB$SOURCES\fR
construction variable as strings, NOT as SCons File Nodes\&. This is because they represent file names to be added to the project file, not the source files used to build the project file\&.
.sp
The above filename lists are all optional, although at least one must be specified for the resulting project file to be non\-empty\&.
.sp
In addition to the above lists of values, the following values may be specified:
.PP
target
.RS 4
The name of the target
\&.dsp
or
\&.vcproj
file\&. The correct suffix for the version of Visual Studio must be used, but the
\fB$MSVSPROJECTSUFFIX\fR
construction variable will be defined to the correct value (see example below)\&.
.RE
.PP
variant
.RS 4
The name of this particular variant\&. For Visual Studio 7 projects, this can also be a list of variant names\&. These are typically things like "Debug" or "Release", but really can be anything you want\&. For Visual Studio 7 projects, they may also specify a target platform separated from the variant name by a
|
(vertical pipe) character:
Debug|Xbox\&. The default target platform is Win32\&. Multiple calls to
\fBMSVSProject\fR
with different variants are allowed; all variants will be added to the project file with their appropriate build targets and sources\&.
.RE
.PP
cmdargs
.RS 4
Additional command line arguments for the different variants\&. The number of
cmdargs
entries must match the number of
variant
entries, or be empty (not specified)\&. If you give only one, it will automatically be propagated to all variants\&.
.RE
.PP
cppdefines
.RS 4
Preprocessor definitions for the different variants\&. The number of
cppdefines
entries must match the number of
variant
entries, or be empty (not specified)\&. If you give only one, it will automatically be propagated to all variants\&. If you don\*(Aqt give this parameter, SCons will use the invoking environment\*(Aqs
CPPDEFINES
entry for all variants\&.
.RE
.PP
cpppaths
.RS 4
Compiler include paths for the different variants\&. The number of
cpppaths
entries must match the number of
variant
entries, or be empty (not specified)\&. If you give only one, it will automatically be propagated to all variants\&. If you don\*(Aqt give this parameter, SCons will use the invoking environment\*(Aqs
CPPPATH
entry for all variants\&.
.RE
.PP
buildtarget
.RS 4
An optional string, node, or list of strings or nodes (one per build variant), to tell the Visual Studio debugger what output target to use in what build variant\&. The number of
buildtarget
entries must match the number of
variant
entries\&.
.RE
.PP
runfile
.RS 4
The name of the file that Visual Studio 7 and later will run and debug\&. This appears as the value of the
Output
field in the resulting Visual Studio project file\&. If this is not specified, the default is the same as the specified
buildtarget
value\&.
.RE
.sp
Note that because
SCons
always executes its build commands from the directory in which the
SConstruct
file is located, if you generate a project file in a different directory than the
SConstruct
directory, users will not be able to double\-click on the file name in compilation error messages displayed in the Visual Studio console output window\&. This can be remedied by adding the Visual C/C++
/FC
compiler option to the
\fB$CCFLAGS\fR
variable so that the compiler will print the full path name of any files that cause compilation errors\&.
.sp
Example usage:
.sp
.if n \{\
.RS 4
.\}
.nf
barsrcs = [\*(Aqbar\&.cpp\*(Aq]
barincs = [\*(Aqbar\&.h\*(Aq]
barlocalincs = [\*(AqStdAfx\&.h\*(Aq]
barresources = [\*(Aqbar\&.rc\*(Aq,\*(Aqresource\&.h\*(Aq]
barmisc = [\*(Aqbar_readme\&.txt\*(Aq]
dll = env\&.SharedLibrary(target=\*(Aqbar\&.dll\*(Aq,
source=barsrcs)
buildtarget = [s for s in dll if str(s)\&.endswith(\*(Aqdll\*(Aq)]
env\&.MSVSProject(target=\*(AqBar\*(Aq + env[\*(AqMSVSPROJECTSUFFIX\*(Aq],
srcs=barsrcs,
incs=barincs,
localincs=barlocalincs,
resources=barresources,
misc=barmisc,
buildtarget=buildtarget,
variant=\*(AqRelease\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Starting with version 2\&.4 of SCons it is also possible to specify the optional argument
\fIDebugSettings\fR, which creates files for debugging under Visual Studio:
.PP
DebugSettings
.RS 4
A dictionary of debug settings that get written to the
\&.vcproj\&.user
or the
\&.vcxproj\&.user
file, depending on the version installed\&. As it is done for cmdargs (see above), you can specify a
\fIDebugSettings\fR
dictionary per variant\&. If you give only one, it will be propagated to all variants\&.
.RE
.sp
Currently, only Visual Studio v9\&.0 and Visual Studio version v11 are implemented, for other versions no file is generated\&. To generate the user file, you just need to add a
\fIDebugSettings\fR
dictionary to the environment with the right parameters for your MSVS version\&. If the dictionary is empty, or does not contain any good value, no file will be generated\&.
.sp
Following is a more contrived example, involving the setup of a project for variants and DebugSettings:
.sp
.if n \{\
.RS 4
.\}
.nf
# Assuming you store your defaults in a file
vars = Variables(\*(Aqvariables\&.py\*(Aq)
msvcver = vars\&.args\&.get(\*(Aqvc\*(Aq, \*(Aq9\*(Aq)
# Check command args to force one Microsoft Visual Studio version
if msvcver == \*(Aq9\*(Aq or msvcver == \*(Aq11\*(Aq:
env = Environment(MSVC_VERSION=msvcver+\*(Aq\&.0\*(Aq, MSVC_BATCH=False)
else:
env = Environment()
AddOption(\*(Aq\-\-userfile\*(Aq, action=\*(Aqstore_true\*(Aq, dest=\*(Aquserfile\*(Aq, default=False,
help="Create Visual Studio Project user file")
#
# 1\&. Configure your Debug Setting dictionary with options you want in the list
# of allowed options, for instance if you want to create a user file to launch
# a specific application for testing your dll with Microsoft Visual Studio 2008 (v9):
#
V9DebugSettings = {
\*(AqCommand\*(Aq:\*(Aqc:\e\emyapp\e\eusing\e\ethisdll\&.exe\*(Aq,
\*(AqWorkingDirectory\*(Aq: \*(Aqc:\e\emyapp\e\eusing\e\e\*(Aq,
\*(AqCommandArguments\*(Aq: \*(Aq\-p password\*(Aq,
# \*(AqAttach\*(Aq:\*(Aqfalse\*(Aq,
# \*(AqDebuggerType\*(Aq:\*(Aq3\*(Aq,
# \*(AqRemote\*(Aq:\*(Aq1\*(Aq,
# \*(AqRemoteMachine\*(Aq: None,
# \*(AqRemoteCommand\*(Aq: None,
# \*(AqHttpUrl\*(Aq: None,
# \*(AqPDBPath\*(Aq: None,
# \*(AqSQLDebugging\*(Aq: None,
# \*(AqEnvironment\*(Aq: \*(Aq\*(Aq,
# \*(AqEnvironmentMerge\*(Aq:\*(Aqtrue\*(Aq,
# \*(AqDebuggerFlavor\*(Aq: None,
# \*(AqMPIRunCommand\*(Aq: None,
# \*(AqMPIRunArguments\*(Aq: None,
# \*(AqMPIRunWorkingDirectory\*(Aq: None,
# \*(AqApplicationCommand\*(Aq: None,
# \*(AqApplicationArguments\*(Aq: None,
# \*(AqShimCommand\*(Aq: None,
# \*(AqMPIAcceptMode\*(Aq: None,
# \*(AqMPIAcceptFilter\*(Aq: None,
}
#
# 2\&. Because there are a lot of different options depending on the Microsoft
# Visual Studio version, if you use more than one version you have to
# define a dictionary per version, for instance if you want to create a user
# file to launch a specific application for testing your dll with Microsoft
# Visual Studio 2012 (v11):
#
V10DebugSettings = {
\*(AqLocalDebuggerCommand\*(Aq: \*(Aqc:\e\emyapp\e\eusing\e\ethisdll\&.exe\*(Aq,
\*(AqLocalDebuggerWorkingDirectory\*(Aq: \*(Aqc:\e\emyapp\e\eusing\e\e\*(Aq,
\*(AqLocalDebuggerCommandArguments\*(Aq: \*(Aq\-p password\*(Aq,
# \*(AqLocalDebuggerEnvironment\*(Aq: None,
# \*(AqDebuggerFlavor\*(Aq: \*(AqWindowsLocalDebugger\*(Aq,
# \*(AqLocalDebuggerAttach\*(Aq: None,
# \*(AqLocalDebuggerDebuggerType\*(Aq: None,
# \*(AqLocalDebuggerMergeEnvironment\*(Aq: None,
# \*(AqLocalDebuggerSQLDebugging\*(Aq: None,
# \*(AqRemoteDebuggerCommand\*(Aq: None,
# \*(AqRemoteDebuggerCommandArguments\*(Aq: None,
# \*(AqRemoteDebuggerWorkingDirectory\*(Aq: None,
# \*(AqRemoteDebuggerServerName\*(Aq: None,
# \*(AqRemoteDebuggerConnection\*(Aq: None,
# \*(AqRemoteDebuggerDebuggerType\*(Aq: None,
# \*(AqRemoteDebuggerAttach\*(Aq: None,
# \*(AqRemoteDebuggerSQLDebugging\*(Aq: None,
# \*(AqDeploymentDirectory\*(Aq: None,
# \*(AqAdditionalFiles\*(Aq: None,
# \*(AqRemoteDebuggerDeployDebugCppRuntime\*(Aq: None,
# \*(AqWebBrowserDebuggerHttpUrl\*(Aq: None,
# \*(AqWebBrowserDebuggerDebuggerType\*(Aq: None,
# \*(AqWebServiceDebuggerHttpUrl\*(Aq: None,
# \*(AqWebServiceDebuggerDebuggerType\*(Aq: None,
# \*(AqWebServiceDebuggerSQLDebugging\*(Aq: None,
}
#
# 3\&. Select the dictionary you want depending on the version of visual Studio
# Files you want to generate\&.
#
if not env\&.GetOption(\*(Aquserfile\*(Aq):
dbgSettings = None
elif env\&.get(\*(AqMSVC_VERSION\*(Aq, None) == \*(Aq9\&.0\*(Aq:
dbgSettings = V9DebugSettings
elif env\&.get(\*(AqMSVC_VERSION\*(Aq, None) == \*(Aq11\&.0\*(Aq:
dbgSettings = V10DebugSettings
else:
dbgSettings = None
#
# 4\&. Add the dictionary to the DebugSettings keyword\&.
#
barsrcs = [\*(Aqbar\&.cpp\*(Aq, \*(Aqdllmain\&.cpp\*(Aq, \*(Aqstdafx\&.cpp\*(Aq]
barincs = [\*(Aqtargetver\&.h\*(Aq]
barlocalincs = [\*(AqStdAfx\&.h\*(Aq]
barresources = [\*(Aqbar\&.rc\*(Aq,\*(Aqresource\&.h\*(Aq]
barmisc = [\*(AqReadMe\&.txt\*(Aq]
dll = env\&.SharedLibrary(target=\*(Aqbar\&.dll\*(Aq,
source=barsrcs)
env\&.MSVSProject(target=\*(AqBar\*(Aq + env[\*(AqMSVSPROJECTSUFFIX\*(Aq],
srcs=barsrcs,
incs=barincs,
localincs=barlocalincs,
resources=barresources,
misc=barmisc,
buildtarget=[dll[0]] * 2,
variant=(\*(AqDebug|Win32\*(Aq, \*(AqRelease|Win32\*(Aq),
cmdargs=\*(Aqvc=%s\*(Aq % msvcver,
DebugSettings=(dbgSettings, {}))
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBMSVSSolution()\fR, \fBenv\&.MSVSSolution()\fR
.RS 4
Builds a Microsoft Visual Studio solution file\&.
.sp
This builds a Visual Studio solution file, based on the version of Visual Studio that is configured (either the latest installed version, or the version specified by
\fB$MSVS_VERSION\fR
in the construction environment)\&. For Visual Studio 6, it will generate a
\&.dsw
file\&. For Visual Studio 7 (\&.NET), it will generate a
\&.sln
file\&.
.sp
The following values must be specified:
.PP
target
.RS 4
The name of the target \&.dsw or \&.sln file\&. The correct suffix for the version of Visual Studio must be used, but the value
\fB$MSVSSOLUTIONSUFFIX\fR
will be defined to the correct value (see example below)\&.
.RE
.PP
variant
.RS 4
The name of this particular variant, or a list of variant names (the latter is only supported for MSVS 7 solutions)\&. These are typically things like "Debug" or "Release", but really can be anything you want\&. For MSVS 7 they may also specify target platform, like this "Debug|Xbox"\&. Default platform is Win32\&.
.RE
.PP
projects
.RS 4
A list of project file names, or Project nodes returned by calls to the
\fBMSVSProject\fR
Builder, to be placed into the solution file\&. It should be noted that these file names are NOT added to the $SOURCES environment variable in form of files, but rather as strings\&. This is because they represent file names to be added to the solution file, not the source files used to build the solution file\&.
.RE
.sp
Example Usage:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.MSVSSolution(target=\*(AqBar\*(Aq + env[\*(AqMSVSSOLUTIONSUFFIX\*(Aq], projects=[\*(Aqbar\*(Aq + env[\*(AqMSVSPROJECTSUFFIX\*(Aq]], variant=\*(AqRelease\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBObject()\fR, \fBenv\&.Object()\fR
.RS 4
A synonym for the
\fBStaticObject\fR
builder method\&.
.RE
.PP
\fBPackage()\fR, \fBenv\&.Package()\fR
.RS 4
Builds a Binary Package of the given source files\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Package(source = FindInstalledFiles())
.fi
.if n \{\
.RE
.\}
.sp
Builds software distribution packages\&. Packages consist of files to install and packaging information\&. The former may be specified with the
\fIsource\fR
parameter and may be left out, in which case the
\fBFindInstalledFiles\fR
function will collect all files that have an
\fBInstall\fR
or
\fBInstallAs\fR
Builder attached\&. If the
\fItarget\fR
is not specified it will be deduced from additional information given to this Builder\&.
.sp
The packaging information is specified with the help of construction variables documented below\&. This information is called a tag to stress that some of them can also be attached to files with the
\fBTag\fR
function\&. The mandatory ones will complain if they were not specified\&. They vary depending on chosen target packager\&.
.sp
The target packager may be selected with the "PACKAGETYPE" command line option or with the
\fB$PACKAGETYPE\fR
construction variable\&. Currently the following packagers available:
.sp
* msi \- Microsoft Installer * rpm \- RPM Package Manger * ipkg \- Itsy Package Management System * tarbz2 \- bzip2 compressed tar * targz \- gzip compressed tar * tarxz \- xz compressed tar * zip \- zip file * src_tarbz2 \- bzip2 compressed tar source * src_targz \- gzip compressed tar source * src_tarxz \- xz compressed tar source * src_zip \- zip file source
.sp
An updated list is always available under the "package_type" option when running "scons \-\-help" on a project that has packaging activated\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdefault\*(Aq, \*(Aqpackaging\*(Aq])
env\&.Install(\*(Aq/bin/\*(Aq, \*(Aqmy_program\*(Aq)
env\&.Package( NAME = \*(Aqfoo\*(Aq,
VERSION = \*(Aq1\&.2\&.3\*(Aq,
PACKAGEVERSION = 0,
PACKAGETYPE = \*(Aqrpm\*(Aq,
LICENSE = \*(Aqgpl\*(Aq,
SUMMARY = \*(Aqbalalalalal\*(Aq,
DESCRIPTION = \*(Aqthis should be really really long\*(Aq,
X_RPM_GROUP = \*(AqApplication/fu\*(Aq,
SOURCE_URL = \*(Aqhttp://foo\&.org/foo\-1\&.2\&.3\&.tar\&.gz\*(Aq
)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBPCH()\fR, \fBenv\&.PCH()\fR
.RS 4
Builds a Microsoft Visual C++ precompiled header\&. Calling this builder method returns a list of two targets: the PCH as the first element, and the object file as the second element\&. Normally the object file is ignored\&. This builder method is only provided when Microsoft Visual C++ is being used as the compiler\&. The PCH builder method is generally used in conjunction with the PCH construction variable to force object files to use the precompiled header:
.sp
.if n \{\
.RS 4
.\}
.nf
env[\*(AqPCH\*(Aq] = env\&.PCH(\*(AqStdAfx\&.cpp\*(Aq)[0]
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBPDF()\fR, \fBenv\&.PDF()\fR
.RS 4
Builds a
\&.pdf
file from a
\&.dvi
input file (or, by extension, a
\&.tex,
\&.ltx, or
\&.latex
input file)\&. The suffix specified by the
\fB$PDFSUFFIX\fR
construction variable (\&.pdf
by default) is added automatically to the target if it is not already present\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
# builds from aaa\&.tex
env\&.PDF(target = \*(Aqaaa\&.pdf\*(Aq, source = \*(Aqaaa\&.tex\*(Aq)
# builds bbb\&.pdf from bbb\&.dvi
env\&.PDF(target = \*(Aqbbb\*(Aq, source = \*(Aqbbb\&.dvi\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBPOInit()\fR, \fBenv\&.POInit()\fR
.RS 4
This builder belongs to
msginit
tool\&. The builder initializes missing
PO
file(s) if
\fB$POAUTOINIT\fR
is set\&. If
\fB$POAUTOINIT\fR
is not set (default),
\fBPOInit\fR
prints instruction for user (that is supposed to be a translator), telling how the
PO
file should be initialized\&. In normal projects
\fIyou should not use \fR\fI\fBPOInit\fR\fR\fI and use \fR\fI\fBPOUpdate\fR\fR\fI instead\fR\&.
\fBPOUpdate\fR
chooses intelligently between
\fBmsgmerge(1)\fR
and
\fBmsginit(1)\fR\&.
\fBPOInit\fR
always uses
\fBmsginit(1)\fR
and should be regarded as builder for special purposes or for temporary use (e\&.g\&. for quick, one time initialization of a bunch of
PO
files) or for tests\&.
.sp
Target nodes defined through
\fBPOInit\fR
are not built by default (they\*(Aqre
Ignored from
\*(Aq\&.\*(Aq
node) but are added to special
Alias
(\*(Aqpo\-create\*(Aq
by default)\&. The alias name may be changed through the
\fB$POCREATE_ALIAS\fR
construction variable\&. All
PO
files defined through
\fBPOInit\fR
may be easily initialized by
\fBscons po\-create\fR\&.
.sp
\fIExample 1\fR\&. Initialize
en\&.po
and
pl\&.po
from
messages\&.pot:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POInit([\*(Aqen\*(Aq, \*(Aqpl\*(Aq]) # messages\&.pot \-\-> [en\&.po, pl\&.po]
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 2\fR\&. Initialize
en\&.po
and
pl\&.po
from
foo\&.pot:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POInit([\*(Aqen\*(Aq, \*(Aqpl\*(Aq], [\*(Aqfoo\*(Aq]) # foo\&.pot \-\-> [en\&.po, pl\&.po]
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 3\fR\&. Initialize
en\&.po
and
pl\&.po
from
foo\&.pot
but using
\fB$POTDOMAIN\fR
construction variable:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POInit([\*(Aqen\*(Aq, \*(Aqpl\*(Aq], POTDOMAIN=\*(Aqfoo\*(Aq) # foo\&.pot \-\-> [en\&.po, pl\&.po]
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 4\fR\&. Initialize
PO
files for languages defined in
LINGUAS
file\&. The files will be initialized from template
messages\&.pot:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POInit(LINGUAS_FILE = 1) # needs \*(AqLINGUAS\*(Aq file
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 5\fR\&. Initialize
en\&.po
and
pl\&.pl
PO
files plus files for languages defined in
LINGUAS
file\&. The files will be initialized from template
messages\&.pot:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POInit([\*(Aqen\*(Aq, \*(Aqpl\*(Aq], LINGUAS_FILE = 1)
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 6\fR\&. You may preconfigure your environment first, and then initialize
PO
files:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env[\*(AqPOAUTOINIT\*(Aq] = 1
env[\*(AqLINGUAS_FILE\*(Aq] = 1
env[\*(AqPOTDOMAIN\*(Aq] = \*(Aqfoo\*(Aq
env\&.POInit()
.fi
.if n \{\
.RE
.\}
.sp
which has same efect as:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POInit(POAUTOINIT = 1, LINGUAS_FILE = 1, POTDOMAIN = \*(Aqfoo\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBPostScript()\fR, \fBenv\&.PostScript()\fR
.RS 4
Builds a
\&.ps
file from a
\&.dvi
input file (or, by extension, a
\&.tex,
\&.ltx, or
\&.latex
input file)\&. The suffix specified by the
\fB$PSSUFFIX\fR
construction variable (\&.ps
by default) is added automatically to the target if it is not already present\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
# builds from aaa\&.tex
env\&.PostScript(target = \*(Aqaaa\&.ps\*(Aq, source = \*(Aqaaa\&.tex\*(Aq)
# builds bbb\&.ps from bbb\&.dvi
env\&.PostScript(target = \*(Aqbbb\*(Aq, source = \*(Aqbbb\&.dvi\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBPOTUpdate()\fR, \fBenv\&.POTUpdate()\fR
.RS 4
The builder belongs to
xgettext
tool\&. The builder updates target
POT
file if exists or creates one if it doesn\*(Aqt\&. The node is not built by default (i\&.e\&. it is
Ignored from
\*(Aq\&.\*(Aq), but only on demand (i\&.e\&. when given
POT
file is required or when special alias is invoked)\&. This builder adds its targe node (messages\&.pot, say) to a special alias (pot\-update
by default, see
\fB$POTUPDATE_ALIAS\fR) so you can update/create them easily with
\fBscons pot\-update\fR\&. The file is not written until there is no real change in internationalized messages (or in comments that enter
POT
file)\&.
.sp
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
You may see
\fBxgettext(1)\fR
being invoked by the
xgettext
tool even if there is no real change in internationalized messages (so the
POT
file is not being updated)\&. This happens every time a source file has changed\&. In such case we invoke
\fBxgettext(1)\fR
and compare its output with the content of
POT
file to decide whether the file should be updated or not\&.
.sp .5v
.RE
.sp
\fIExample 1\&.\fR
Let\*(Aqs create
po/
directory and place following
SConstruct
script there:
.sp
.if n \{\
.RS 4
.\}
.nf
# SConstruct in \*(Aqpo/\*(Aq subdir
env = Environment( tools = [\*(Aqdefault\*(Aq, \*(Aqxgettext\*(Aq] )
env\&.POTUpdate([\*(Aqfoo\*(Aq], [\*(Aq\&.\&./a\&.cpp\*(Aq, \*(Aq\&.\&./b\&.cpp\*(Aq])
env\&.POTUpdate([\*(Aqbar\*(Aq], [\*(Aq\&.\&./c\&.cpp\*(Aq, \*(Aq\&.\&./d\&.cpp\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
Then invoke scons few times:
.sp
.if n \{\
.RS 4
.\}
.nf
user@host:$ scons # Does not create foo\&.pot nor bar\&.pot
user@host:$ scons foo\&.pot # Updates or creates foo\&.pot
user@host:$ scons pot\-update # Updates or creates foo\&.pot and bar\&.pot
user@host:$ scons \-c # Does not clean foo\&.pot nor bar\&.pot\&.
.fi
.if n \{\
.RE
.\}
.sp
the results shall be as the comments above say\&.
.sp
\fIExample 2\&.\fR
The
\fBPOTUpdate\fR
builder may be used with no target specified, in which case default target
messages\&.pot
will be used\&. The default target may also be overridden by setting
\fB$POTDOMAIN\fR
construction variable or providing it as an override to
\fBPOTUpdate\fR
builder:
.sp
.if n \{\
.RS 4
.\}
.nf
# SConstruct script
env = Environment( tools = [\*(Aqdefault\*(Aq, \*(Aqxgettext\*(Aq] )
env[\*(AqPOTDOMAIN\*(Aq] = "foo"
env\&.POTUpdate(source = ["a\&.cpp", "b\&.cpp"]) # Creates foo\&.pot \&.\&.\&.
env\&.POTUpdate(POTDOMAIN = "bar", source = ["c\&.cpp", "d\&.cpp"]) # and bar\&.pot
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 3\&.\fR
The sources may be specified within separate file, for example
POTFILES\&.in:
.sp
.if n \{\
.RS 4
.\}
.nf
# POTFILES\&.in in \*(Aqpo/\*(Aq subdirectory
\&.\&./a\&.cpp
\&.\&./b\&.cpp
# end of file
.fi
.if n \{\
.RE
.\}
.sp
The name of the file (POTFILES\&.in) containing the list of sources is provided via
\fB$XGETTEXTFROM\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
# SConstruct file in \*(Aqpo/\*(Aq subdirectory
env = Environment( tools = [\*(Aqdefault\*(Aq, \*(Aqxgettext\*(Aq] )
env\&.POTUpdate(XGETTEXTFROM = \*(AqPOTFILES\&.in\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 4\&.\fR
You may use
\fB$XGETTEXTPATH\fR
to define source search path\&. Assume, for example, that you have files
a\&.cpp,
b\&.cpp,
po/SConstruct,
po/POTFILES\&.in\&. Then your
POT\-related files could look as below:
.sp
.if n \{\
.RS 4
.\}
.nf
# POTFILES\&.in in \*(Aqpo/\*(Aq subdirectory
a\&.cpp
b\&.cpp
# end of file
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
# SConstruct file in \*(Aqpo/\*(Aq subdirectory
env = Environment( tools = [\*(Aqdefault\*(Aq, \*(Aqxgettext\*(Aq] )
env\&.POTUpdate(XGETTEXTFROM = \*(AqPOTFILES\&.in\*(Aq, XGETTEXTPATH=\*(Aq\&.\&./\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 5\&.\fR
Multiple search directories may be defined within a list, i\&.e\&.
XGETTEXTPATH = [\*(Aqdir1\*(Aq, \*(Aqdir2\*(Aq, \&.\&.\&.]\&. The order in the list determines the search order of source files\&. The path to the first file found is used\&.
.sp
Let\*(Aqs create
0/1/po/SConstruct
script:
.sp
.if n \{\
.RS 4
.\}
.nf
# SConstruct file in \*(Aq0/1/po/\*(Aq subdirectory
env = Environment( tools = [\*(Aqdefault\*(Aq, \*(Aqxgettext\*(Aq] )
env\&.POTUpdate(XGETTEXTFROM = \*(AqPOTFILES\&.in\*(Aq, XGETTEXTPATH=[\*(Aq\&.\&./\*(Aq, \*(Aq\&.\&./\&.\&./\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
and
0/1/po/POTFILES\&.in:
.sp
.if n \{\
.RS 4
.\}
.nf
# POTFILES\&.in in \*(Aq0/1/po/\*(Aq subdirectory
a\&.cpp
# end of file
.fi
.if n \{\
.RE
.\}
.sp
Write two
*\&.cpp
files, the first one is
0/a\&.cpp:
.sp
.if n \{\
.RS 4
.\}
.nf
/* 0/a\&.cpp */
gettext("Hello from \&.\&./\&.\&./a\&.cpp")
.fi
.if n \{\
.RE
.\}
.sp
and the second is
0/1/a\&.cpp:
.sp
.if n \{\
.RS 4
.\}
.nf
/* 0/1/a\&.cpp */
gettext("Hello from \&.\&./a\&.cpp")
.fi
.if n \{\
.RE
.\}
.sp
then run scons\&. You\*(Aqll obtain
0/1/po/messages\&.pot
with the message
"Hello from \&.\&./a\&.cpp"\&. When you reverse order in
\fI$XGETTEXTFOM\fR, i\&.e\&. when you write SConscript as
.sp
.if n \{\
.RS 4
.\}
.nf
# SConstruct file in \*(Aq0/1/po/\*(Aq subdirectory
env = Environment( tools = [\*(Aqdefault\*(Aq, \*(Aqxgettext\*(Aq] )
env\&.POTUpdate(XGETTEXTFROM = \*(AqPOTFILES\&.in\*(Aq, XGETTEXTPATH=[\*(Aq\&.\&./\&.\&./\*(Aq, \*(Aq\&.\&./\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
then the
messages\&.pot
will contain
msgid "Hello from \&.\&./\&.\&./a\&.cpp"
line and not
msgid "Hello from \&.\&./a\&.cpp"\&.
.RE
.PP
\fBPOUpdate()\fR, \fBenv\&.POUpdate()\fR
.RS 4
The builder belongs to
msgmerge
tool\&. The builder updates
PO
files with
\fBmsgmerge(1)\fR, or initializes missing
PO
files as described in documentation of
msginit
tool and
\fBPOInit\fR
builder (see also
\fB$POAUTOINIT\fR)\&. Note, that
\fBPOUpdate\fR
\fIdoes not add its targets to \fR\fIpo\-create\fR\fI alias\fR
as
\fBPOInit\fR
does\&.
.sp
Target nodes defined through
\fBPOUpdate\fR
are not built by default (they\*(Aqre
Ignored from
\*(Aq\&.\*(Aq
node)\&. Instead, they are added automatically to special
Alias
(\*(Aqpo\-update\*(Aq
by default)\&. The alias name may be changed through the
\fB$POUPDATE_ALIAS\fR
construction variable\&. You can easily update
PO
files in your project by
\fBscons po\-update\fR\&.
.sp
\fIExample 1\&.\fR
Update
en\&.po
and
pl\&.po
from
messages\&.pot
template (see also
\fB$POTDOMAIN\fR), assuming that the later one exists or there is rule to build it (see
\fBPOTUpdate\fR):
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POUpdate([\*(Aqen\*(Aq,\*(Aqpl\*(Aq]) # messages\&.pot \-\-> [en\&.po, pl\&.po]
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 2\&.\fR
Update
en\&.po
and
pl\&.po
from
foo\&.pot
template:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POUpdate([\*(Aqen\*(Aq, \*(Aqpl\*(Aq], [\*(Aqfoo\*(Aq]) # foo\&.pot \-\-> [en\&.po, pl\&.pl]
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 3\&.\fR
Update
en\&.po
and
pl\&.po
from
foo\&.pot
(another version):
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POUpdate([\*(Aqen\*(Aq, \*(Aqpl\*(Aq], POTDOMAIN=\*(Aqfoo\*(Aq) # foo\&.pot \-\- > [en\&.po, pl\&.pl]
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 4\&.\fR
Update files for languages defined in
LINGUAS
file\&. The files are updated from
messages\&.pot
template:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POUpdate(LINGUAS_FILE = 1) # needs \*(AqLINGUAS\*(Aq file
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 5\&.\fR
Same as above, but update from
foo\&.pot
template:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POUpdate(LINGUAS_FILE = 1, source = [\*(Aqfoo\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 6\&.\fR
Update
en\&.po
and
pl\&.po
plus files for languages defined in
LINGUAS
file\&. The files are updated from
messages\&.pot
template:
.sp
.if n \{\
.RS 4
.\}
.nf
# produce \*(Aqen\&.po\*(Aq, \*(Aqpl\&.po\*(Aq + files defined in \*(AqLINGUAS\*(Aq:
env\&.POUpdate([\*(Aqen\*(Aq, \*(Aqpl\*(Aq ], LINGUAS_FILE = 1)
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 7\&.\fR
Use
\fB$POAUTOINIT\fR
to automatically initialize
PO
file if it doesn\*(Aqt exist:
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env\&.POUpdate(LINGUAS_FILE = 1, POAUTOINIT = 1)
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 8\&.\fR
Update
PO
files for languages defined in
LINGUAS
file\&. The files are updated from
foo\&.pot
template\&. All necessary settings are pre\-configured via environment\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# \&.\&.\&.
env[\*(AqPOAUTOINIT\*(Aq] = 1
env[\*(AqLINGUAS_FILE\*(Aq] = 1
env[\*(AqPOTDOMAIN\*(Aq] = \*(Aqfoo\*(Aq
env\&.POUpdate()
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBProgram()\fR, \fBenv\&.Program()\fR
.RS 4
Builds an executable given one or more object files or C, C++, D, or Fortran source files\&. If any C, C++, D or Fortran source files are specified, then they will be automatically compiled to object files using the
\fBObject\fR
builder method; see that builder method\*(Aqs description for a list of legal source file suffixes and how they are interpreted\&. The target executable file prefix (specified by the
\fB$PROGPREFIX\fR
construction variable; nothing by default) and suffix (specified by the
\fB$PROGSUFFIX\fR
construction variable; by default,
\&.exe
on Windows systems, nothing on POSIX systems) are automatically added to the target if not already present\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Program(target = \*(Aqfoo\*(Aq, source = [\*(Aqfoo\&.o\*(Aq, \*(Aqbar\&.c\*(Aq, \*(Aqbaz\&.f\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBProgramAllAtOnce()\fR, \fBenv\&.ProgramAllAtOnce()\fR
.RS 4
Builds an executable from D sources without first creating individual objects for each file\&.
.sp
D sources can be compiled file\-by\-file as C and C++ source are, and D is integrated into the
scons
Object and Program builders for this model of build\&. D codes can though do whole source meta\-programming (some of the testing frameworks do this)\&. For this it is imperative that all sources are compiled and linked in a single call to the D compiler\&. This builder serves that purpose\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.ProgramAllAtOnce(\*(Aqexecutable\*(Aq, [\*(Aqmod_a\&.d, mod_b\&.d\*(Aq, \*(Aqmod_c\&.d\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
This command will compile the modules mod_a, mod_b, and mod_c in a single compilation process without first creating object files for the modules\&. Some of the D compilers will create executable\&.o others will not\&.
.RE
.PP
\fBRES()\fR, \fBenv\&.RES()\fR
.RS 4
Builds a Microsoft Visual C++ resource file\&. This builder method is only provided when Microsoft Visual C++ or MinGW is being used as the compiler\&. The
\&.res
(or
\&.o
for MinGW) suffix is added to the target name if no other suffix is given\&. The source file is scanned for implicit dependencies as though it were a C file\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.RES(\*(Aqresource\&.rc\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBRMIC()\fR, \fBenv\&.RMIC()\fR
.RS 4
Builds stub and skeleton class files for remote objects from Java
\&.class
files\&. The target is a directory relative to which the stub and skeleton class files will be written\&. The source can be the names of
\&.class
files, or the objects return from the
\fBJava\fR
builder method\&.
.sp
If the construction variable
\fB$JAVACLASSDIR\fR
is set, either in the environment or in the call to the
\fBRMIC\fR
builder method itself, then the value of the variable will be stripped from the beginning of any
\&.class
file names\&.
.sp
.if n \{\
.RS 4
.\}
.nf
classes = env\&.Java(target = \*(Aqclassdir\*(Aq, source = \*(Aqsrc\*(Aq)
env\&.RMIC(target = \*(Aqoutdir1\*(Aq, source = classes)
env\&.RMIC(target = \*(Aqoutdir2\*(Aq,
source = [\*(Aqpackage/foo\&.class\*(Aq, \*(Aqpackage/bar\&.class\*(Aq])
env\&.RMIC(target = \*(Aqoutdir3\*(Aq,
source = [\*(Aqclasses/foo\&.class\*(Aq, \*(Aqclasses/bar\&.class\*(Aq],
JAVACLASSDIR = \*(Aqclasses\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBRPCGenClient()\fR, \fBenv\&.RPCGenClient()\fR
.RS 4
Generates an RPC client stub (_clnt\&.c) file from a specified RPC (\&.x) source file\&. Because rpcgen only builds output files in the local directory, the command will be executed in the source file\*(Aqs directory by default\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# Builds src/rpcif_clnt\&.c
env\&.RPCGenClient(\*(Aqsrc/rpcif\&.x\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBRPCGenHeader()\fR, \fBenv\&.RPCGenHeader()\fR
.RS 4
Generates an RPC header (\&.h) file from a specified RPC (\&.x) source file\&. Because rpcgen only builds output files in the local directory, the command will be executed in the source file\*(Aqs directory by default\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# Builds src/rpcif\&.h
env\&.RPCGenHeader(\*(Aqsrc/rpcif\&.x\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBRPCGenService()\fR, \fBenv\&.RPCGenService()\fR
.RS 4
Generates an RPC server\-skeleton (_svc\&.c) file from a specified RPC (\&.x) source file\&. Because rpcgen only builds output files in the local directory, the command will be executed in the source file\*(Aqs directory by default\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# Builds src/rpcif_svc\&.c
env\&.RPCGenClient(\*(Aqsrc/rpcif\&.x\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBRPCGenXDR()\fR, \fBenv\&.RPCGenXDR()\fR
.RS 4
Generates an RPC XDR routine (_xdr\&.c) file from a specified RPC (\&.x) source file\&. Because rpcgen only builds output files in the local directory, the command will be executed in the source file\*(Aqs directory by default\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# Builds src/rpcif_xdr\&.c
env\&.RPCGenClient(\*(Aqsrc/rpcif\&.x\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBSharedLibrary()\fR, \fBenv\&.SharedLibrary()\fR
.RS 4
Builds a shared library (\&.so
on a POSIX system,
\&.dll
on Windows) given one or more object files or C, C++, D or Fortran source files\&. If any source files are given, then they will be automatically compiled to object files\&. The static library prefix and suffix (if any) are automatically added to the target\&. The target library file prefix (specified by the
\fB$SHLIBPREFIX\fR
construction variable; by default,
lib
on POSIX systems, nothing on Windows systems) and suffix (specified by the
\fB$SHLIBSUFFIX\fR
construction variable; by default,
\&.dll
on Windows systems,
\&.so
on POSIX systems) are automatically added to the target if not already present\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.SharedLibrary(target = \*(Aqbar\*(Aq, source = [\*(Aqbar\&.c\*(Aq, \*(Aqfoo\&.o\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
On Windows systems, the
\fBSharedLibrary\fR
builder method will always build an import (\&.lib) library in addition to the shared (\&.dll) library, adding a
\&.lib
library with the same basename if there is not already a
\&.lib
file explicitly listed in the targets\&.
.sp
On Cygwin systems, the
\fBSharedLibrary\fR
builder method will always build an import (\&.dll\&.a) library in addition to the shared (\&.dll) library, adding a
\&.dll\&.a
library with the same basename if there is not already a
\&.dll\&.a
file explicitly listed in the targets\&.
.sp
Any object files listed in the
source
must have been built for a shared library (that is, using the
\fBSharedObject\fR
builder method)\&.
scons
will raise an error if there is any mismatch\&.
.sp
On some platforms, there is a distinction between a shared library (loaded automatically by the system to resolve external references) and a loadable module (explicitly loaded by user action)\&. For maximum portability, use the
\fBLoadableModule\fR
builder for the latter\&.
.sp
When the
\fB$SHLIBVERSION\fR
construction variable is defined a versioned shared library is created\&. This modifies the
\fB$SHLINKFLAGS\fR
as required, adds the version number to the library name, and creates the symlinks that are needed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.SharedLibrary(target = \*(Aqbar\*(Aq, source = [\*(Aqbar\&.c\*(Aq, \*(Aqfoo\&.o\*(Aq], SHLIBVERSION=\*(Aq1\&.5\&.2\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
On a POSIX system, versions with a single token create exactly one symlink: libbar\&.so\&.6 would have symlinks libbar\&.so only\&. On a POSIX system, versions with two or more tokens create exactly two symlinks: libbar\&.so\&.2\&.3\&.1 would have symlinks libbar\&.so and libbar\&.so\&.2; on a Darwin (OSX) system the library would be libbar\&.2\&.3\&.1\&.dylib and the link would be libbar\&.dylib\&.
.sp
On Windows systems, specifying
register=1
will cause the
\&.dll
to be registered after it is built using REGSVR32\&. The command that is run ("regsvr32" by default) is determined by
\fB$REGSVR\fR
construction variable, and the flags passed are determined by
\fB$REGSVRFLAGS\fR\&. By default,
\fB$REGSVRFLAGS\fR
includes the
\fB/s\fR
option, to prevent dialogs from popping up and requiring user attention when it is run\&. If you change
\fB$REGSVRFLAGS\fR, be sure to include the
\fB/s\fR
option\&. For example,
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.SharedLibrary(target = \*(Aqbar\*(Aq,
source = [\*(Aqbar\&.cxx\*(Aq, \*(Aqfoo\&.obj\*(Aq],
register=1)
.fi
.if n \{\
.RE
.\}
.sp
will register
bar\&.dll
as a COM object when it is done linking it\&.
.RE
.PP
\fBSharedObject()\fR, \fBenv\&.SharedObject()\fR
.RS 4
Builds an object file for inclusion in a shared library\&. Source files must have one of the same set of extensions specified above for the
\fBStaticObject\fR
builder method\&. On some platforms building a shared object requires additional compiler option (e\&.g\&.
\fB\-fPIC\fR
for gcc) in addition to those needed to build a normal (static) object, but on some platforms there is no difference between a shared object and a normal (static) one\&. When there is a difference, SCons will only allow shared objects to be linked into a shared library, and will use a different suffix for shared objects\&. On platforms where there is no difference, SCons will allow both normal (static) and shared objects to be linked into a shared library, and will use the same suffix for shared and normal (static) objects\&. The target object file prefix (specified by the
\fB$SHOBJPREFIX\fR
construction variable; by default, the same as
\fB$OBJPREFIX\fR) and suffix (specified by the
\fB$SHOBJSUFFIX\fR
construction variable) are automatically added to the target if not already present\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.SharedObject(target = \*(Aqddd\*(Aq, source = \*(Aqddd\&.c\*(Aq)
env\&.SharedObject(target = \*(Aqeee\&.o\*(Aq, source = \*(Aqeee\&.cpp\*(Aq)
env\&.SharedObject(target = \*(Aqfff\&.obj\*(Aq, source = \*(Aqfff\&.for\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Note that the source files will be scanned according to the suffix mappings in the
SourceFileScanner
object\&. See the section "Scanner Objects," below, for more information\&.
.RE
.PP
\fBStaticLibrary()\fR, \fBenv\&.StaticLibrary()\fR
.RS 4
Builds a static library given one or more object files or C, C++, D or Fortran source files\&. If any source files are given, then they will be automatically compiled to object files\&. The static library prefix and suffix (if any) are automatically added to the target\&. The target library file prefix (specified by the
\fB$LIBPREFIX\fR
construction variable; by default,
lib
on POSIX systems, nothing on Windows systems) and suffix (specified by the
\fB$LIBSUFFIX\fR
construction variable; by default,
\&.lib
on Windows systems,
\&.a
on POSIX systems) are automatically added to the target if not already present\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.StaticLibrary(target = \*(Aqbar\*(Aq, source = [\*(Aqbar\&.c\*(Aq, \*(Aqfoo\&.o\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
Any object files listed in the
source
must have been built for a static library (that is, using the
\fBStaticObject\fR
builder method)\&.
scons
will raise an error if there is any mismatch\&.
.RE
.PP
\fBStaticObject()\fR, \fBenv\&.StaticObject()\fR
.RS 4
Builds a static object file from one or more C, C++, D, or Fortran source files\&. Source files must have one of the following extensions:
.sp
.if n \{\
.RS 4
.\}
.nf
\&.asm assembly language file
\&.ASM assembly language file
\&.c C file
\&.C Windows: C file
POSIX: C++ file
\&.cc C++ file
\&.cpp C++ file
\&.cxx C++ file
\&.cxx C++ file
\&.c++ C++ file
\&.C++ C++ file
\&.d D file
\&.f Fortran file
\&.F Windows: Fortran file
POSIX: Fortran file + C pre\-processor
\&.for Fortran file
\&.FOR Fortran file
\&.fpp Fortran file + C pre\-processor
\&.FPP Fortran file + C pre\-processor
\&.m Object C file
\&.mm Object C++ file
\&.s assembly language file
\&.S Windows: assembly language file
ARM: CodeSourcery Sourcery Lite
\&.sx assembly language file + C pre\-processor
POSIX: assembly language file + C pre\-processor
\&.spp assembly language file + C pre\-processor
\&.SPP assembly language file + C pre\-processor
.fi
.if n \{\
.RE
.\}
.sp
The target object file prefix (specified by the
\fB$OBJPREFIX\fR
construction variable; nothing by default) and suffix (specified by the
\fB$OBJSUFFIX\fR
construction variable;
\&.obj
on Windows systems,
\&.o
on POSIX systems) are automatically added to the target if not already present\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.StaticObject(target = \*(Aqaaa\*(Aq, source = \*(Aqaaa\&.c\*(Aq)
env\&.StaticObject(target = \*(Aqbbb\&.o\*(Aq, source = \*(Aqbbb\&.c++\*(Aq)
env\&.StaticObject(target = \*(Aqccc\&.obj\*(Aq, source = \*(Aqccc\&.f\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Note that the source files will be scanned according to the suffix mappings in
SourceFileScanner
object\&. See the section "Scanner Objects," below, for more information\&.
.RE
.PP
\fBSubstfile()\fR, \fBenv\&.Substfile()\fR
.RS 4
The
\fBSubstfile\fR
builder creates a single text file from another file or set of files by concatenating them with
\fB$LINESEPARATOR\fR
and replacing text using the
\fB$SUBST_DICT\fR
construction variable\&. Nested lists of source files are flattened\&. See also
\fBTextfile\fR\&.
.sp
If a single source file is present with an
\&.in
suffix, the suffix is stripped and the remainder is used as the default target name\&.
.sp
The prefix and suffix specified by the
\fB$SUBSTFILEPREFIX\fR
and
\fB$SUBSTFILESUFFIX\fR
construction variables (the null string by default in both cases) are automatically added to the target if they are not already present\&.
.sp
If a construction variable named
\fB$SUBST_DICT\fR
is present, it may be either a Python dictionary or a sequence of (key,value) tuples\&. If it is a dictionary it is converted into a list of tuples in an arbitrary order, so if one key is a prefix of another key or if one substitution could be further expanded by another subsitition, it is unpredictable whether the expansion will occur\&.
.sp
Any occurrences of a key in the source are replaced by the corresponding value, which may be a Python callable function or a string\&. If the value is a callable, it is called with no arguments to get a string\&. Strings are
\fIsubst\fR\-expanded and the result replaces the key\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools=[\*(Aqdefault\*(Aq])
env[\*(Aqprefix\*(Aq] = \*(Aq/usr/bin\*(Aq
script_dict = {\*(Aq@prefix@\*(Aq: \*(Aq/bin\*(Aq, \*(Aq@exec_prefix@\*(Aq: \*(Aq$prefix\*(Aq}
env\&.Substfile(\*(Aqscript\&.in\*(Aq, SUBST_DICT = script_dict)
conf_dict = {\*(Aq%VERSION%\*(Aq: \*(Aq1\&.2\&.3\*(Aq, \*(Aq%BASE%\*(Aq: \*(AqMyProg\*(Aq}
env\&.Substfile(\*(Aqconfig\&.h\&.in\*(Aq, conf_dict, SUBST_DICT = conf_dict)
# UNPREDICTABLE \- one key is a prefix of another
bad_foo = {\*(Aq$foo\*(Aq: \*(Aq$foo\*(Aq, \*(Aq$foobar\*(Aq: \*(Aq$foobar\*(Aq}
env\&.Substfile(\*(Aqfoo\&.in\*(Aq, SUBST_DICT = bad_foo)
# PREDICTABLE \- keys are applied longest first
good_foo = [(\*(Aq$foobar\*(Aq, \*(Aq$foobar\*(Aq), (\*(Aq$foo\*(Aq, \*(Aq$foo\*(Aq)]
env\&.Substfile(\*(Aqfoo\&.in\*(Aq, SUBST_DICT = good_foo)
# UNPREDICTABLE \- one substitution could be futher expanded
bad_bar = {\*(Aq@bar@\*(Aq: \*(Aq@soap@\*(Aq, \*(Aq@soap@\*(Aq: \*(Aqlye\*(Aq}
env\&.Substfile(\*(Aqbar\&.in\*(Aq, SUBST_DICT = bad_bar)
# PREDICTABLE \- substitutions are expanded in order
good_bar = ((\*(Aq@bar@\*(Aq, \*(Aq@soap@\*(Aq), (\*(Aq@soap@\*(Aq, \*(Aqlye\*(Aq))
env\&.Substfile(\*(Aqbar\&.in\*(Aq, SUBST_DICT = good_bar)
# the SUBST_DICT may be in common (and not an override)
substutions = {}
subst = Environment(tools=[\*(Aqtextfile\*(Aq], SUBST_DICT=substitutions)
substitutions[\*(Aq@foo@\*(Aq] = \*(Aqfoo\*(Aq
subst[\*(AqSUBST_DICT\*(Aq][\*(Aq@bar@\*(Aq] = \*(Aqbar\*(Aq
subst\&.Substfile(\*(Aqpgm1\&.c\*(Aq, [Value(\*(Aq#include "@foo@\&.h"\*(Aq),
Value(\*(Aq#include "@bar@\&.h"\*(Aq),
"common\&.in",
"pgm1\&.in"
])
subst\&.Substfile(\*(Aqpgm2\&.c\*(Aq, [Value(\*(Aq#include "@foo@\&.h"\*(Aq),
Value(\*(Aq#include "@bar@\&.h"\*(Aq),
"common\&.in",
"pgm2\&.in"
])
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBTar()\fR, \fBenv\&.Tar()\fR
.RS 4
Builds a tar archive of the specified files and/or directories\&. Unlike most builder methods, the
\fBTar\fR
builder method may be called multiple times for a given target; each additional call adds to the list of entries that will be built into the archive\&. Any source directories will be scanned for changes to any on\-disk files, regardless of whether or not
scons
knows about them from other Builder or function calls\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Tar(\*(Aqsrc\&.tar\*(Aq, \*(Aqsrc\*(Aq)
# Create the stuff\&.tar file\&.
env\&.Tar(\*(Aqstuff\*(Aq, [\*(Aqsubdir1\*(Aq, \*(Aqsubdir2\*(Aq])
# Also add "another" to the stuff\&.tar file\&.
env\&.Tar(\*(Aqstuff\*(Aq, \*(Aqanother\*(Aq)
# Set TARFLAGS to create a gzip\-filtered archive\&.
env = Environment(TARFLAGS = \*(Aq\-c \-z\*(Aq)
env\&.Tar(\*(Aqfoo\&.tar\&.gz\*(Aq, \*(Aqfoo\*(Aq)
# Also set the suffix to \&.tgz\&.
env = Environment(TARFLAGS = \*(Aq\-c \-z\*(Aq,
TARSUFFIX = \*(Aq\&.tgz\*(Aq)
env\&.Tar(\*(Aqfoo\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBTextfile()\fR, \fBenv\&.Textfile()\fR
.RS 4
The
\fBTextfile\fR
builder generates a single text file\&. The source strings constitute the lines; nested lists of sources are flattened\&.
\fB$LINESEPARATOR\fR
is used to separate the strings\&.
.sp
If present, the
\fB$SUBST_DICT\fR
construction variable is used to modify the strings before they are written; see the
\fBSubstfile\fR
description for details\&.
.sp
The prefix and suffix specified by the
\fB$TEXTFILEPREFIX\fR
and
\fB$TEXTFILESUFFIX\fR
construction variables (the null string and
\&.txt
by default, respectively) are automatically added to the target if they are not already present\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# builds/writes foo\&.txt
env\&.Textfile(target = \*(Aqfoo\&.txt\*(Aq, source = [\*(AqGoethe\*(Aq, 42, \*(AqSchiller\*(Aq])
# builds/writes bar\&.txt
env\&.Textfile(target = \*(Aqbar\*(Aq,
source = [\*(Aqlalala\*(Aq, \*(Aqtanteratei\*(Aq],
LINESEPARATOR=\*(Aq|*\*(Aq)
# nested lists are flattened automatically
env\&.Textfile(target = \*(Aqblob\*(Aq,
source = [\*(Aqlalala\*(Aq, [\*(AqGoethe\*(Aq, 42 \*(AqSchiller\*(Aq], \*(Aqtanteratei\*(Aq])
# files may be used as input by wraping them in File()
env\&.Textfile(target = \*(Aqconcat\*(Aq, # concatenate files with a marker between
source = [File(\*(Aqconcat1\*(Aq), File(\*(Aqconcat2\*(Aq)],
LINESEPARATOR = \*(Aq====================\en\*(Aq)
Results are:
foo\&.txt
\&.\&.\&.\&.8<\-\-\-\-
Goethe
42
Schiller
\&.\&.\&.\&.8<\-\-\-\- (no linefeed at the end)
bar\&.txt:
\&.\&.\&.\&.8<\-\-\-\-
lalala|*tanteratei
\&.\&.\&.\&.8<\-\-\-\- (no linefeed at the end)
blob\&.txt
\&.\&.\&.\&.8<\-\-\-\-
lalala
Goethe
42
Schiller
tanteratei
\&.\&.\&.\&.8<\-\-\-\- (no linefeed at the end)
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBTranslate()\fR, \fBenv\&.Translate()\fR
.RS 4
This pseudo\-builder belongs to
gettext
toolset\&. The builder extracts internationalized messages from source files, updates
POT
template (if necessary) and then updates
PO
translations (if necessary)\&. If
\fB$POAUTOINIT\fR
is set, missing
PO
files will be automatically created (i\&.e\&. without translator person intervention)\&. The variables
\fB$LINGUAS_FILE\fR
and
\fB$POTDOMAIN\fR
are taken into acount too\&. All other construction variables used by
\fBPOTUpdate\fR, and
\fBPOUpdate\fR
work here too\&.
.sp
\fIExample 1\fR\&. The simplest way is to specify input files and output languages inline in a SCons script when invoking
\fBTranslate\fR
.sp
.if n \{\
.RS 4
.\}
.nf
# SConscript in \*(Aqpo/\*(Aq directory
env = Environment( tools = ["default", "gettext"] )
env[\*(AqPOAUTOINIT\*(Aq] = 1
env\&.Translate([\*(Aqen\*(Aq,\*(Aqpl\*(Aq], [\*(Aq\&.\&./a\&.cpp\*(Aq,\*(Aq\&.\&./b\&.cpp\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
\fIExample 2\fR\&. If you wish, you may also stick to conventional style known from
autotools, i\&.e\&. using
POTFILES\&.in
and
LINGUAS
files
.sp
.if n \{\
.RS 4
.\}
.nf
# LINGUAS
en pl
#end
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
# POTFILES\&.in
a\&.cpp
b\&.cpp
# end
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
# SConscript
env = Environment( tools = ["default", "gettext"] )
env[\*(AqPOAUTOINIT\*(Aq] = 1
env[\*(AqXGETTEXTPATH\*(Aq] = [\*(Aq\&.\&./\*(Aq]
env\&.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = \*(AqPOTFILES\&.in\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The last approach is perhaps the recommended one\&. It allows easily split internationalization/localization onto separate SCons scripts, where a script in source tree is responsible for translations (from sources to
PO
files) and script(s) under variant directories are responsible for compilation of
PO
to
MO
files to and for installation of
MO
files\&. The "gluing factor" synchronizing these two scripts is then the content of
LINGUAS
file\&. Note, that the updated
POT
and
PO
files are usually going to be committed back to the repository, so they must be updated within the source directory (and not in variant directories)\&. Additionaly, the file listing of
po/
directory contains
LINGUAS
file, so the source tree looks familiar to translators, and they may work with the project in their usual way\&.
.sp
\fIExample 3\fR\&. Let\*(Aqs prepare a development tree as below
.sp
.if n \{\
.RS 4
.\}
.nf
project/
+ SConstruct
+ build/
+ src/
+ po/
+ SConscript
+ SConscript\&.i18n
+ POTFILES\&.in
+ LINGUAS
.fi
.if n \{\
.RE
.\}
.sp
with
build
being variant directory\&. Write the top\-level
SConstruct
script as follows
.sp
.if n \{\
.RS 4
.\}
.nf
# SConstruct
env = Environment( tools = ["default", "gettext"] )
VariantDir(\*(Aqbuild\*(Aq, \*(Aqsrc\*(Aq, duplicate = 0)
env[\*(AqPOAUTOINIT\*(Aq] = 1
SConscript(\*(Aqsrc/po/SConscript\&.i18n\*(Aq, exports = \*(Aqenv\*(Aq)
SConscript(\*(Aqbuild/po/SConscript\*(Aq, exports = \*(Aqenv\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
the
src/po/SConscript\&.i18n
as
.sp
.if n \{\
.RS 4
.\}
.nf
# src/po/SConscript\&.i18n
Import(\*(Aqenv\*(Aq)
env\&.Translate(LINGUAS_FILE=1, XGETTEXTFROM=\*(AqPOTFILES\&.in\*(Aq, XGETTEXTPATH=[\*(Aq\&.\&./\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
and the
src/po/SConscript
.sp
.if n \{\
.RS 4
.\}
.nf
# src/po/SConscript
Import(\*(Aqenv\*(Aq)
env\&.MOFiles(LINGUAS_FILE = 1)
.fi
.if n \{\
.RE
.\}
.sp
Such setup produces
POT
and
PO
files under source tree in
src/po/
and binary
MO
files under variant tree in
build/po/\&. This way the
POT
and
PO
files are separated from other output files, which must not be committed back to source repositories (e\&.g\&.
MO
files)\&.
.sp
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
In above example, the
PO
files are not updated, nor created automatically when you issue
\fBscons \*(Aq\&.\*(Aq\fR
command\&. The files must be updated (created) by hand via
\fBscons po\-update\fR
and then
MO
files can be compiled by running
\fBscons \*(Aq\&.\*(Aq\fR\&.
.sp .5v
.RE
.RE
.PP
\fBTypeLibrary()\fR, \fBenv\&.TypeLibrary()\fR
.RS 4
Builds a Windows type library (\&.tlb) file from an input IDL file (\&.idl)\&. In addition, it will build the associated interface stub and proxy source files, naming them according to the base name of the
\&.idl
file\&. For example,
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.TypeLibrary(source="foo\&.idl")
.fi
.if n \{\
.RE
.\}
.sp
Will create
foo\&.tlb,
foo\&.h,
foo_i\&.c,
foo_p\&.c
and
foo_data\&.c
files\&.
.RE
.PP
\fBUic()\fR, \fBenv\&.Uic()\fR
.RS 4
Builds a header file, an implementation file and a moc file from an ui file\&. and returns the corresponding nodes in the above order\&. This builder is only available after using the tool \*(Aqqt\*(Aq\&. Note: you can specify
\&.ui
files directly as source files to the
\fBProgram\fR,
\fBLibrary\fR
and
\fBSharedLibrary\fR
builders without using this builder\&. Using this builder lets you override the standard naming conventions (be careful: prefixes are always prepended to names of built files; if you don\*(Aqt want prefixes, you may set them to ``)\&. See the
\fB$QTDIR\fR
variable for more information\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Uic(\*(Aqfoo\&.ui\*(Aq) # \-> [\*(Aqfoo\&.h\*(Aq, \*(Aquic_foo\&.cc\*(Aq, \*(Aqmoc_foo\&.cc\*(Aq]
env\&.Uic(target = Split(\*(Aqinclude/foo\&.h gen/uicfoo\&.cc gen/mocfoo\&.cc\*(Aq),
source = \*(Aqfoo\&.ui\*(Aq) # \-> [\*(Aqinclude/foo\&.h\*(Aq, \*(Aqgen/uicfoo\&.cc\*(Aq, \*(Aqgen/mocfoo\&.cc\*(Aq]
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBZip()\fR, \fBenv\&.Zip()\fR
.RS 4
Builds a zip archive of the specified files and/or directories\&. Unlike most builder methods, the
\fBZip\fR
builder method may be called multiple times for a given target; each additional call adds to the list of entries that will be built into the archive\&. Any source directories will be scanned for changes to any on\-disk files, regardless of whether or not
scons
knows about them from other Builder or function calls\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Zip(\*(Aqsrc\&.zip\*(Aq, \*(Aqsrc\*(Aq)
# Create the stuff\&.zip file\&.
env\&.Zip(\*(Aqstuff\*(Aq, [\*(Aqsubdir1\*(Aq, \*(Aqsubdir2\*(Aq])
# Also add "another" to the stuff\&.tar file\&.
env\&.Zip(\*(Aqstuff\*(Aq, \*(Aqanother\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
All targets of builder methods automatically depend on their sources\&. An explicit dependency can be specified using the
\fBDepends\fR
method of a construction environment (see below)\&.
.PP
In addition,
\fBscons\fR
automatically scans source files for various programming languages, so the dependencies do not need to be specified explicitly\&. By default, SCons can C source files, C++ source files, Fortran source files with
\fB\&.F\fR
(POSIX systems only),
\fB\&.fpp,\fR
or
\fB\&.FPP\fR
file extensions, and assembly language files with
\fB\&.S\fR
(POSIX systems only),
\fB\&.spp,\fR
or
\fB\&.SPP\fR
files extensions for C preprocessor dependencies\&. SCons also has default support for scanning D source files, You can also write your own Scanners to add support for additional source file types\&. These can be added to the default Scanner object used by the
\fBObject\fR(),
\fBStaticObject\fR(), and
\fBSharedObject\fR() Builders by adding them to the
\fBSourceFileScanner\fR
object\&. See the section "Scanner Objects" below, for more information about defining your own Scanner objects and using the
\fBSourceFileScanner\fR
object\&.
.SS "Methods and Functions to Do Things"
.PP
In addition to Builder methods,
\fBscons\fR
provides a number of other construction environment methods and global functions to manipulate the build configuration\&.
.PP
Usually, a construction environment method and global function with the same name both exist so that you don\*(Aqt have to remember whether to a specific bit of functionality must be called with or without a construction environment\&. In the following list, if you call something as a global function it looks like:
.sp
.if n \{\
.RS 4
.\}
.nf
Function(\fIarguments\fR)
.fi
.if n \{\
.RE
.\}
.PP
and if you call something through a construction environment it looks like:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Function(\fIarguments\fR)
.fi
.if n \{\
.RE
.\}
.PP
If you can call the functionality in both ways, then both forms are listed\&.
.PP
Global functions may be called from custom Python modules that you import into an SConscript file by adding the following to the Python module:
.sp
.if n \{\
.RS 4
.\}
.nf
from SCons\&.Script import *
.fi
.if n \{\
.RE
.\}
.PP
Except where otherwise noted, the same\-named construction environment method and global function provide the exact same functionality\&. The only difference is that, where appropriate, calling the functionality through a construction environment will substitute construction variables into any supplied strings\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(FOO = \*(Aqfoo\*(Aq)
Default(\*(Aq$FOO\*(Aq)
env\&.Default(\*(Aq$FOO\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
In the above example, the first call to the global
\fBDefault()\fR
function will actually add a target named
\fB$FOO\fR
to the list of default targets, while the second call to the
\fBenv\&.Default()\fR
construction environment method will expand the value and add a target named
\fBfoo\fR
to the list of default targets\&. For more on construction variable expansion, see the next section on construction variables\&.
.PP
Construction environment methods and global functions supported by
\fBscons\fR
include:
.PP
Action(action, [cmd/str/fun, [var, \&.\&.\&.]] [option=value, \&.\&.\&.]), env\&.Action(action, [cmd/str/fun, [var, \&.\&.\&.]] [option=value, \&.\&.\&.])
.RS 4
Creates an Action object for the specified
\fIaction\fR\&. See the manpage section "Action Objects" for a complete explanation of the arguments and behavior\&.
.sp
Note that the
\fBenv\&.Action\fR() form of the invocation will expand construction variables in any argument strings, including the
\fIaction\fR
argument, at the time it is called using the construction variables in the
\fIenv\fR
construction environment through which
\fBenv\&.Action\fR() was called\&. The
\fBAction\fR() form delays all variable expansion until the Action object is actually used\&.
.RE
.PP
AddMethod(object, function, [name]), env\&.AddMethod(function, [name])
.RS 4
When called with the
\fBAddMethod\fR() form, adds the specified
\fIfunction\fR
to the specified
\fIobject\fR
as the specified method
\fIname\fR\&. When called with the
\fBenv\&.AddMethod\fR() form, adds the specified
\fIfunction\fR
to the construction environment
\fIenv\fR
as the specified method
\fIname\fR\&. In both cases, if
\fIname\fR
is omitted or
None, the name of the specified
\fIfunction\fR
itself is used for the method name\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# Note that the first argument to the function to
# be attached as a method must be the object through
# which the method will be called; the Python
# convention is to call it \*(Aqself\*(Aq\&.
def my_method(self, arg):
print("my_method() got", arg)
# Use the global AddMethod() function to add a method
# to the Environment class\&. This
AddMethod(Environment, my_method)
env = Environment()
env\&.my_method(\*(Aqarg\*(Aq)
# Add the function as a method, using the function
# name for the method call\&.
env = Environment()
env\&.AddMethod(my_method, \*(Aqother_method_name\*(Aq)
env\&.other_method_name(\*(Aqanother arg\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
AddOption(arguments)
.RS 4
This function adds a new command\-line option to be recognized\&. The specified
\fIarguments\fR
are the same as supported by the
\fBadd_option\fR
method in the standard Python library module
\fIoptparse\fR, with a few additional capabilities noted below; see the documentation for
\fIoptparse\fR
for a thorough discussion of its option\-processing capabities\&.
.sp
In addition to the arguments and values supported by the
\fBoptparse\&.add_option\fR() method, the SCons
\fBAddOption\fR
function allows you to set the
nargs
keyword value to
\*(Aq?\*(Aq
(a string with just the question mark) to indicate that the specified long option(s) take(s) an
\fIoptional\fR
argument\&. When
nargs = \*(Aq?\*(Aq
is passed to the
\fBAddOption\fR
function, the
const
keyword argument may be used to supply the "default" value that should be used when the option is specified on the command line without an explicit argument\&.
.sp
If no
default=
keyword argument is supplied when calling
\fBAddOption\fR, the option will have a default value of
None\&.
.sp
Unlike regular
\fIoptparse\fR, option names added via
\fBAddOption\fR
must be matched exactly, the automatic matching of abbreviations on the command line for long options is not supported\&. To allow specific abbreviations, include them in the
\fBAddOption\fR
call\&.
.sp
Once a new command\-line option has been added with
\fBAddOption\fR, the option value may be accessed using
\fBGetOption\fR
or
\fBenv\&.GetOption\fR()\&.
\fBSetOption\fR
is not currently supported for options added with
\fBAddOption\fR\&.
.sp
Any specified
help=
strings for the new option(s) will be displayed by the
\fB\-H\fR
or
\fB\-h\fR
options (the latter only if no other help text is specified in the SConscript files)\&. The help text for the local options specified by
\fBAddOption\fR
will appear below the SCons options themselves, under a separate
Local Options
heading\&. The options will appear in the help text in the order in which the
\fBAddOption\fR
calls occur\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
AddOption(\*(Aq\-\-prefix\*(Aq,
dest=\*(Aqprefix\*(Aq,
nargs=1, type=\*(Aqstring\*(Aq,
action=\*(Aqstore\*(Aq,
metavar=\*(AqDIR\*(Aq,
help=\*(Aqinstallation prefix\*(Aq)
env = Environment(PREFIX = GetOption(\*(Aqprefix\*(Aq))
.fi
.if n \{\
.RE
.\}
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
While
\fBAddOption\fR
behaves like
\fBadd_option\fR, from the
\fIoptparse\fR
module, the behavior of options added by
\fBAddOption\fR
which take arguments is underfined in
\fBscons\fR
if whitespace (rather than an
=
sign) is used as the separator on the command line when the option is invoked\&. Such usage should be avoided\&.
.sp .5v
.RE
.RE
.PP
AddPostAction(target, action), env\&.AddPostAction(target, action)
.RS 4
Arranges for the specified
\fIaction\fR
to be performed after the specified
\fItarget\fR
has been built\&. The specified action(s) may be an Action object, or anything that can be converted into an Action object See the manpage section "Action Objects" for a complete explanation\&.
.sp
When multiple targets are supplied, the action may be called multiple times, once after each action that generates one or more targets in the list\&.
.RE
.PP
AddPreAction(target, action), env\&.AddPreAction(target, action)
.RS 4
Arranges for the specified
\fIaction\fR
to be performed before the specified
\fItarget\fR
is built\&. The specified action(s) may be an Action object, or anything that can be converted into an Action object See the manpage section "Action Objects" for a complete explanation\&.
.sp
When multiple targets are specified, the action(s) may be called multiple times, once before each action that generates one or more targets in the list\&.
.sp
Note that if any of the targets are built in multiple steps, the action will be invoked just before the "final" action that specifically generates the specified target(s)\&. For example, when building an executable program from a specified source
\&.c
file via an intermediate object file:
.sp
.if n \{\
.RS 4
.\}
.nf
foo = Program(\*(Aqfoo\&.c\*(Aq)
AddPreAction(foo, \*(Aqpre_action\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The specified
pre_action
would be executed before
scons
calls the link command that actually generates the executable program binary
foo, not before compiling the
foo\&.c
file into an object file\&.
.RE
.PP
Alias(alias, [targets, [action]]), env\&.Alias(alias, [targets, [action]])
.RS 4
Creates one or more phony targets that expand to one or more other targets\&. An optional
\fIaction\fR
(command) or list of actions can be specified that will be executed whenever the any of the alias targets are out\-of\-date\&. Returns the Node object representing the alias, which exists outside of any file system\&. This Node object, or the alias name, may be used as a dependency of any other target, including another alias\&.
\fBAlias\fR
can be called multiple times for the same alias to add additional targets to the alias, or additional actions to the list for this alias\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Alias(\*(Aqinstall\*(Aq)
Alias(\*(Aqinstall\*(Aq, \*(Aq/usr/bin\*(Aq)
Alias([\*(Aqinstall\*(Aq, \*(Aqinstall\-lib\*(Aq], \*(Aq/usr/local/lib\*(Aq)
env\&.Alias(\*(Aqinstall\*(Aq, [\*(Aq/usr/local/bin\*(Aq, \*(Aq/usr/local/lib\*(Aq])
env\&.Alias(\*(Aqinstall\*(Aq, [\*(Aq/usr/local/man\*(Aq])
env\&.Alias(\*(Aqupdate\*(Aq, [\*(Aqfile1\*(Aq, \*(Aqfile2\*(Aq], "update_database $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
AllowSubstExceptions([exception, \&.\&.\&.])
.RS 4
Specifies the exceptions that will be allowed when expanding construction variables\&. By default, any construction variable expansions that generate a
NameError
or
IndexError
exception will expand to a
\*(Aq\*(Aq
(a null string) and not cause scons to fail\&. All exceptions not in the specified list will generate an error message and terminate processing\&.
.sp
If
\fBAllowSubstExceptions\fR
is called multiple times, each call completely overwrites the previous list of allowed exceptions\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
# Requires that all construction variable names exist\&.
# (You may wish to do this if you want to enforce strictly
# that all construction variables must be defined before use\&.)
AllowSubstExceptions()
# Also allow a string containing a zero\-division expansion
# like \*(Aq${1 / 0}\*(Aq to evalute to \*(Aq\*(Aq\&.
AllowSubstExceptions(IndexError, NameError, ZeroDivisionError)
.fi
.if n \{\
.RE
.\}
.RE
.PP
AlwaysBuild(target, \&.\&.\&.), env\&.AlwaysBuild(target, \&.\&.\&.)
.RS 4
Marks each given
\fItarget\fR
so that it is always assumed to be out of date, and will always be rebuilt if needed\&. Note, however, that
\fBAlwaysBuild\fR
does not add its target(s) to the default target list, so the targets will only be built if they are specified on the command line, or are a dependent of a target specified on the command line\-\-but they will
\fIalways\fR
be built if so specified\&. Multiple targets can be passed in to a single call to
\fBAlwaysBuild\fR\&.
.RE
.PP
env\&.Append(key=val, [\&.\&.\&.])
.RS 4
Appends the specified keyword arguments to the end of construction variables in the environment\&. If the Environment does not have the specified construction variable, it is simply added to the environment\&. If the values of the construction variable and the keyword argument are the same type, then the two values will be simply added together\&. Otherwise, the construction variable and the value of the keyword argument are both coerced to lists, and the lists are added together\&. (See also the
\fBPrepend\fR
method)\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Append(CCFLAGS = \*(Aq \-g\*(Aq, FOO = [\*(Aqfoo\&.yyy\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
env\&.AppendENVPath(name, newpath, [envname, sep, delete_existing])
.RS 4
This appends new path elements to the given path in the specified external environment (ENV
by default)\&. This will only add any particular path once (leaving the last one it encounters and ignoring the rest, to preserve path order), and to help assure this, will normalize all paths (using
\fBos\&.path\&.normpath\fR
and
\fBos\&.path\&.normcase\fR)\&. This can also handle the case where the given old path variable is a list instead of a string, in which case a list will be returned instead of a string\&.
.sp
If
\fIdelete_existing\fR
is 0, then adding a path that already exists will not move it to the end; it will stay where it is in the list\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
print \*(Aqbefore:\*(Aq,env[\*(AqENV\*(Aq][\*(AqINCLUDE\*(Aq]
include_path = \*(Aq/foo/bar:/foo\*(Aq
env\&.AppendENVPath(\*(AqINCLUDE\*(Aq, include_path)
print \*(Aqafter:\*(Aq,env[\*(AqENV\*(Aq][\*(AqINCLUDE\*(Aq]
yields:
before: /foo:/biz
after: /biz:/foo/bar:/foo
.fi
.if n \{\
.RE
.\}
.RE
.PP
env\&.AppendUnique(key=val, [\&.\&.\&.], delete_existing=0)
.RS 4
Appends the specified keyword arguments to the end of construction variables in the environment\&. If the Environment does not have the specified construction variable, it is simply added to the environment\&. If the construction variable being appended to is a list, then any value(s) that already exist in the construction variable will
\fInot\fR
be added again to the list\&. However, if delete_existing is 1, existing matching values are removed first, so existing values in the arg list move to the end of the list\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.AppendUnique(CCFLAGS = \*(Aq\-g\*(Aq, FOO = [\*(Aqfoo\&.yyy\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
Builder(action, [arguments]), env\&.Builder(action, [arguments])
.RS 4
Creates a Builder object for the specified
\fIaction\fR\&. See the manpage section "Builder Objects" for a complete explanation of the arguments and behavior\&.
.sp
Note that the
\fBenv\&.Builder\fR() form of the invocation will expand construction variables in any arguments strings, including the
\fIaction\fR
argument, at the time it is called using the construction variables in the
\fIenv\fR
construction environment through which
\fBenv\&.Builder\fR() was called\&. The
\fBBuilder\fR
form delays all variable expansion until after the Builder object is actually called\&.
.RE
.PP
CacheDir(cache_dir), env\&.CacheDir(cache_dir)
.RS 4
Specifies that
scons
will maintain a cache of derived files in
\fIcache_dir\fR\&. The derived files in the cache will be shared among all the builds using the same
\fBCacheDir\fR
call\&. Specifying a
\fIcache_dir\fR
of
None
disables derived file caching\&.
.sp
Calling
\fBenv\&.CacheDir\fR() will only affect targets built through the specified construction environment\&. Calling
\fBCacheDir\fR
sets a global default that will be used by all targets built through construction environments that do
\fInot\fR
have an
\fBenv\&.CacheDir\fR() specified\&.
.sp
When a
\fBCacheDir\fR() is being used and
scons
finds a derived file that needs to be rebuilt, it will first look in the cache to see if a derived file has already been built from identical input files and an identical build action (as incorporated into the MD5 build signature)\&. If so,
scons
will retrieve the file from the cache\&. If the derived file is not present in the cache,
scons
will rebuild it and then place a copy of the built file in the cache (identified by its MD5 build signature), so that it may be retrieved by other builds that need to build the same derived file from identical inputs\&.
.sp
Use of a specified
\fBCacheDir\fR
may be disabled for any invocation by using the
\fB\-\-cache\-disable\fR
option\&.
.sp
If the
\fB\-\-cache\-force\fR
option is used,
scons
will place a copy of
\fIall\fR
derived files in the cache, even if they already existed and were not built by this invocation\&. This is useful to populate a cache the first time
\fBCacheDir\fR
is added to a build, or after using the
\fB\-\-cache\-disable\fR
option\&.
.sp
When using
\fBCacheDir\fR,
scons
will report, "Retrieved `file\*(Aq from cache," unless the
\fB\-\-cache\-show\fR
option is being used\&. When the
\fB\-\-cache\-show\fR
option is used,
scons
will print the action that
\fIwould\fR
have been used to build the file, without any indication that the file was actually retrieved from the cache\&. This is useful to generate build logs that are equivalent regardless of whether a given derived file has been built in\-place or retrieved from the cache\&.
.sp
The
\fBNoCache\fR
method can be used to disable caching of specific files\&. This can be useful if inputs and/or outputs of some tool are impossible to predict or prohibitively large\&.
.RE
.PP
Clean(targets, files_or_dirs), env\&.Clean(targets, files_or_dirs)
.RS 4
This specifies a list of files or directories which should be removed whenever the targets are specified with the
\fB\-c\fR
command line option\&. The specified targets may be a list or an individual target\&. Multiple calls to
\fBClean\fR
are legal, and create new targets or add files and directories to the clean list for the specified targets\&.
.sp
Multiple files or directories should be specified either as separate arguments to the
\fBClean\fR
method, or as a list\&.
\fBClean\fR
will also accept the return value of any of the construction environment Builder methods\&. Examples:
.sp
The related
\fBNoClean\fR
function overrides calling
\fBClean\fR
for the same target, and any targets passed to both functions will
\fInot\fR
be removed by the
\fB\-c\fR
option\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Clean(\*(Aqfoo\*(Aq, [\*(Aqbar\*(Aq, \*(Aqbaz\*(Aq])
Clean(\*(Aqdist\*(Aq, env\&.Program(\*(Aqhello\*(Aq, \*(Aqhello\&.c\*(Aq))
Clean([\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq], \*(Aqsomething_else_to_clean\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
In this example, installing the project creates a subdirectory for the documentation\&. This statement causes the subdirectory to be removed if the project is deinstalled\&.
.sp
.if n \{\
.RS 4
.\}
.nf
Clean(docdir, os\&.path\&.join(docdir, projectname))
.fi
.if n \{\
.RE
.\}
.RE
.PP
env\&.Clone([key=val, \&.\&.\&.])
.RS 4
Returns a separate copy of a construction environment\&. If there are any keyword arguments specified, they are added to the returned copy, overwriting any existing values for the keywords\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env2 = env\&.Clone()
env3 = env\&.Clone(CCFLAGS = \*(Aq\-g\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Additionally, a list of tools and a toolpath may be specified, as in the Environment constructor:
.sp
.if n \{\
.RS 4
.\}
.nf
def MyTool(env): env[\*(AqFOO\*(Aq] = \*(Aqbar\*(Aq
env4 = env\&.Clone(tools = [\*(Aqmsvc\*(Aq, MyTool])
.fi
.if n \{\
.RE
.\}
.sp
The
\fIparse_flags\fR
keyword argument is also recognized to allow merging command\-line style arguments into the appropriate construction variables (see
\fBenv\&.MergeFlags\fR)\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# create an environment for compiling programs that use wxWidgets
wx_env = env\&.Clone(parse_flags=\*(Aq!wx\-config \-\-cflags \-\-cxxflags\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Command(target, source, action, [key=val, \&.\&.\&.]), env\&.Command(target, source, action, [key=val, \&.\&.\&.])
.RS 4
Executes a specific action (or list of actions) to build a target file or files\&. This is more convenient than defining a separate Builder object for a single special\-case build\&.
.sp
\fBCommand\fR
builder accepts
\fIsource_scanner\fR,
\fItarget_scanner\fR,
\fIsource_factory\fR, and
\fItarget_factory\fR
keyword arguments\&. The *_scanner args can be used to specify a Scanner object that will be used to apply a custom scanner for a source or target\&. For example, the global
DirScanner
object can be used if any of the sources will be directories that must be scanned on\-disk for changes to files that aren\*(Aqt already specified in other Builder of function calls\&. The *_factory args take a factory function that the Command will use to turn any sources or targets specified as strings into SCons Nodes\&. See the sections "Builder Objects" below, for more information about how these args work in a Builder\&.
.sp
Any other keyword arguments specified override any same\-named existing construction variables\&.
.sp
An action can be an external command, specified as a string, or a callable Python object; see the manpage section "Action Objects" for more complete information\&. Also note that a string specifying an external command may be preceded by an
@
(at\-sign) to suppress printing the command in question, or by a
\-
(hyphen) to ignore the exit status of the external command\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Command(\*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq,
"$FOO_BUILD < $SOURCES > $TARGET")
env\&.Command(\*(Aqbar\&.out\*(Aq, \*(Aqbar\&.in\*(Aq,
["rm \-f $TARGET",
"$BAR_BUILD < $SOURCES > $TARGET"],
ENV={\*(AqPATH\*(Aq: \*(Aq/usr/local/bin/\*(Aq})
def rename(env, target, source):
import os
os\&.rename(\*(Aq\&.tmp\*(Aq, str(target[0]))
env\&.Command(\*(Aqbaz\&.out\*(Aq, \*(Aqbaz\&.in\*(Aq,
["$BAZ_BUILD < $SOURCES > \&.tmp",
rename])
.fi
.if n \{\
.RE
.\}
.sp
Note that the
\fBCommand\fR
function will usually assume, by default, that the specified targets and/or sources are Files, if no other part of the configuration identifies what type of entries they are\&. If necessary, you can explicitly specify that targets or source nodes should be treated as directories by using the
\fBDir\fR
or
\fBenv\&.Dir\fR
functions\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Command(\*(Aqddd\&.list\*(Aq, Dir(\*(Aqddd\*(Aq), \*(Aqls \-l $SOURCE > $TARGET\*(Aq)
env[\*(AqDISTDIR\*(Aq] = \*(Aqdestination/directory\*(Aq
env\&.Command(env\&.Dir(\*(Aq$DISTDIR\*(Aq)), None, make_distdir)
.fi
.if n \{\
.RE
.\}
.sp
Also note that SCons will usually automatically create any directory necessary to hold a target file, so you normally don\*(Aqt need to create directories by hand\&.
.RE
.PP
Configure(env, [custom_tests, conf_dir, log_file, config_h]), env\&.Configure([custom_tests, conf_dir, log_file, config_h])
.RS 4
Creates a Configure object for integrated functionality similar to GNU autoconf\&. See the manpage section "Configure Contexts" for a complete explanation of the arguments and behavior\&.
.RE
.PP
env\&.Copy([key=val, \&.\&.\&.])
.RS 4
A now\-deprecated synonym for
\fBenv\&.Clone\fR()\&.
.RE
.PP
Decider(function), env\&.Decider(function)
.RS 4
Specifies that all up\-to\-date decisions for targets built through this construction environment will be handled by the specified
\fIfunction\fR\&. The
\fIfunction\fR
can be one of the following strings that specify the type of decision function to be performed:
.PP
timestamp\-newer
.RS 4
Specifies that a target shall be considered out of date and rebuilt if the dependency\*(Aqs timestamp is newer than the target file\*(Aqs timestamp\&. This is the behavior of the classic Make utility, and
make
can be used a synonym for
timestamp\-newer\&.
.RE
.PP
timestamp\-match
.RS 4
Specifies that a target shall be considered out of date and rebuilt if the dependency\*(Aqs timestamp is different than the timestamp recorded the last time the target was built\&. This provides behavior very similar to the classic Make utility (in particular, files are not opened up so that their contents can be checksummed) except that the target will also be rebuilt if a dependency file has been restored to a version with an
\fIearlier\fR
timestamp, such as can happen when restoring files from backup archives\&.
.RE
.PP
MD5
.RS 4
Specifies that a target shall be considered out of date and rebuilt if the dependency\*(Aqs content has changed since the last time the target was built, as determined be performing an MD5 checksum on the dependency\*(Aqs contents and comparing it to the checksum recorded the last time the target was built\&.
content
can be used as a synonym for
MD5\&.
.RE
.PP
MD5\-timestamp
.RS 4
Specifies that a target shall be considered out of date and rebuilt if the dependency\*(Aqs content has changed since the last time the target was built, except that dependencies with a timestamp that matches the last time the target was rebuilt will be assumed to be up\-to\-date and
\fInot\fR
rebuilt\&. This provides behavior very similar to the
MD5
behavior of always checksumming file contents, with an optimization of not checking the contents of files whose timestamps haven\*(Aqt changed\&. The drawback is that SCons will
\fInot\fR
detect if a file\*(Aqs content has changed but its timestamp is the same, as might happen in an automated script that runs a build, updates a file, and runs the build again, all within a single second\&.
.RE
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# Use exact timestamp matches by default\&.
Decider(\*(Aqtimestamp\-match\*(Aq)
# Use MD5 content signatures for any targets built
# with the attached construction environment\&.
env\&.Decider(\*(Aqcontent\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
In addition to the above already\-available functions, the
\fIfunction\fR
argument may be an actual Python function that takes the following three arguments:
.PP
\fIdependency\fR
.RS 4
The Node (file) which should cause the
\fItarget\fR
to be rebuilt if it has "changed" since the last tme
\fItarget\fR
was built\&.
.RE
.PP
\fItarget\fR
.RS 4
The Node (file) being built\&. In the normal case, this is what should get rebuilt if the
\fIdependency\fR
has "changed\&."
.RE
.PP
\fIprev_ni\fR
.RS 4
Stored information about the state of the
\fIdependency\fR
the last time the
\fItarget\fR
was built\&. This can be consulted to match various file characteristics such as the timestamp, size, or content signature\&.
.RE
.PP
\fIrepo_node\fR
.RS 4
Use this node instead of the one specified by
\fIdependency\fR
to determine if the dependency has changed\&.
.RE
.sp
The
\fIfunction\fR
should return a
True
(non\-zero) value if the
\fIdependency\fR
has "changed" since the last time the
\fItarget\fR
was built (indicating that the target
\fIshould\fR
be rebuilt), and
False
(zero) otherwise (indicating that the target should
\fInot\fR
be rebuilt)\&. Note that the decision can be made using whatever criteria are appopriate\&. Ignoring some or all of the function arguments is perfectly normal\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
def my_decider(dependency, target, prev_ni, repo_node=None):
return not os\&.path\&.exists(str(target))
env\&.Decider(my_decider)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Default(targets), env\&.Default(targets)
.RS 4
This specifies a list of default targets, which will be built by
scons
if no explicit targets are given on the command line\&. Multiple calls to
\fBDefault\fR
are legal, and add to the list of default targets\&. As noted above, both forms of this call affect the same global list of default targets; the construction environment method applies construction variable expansion to the targets\&.
.sp
Multiple targets should be specified as separate arguments to the
\fBDefault\fR
method, or as a list\&.
\fBDefault\fR
will also accept the Node returned by any of a construction environment\*(Aqs builder methods\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Default(\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq, \*(Aqbaz\*(Aq)
env\&.Default([\*(Aqa\*(Aq, \*(Aqb\*(Aq, \*(Aqc\*(Aq])
hello = env\&.Program(\*(Aqhello\*(Aq, \*(Aqhello\&.c\*(Aq)
env\&.Default(hello)
.fi
.if n \{\
.RE
.\}
.sp
An argument to
\fBDefault\fR
of
None
will clear all default targets\&. Later calls to
\fBDefault\fR
will add to the (now empty) default\-target list like normal\&.
.sp
The current list of targets added using the
\fBDefault\fR
function or method is available in the
DEFAULT_TARGETS
list; see below\&.
.RE
.PP
DefaultEnvironment([**kwargs])
.RS 4
Creates and returns the default
construction environment
object\&. The default
construction environment
is used internally by SCons in order to execute many of the global functions in this list (i\&.e\&. those not called as methods of a specific
construction environment), and to fetch source files transparently from source code management systems\&. The default environment is a singleton, so the keyword arguments affect it only on the first call, on subsequent calls the already\-constructed object is returned\&. The default environment can be modified in the same way as any
construction environment\&.
.RE
.PP
Depends(target, dependency), env\&.Depends(target, dependency)
.RS 4
Specifies an explicit dependency; the
\fItarget\fR
will be rebuilt whenever the
\fIdependency\fR
has changed\&. Both the specified
\fItarget\fR
and
\fIdependency\fR
can be a string (usually the path name of a file or directory) or Node objects, or a list of strings or Node objects (such as returned by a Builder call)\&. This should only be necessary for cases where the dependency is not caught by a Scanner for the file\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Depends(\*(Aqfoo\*(Aq, \*(Aqother\-input\-file\-for\-foo\*(Aq)
mylib = env\&.Library(\*(Aqmylib\&.c\*(Aq)
installed_lib = env\&.Install(\*(Aqlib\*(Aq, mylib)
bar = env\&.Program(\*(Aqbar\&.c\*(Aq)
# Arrange for the library to be copied into the installation
# directory before trying to build the "bar" program\&.
# (Note that this is for example only\&. A "real" library
# dependency would normally be configured through the $LIBS
# and $LIBPATH variables, not using an env\&.Depends() call\&.)
env\&.Depends(bar, installed_lib)
.fi
.if n \{\
.RE
.\}
.RE
.PP
env\&.Dictionary([vars])
.RS 4
Returns a dictionary object containing the
construction variables
in the
construction environment\&. If there are any arguments specified, the values of the specified
construction variables
are returned as a string (if one argument) or as a list of strings\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
cvars = env\&.Dictionary()
cc_values = env\&.Dictionary(\*(AqCC\*(Aq, \*(AqCCFLAGS\*(Aq, \*(AqCCCOM\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Dir(name, [directory]), env\&.Dir(name, [directory])
.RS 4
This returns a Directory Node, an object that represents the specified directory
\fIname\fR\&.
\fIname\fR
can be a relative or absolute path\&.
\fIdirectory\fR
is an optional directory that will be used as the parent directory\&. If no
\fIdirectory\fR
is specified, the current script\*(Aqs directory is used as the parent\&.
.sp
If
\fIname\fR
is a list, SCons returns a list of Dir nodes\&. Construction variables are expanded in
\fIname\fR\&.
.sp
Directory Nodes can be used anywhere you would supply a string as a directory name to a Builder method or function\&. Directory Nodes have attributes and methods that are useful in many situations; see manpage section "File and Directory Nodes" for more information\&.
.RE
.PP
env\&.Dump([key])
.RS 4
Returns a pretty printable representation of the environment\&.
\fIkey\fR, if not
None, should be a string containing the name of the variable of interest\&.
.sp
This SConstruct:
.sp
.if n \{\
.RS 4
.\}
.nf
env=Environment()
print(env\&.Dump(\*(AqCCCOM\*(Aq))
.fi
.if n \{\
.RE
.\}
.sp
will print:
.sp
.if n \{\
.RS 4
.\}
.nf
\*(Aq$CC \-c \-o $TARGET $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES\*(Aq
.fi
.if n \{\
.RE
.\}
.sp
While this SConstruct:
.sp
.if n \{\
.RS 4
.\}
.nf
env=Environment()
print(env\&.Dump())
.fi
.if n \{\
.RE
.\}
.sp
will print:
.sp
.if n \{\
.RS 4
.\}
.nf
{ \*(AqAR\*(Aq: \*(Aqar\*(Aq,
\*(AqARCOM\*(Aq: \*(Aq$AR $ARFLAGS $TARGET $SOURCES\en$RANLIB $RANLIBFLAGS $TARGET\*(Aq,
\*(AqARFLAGS\*(Aq: [\*(Aqr\*(Aq],
\*(AqAS\*(Aq: \*(Aqas\*(Aq,
\*(AqASCOM\*(Aq: \*(Aq$AS $ASFLAGS \-o $TARGET $SOURCES\*(Aq,
\*(AqASFLAGS\*(Aq: [],
\&.\&.\&.
.fi
.if n \{\
.RE
.\}
.RE
.PP
EnsurePythonVersion(major, minor), env\&.EnsurePythonVersion(major, minor)
.RS 4
Ensure that the Python version is at least
\fImajor\fR\&.\fIminor\fR\&. This function will print out an error message and exit SCons with a non\-zero exit code if the actual Python version is not late enough\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
EnsurePythonVersion(2,2)
.fi
.if n \{\
.RE
.\}
.RE
.PP
EnsureSConsVersion(major, minor, [revision]), env\&.EnsureSConsVersion(major, minor, [revision])
.RS 4
Ensure that the SCons version is at least
\fImajor\&.minor\fR, or
\fImajor\&.minor\&.revision\fR\&. if
\fIrevision\fR
is specified\&. This function will print out an error message and exit SCons with a non\-zero exit code if the actual SCons version is not late enough\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
EnsureSConsVersion(0,14)
EnsureSConsVersion(0,96,90)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Environment([key=value, \&.\&.\&.]), env\&.Environment([key=value, \&.\&.\&.])
.RS 4
Return a new construction environment initialized with the specified
\fIkey\fR=\fIvalue\fR
pairs\&.
.RE
.PP
Execute(action, [strfunction, varlist]), env\&.Execute(action, [strfunction, varlist])
.RS 4
Executes an Action object\&. The specified
\fIaction\fR
may be an Action object (see manpage section "Action Objects" for a complete explanation of the arguments and behavior), or it may be a command\-line string, list of commands, or executable Python function, each of which will be converted into an Action object and then executed\&. The exit value of the command or return value of the Python function will be returned\&.
.sp
Note that
scons
will print an error message if the executed
\fIaction\fR
fails\-\-that is, exits with or returns a non\-zero value\&.
scons
will
\fInot\fR, however, automatically terminate the build if the specified
\fIaction\fR
fails\&. If you want the build to stop in response to a failed
\fBExecute\fR
call, you must explicitly check for a non\-zero return value:
.sp
.if n \{\
.RS 4
.\}
.nf
Execute(Copy(\*(Aqfile\&.out\*(Aq, \*(Aqfile\&.in\*(Aq))
if Execute("mkdir sub/dir/ectory"):
# The mkdir failed, don\*(Aqt try to build\&.
Exit(1)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Exit([value]), env\&.Exit([value])
.RS 4
This tells
scons
to exit immediately with the specified
\fIvalue\fR\&. A default exit value of
0
(zero) is used if no value is specified\&.
.RE
.PP
Export(vars), env\&.Export(vars)
.RS 4
This tells
scons
to export a list of variables from the current SConscript file to all other SConscript files\&. The exported variables are kept in a global collection, so subsequent calls to
\fBExport\fR
will over\-write previous exports that have the same name\&. Multiple variable names can be passed to
\fBExport\fR
as separate arguments or as a list\&. Keyword arguments can be used to provide names and their values\&. A dictionary can be used to map variables to a different name when exported\&. Both local variables and global variables can be exported\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
# Make env available for all SConscript files to Import()\&.
Export("env")
package = \*(Aqmy_name\*(Aq
# Make env and package available for all SConscript files:\&.
Export("env", "package")
# Make env and package available for all SConscript files:
Export(["env", "package"])
# Make env available using the name debug:
Export(debug = env)
# Make env available using the name debug:
Export({"debug":env})
.fi
.if n \{\
.RE
.\}
.sp
Note that the
\fBSConscript\fR
function supports an
\fIexports\fR
argument that makes it easier to to export a variable or set of variables to a single SConscript file\&. See the description of the
\fBSConscript\fR
function, below\&.
.RE
.PP
File(name, [directory]), env\&.File(name, [directory])
.RS 4
This returns a File Node, an object that represents the specified file
\fIname\fR\&.
\fIname\fR
can be a relative or absolute path\&.
\fIdirectory\fR
is an optional directory that will be used as the parent directory\&.
.sp
If
\fIname\fR
is a list, SCons returns a list of File nodes\&. Construction variables are expanded in
\fIname\fR\&.
.sp
File Nodes can be used anywhere you would supply a string as a file name to a Builder method or function\&. File Nodes have attributes and methods that are useful in many situations; see manpage section "File and Directory Nodes" for more information\&.
.RE
.PP
FindFile(file, dirs), env\&.FindFile(file, dirs)
.RS 4
Search for
\fIfile\fR
in the path specified by
\fIdirs\fR\&.
\fIdirs\fR
may be a list of directory names or a single directory name\&. In addition to searching for files that exist in the filesystem, this function also searches for derived files that have not yet been built\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
foo = env\&.FindFile(\*(Aqfoo\*(Aq, [\*(Aqdir1\*(Aq, \*(Aqdir2\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
FindInstalledFiles(), env\&.FindInstalledFiles()
.RS 4
Returns the list of targets set up by the
\fBInstall\fR
or
\fBInstallAs\fR
builders\&.
.sp
This function serves as a convenient method to select the contents of a binary package\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
Install( \*(Aq/bin\*(Aq, [ \*(Aqexecutable_a\*(Aq, \*(Aqexecutable_b\*(Aq ] )
# will return the file node list
# [ \*(Aq/bin/executable_a\*(Aq, \*(Aq/bin/executable_b\*(Aq ]
FindInstalledFiles()
Install( \*(Aq/lib\*(Aq, [ \*(Aqsome_library\*(Aq ] )
# will return the file node list
# [ \*(Aq/bin/executable_a\*(Aq, \*(Aq/bin/executable_b\*(Aq, \*(Aq/lib/some_library\*(Aq ]
FindInstalledFiles()
.fi
.if n \{\
.RE
.\}
.RE
.PP
FindPathDirs(variable)
.RS 4
Returns a function (actually a callable Python object) intended to be used as the
\fIpath_function\fR
of a Scanner object\&. The returned object will look up the specified
\fIvariable\fR
in a construction environment and treat the construction variable\*(Aqs value as a list of directory paths that should be searched (like
\fB$CPPPATH\fR,
\fB$LIBPATH\fR, etc\&.)\&.
.sp
Note that use of
\fBFindPathDirs\fR
is generally preferable to writing your own
\fIpath_function\fR
for the following reasons: 1) The returned list will contain all appropriate directories found in source trees (when
\fBVariantDir\fR
is used) or in code repositories (when
\fBRepository\fR
or the
\fB\-Y\fR
option are used)\&. 2) scons will identify expansions of
\fIvariable\fR
that evaluate to the same list of directories as, in fact, the same list, and avoid re\-scanning the directories for files, when possible\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
def my_scan(node, env, path, arg):
# Code to scan file contents goes here\&.\&.\&.
return include_files
scanner = Scanner(name = \*(Aqmyscanner\*(Aq,
function = my_scan,
path_function = FindPathDirs(\*(AqMYPATH\*(Aq))
.fi
.if n \{\
.RE
.\}
.RE
.PP
FindSourceFiles(node=\*(Aq"\&."\*(Aq), env\&.FindSourceFiles(node=\*(Aq"\&."\*(Aq)
.RS 4
Returns the list of nodes which serve as the source of the built files\&. It does so by inspecting the dependency tree starting at the optional argument
\fInode\fR
which defaults to the \*(Aq"\&."\*(Aq\-node\&. It will then return all leaves of
\fInode\fR\&. These are all children which have no further children\&.
.sp
This function is a convenient method to select the contents of a Source Package\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
Program( \*(Aqsrc/main_a\&.c\*(Aq )
Program( \*(Aqsrc/main_b\&.c\*(Aq )
Program( \*(Aqmain_c\&.c\*(Aq )
# returns [\*(Aqmain_c\&.c\*(Aq, \*(Aqsrc/main_a\&.c\*(Aq, \*(AqSConstruct\*(Aq, \*(Aqsrc/main_b\&.c\*(Aq]
FindSourceFiles()
# returns [\*(Aqsrc/main_b\&.c\*(Aq, \*(Aqsrc/main_a\&.c\*(Aq ]
FindSourceFiles( \*(Aqsrc\*(Aq )
.fi
.if n \{\
.RE
.\}
.sp
As you can see build support files (SConstruct in the above example) will also be returned by this function\&.
.RE
.PP
Flatten(sequence), env\&.Flatten(sequence)
.RS 4
Takes a sequence (that is, a Python list or tuple) that may contain nested sequences and returns a flattened list containing all of the individual elements in any sequence\&. This can be helpful for collecting the lists returned by calls to Builders; other Builders will automatically flatten lists specified as input, but direct Python manipulation of these lists does not\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
foo = Object(\*(Aqfoo\&.c\*(Aq)
bar = Object(\*(Aqbar\&.c\*(Aq)
# Because `foo\*(Aq and `bar\*(Aq are lists returned by the Object() Builder,
# `objects\*(Aq will be a list containing nested lists:
objects = [\*(Aqf1\&.o\*(Aq, foo, \*(Aqf2\&.o\*(Aq, bar, \*(Aqf3\&.o\*(Aq]
# Passing such a list to another Builder is all right because
# the Builder will flatten the list automatically:
Program(source = objects)
# If you need to manipulate the list directly using Python, you need to
# call Flatten() yourself, or otherwise handle nested lists:
for object in Flatten(objects):
print str(object)
.fi
.if n \{\
.RE
.\}
.RE
.PP
GetBuildFailures()
.RS 4
Returns a list of exceptions for the actions that failed while attempting to build targets\&. Each element in the returned list is a
BuildError
object with the following attributes that record various aspects of the build failure:
.sp
\&.node
The node that was being built when the build failure occurred\&.
.sp
\&.status
The numeric exit status returned by the command or Python function that failed when trying to build the specified Node\&.
.sp
\&.errstr
The SCons error string describing the build failure\&. (This is often a generic message like "Error 2" to indicate that an executed command exited with a status of 2\&.)
.sp
\&.filename
The name of the file or directory that actually caused the failure\&. This may be different from the
\&.node
attribute\&. For example, if an attempt to build a target named
sub/dir/target
fails because the
sub/dir
directory could not be created, then the
\&.node
attribute will be
sub/dir/target
but the
\&.filename
attribute will be
sub/dir\&.
.sp
\&.executor
The SCons Executor object for the target Node being built\&. This can be used to retrieve the construction environment used for the failed action\&.
.sp
\&.action
The actual SCons Action object that failed\&. This will be one specific action out of the possible list of actions that would have been executed to build the target\&.
.sp
\&.command
The actual expanded command that was executed and failed, after expansion of
\fB$TARGET\fR,
\fB$SOURCE\fR, and other construction variables\&.
.sp
Note that the
\fBGetBuildFailures\fR
function will always return an empty list until any build failure has occurred, which means that
\fBGetBuildFailures\fR
will always return an empty list while the
SConscript
files are being read\&. Its primary intended use is for functions that will be executed before SCons exits by passing them to the standard Python
\fBatexit\&.register\fR() function\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
import atexit
def print_build_failures():
from SCons\&.Script import GetBuildFailures
for bf in GetBuildFailures():
print("%s failed: %s" % (bf\&.node, bf\&.errstr))
atexit\&.register(print_build_failures)
.fi
.if n \{\
.RE
.\}
.RE
.PP
GetBuildPath(file, [\&.\&.\&.]), env\&.GetBuildPath(file, [\&.\&.\&.])
.RS 4
Returns the
scons
path name (or names) for the specified
\fIfile\fR
(or files)\&. The specified
\fIfile\fR
or files may be
scons
Nodes or strings representing path names\&.
.RE
.PP
GetLaunchDir(), env\&.GetLaunchDir()
.RS 4
Returns the absolute path name of the directory from which
scons
was initially invoked\&. This can be useful when using the
\fB\-u\fR,
\fB\-U\fR
or
\fB\-D\fR
options, which internally change to the directory in which the
SConstruct
file is found\&.
.RE
.PP
GetOption(name), env\&.GetOption(name)
.RS 4
This function provides a way to query the value of SCons options set on scons command line (or set using the
\fBSetOption\fR
function)\&. The options supported are:
.PP
cache_debug
.RS 4
which corresponds to \-\-cache\-debug;
.RE
.PP
cache_disable
.RS 4
which corresponds to \-\-cache\-disable;
.RE
.PP
cache_force
.RS 4
which corresponds to \-\-cache\-force;
.RE
.PP
cache_show
.RS 4
which corresponds to \-\-cache\-show;
.RE
.PP
clean
.RS 4
which corresponds to \-c, \-\-clean and \-\-remove;
.RE
.PP
config
.RS 4
which corresponds to \-\-config;
.RE
.PP
directory
.RS 4
which corresponds to \-C and \-\-directory;
.RE
.PP
diskcheck
.RS 4
which corresponds to \-\-diskcheck
.RE
.PP
duplicate
.RS 4
which corresponds to \-\-duplicate;
.RE
.PP
file
.RS 4
which corresponds to \-f, \-\-file, \-\-makefile and \-\-sconstruct;
.RE
.PP
help
.RS 4
which corresponds to \-h and \-\-help;
.RE
.PP
ignore_errors
.RS 4
which corresponds to \-\-ignore\-errors;
.RE
.PP
implicit_cache
.RS 4
which corresponds to \-\-implicit\-cache;
.RE
.PP
implicit_deps_changed
.RS 4
which corresponds to \-\-implicit\-deps\-changed;
.RE
.PP
implicit_deps_unchanged
.RS 4
which corresponds to \-\-implicit\-deps\-unchanged;
.RE
.PP
interactive
.RS 4
which corresponds to \-\-interact and \-\-interactive;
.RE
.PP
keep_going
.RS 4
which corresponds to \-k and \-\-keep\-going;
.RE
.PP
max_drift
.RS 4
which corresponds to \-\-max\-drift;
.RE
.PP
no_exec
.RS 4
which corresponds to \-n, \-\-no\-exec, \-\-just\-print, \-\-dry\-run and \-\-recon;
.RE
.PP
no_site_dir
.RS 4
which corresponds to \-\-no\-site\-dir;
.RE
.PP
num_jobs
.RS 4
which corresponds to \-j and \-\-jobs;
.RE
.PP
profile_file
.RS 4
which corresponds to \-\-profile;
.RE
.PP
question
.RS 4
which corresponds to \-q and \-\-question;
.RE
.PP
random
.RS 4
which corresponds to \-\-random;
.RE
.PP
repository
.RS 4
which corresponds to \-Y, \-\-repository and \-\-srcdir;
.RE
.PP
silent
.RS 4
which corresponds to \-s, \-\-silent and \-\-quiet;
.RE
.PP
site_dir
.RS 4
which corresponds to \-\-site\-dir;
.RE
.PP
stack_size
.RS 4
which corresponds to \-\-stack\-size;
.RE
.PP
taskmastertrace_file
.RS 4
which corresponds to \-\-taskmastertrace; and
.RE
.PP
warn
.RS 4
which corresponds to \-\-warn and \-\-warning\&.
.RE
.sp
See the documentation for the corresponding command line object for information about each specific option\&.
.RE
.PP
Glob(pattern, [ondisk, source, strings, exclude]), env\&.Glob(pattern, [ondisk, source, strings, exclude])
.RS 4
Returns Nodes (or strings) that match the specified
\fIpattern\fR, relative to the directory of the current
SConscript
file\&. The
\fBenv\&.Glob\fR() form performs string substition on
\fIpattern\fR
and returns whatever matches the resulting expanded pattern\&.
.sp
The specified
\fIpattern\fR
uses Unix shell style metacharacters for matching:
.sp
.if n \{\
.RS 4
.\}
.nf
* matches everything
? matches any single character
[seq] matches any character in seq
[!seq] matches any char not in seq
.fi
.if n \{\
.RE
.\}
.sp
If the first character of a filename is a dot, it must be matched explicitly\&. Character matches do
\fInot\fR
span directory separators\&.
.sp
The
\fBGlob\fR
knows about repositories (see the
\fBRepository\fR
function) and source directories (see the
\fBVariantDir\fR
function) and returns a Node (or string, if so configured) in the local (SConscript) directory if matching Node is found anywhere in a corresponding repository or source directory\&.
.sp
The
\fIondisk\fR
argument may be set to
False
(or any other non\-true value) to disable the search for matches on disk, thereby only returning matches among already\-configured File or Dir Nodes\&. The default behavior is to return corresponding Nodes for any on\-disk matches found\&.
.sp
The
\fIsource\fR
argument may be set to
True
(or any equivalent value) to specify that, when the local directory is a
\fBVariantDir\fR, the returned Nodes should be from the corresponding source directory, not the local directory\&.
.sp
The
\fIstrings\fR
argument may be set to
True
(or any equivalent value) to have the
\fBGlob\fR
function return strings, not Nodes, that represent the matched files or directories\&. The returned strings will be relative to the local (SConscript) directory\&. (Note that This may make it easier to perform arbitrary manipulation of file names, but if the returned strings are passed to a different
SConscript
file, any Node translation will be relative to the other
SConscript
directory, not the original
SConscript
directory\&.)
.sp
The
\fIexclude\fR
argument may be set to a pattern or a list of patterns (following the same Unix shell semantics) which must be filtered out of returned elements\&. Elements matching a least one pattern of this list will be excluded\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Program(\*(Aqfoo\*(Aq, Glob(\*(Aq*\&.c\*(Aq))
Zip(\*(Aq/tmp/everything\*(Aq, Glob(\*(Aq\&.??*\*(Aq) + Glob(\*(Aq*\*(Aq))
sources = Glob(\*(Aq*\&.cpp\*(Aq, exclude=[\*(Aqos_*_specific_*\&.cpp\*(Aq]) + Glob(\*(Aqos_%s_specific_*\&.cpp\*(Aq%currentOS)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Help(text, append=False), env\&.Help(text, append=False)
.RS 4
This specifies help text to be printed if the
\fB\-h\fR
argument is given to
scons\&. If
\fBHelp\fR
is called multiple times, the text is appended together in the order that
\fBHelp\fR
is called\&. With append set to False, any
\fBHelp\fR
text generated with
\fBAddOption\fR
is clobbered\&. If append is True, the AddOption help is prepended to the help string, thus preserving the
\fB\-h\fR
message\&.
.RE
.PP
Ignore(target, dependency), env\&.Ignore(target, dependency)
.RS 4
The specified dependency file(s) will be ignored when deciding if the target file(s) need to be rebuilt\&.
.sp
You can also use
\fBIgnore\fR
to remove a target from the default build\&. In order to do this you must specify the directory the target will be built in as the target, and the file you want to skip building as the dependency\&.
.sp
Note that this will only remove the dependencies listed from the files built by default\&. It will still be built if that dependency is needed by another object being built\&. See the third and forth examples below\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Ignore(\*(Aqfoo\*(Aq, \*(Aqfoo\&.c\*(Aq)
env\&.Ignore(\*(Aqbar\*(Aq, [\*(Aqbar1\&.h\*(Aq, \*(Aqbar2\&.h\*(Aq])
env\&.Ignore(\*(Aq\&.\*(Aq,\*(Aqfoobar\&.obj\*(Aq)
env\&.Ignore(\*(Aqbar\*(Aq,\*(Aqbar/foobar\&.obj\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Import(vars), env\&.Import(vars)
.RS 4
This tells
scons
to import a list of variables into the current SConscript file\&. This will import variables that were exported with
\fBExport\fR
or in the
\fIexports\fR
argument to
\fBSConscript\fR\&. Variables exported by
\fBSConscript\fR
have precedence\&. Multiple variable names can be passed to
\fBImport\fR
as separate arguments or as a list\&. The variable "*" can be used to import all variables\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Import("env")
Import("env", "variable")
Import(["env", "variable"])
Import("*")
.fi
.if n \{\
.RE
.\}
.RE
.PP
Literal(string), env\&.Literal(string)
.RS 4
The specified
\fIstring\fR
will be preserved as\-is and not have construction variables expanded\&.
.RE
.PP
Local(targets), env\&.Local(targets)
.RS 4
The specified
\fItargets\fR
will have copies made in the local tree, even if an already up\-to\-date copy exists in a repository\&. Returns a list of the target Node or Nodes\&.
.RE
.PP
env\&.MergeFlags(arg, [unique])
.RS 4
Merges the specified
\fIarg\fR
values to the construction environment\*(Aqs construction variables\&. If the
\fIarg\fR
argument is not a dictionary, it is converted to one by calling
\fBenv\&.ParseFlags\fR
on the argument before the values are merged\&. Note that
\fIarg\fR
must be a single value, so multiple strings must be passed in as a list, not as separate arguments to
\fBenv\&.MergeFlags\fR\&.
.sp
By default, duplicate values are eliminated; you can, however, specify
unique=0
to allow duplicate values to be added\&. When eliminating duplicate values, any construction variables that end with the string
PATH
keep the left\-most unique value\&. All other construction variables keep the right\-most unique value\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# Add an optimization flag to $CCFLAGS\&.
env\&.MergeFlags(\*(Aq\-O3\*(Aq)
# Combine the flags returned from running pkg\-config with an optimization
# flag and merge the result into the construction variables\&.
env\&.MergeFlags([\*(Aq!pkg\-config gtk+\-2\&.0 \-\-cflags\*(Aq, \*(Aq\-O3\*(Aq])
# Combine an optimization flag with the flags returned from running pkg\-config
# twice and merge the result into the construction variables\&.
env\&.MergeFlags([\*(Aq\-O3\*(Aq,
\*(Aq!pkg\-config gtk+\-2\&.0 \-\-cflags \-\-libs\*(Aq,
\*(Aq!pkg\-config libpng12 \-\-cflags \-\-libs\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
NoCache(target, \&.\&.\&.), env\&.NoCache(target, \&.\&.\&.)
.RS 4
Specifies a list of files which should
\fInot\fR
be cached whenever the
\fBCacheDir\fR
method has been activated\&. The specified targets may be a list or an individual target\&.
.sp
Multiple files should be specified either as separate arguments to the
\fBNoCache\fR
method, or as a list\&.
\fBNoCache\fR
will also accept the return value of any of the construction environment Builder methods\&.
.sp
Calling
\fBNoCache\fR
on directories and other non\-File Node types has no effect because only File Nodes are cached\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
NoCache(\*(Aqfoo\&.elf\*(Aq)
NoCache(env\&.Program(\*(Aqhello\*(Aq, \*(Aqhello\&.c\*(Aq))
.fi
.if n \{\
.RE
.\}
.RE
.PP
NoClean(target, \&.\&.\&.), env\&.NoClean(target, \&.\&.\&.)
.RS 4
Specifies a list of files or directories which should
\fInot\fR
be removed whenever the targets (or their dependencies) are specified with the
\fB\-c\fR
command line option\&. The specified targets may be a list or an individual target\&. Multiple calls to
\fBNoClean\fR
are legal, and prevent each specified target from being removed by calls to the
\fB\-c\fR
option\&.
.sp
Multiple files or directories should be specified either as separate arguments to the
\fBNoClean\fR
method, or as a list\&.
\fBNoClean\fR
will also accept the return value of any of the construction environment Builder methods\&.
.sp
Calling
\fBNoClean\fR
for a target overrides calling
\fBClean\fR
for the same target, and any targets passed to both functions will
\fInot\fR
be removed by the
\fB\-c\fR
option\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
NoClean(\*(Aqfoo\&.elf\*(Aq)
NoClean(env\&.Program(\*(Aqhello\*(Aq, \*(Aqhello\&.c\*(Aq))
.fi
.if n \{\
.RE
.\}
.RE
.PP
env\&.ParseConfig(command, [function, unique])
.RS 4
Calls the specified
\fIfunction\fR
to modify the environment as specified by the output of
\fIcommand\fR\&. The default
\fIfunction\fR
is
\fBenv\&.MergeFlags\fR, which expects the output of a typical
*\-config
command (for example,
gtk\-config) and adds the options to the appropriate construction variables\&. By default, duplicate values are not added to any construction variables; you can specify
unique=0
to allow duplicate values to be added\&.
.sp
Interpreted options and the construction variables they affect are as specified for the
\fBenv\&.ParseFlags\fR
method (which this method calls)\&. See that method\*(Aqs description for a table of options and construction variables\&.
.RE
.PP
ParseDepends(filename, [must_exist, only_one]), env\&.ParseDepends(filename, [must_exist, only_one])
.RS 4
Parses the contents of the specified
\fIfilename\fR
as a list of dependencies in the style of
Make
or
mkdep, and explicitly establishes all of the listed dependencies\&.
.sp
By default, it is not an error if the specified
\fIfilename\fR
does not exist\&. The optional
\fImust_exist\fR
argument may be set to a non\-zero value to have scons throw an exception and generate an error if the file does not exist, or is otherwise inaccessible\&.
.sp
The optional
\fIonly_one\fR
argument may be set to a non\-zero value to have scons thrown an exception and generate an error if the file contains dependency information for more than one target\&. This can provide a small sanity check for files intended to be generated by, for example, the
gcc \-M
flag, which should typically only write dependency information for one output file into a corresponding
\&.d
file\&.
.sp
The
\fIfilename\fR
and all of the files listed therein will be interpreted relative to the directory of the
SConscript
file which calls the
\fBParseDepends\fR
function\&.
.RE
.PP
env\&.ParseFlags(flags, \&.\&.\&.)
.RS 4
Parses one or more strings containing typical command\-line flags for GCC tool chains and returns a dictionary with the flag values separated into the appropriate SCons construction variables\&. This is intended as a companion to the
\fBenv\&.MergeFlags\fR
method, but allows for the values in the returned dictionary to be modified, if necessary, before merging them into the construction environment\&. (Note that
\fBenv\&.MergeFlags\fR
will call this method if its argument is not a dictionary, so it is usually not necessary to call
\fBenv\&.ParseFlags\fR
directly unless you want to manipulate the values\&.)
.sp
If the first character in any string is an exclamation mark (!), the rest of the string is executed as a command, and the output from the command is parsed as GCC tool chain command\-line flags and added to the resulting dictionary\&.
.sp
Flag values are translated accordig to the prefix found, and added to the following construction variables:
.sp
.if n \{\
.RS 4
.\}
.nf
\-arch CCFLAGS, LINKFLAGS
\-D CPPDEFINES
\-framework FRAMEWORKS
\-frameworkdir= FRAMEWORKPATH
\-fmerge\-all\-constants CCFLAGS, LINKFLAGS
\-fopenmp CCFLAGS, LINKFLAGS
\-include CCFLAGS
\-imacros CCFLAGS
\-isysroot CCFLAGS, LINKFLAGS
\-isystem CCFLAGS
\-iquote CCFLAGS
\-idirafter CCFLAGS
\-I CPPPATH
\-l LIBS
\-L LIBPATH
\-mno\-cygwin CCFLAGS, LINKFLAGS
\-mwindows LINKFLAGS
\-openmp CCFLAGS, LINKFLAGS
\-pthread CCFLAGS, LINKFLAGS
\-std= CFLAGS
\-Wa, ASFLAGS, CCFLAGS
\-Wl,\-rpath= RPATH
\-Wl,\-R, RPATH
\-Wl,\-R RPATH
\-Wl, LINKFLAGS
\-Wp, CPPFLAGS
\- CCFLAGS
+ CCFLAGS, LINKFLAGS
.fi
.if n \{\
.RE
.\}
.sp
Any other strings not associated with options are assumed to be the names of libraries and added to the
\fB$LIBS\fR
construction variable\&.
.sp
Examples (all of which produce the same result):
.sp
.if n \{\
.RS 4
.\}
.nf
dict = env\&.ParseFlags(\*(Aq\-O2 \-Dfoo \-Dbar=1\*(Aq)
dict = env\&.ParseFlags(\*(Aq\-O2\*(Aq, \*(Aq\-Dfoo\*(Aq, \*(Aq\-Dbar=1\*(Aq)
dict = env\&.ParseFlags([\*(Aq\-O2\*(Aq, \*(Aq\-Dfoo \-Dbar=1\*(Aq])
dict = env\&.ParseFlags(\*(Aq\-O2\*(Aq, \*(Aq!echo \-Dfoo \-Dbar=1\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Platform(string)
.RS 4
The
\fBPlatform\fR
form returns a callable object that can be used to initialize a construction environment using the platform keyword of the
\fBEnvironment\fR
function\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(platform = Platform(\*(Aqwin32\*(Aq))
.fi
.if n \{\
.RE
.\}
.sp
The
\fBenv\&.Platform\fR
form applies the callable object for the specified platform
\fIstring\fR
to the environment through which the method was called\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Platform(\*(Aqposix\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
Note that the
win32
platform adds the
SystemDrive
and
SystemRoot
variables from the user\*(Aqs external environment to the construction environment\*(Aqs
\fB$ENV\fR
dictionary\&. This is so that any executed commands that use sockets to connect with other systems (such as fetching source files from external CVS repository specifications like
:pserver:anonymous@cvs\&.sourceforge\&.net:/cvsroot/scons) will work on Windows systems\&.
.RE
.PP
Precious(target, \&.\&.\&.), env\&.Precious(target, \&.\&.\&.)
.RS 4
Marks each given
\fItarget\fR
as precious so it is not deleted before it is rebuilt\&. Normally
scons
deletes a target before building it\&. Multiple targets can be passed in to a single call to
\fBPrecious\fR\&.
.RE
.PP
env\&.Prepend(key=val, [\&.\&.\&.])
.RS 4
Appends the specified keyword arguments to the beginning of construction variables in the environment\&. If the Environment does not have the specified construction variable, it is simply added to the environment\&. If the values of the construction variable and the keyword argument are the same type, then the two values will be simply added together\&. Otherwise, the construction variable and the value of the keyword argument are both coerced to lists, and the lists are added together\&. (See also the Append method, above\&.)
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Prepend(CCFLAGS = \*(Aq\-g \*(Aq, FOO = [\*(Aqfoo\&.yyy\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
env\&.PrependENVPath(name, newpath, [envname, sep, delete_existing])
.RS 4
This appends new path elements to the given path in the specified external environment (\fB$ENV\fR
by default)\&. This will only add any particular path once (leaving the first one it encounters and ignoring the rest, to preserve path order), and to help assure this, will normalize all paths (using
os\&.path\&.normpath
and
os\&.path\&.normcase)\&. This can also handle the case where the given old path variable is a list instead of a string, in which case a list will be returned instead of a string\&.
.sp
If
\fIdelete_existing\fR
is 0, then adding a path that already exists will not move it to the beginning; it will stay where it is in the list\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
print \*(Aqbefore:\*(Aq,env[\*(AqENV\*(Aq][\*(AqINCLUDE\*(Aq]
include_path = \*(Aq/foo/bar:/foo\*(Aq
env\&.PrependENVPath(\*(AqINCLUDE\*(Aq, include_path)
print \*(Aqafter:\*(Aq,env[\*(AqENV\*(Aq][\*(AqINCLUDE\*(Aq]
.fi
.if n \{\
.RE
.\}
.sp
The above example will print:
.sp
.if n \{\
.RS 4
.\}
.nf
before: /biz:/foo
after: /foo/bar:/foo:/biz
.fi
.if n \{\
.RE
.\}
.RE
.PP
env\&.PrependUnique(key=val, delete_existing=0, [\&.\&.\&.])
.RS 4
Appends the specified keyword arguments to the beginning of construction variables in the environment\&. If the Environment does not have the specified construction variable, it is simply added to the environment\&. If the construction variable being appended to is a list, then any value(s) that already exist in the construction variable will
\fInot\fR
be added again to the list\&. However, if delete_existing is 1, existing matching values are removed first, so existing values in the arg list move to the front of the list\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.PrependUnique(CCFLAGS = \*(Aq\-g\*(Aq, FOO = [\*(Aqfoo\&.yyy\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
Progress(callable, [interval]), Progress(string, [interval, file, overwrite]), Progress(list_of_strings, [interval, file, overwrite])
.RS 4
Allows SCons to show progress made during the build by displaying a string or calling a function while evaluating Nodes (e\&.g\&. files)\&.
.sp
If the first specified argument is a Python callable (a function or an object that has a
\fB__call__\fR() method), the function will be called once every
\fIinterval\fR
times a Node is evaluated\&. The callable will be passed the evaluated Node as its only argument\&. (For future compatibility, it\*(Aqs a good idea to also add
*args
and
**kw
as arguments to your function or method\&. This will prevent the code from breaking if SCons ever changes the interface to call the function with additional arguments in the future\&.)
.sp
An example of a simple custom progress function that prints a string containing the Node name every 10 Nodes:
.sp
.if n \{\
.RS 4
.\}
.nf
def my_progress_function(node, *args, **kw):
print(\*(AqEvaluating node %s!\*(Aq % node)
Progress(my_progress_function, interval=10)
.fi
.if n \{\
.RE
.\}
.sp
A more complicated example of a custom progress display object that prints a string containing a count every 100 evaluated Nodes\&. Note the use of
\er
(a carriage return) at the end so that the string will overwrite itself on a display:
.sp
.if n \{\
.RS 4
.\}
.nf
import sys
class ProgressCounter(object):
count = 0
def __call__(self, node, *args, **kw):
self\&.count += 100
sys\&.stderr\&.write(\*(AqEvaluated %s nodes\er\*(Aq % self\&.count)
Progress(ProgressCounter(), interval=100)
.fi
.if n \{\
.RE
.\}
.sp
If the first argument
\fBProgress\fR
is a string, the string will be displayed every
\fIinterval\fR
evaluated Nodes\&. The default is to print the string on standard output; an alternate output stream may be specified with the
file=
argument\&. The following will print a series of dots on the error output, one dot for every 100 evaluated Nodes:
.sp
.if n \{\
.RS 4
.\}
.nf
import sys
Progress(\*(Aq\&.\*(Aq, interval=100, file=sys\&.stderr)
.fi
.if n \{\
.RE
.\}
.sp
If the string contains the verbatim substring
\fB$TARGET\fR, it will be replaced with the Node\&. Note that, for performance reasons, this is
\fInot\fR
a regular SCons variable substition, so you can not use other variables or use curly braces\&. The following example will print the name of every evaluated Node, using a
\er
(carriage return) to cause each line to overwritten by the next line, and the
overwrite=
keyword argument to make sure the previously\-printed file name is overwritten with blank spaces:
.sp
.if n \{\
.RS 4
.\}
.nf
import sys
Progress(\*(Aq$TARGET\er\*(Aq, overwrite=True)
.fi
.if n \{\
.RE
.\}
.sp
If the first argument to
\fBProgress\fR
is a list of strings, then each string in the list will be displayed in rotating fashion every
\fIinterval\fR
evaluated Nodes\&. This can be used to implement a "spinner" on the user\*(Aqs screen as follows:
.sp
.if n \{\
.RS 4
.\}
.nf
Progress([\*(Aq\-\er\*(Aq, \*(Aq\e\e\er\*(Aq, \*(Aq|\er\*(Aq, \*(Aq/\er\*(Aq], interval=5)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Pseudo(target, \&.\&.\&.), env\&.Pseudo(target, \&.\&.\&.)
.RS 4
This indicates that each given
\fItarget\fR
should not be created by the build rule, and if the target is created, an error will be generated\&. This is similar to the gnu make \&.PHONY target\&. However, in the vast majority of cases, an
\fBAlias\fR
is more appropriate\&. Multiple targets can be passed in to a single call to
\fBPseudo\fR\&.
.RE
.PP
PyPackageDir(modulename), env\&.PyPackageDir(modulename)
.RS 4
This returns a Directory Node similar to Dir\&. The python module / package is looked up and if located the directory is returned for the location\&.
\fImodulename\fR
Is a named python package / module to lookup the directory for it\*(Aqs location\&.
.sp
If
\fImodulename\fR
is a list, SCons returns a list of Dir nodes\&. Construction variables are expanded in
\fImodulename\fR\&.
.RE
.PP
env\&.Replace(key=val, [\&.\&.\&.])
.RS 4
Replaces construction variables in the Environment with the specified keyword arguments\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Replace(CCFLAGS = \*(Aq\-g\*(Aq, FOO = \*(Aqfoo\&.xxx\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Repository(directory), env\&.Repository(directory)
.RS 4
Specifies that
\fIdirectory\fR
is a repository to be searched for files\&. Multiple calls to
\fBRepository\fR
are legal, and each one adds to the list of repositories that will be searched\&.
.sp
To
scons, a repository is a copy of the source tree, from the top\-level directory on down, which may contain both source files and derived files that can be used to build targets in the local source tree\&. The canonical example would be an official source tree maintained by an integrator\&. If the repository contains derived files, then the derived files should have been built using
scons, so that the repository contains the necessary signature information to allow
scons
to figure out when it is appropriate to use the repository copy of a derived file, instead of building one locally\&.
.sp
Note that if an up\-to\-date derived file already exists in a repository,
scons
will
\fInot\fR
make a copy in the local directory tree\&. In order to guarantee that a local copy will be made, use the
\fBLocal\fR
method\&.
.RE
.PP
Requires(target, prerequisite), env\&.Requires(target, prerequisite)
.RS 4
Specifies an order\-only relationship between the specified target file(s) and the specified prerequisite file(s)\&. The prerequisite file(s) will be (re)built, if necessary,
\fIbefore\fR
the target file(s), but the target file(s) do not actually depend on the prerequisites and will not be rebuilt simply because the prerequisite file(s) change\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Requires(\*(Aqfoo\*(Aq, \*(Aqfile\-that\-must\-be\-built\-before\-foo\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Return([vars\&.\&.\&., stop=])
.RS 4
By default, this stops processing the current SConscript file and returns to the calling SConscript file the values of the variables named in the
\fIvars\fR
string arguments\&. Multiple strings contaning variable names may be passed to
\fBReturn\fR\&. Any strings that contain white space
.sp
The optional
stop=
keyword argument may be set to a false value to continue processing the rest of the SConscript file after the
\fBReturn\fR
call\&. This was the default behavior prior to SCons 0\&.98\&. However, the values returned are still the values of the variables in the named
\fIvars\fR
at the point
\fBReturn\fR
is called\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# Returns without returning a value\&.
Return()
# Returns the value of the \*(Aqfoo\*(Aq Python variable\&.
Return("foo")
# Returns the values of the Python variables \*(Aqfoo\*(Aq and \*(Aqbar\*(Aq\&.
Return("foo", "bar")
# Returns the values of Python variables \*(Aqval1\*(Aq and \*(Aqval2\*(Aq\&.
Return(\*(Aqval1 val2\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Scanner(function, [argument, keys, path_function, node_class, node_factory, scan_check, recursive]), env\&.Scanner(function, [argument, keys, path_function, node_class, node_factory, scan_check, recursive])
.RS 4
Creates a Scanner object for the specified
\fIfunction\fR\&. See manpage section "Scanner Objects" for a complete explanation of the arguments and behavior\&.
.RE
.PP
SConscript(scripts, [exports, variant_dir, duplicate, must_exist]), env\&.SConscript(scripts, [exports, variant_dir, duplicate, must_exist]), SConscript(dirs=subdirs, [name=script, exports, variant_dir, duplicate, must_exist]), env\&.SConscript(dirs=subdirs, [name=script, exports, variant_dir, duplicate, must_exist])
.RS 4
This tells
scons
to execute one or more subsidiary SConscript (configuration) files\&. Any variables returned by a called script using
\fBReturn\fR
will be returned by the call to
\fBSConscript\fR\&. There are two ways to call the
\fBSConscript\fR
function\&.
.sp
The first way you can call
\fBSConscript\fR
is to explicitly specify one or more
\fIscripts\fR
as the first argument\&. A single script may be specified as a string; multiple scripts must be specified as a list (either explicitly or as created by a function like
\fBSplit\fR)\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
SConscript(\*(AqSConscript\*(Aq) # run SConscript in the current directory
SConscript(\*(Aqsrc/SConscript\*(Aq) # run SConscript in the src directory
SConscript([\*(Aqsrc/SConscript\*(Aq, \*(Aqdoc/SConscript\*(Aq])
config = SConscript(\*(AqMyConfig\&.py\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The second way you can call
\fBSConscript\fR
is to specify a list of (sub)directory names as a
dirs=\fIsubdirs\fR
keyword argument\&. In this case,
scons
will, by default, execute a subsidiary configuration file named
SConscript
in each of the specified directories\&. You may specify a name other than
SConscript
by supplying an optional
name=\fIscript\fR
keyword argument\&. The first three examples below have the same effect as the first three examples above:
.sp
.if n \{\
.RS 4
.\}
.nf
SConscript(dirs=\*(Aq\&.\*(Aq) # run SConscript in the current directory
SConscript(dirs=\*(Aqsrc\*(Aq) # run SConscript in the src directory
SConscript(dirs=[\*(Aqsrc\*(Aq, \*(Aqdoc\*(Aq])
SConscript(dirs=[\*(Aqsub1\*(Aq, \*(Aqsub2\*(Aq], name=\*(AqMySConscript\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The optional
\fIexports\fR
argument provides a list of variable names or a dictionary of named values to export to the
\fIscript(s)\fR\&. These variables are locally exported only to the specified
\fIscript(s)\fR, and do not affect the global pool of variables used by the
\fBExport\fR
function\&.
The subsidiary
\fIscript(s)\fR
must use the
\fBImport\fR
function to import the variables\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
foo = SConscript(\*(Aqsub/SConscript\*(Aq, exports=\*(Aqenv\*(Aq)
SConscript(\*(Aqdir/SConscript\*(Aq, exports=[\*(Aqenv\*(Aq, \*(Aqvariable\*(Aq])
SConscript(dirs=\*(Aqsubdir\*(Aq, exports=\*(Aqenv variable\*(Aq)
SConscript(dirs=[\*(Aqone\*(Aq, \*(Aqtwo\*(Aq, \*(Aqthree\*(Aq], exports=\*(Aqshared_info\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
If the optional
\fIvariant_dir\fR
argument is present, it causes an effect equivalent to the
\fBVariantDir\fR
method described below\&. (If
\fIvariant_dir\fR
is not present, the
\fIduplicate\fR
argument is ignored\&.) The
\fIvariant_dir\fR
argument is interpreted relative to the directory of the calling
SConscript
file\&. See the description of the
\fBVariantDir\fR
function below for additional details and restrictions\&.
.sp
If
\fIvariant_dir\fR
is present,
the source directory is the directory in which the
SConscript
file resides and the
SConscript
file is evaluated as if it were in the
\fIvariant_dir\fR
directory:
.sp
.if n \{\
.RS 4
.\}
.nf
SConscript(\*(Aqsrc/SConscript\*(Aq, variant_dir = \*(Aqbuild\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
is equivalent to
.sp
.if n \{\
.RS 4
.\}
.nf
VariantDir(\*(Aqbuild\*(Aq, \*(Aqsrc\*(Aq)
SConscript(\*(Aqbuild/SConscript\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
This later paradigm is often used when the sources are in the same directory as the
SConstruct:
.sp
.if n \{\
.RS 4
.\}
.nf
SConscript(\*(AqSConscript\*(Aq, variant_dir = \*(Aqbuild\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
is equivalent to
.sp
.if n \{\
.RS 4
.\}
.nf
VariantDir(\*(Aqbuild\*(Aq, \*(Aq\&.\*(Aq)
SConscript(\*(Aqbuild/SConscript\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
.sp
The optional
\fImust_exist\fR
argument, if true, causes an exception to be raised if a requested
SConscript
file is not found\&. The current default is false, causing only a warning to be omitted, but this behavior is deprecated\&. For scripts which truly intend to be optional, transition to explicty supplying
must_exist=False
to the call\&.
.sp
Here are some composite examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# collect the configuration information and use it to build src and doc
shared_info = SConscript(\*(AqMyConfig\&.py\*(Aq)
SConscript(\*(Aqsrc/SConscript\*(Aq, exports=\*(Aqshared_info\*(Aq)
SConscript(\*(Aqdoc/SConscript\*(Aq, exports=\*(Aqshared_info\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
# build debugging and production versions\&. SConscript
# can use Dir(\*(Aq\&.\*(Aq)\&.path to determine variant\&.
SConscript(\*(AqSConscript\*(Aq, variant_dir=\*(Aqdebug\*(Aq, duplicate=0)
SConscript(\*(AqSConscript\*(Aq, variant_dir=\*(Aqprod\*(Aq, duplicate=0)
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
# build debugging and production versions\&. SConscript
# is passed flags to use\&.
opts = { \*(AqCPPDEFINES\*(Aq : [\*(AqDEBUG\*(Aq], \*(AqCCFLAGS\*(Aq : \*(Aq\-pgdb\*(Aq }
SConscript(\*(AqSConscript\*(Aq, variant_dir=\*(Aqdebug\*(Aq, duplicate=0, exports=opts)
opts = { \*(AqCPPDEFINES\*(Aq : [\*(AqNODEBUG\*(Aq], \*(AqCCFLAGS\*(Aq : \*(Aq\-O\*(Aq }
SConscript(\*(AqSConscript\*(Aq, variant_dir=\*(Aqprod\*(Aq, duplicate=0, exports=opts)
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
# build common documentation and compile for different architectures
SConscript(\*(Aqdoc/SConscript\*(Aq, variant_dir=\*(Aqbuild/doc\*(Aq, duplicate=0)
SConscript(\*(Aqsrc/SConscript\*(Aq, variant_dir=\*(Aqbuild/x86\*(Aq, duplicate=0)
SConscript(\*(Aqsrc/SConscript\*(Aq, variant_dir=\*(Aqbuild/ppc\*(Aq, duplicate=0)
.fi
.if n \{\
.RE
.\}
.RE
.PP
SConscriptChdir(value), env\&.SConscriptChdir(value)
.RS 4
By default,
scons
changes its working directory to the directory in which each subsidiary SConscript file lives\&. This behavior may be disabled by specifying either:
.sp
.if n \{\
.RS 4
.\}
.nf
SConscriptChdir(0)
env\&.SConscriptChdir(0)
.fi
.if n \{\
.RE
.\}
.sp
in which case
scons
will stay in the top\-level directory while reading all SConscript files\&. (This may be necessary when building from repositories, when all the directories in which SConscript files may be found don\*(Aqt necessarily exist locally\&.) You may enable and disable this ability by calling SConscriptChdir() multiple times\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
SConscriptChdir(0)
SConscript(\*(Aqfoo/SConscript\*(Aq) # will not chdir to foo
env\&.SConscriptChdir(1)
SConscript(\*(Aqbar/SConscript\*(Aq) # will chdir to bar
.fi
.if n \{\
.RE
.\}
.RE
.PP
SConsignFile([file, dbm_module]), env\&.SConsignFile([file, dbm_module])
.RS 4
This tells
scons
to store all file signatures in the specified database
\fIfile\fR\&. If the
\fIfile\fR
name is omitted,
\&.sconsign
is used by default\&. (The actual file name(s) stored on disk may have an appropriated suffix appended by the
\fI dbm_module\fR\&.) If
\fIfile\fR
is not an absolute path name, the file is placed in the same directory as the top\-level
SConstruct
file\&.
.sp
If
\fIfile\fR
is
None, then
scons
will store file signatures in a separate
\&.sconsign
file in each directory, not in one global database file\&. (This was the default behavior prior to SCons 0\&.96\&.91 and 0\&.97\&.)
.sp
The optional
\fIdbm_module\fR
argument can be used to specify which Python database module The default is to use a custom
SCons\&.dblite
module that uses pickled Python data structures, and which works on all Python versions\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# Explicitly stores signatures in "\&.sconsign\&.dblite"
# in the top\-level SConstruct directory (the
# default behavior)\&.
SConsignFile()
# Stores signatures in the file "etc/scons\-signatures"
# relative to the top\-level SConstruct directory\&.
SConsignFile("etc/scons\-signatures")
# Stores signatures in the specified absolute file name\&.
SConsignFile("/home/me/SCons/signatures")
# Stores signatures in a separate \&.sconsign file
# in each directory\&.
SConsignFile(None)
.fi
.if n \{\
.RE
.\}
.RE
.PP
env\&.SetDefault(key=val, [\&.\&.\&.])
.RS 4
Sets construction variables to default values specified with the keyword arguments if (and only if) the variables are not already set\&. The following statements are equivalent:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.SetDefault(FOO = \*(Aqfoo\*(Aq)
if \*(AqFOO\*(Aq not in env: env[\*(AqFOO\*(Aq] = \*(Aqfoo\*(Aq
.fi
.if n \{\
.RE
.\}
.RE
.PP
SetOption(name, value), env\&.SetOption(name, value)
.RS 4
This function provides a way to set a select subset of the scons command line options from a SConscript file\&. The options supported are:
.PP
clean
.RS 4
which corresponds to \-c, \-\-clean and \-\-remove;
.RE
.PP
duplicate
.RS 4
which corresponds to \-\-duplicate;
.RE
.PP
help
.RS 4
which corresponds to \-h and \-\-help;
.RE
.PP
implicit_cache
.RS 4
which corresponds to \-\-implicit\-cache;
.RE
.PP
max_drift
.RS 4
which corresponds to \-\-max\-drift;
.RE
.PP
no_exec
.RS 4
which corresponds to \-n, \-\-no\-exec, \-\-just\-print, \-\-dry\-run and \-\-recon;
.RE
.PP
num_jobs
.RS 4
which corresponds to \-j and \-\-jobs;
.RE
.PP
random
.RS 4
which corresponds to \-\-random; and
.RE
.PP
silent
.RS 4
which corresponds to \-\-silent\&.
.RE
.PP
stack_size
.RS 4
which corresponds to \-\-stack\-size\&.
.RE
.sp
See the documentation for the corresponding command line object for information about each specific option\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
SetOption(\*(Aqmax_drift\*(Aq, 1)
.fi
.if n \{\
.RE
.\}
.RE
.PP
SideEffect(side_effect, target), env\&.SideEffect(side_effect, target)
.RS 4
Declares
\fIside_effect\fR
as a side effect of building
\fItarget\fR\&. Both
\fIside_effect\fR
and
\fItarget\fR
can be a list, a file name, or a node\&. A side effect is a target file that is created or updated as a side effect of building other targets\&. For example, a Windows PDB file is created as a side effect of building the \&.obj files for a static library, and various log files are created updated as side effects of various TeX commands\&. If a target is a side effect of multiple build commands,
scons
will ensure that only one set of commands is executed at a time\&. Consequently, you only need to use this method for side\-effect targets that are built as a result of multiple build commands\&.
.sp
Because multiple build commands may update the same side effect file, by default the
\fIside_effect\fR
target is
\fInot\fR
automatically removed when the
\fItarget\fR
is removed by the
\fB\-c\fR
option\&. (Note, however, that the
\fIside_effect\fR
might be removed as part of cleaning the directory in which it lives\&.) If you want to make sure the
\fIside_effect\fR
is cleaned whenever a specific
\fItarget\fR
is cleaned, you must specify this explicitly with the
\fBClean\fR
or
\fBenv\&.Clean\fR
function\&.
.RE
.PP
SourceCode(entries, builder), env\&.SourceCode(entries, builder)
.RS 4
This function and its associate factory functions are deprecated\&. There is no replacement\&. The intended use was to keep a local tree in sync with an archive, but in actuality the function only causes the archive to be fetched on the first run\&. Synchronizing with the archive is best done external to
SCons\&.
.sp
Arrange for non\-existent source files to be fetched from a source code management system using the specified
\fIbuilder\fR\&. The specified
\fIentries\fR
may be a Node, string or list of both, and may represent either individual source files or directories in which source files can be found\&.
.sp
For any non\-existent source files,
scons
will search up the directory tree and use the first
\fBSourceCode\fR
builder it finds\&. The specified
\fIbuilder\fR
may be
None, in which case
scons
will not use a builder to fetch source files for the specified
\fIentries\fR, even if a
\fBSourceCode\fR
builder has been specified for a directory higher up the tree\&.
.sp
scons
will, by default, fetch files from SCCS or RCS subdirectories without explicit configuration\&. This takes some extra processing time to search for the necessary source code management files on disk\&. You can avoid these extra searches and speed up your build a little by disabling these searches as follows:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.SourceCode(\*(Aq\&.\*(Aq, None)
.fi
.if n \{\
.RE
.\}
.sp
Note that if the specified
\fIbuilder\fR
is one you create by hand, it must have an associated construction environment to use when fetching a source file\&.
.sp
scons
provides a set of canned factory functions that return appropriate Builders for various popular source code management systems\&. Canonical examples of invocation include:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.SourceCode(\*(Aq\&.\*(Aq, env\&.BitKeeper(\*(Aq/usr/local/BKsources\*(Aq))
env\&.SourceCode(\*(Aqsrc\*(Aq, env\&.CVS(\*(Aq/usr/local/CVSROOT\*(Aq))
env\&.SourceCode(\*(Aq/\*(Aq, env\&.RCS())
env\&.SourceCode([\*(Aqf1\&.c\*(Aq, \*(Aqf2\&.c\*(Aq], env\&.SCCS())
env\&.SourceCode(\*(Aqno_source\&.c\*(Aq, None)
.fi
.if n \{\
.RE
.\}
.sp
.RE
.PP
Split(arg), env\&.Split(arg)
.RS 4
Returns a list of file names or other objects\&. If arg is a string, it will be split on strings of white\-space characters within the string, making it easier to write long lists of file names\&. If arg is already a list, the list will be returned untouched\&. If arg is any other type of object, it will be returned as a list containing just the object\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
files = Split("f1\&.c f2\&.c f3\&.c")
files = env\&.Split("f4\&.c f5\&.c f6\&.c")
files = Split("""
f7\&.c
f8\&.c
f9\&.c
""")
.fi
.if n \{\
.RE
.\}
.RE
.PP
env\&.subst(input, [raw, target, source, conv])
.RS 4
Performs construction variable interpolation on the specified string or sequence argument
\fIinput\fR\&.
.sp
By default, leading or trailing white space will be removed from the result\&. and all sequences of white space will be compressed to a single space character\&. Additionally, any
$(
and
$)
character sequences will be stripped from the returned string, The optional
\fIraw\fR
argument may be set to
1
if you want to preserve white space and
$(\-$)
sequences\&. The
\fIraw\fR
argument may be set to
2
if you want to strip all characters between any
$(
and
$)
pairs (as is done for signature calculation)\&.
.sp
If the input is a sequence (list or tuple), the individual elements of the sequence will be expanded, and the results will be returned as a list\&.
.sp
The optional
\fItarget\fR
and
\fIsource\fR
keyword arguments must be set to lists of target and source nodes, respectively, if you want the
\fB$TARGET\fR,
\fB$TARGETS\fR,
\fB$SOURCE\fR
and
\fB$SOURCES\fR
to be available for expansion\&. This is usually necessary if you are calling
\fBenv\&.subst\fR
from within a Python function used as an SCons action\&.
.sp
Returned string values or sequence elements are converted to their string representation by default\&. The optional
\fIconv\fR
argument may specify a conversion function that will be used in place of the default\&. For example, if you want Python objects (including SCons Nodes) to be returned as Python objects, you can use the Python Λ idiom to pass in an unnamed function that simply returns its unconverted argument\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
print(env\&.subst("The C compiler is: $CC"))
def compile(target, source, env):
sourceDir = env\&.subst("${SOURCE\&.srcdir}",
target=target,
source=source)
source_nodes = env\&.subst(\*(Aq$EXPAND_TO_NODELIST\*(Aq,
conv=lambda x: x)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Tag(node, tags)
.RS 4
Annotates file or directory Nodes with information about how the
\fBPackage\fR
Builder should package those files or directories\&. All tags are optional\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# makes sure the built library will be installed with 0o644 file
# access mode
Tag( Library( \*(Aqlib\&.c\*(Aq ), UNIX_ATTR="0o644" )
# marks file2\&.txt to be a documentation file
Tag( \*(Aqfile2\&.txt\*(Aq, DOC )
.fi
.if n \{\
.RE
.\}
.RE
.PP
Tool(string, [toolpath, **kw]), env\&.Tool(string, [toolpath, **kw])
.RS 4
The
\fBTool\fR
form of the function returns a callable object that can be used to initialize a construction environment using the tools keyword of the Environment() method\&. The object may be called with a construction environment as an argument, in which case the object will add the necessary variables to the construction environment and the name of the tool will be added to the
\fB$TOOLS\fR
construction variable\&.
.sp
Additional keyword arguments are passed to the tool\*(Aqs
\fBgenerate\fR() method\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools = [ Tool(\*(Aqmsvc\*(Aq) ])
env = Environment()
t = Tool(\*(Aqmsvc\*(Aq)
t(env) # adds \*(Aqmsvc\*(Aq to the TOOLS variable
u = Tool(\*(Aqopengl\*(Aq, toolpath = [\*(Aqtools\*(Aq])
u(env) # adds \*(Aqopengl\*(Aq to the TOOLS variable
.fi
.if n \{\
.RE
.\}
.sp
The
\fBenv\&.Tool\fR
form of the function applies the callable object for the specified tool
\fIstring\fR
to the environment through which the method was called\&.
.sp
Additional keyword arguments are passed to the tool\*(Aqs
\fBgenerate\fR() method\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Tool(\*(Aqgcc\*(Aq)
env\&.Tool(\*(Aqopengl\*(Aq, toolpath = [\*(Aqbuild/tools\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
Value(value, [built_value]), env\&.Value(value, [built_value])
.RS 4
Returns a Node object representing the specified Python value\&. Value Nodes can be used as dependencies of targets\&. If the result of calling
\fBstr\fR(\fIvalue\fR) changes between SCons runs, any targets depending on
\fBValue\fR(\fIvalue\fR) will be rebuilt\&. (This is true even when using timestamps to decide if files are up\-to\-date\&.) When using timestamp source signatures, Value Nodes\*(Aq timestamps are equal to the system time when the Node is created\&.
.sp
The returned Value Node object has a
\fBwrite\fR() method that can be used to "build" a Value Node by setting a new value\&. The optional
\fIbuilt_value\fR
argument can be specified when the Value Node is created to indicate the Node should already be considered "built\&." There is a corresponding
\fBread\fR() method that will return the built value of the Node\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
def create(target, source, env):
# A function that will write a \*(Aqprefix=$SOURCE\*(Aq
# string into the file name specified as the
# $TARGET\&.
f = open(str(target[0]), \*(Aqwb\*(Aq)
f\&.write(\*(Aqprefix=\*(Aq + source[0]\&.get_contents())
# Fetch the prefix= argument, if any, from the command
# line, and use /usr/local as the default\&.
prefix = ARGUMENTS\&.get(\*(Aqprefix\*(Aq, \*(Aq/usr/local\*(Aq)
# Attach a \&.Config() builder for the above function action
# to the construction environment\&.
env[\*(AqBUILDERS\*(Aq][\*(AqConfig\*(Aq] = Builder(action = create)
env\&.Config(target = \*(Aqpackage\-config\*(Aq, source = Value(prefix))
def build_value(target, source, env):
# A function that "builds" a Python Value by updating
# the the Python value with the contents of the file
# specified as the source of the Builder call ($SOURCE)\&.
target[0]\&.write(source[0]\&.get_contents())
output = env\&.Value(\*(Aqbefore\*(Aq)
input = env\&.Value(\*(Aqafter\*(Aq)
# Attach a \&.UpdateValue() builder for the above function
# action to the construction environment\&.
env[\*(AqBUILDERS\*(Aq][\*(AqUpdateValue\*(Aq] = Builder(action = build_value)
env\&.UpdateValue(target = Value(output), source = Value(input))
.fi
.if n \{\
.RE
.\}
.RE
.PP
VariantDir(variant_dir, src_dir, [duplicate]), env\&.VariantDir(variant_dir, src_dir, [duplicate])
.RS 4
Use the
\fBVariantDir\fR
function to create a copy of your sources in another location: if a name under
\fIvariant_dir\fR
is not found but exists under
\fIsrc_dir\fR, the file or directory is copied to
\fIvariant_dir\fR\&. Target files can be built in a different directory than the original sources by simply refering to the sources (and targets) within the variant tree\&.
.sp
\fBVariantDir\fR
can be called multiple times with the same
\fIsrc_dir\fR
to set up multiple builds with different options (\fIvariants\fR)\&. The
\fIsrc_dir\fR
location must be in or underneath the SConstruct file\*(Aqs directory, and
\fIvariant_dir\fR
may not be underneath
\fIsrc_dir\fR\&.
.sp
The default behavior is for
scons
to physically duplicate the source files in the variant tree\&. Thus, a build performed in the variant tree is guaranteed to be identical to a build performed in the source tree even if intermediate source files are generated during the build, or preprocessors or other scanners search for included files relative to the source file, or individual compilers or other invoked tools are hard\-coded to put derived files in the same directory as source files\&.
.sp
If possible on the platform, the duplication is performed by linking rather than copying; see also the
\fB\-\-duplicate\fR
command\-line option\&. Moreover, only the files needed for the build are duplicated; files and directories that are not used are not present in
\fIvariant_dir\fR\&.
.sp
Duplicating the source tree may be disabled by setting the
duplicate
argument to
0
(zero)\&. This will cause
scons
to invoke Builders using the path names of source files in
\fIsrc_dir\fR
and the path names of derived files within
\fIvariant_dir\fR\&. This is always more efficient than
duplicate=1, and is usually safe for most builds (but see above for cases that may cause problems)\&.
.sp
Note that
\fBVariantDir\fR
works most naturally with a subsidiary SConscript file\&. However, you would then call the subsidiary SConscript file not in the source directory, but in the
\fIvariant_dir\fR, regardless of the value of
duplicate\&. This is how you tell
scons
which variant of a source tree to build:
.sp
.if n \{\
.RS 4
.\}
.nf
# run src/SConscript in two variant directories
VariantDir(\*(Aqbuild/variant1\*(Aq, \*(Aqsrc\*(Aq)
SConscript(\*(Aqbuild/variant1/SConscript\*(Aq)
VariantDir(\*(Aqbuild/variant2\*(Aq, \*(Aqsrc\*(Aq)
SConscript(\*(Aqbuild/variant2/SConscript\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
See also the
\fBSConscript\fR
function, described above, for another way to specify a variant directory in conjunction with calling a subsidiary SConscript file\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
# use names in the build directory, not the source directory
VariantDir(\*(Aqbuild\*(Aq, \*(Aqsrc\*(Aq, duplicate=0)
Program(\*(Aqbuild/prog\*(Aq, \*(Aqbuild/source\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
# this builds both the source and docs in a separate subtree
VariantDir(\*(Aqbuild\*(Aq, \*(Aq\&.\*(Aq, duplicate=0)
SConscript(dirs=[\*(Aqbuild/src\*(Aq,\*(Aqbuild/doc\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
# same as previous example, but only uses SConscript
SConscript(dirs=\*(Aqsrc\*(Aq, variant_dir=\*(Aqbuild/src\*(Aq, duplicate=0)
SConscript(dirs=\*(Aqdoc\*(Aq, variant_dir=\*(Aqbuild/doc\*(Aq, duplicate=0)
.fi
.if n \{\
.RE
.\}
.RE
.PP
WhereIs(program, [path, pathext, reject]), env\&.WhereIs(program, [path, pathext, reject])
.RS 4
Searches for the specified executable
\fIprogram\fR, returning the full path name to the program if it is found, else
None\&. Searches the value of the
\fIpath\fR
keyword argument, or if
None
(the default) the value of the calling environment\*(Aqs
\fBPATH\fR
(env[\*(AqENV\*(Aq][\*(AqPATH\*(Aq])\&. If
\fIpath\fR
is
None
and the
env[\*(AqENV\*(Aq][\*(AqPATH\*(Aq]
key does not exist, the user\*(Aqs current external
\fBPATH\fR
(os\&.environ[\*(AqPATH\*(Aq]) is used as fallback\&.
.sp
On Windows systems, searches for executable programs with any of the file extensions listed in the
\fIpathext\fR
keyword argument, or if
None
(the default) the calling environment\*(Aqs
\fBPATHEXT\fR
(env[\*(AqENV\*(Aq][\*(AqPATHEXT\*(Aq])\&. The user\*(Aqs current external
\fBPATHEXT\fR
(os\&.environ[\*(AqPATHEXT\*(Aq]) is used as a fallback if
\fIpathext\fR
is
None
and the key
env[\*(AqENV\*(Aq][\*(AqPATHEXT\*(Aq]
does not exist\&.
.sp
Will not select any path name or names in the specified
\fIreject\fR
list, if any\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
If you would prefer to search the user\*(Aqs current external
\fBPATH\fR
(os\&.environ[\*(AqPATH\*(Aq]) by default, consider using the function
SCons\&.Util\&.WhereIs
instead\&. Note that
SCons\&.Util\&.WhereIs
does not expand environment variables automatically (no implicit
env\&.subst
for its arguments)\&.
.sp .5v
.RE
.RE
.SS "SConscript Variables"
.PP
In addition to the global functions and methods,
\fBscons\fR
supports a number of Python variables that can be used in SConscript files to affect how you want the build to be performed\&. These variables may be accessed from custom Python modules that you import into an SConscript file by adding the following to the Python module:
.sp
.if n \{\
.RS 4
.\}
.nf
from SCons\&.Script import *
.fi
.if n \{\
.RE
.\}
.PP
ARGLIST
.RS 4
A list
\fIkeyword\fR=\fIvalue\fR
arguments specified on the command line\&. Each element in the list is a tuple containing the (\fIkeyword\fR,\fIvalue\fR) of the argument\&. The separate
\fIkeyword\fR
and
\fIvalue\fR
elements of the tuple can be accessed by subscripting for element
\fB[0]\fR
and
\fB[1]\fR
of the tuple, respectively\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
print("first keyword, value =", ARGLIST[0][0], ARGLIST[0][1])
print("second keyword, value =", ARGLIST[1][0], ARGLIST[1][1])
third_tuple = ARGLIST[2]
print("third keyword, value =", third_tuple[0], third_tuple[1])
for key, value in ARGLIST:
# process key and value
.fi
.if n \{\
.RE
.\}
.RE
.PP
ARGUMENTS
.RS 4
A dictionary of all the
\fIkeyword\fR=\fIvalue\fR
arguments specified on the command line\&. The dictionary is not in order, and if a given keyword has more than one value assigned to it on the command line, the last (right\-most) value is the one in the
\fBARGUMENTS\fR
dictionary\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
if ARGUMENTS\&.get(\*(Aqdebug\*(Aq, 0):
env = Environment(CCFLAGS = \*(Aq\-g\*(Aq)
else:
env = Environment()
.fi
.if n \{\
.RE
.\}
.RE
.PP
BUILD_TARGETS
.RS 4
A list of the targets which
\fBscons\fR
will actually try to build, regardless of whether they were specified on the command line or via the
\fBDefault\fR() function or method\&. The elements of this list may be strings
\fIor\fR
nodes, so you should run the list through the Python
\fBstr\fR
function to make sure any Node path names are converted to strings\&.
.sp
Because this list may be taken from the list of targets specified using the
\fBDefault\fR() function or method, the contents of the list may change on each successive call to
\fBDefault\fR()\&. See the
\fBDEFAULT_TARGETS\fR
list, below, for additional information\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
if \*(Aqfoo\*(Aq in BUILD_TARGETS:
print("Don\*(Aqt forget to test the `foo\*(Aq program!")
if \*(Aqspecial/program\*(Aq in BUILD_TARGETS:
SConscript(\*(Aqspecial\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Note that the
\fBBUILD_TARGETS\fR
list only contains targets expected listed on the command line or via calls to the
\fBDefault\fR() function or method\&. It does
\fInot\fR
contain all dependent targets that will be built as a result of making the sure the explicitly\-specified targets are up to date\&.
.PP
COMMAND_LINE_TARGETS
.RS 4
A list of the targets explicitly specified on the command line\&. If there are no targets specified on the command line, the list is empty\&. This can be used, for example, to take specific actions only when a certain target or targets is explicitly being built\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
if \*(Aqfoo\*(Aq in COMMAND_LINE_TARGETS:
print("Don\*(Aqt forget to test the `foo\*(Aq program!")
if \*(Aqspecial/program\*(Aq in COMMAND_LINE_TARGETS:
SConscript(\*(Aqspecial\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
DEFAULT_TARGETS
.RS 4
A list of the target
\fInodes\fR
that have been specified using the
\fBDefault\fR() function or method\&. The elements of the list are nodes, so you need to run them through the Python
\fBstr\fR
function to get at the path name for each Node\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
print(str(DEFAULT_TARGETS[0]))
if \*(Aqfoo\*(Aq in [str(t) for t in DEFAULT_TARGETS]:
print("Don\*(Aqt forget to test the `foo\*(Aq program!")
.fi
.if n \{\
.RE
.\}
.RE
.PP
The contents of the
\fBDEFAULT_TARGETS\fR
list change on on each successive call to the
\fBDefault\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
print([str(t) for t in DEFAULT_TARGETS]) # originally []
Default(\*(Aqfoo\*(Aq)
print([str(t) for t in DEFAULT_TARGETS]) # now a node [\*(Aqfoo\*(Aq]
Default(\*(Aqbar\*(Aq)
print([str(t) for t in DEFAULT_TARGETS]) # now a node [\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq]
Default(None)
print([str(t) for t in DEFAULT_TARGETS]) # back to []
.fi
.if n \{\
.RE
.\}
.PP
Consequently, be sure to use
\fBDEFAULT_TARGETS\fR
only after you\*(Aqve made all of your
\fBDefault\fR() calls, or else simply be careful of the order of these statements in your SConscript files so that you don\*(Aqt look for a specific default target before it\*(Aqs actually been added to the list\&.
.SS "Construction Variables"
.PP
A construction environment has an associated dictionary of
\fIconstruction variables\fR
that are used by built\-in or user\-supplied build rules\&. Construction variables must follow the same rules for Python identifiers: the initial character must be an underscore or letter, followed by any number of underscores, letters, or digits\&.
.PP
A number of useful construction variables are automatically defined by scons for each supported platform, and additional construction variables can be defined by the user\&. The following is a list of the automatically defined construction variables:
.PP
__LDMODULEVERSIONFLAGS
.RS 4
This construction variable automatically introduces
\fB$_LDMODULEVERSIONFLAGS\fR
if
\fB$LDMODULEVERSION\fR
is set\&. Othervise it evaluates to an empty string\&.
.RE
.PP
__SHLIBVERSIONFLAGS
.RS 4
This construction variable automatically introduces
\fB$_SHLIBVERSIONFLAGS\fR
if
\fB$SHLIBVERSION\fR
is set\&. Othervise it evaluates to an empty string\&.
.RE
.PP
_APPLELINK_COMPATIBILITY_VERSION
.RS 4
A macro (by default a generator function) used to create the linker flags to specify apple\*(Aqs linker\*(Aqs \-compatibility_version flag\&. The default generator uses
\fB$APPLELINK_COMPATIBILITY_VERSION\fR
and
\fB$APPLELINK_NO_COMPATIBILITY_VERSION\fR
and
\fB$SHLIBVERSION\fR
to determine the correct flag\&.
.RE
.PP
APPLELINK_COMPATIBILITY_VERSION
.RS 4
On Mac OS X this is used to set the linker flag: \-compatibility_version
.sp
The value is specified as X[\&.Y[\&.Z]] where X is between 1 and 65535, Y can be omitted or between 1 and 255, Z can be omitted or between 1 and 255\&. This value will be derived from
\fB$SHLIBVERSION\fR
if not specified\&. The lowest digit will be dropped and replaced by a 0\&.
.sp
If the
\fB$APPLELINK_NO_COMPATIBILITY_VERSION\fR
is set then no \-compatibility_version will be output\&.
.sp
See MacOS\*(Aqs ld manpage for more details
.RE
.PP
_APPLELINK_CURRENT_VERSION
.RS 4
A macro (by default a generator function) used to create the linker flags to specify apple\*(Aqs linker\*(Aqs \-current_version flag\&. The default generator uses
\fB$APPLELINK_CURRENT_VERSION\fR
and
\fB$APPLELINK_NO_CURRENT_VERSION\fR
and
\fB$SHLIBVERSION\fR
to determine the correct flag\&.
.RE
.PP
APPLELINK_CURRENT_VERSION
.RS 4
On Mac OS X this is used to set the linker flag: \-current_version
.sp
The value is specified as X[\&.Y[\&.Z]] where X is between 1 and 65535, Y can be omitted or between 1 and 255, Z can be omitted or between 1 and 255\&. This value will be set to
\fB$SHLIBVERSION\fR
if not specified\&.
.sp
If the
\fB$APPLELINK_NO_CURRENT_VERSION\fR
is set then no \-current_version will be output\&.
.sp
See MacOS\*(Aqs ld manpage for more details
.RE
.PP
APPLELINK_NO_COMPATIBILITY_VERSION
.RS 4
Set this to any True (1|True|non\-empty string) value to disable adding \-compatibility_version flag when generating versioned shared libraries\&.
.sp
This overrides
\fB$APPLELINK_COMPATIBILITY_VERSION\fR\&.
.RE
.PP
APPLELINK_NO_CURRENT_VERSION
.RS 4
Set this to any True (1|True|non\-empty string) value to disable adding \-current_version flag when generating versioned shared libraries\&.
.sp
This overrides
\fB$APPLELINK_CURRENT_VERSION\fR\&.
.RE
.PP
AR
.RS 4
The static library archiver\&.
.RE
.PP
ARCHITECTURE
.RS 4
Specifies the system architecture for which the package is being built\&. The default is the system architecture of the machine on which SCons is running\&. This is used to fill in the
Architecture:
field in an Ipkg
control
file, and the
BuildArch:
field in the RPM
\&.spec
file, as well as forming part of the name of a generated RPM package file\&.
.RE
.PP
ARCOM
.RS 4
The command line used to generate a static library from object files\&.
.RE
.PP
ARCOMSTR
.RS 4
The string displayed when an object file is generated from an assembly\-language source file\&. If this is not set, then
\fB$ARCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(ARCOMSTR = "Archiving $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
ARFLAGS
.RS 4
General options passed to the static library archiver\&.
.RE
.PP
AS
.RS 4
The assembler\&.
.RE
.PP
ASCOM
.RS 4
The command line used to generate an object file from an assembly\-language source file\&.
.RE
.PP
ASCOMSTR
.RS 4
The string displayed when an object file is generated from an assembly\-language source file\&. If this is not set, then
\fB$ASCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(ASCOMSTR = "Assembling $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
ASFLAGS
.RS 4
General options passed to the assembler\&.
.RE
.PP
ASPPCOM
.RS 4
The command line used to assemble an assembly\-language source file into an object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$ASFLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&.
.RE
.PP
ASPPCOMSTR
.RS 4
The string displayed when an object file is generated from an assembly\-language source file after first running the file through the C preprocessor\&. If this is not set, then
\fB$ASPPCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(ASPPCOMSTR = "Assembling $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
ASPPFLAGS
.RS 4
General options when an assembling an assembly\-language source file into an object file after first running the file through the C preprocessor\&. The default is to use the value of
\fB$ASFLAGS\fR\&.
.RE
.PP
BIBTEX
.RS 4
The bibliography generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&.
.RE
.PP
BIBTEXCOM
.RS 4
The command line used to call the bibliography generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&.
.RE
.PP
BIBTEXCOMSTR
.RS 4
The string displayed when generating a bibliography for TeX or LaTeX\&. If this is not set, then
\fB$BIBTEXCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(BIBTEXCOMSTR = "Generating bibliography $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
BIBTEXFLAGS
.RS 4
General options passed to the bibliography generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&.
.RE
.PP
BUILDERS
.RS 4
A dictionary mapping the names of the builders available through this environment to underlying Builder objects\&. Builders named Alias, CFile, CXXFile, DVI, Library, Object, PDF, PostScript, and Program are available by default\&. If you initialize this variable when an Environment is created:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(BUILDERS = {\*(AqNewBuilder\*(Aq : foo})
.fi
.if n \{\
.RE
.\}
.sp
the default Builders will no longer be available\&. To use a new Builder object in addition to the default Builders, add your new Builder object like this:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
env\&.Append(BUILDERS = {\*(AqNewBuilder\*(Aq : foo})
.fi
.if n \{\
.RE
.\}
.sp
or this:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
env[\*(AqBUILDERS\*(Aq][\*(AqNewBuilder\*(Aq] = foo
.fi
.if n \{\
.RE
.\}
.RE
.PP
CC
.RS 4
The C compiler\&.
.RE
.PP
CCCOM
.RS 4
The command line used to compile a C source file to a (static) object file\&. Any options specified in the
\fB$CFLAGS\fR,
\fB$CCFLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&.
.RE
.PP
CCCOMSTR
.RS 4
The string displayed when a C source file is compiled to a (static) object file\&. If this is not set, then
\fB$CCCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(CCCOMSTR = "Compiling static object $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
CCFLAGS
.RS 4
General options that are passed to the C and C++ compilers\&.
.RE
.PP
CCPCHFLAGS
.RS 4
Options added to the compiler command line to support building with precompiled headers\&. The default value expands expands to the appropriate Microsoft Visual C++ command\-line options when the
\fB$PCH\fR
construction variable is set\&.
.RE
.PP
CCPDBFLAGS
.RS 4
Options added to the compiler command line to support storing debugging information in a Microsoft Visual C++ PDB file\&. The default value expands expands to appropriate Microsoft Visual C++ command\-line options when the
\fB$PDB\fR
construction variable is set\&.
.sp
The Visual C++ compiler option that SCons uses by default to generate PDB information is
\fB/Z7\fR\&. This works correctly with parallel (\fB\-j\fR) builds because it embeds the debug information in the intermediate object files, as opposed to sharing a single PDB file between multiple object files\&. This is also the only way to get debug information embedded into a static library\&. Using the
\fB/Zi\fR
instead may yield improved link\-time performance, although parallel builds will no longer work\&.
.sp
You can generate PDB files with the
\fB/Zi\fR
switch by overriding the default
\fB$CCPDBFLAGS\fR
variable as follows:
.sp
.if n \{\
.RS 4
.\}
.nf
env[\*(AqCCPDBFLAGS\*(Aq] = [\*(Aq${(PDB and "/Zi /Fd%s" % File(PDB)) or ""}\*(Aq]
.fi
.if n \{\
.RE
.\}
.sp
An alternative would be to use the
\fB/Zi\fR
to put the debugging information in a separate
\&.pdb
file for each object file by overriding the
\fB$CCPDBFLAGS\fR
variable as follows:
.sp
.if n \{\
.RS 4
.\}
.nf
env[\*(AqCCPDBFLAGS\*(Aq] = \*(Aq/Zi /Fd${TARGET}\&.pdb\*(Aq
.fi
.if n \{\
.RE
.\}
.RE
.PP
CCVERSION
.RS 4
The version number of the C compiler\&. This may or may not be set, depending on the specific C compiler being used\&.
.RE
.PP
CFILESUFFIX
.RS 4
The suffix for C source files\&. This is used by the internal CFile builder when generating C files from Lex (\&.l) or YACC (\&.y) input files\&. The default suffix, of course, is
\&.c
(lower case)\&. On case\-insensitive systems (like Windows), SCons also treats
\&.C
(upper case) files as C files\&.
.RE
.PP
CFLAGS
.RS 4
General options that are passed to the C compiler (C only; not C++)\&.
.RE
.PP
CHANGE_SPECFILE
.RS 4
A hook for modifying the file that controls the packaging build (the
\&.spec
for RPM, the
control
for Ipkg, the
\&.wxs
for MSI)\&. If set, the function will be called after the SCons template for the file has been written\&.
.RE
.PP
CHANGED_SOURCES
.RS 4
A reserved variable name that may not be set or used in a construction environment\&. (See the manpage section "Variable Substitution" for more information)\&.
.RE
.PP
CHANGED_TARGETS
.RS 4
A reserved variable name that may not be set or used in a construction environment\&. (See the manpage section "Variable Substitution" for more information)\&.
.RE
.PP
CHANGELOG
.RS 4
The name of a file containing the change log text to be included in the package\&. This is included as the
%changelog
section of the RPM
\&.spec
file\&.
.RE
.PP
_concat
.RS 4
A function used to produce variables like
\fB$_CPPINCFLAGS\fR\&. It takes four or five arguments: a prefix to concatenate onto each element, a list of elements, a suffix to concatenate onto each element, an environment for variable interpolation, and an optional function that will be called to transform the list before concatenation\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env[\*(Aq_CPPINCFLAGS\*(Aq] = \*(Aq$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs)} $)\*(Aq,
.fi
.if n \{\
.RE
.\}
.RE
.PP
CONFIGUREDIR
.RS 4
The name of the directory in which Configure context test files are written\&. The default is
\&.sconf_temp
in the top\-level directory containing the
SConstruct
file\&.
.RE
.PP
CONFIGURELOG
.RS 4
The name of the Configure context log file\&. The default is
config\&.log
in the top\-level directory containing the
SConstruct
file\&.
.RE
.PP
_CPPDEFFLAGS
.RS 4
An automatically\-generated construction variable containing the C preprocessor command\-line options to define values\&. The value of
\fB$_CPPDEFFLAGS\fR
is created by respectively prepending and appending
\fB$CPPDEFPREFIX\fR
and
\fB$CPPDEFSUFFIX\fR
to the beginning and end of each definition in
\fB$CPPDEFINES\fR\&.
.RE
.PP
CPPDEFINES
.RS 4
A platform independent specification of C preprocessor definitions\&. The definitions will be added to command lines through the automatically\-generated
\fB$_CPPDEFFLAGS\fR
construction variable (see above), which is constructed according to the type of value of
\fB$CPPDEFINES\fR:
.sp
If
\fB$CPPDEFINES\fR
is a string, the values of the
\fB$CPPDEFPREFIX\fR
and
\fB$CPPDEFSUFFIX\fR
construction variables will be respectively prepended and appended to the beginning and end of each definition in
\fB$CPPDEFINES\fR\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# Will add \-Dxyz to POSIX compiler command lines,
# and /Dxyz to Microsoft Visual C++ command lines\&.
env = Environment(CPPDEFINES=\*(Aqxyz\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
If
\fB$CPPDEFINES\fR
is a list, the values of the
\fB$CPPDEFPREFIX\fR
and
\fB$CPPDEFSUFFIX\fR
construction variables will be respectively prepended and appended to the beginning and end of each element in the list\&. If any element is a list or tuple, then the first item is the name being defined and the second item is its value:
.sp
.if n \{\
.RS 4
.\}
.nf
# Will add \-DB=2 \-DA to POSIX compiler command lines,
# and /DB=2 /DA to Microsoft Visual C++ command lines\&.
env = Environment(CPPDEFINES=[(\*(AqB\*(Aq, 2), \*(AqA\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
If
\fB$CPPDEFINES\fR
is a dictionary, the values of the
\fB$CPPDEFPREFIX\fR
and
\fB$CPPDEFSUFFIX\fR
construction variables will be respectively prepended and appended to the beginning and end of each item from the dictionary\&. The key of each dictionary item is a name being defined to the dictionary item\*(Aqs corresponding value; if the value is
None, then the name is defined without an explicit value\&. Note that the resulting flags are sorted by keyword to ensure that the order of the options on the command line is consistent each time
scons
is run\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# Will add \-DA \-DB=2 to POSIX compiler command lines,
# and /DA /DB=2 to Microsoft Visual C++ command lines\&.
env = Environment(CPPDEFINES={\*(AqB\*(Aq:2, \*(AqA\*(Aq:None})
.fi
.if n \{\
.RE
.\}
.RE
.PP
CPPDEFPREFIX
.RS 4
The prefix used to specify preprocessor definitions on the C compiler command line\&. This will be prepended to the beginning of each definition in the
\fB$CPPDEFINES\fR
construction variable when the
\fB$_CPPDEFFLAGS\fR
variable is automatically generated\&.
.RE
.PP
CPPDEFSUFFIX
.RS 4
The suffix used to specify preprocessor definitions on the C compiler command line\&. This will be appended to the end of each definition in the
\fB$CPPDEFINES\fR
construction variable when the
\fB$_CPPDEFFLAGS\fR
variable is automatically generated\&.
.RE
.PP
CPPFLAGS
.RS 4
User\-specified C preprocessor options\&. These will be included in any command that uses the C preprocessor, including not just compilation of C and C++ source files via the
\fB$CCCOM\fR,
\fB$SHCCCOM\fR,
\fB$CXXCOM\fR
and
\fB$SHCXXCOM\fR
command lines, but also the
\fB$FORTRANPPCOM\fR,
\fB$SHFORTRANPPCOM\fR,
\fB$F77PPCOM\fR
and
\fB$SHF77PPCOM\fR
command lines used to compile a Fortran source file, and the
\fB$ASPPCOM\fR
command line used to assemble an assembly language source file, after first running each file through the C preprocessor\&. Note that this variable does
\fInot\fR
contain
\fB\-I\fR
(or similar) include search path options that scons generates automatically from
\fB$CPPPATH\fR\&. See
\fB$_CPPINCFLAGS\fR, below, for the variable that expands to those options\&.
.RE
.PP
_CPPINCFLAGS
.RS 4
An automatically\-generated construction variable containing the C preprocessor command\-line options for specifying directories to be searched for include files\&. The value of
\fB$_CPPINCFLAGS\fR
is created by respectively prepending and appending
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
to the beginning and end of each directory in
\fB$CPPPATH\fR\&.
.RE
.PP
CPPPATH
.RS 4
The list of directories that the C preprocessor will search for include directories\&. The C/C++ implicit dependency scanner will search these directories for include files\&. Don\*(Aqt explicitly put include directory arguments in CCFLAGS or CXXFLAGS because the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in CPPPATH will be looked\-up relative to the SConscript directory when they are used in a command\&. To force
scons
to look\-up a directory relative to the root of the source tree use #:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(CPPPATH=\*(Aq#/include\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The directory look\-up can also be forced using the
\fBDir\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
include = Dir(\*(Aqinclude\*(Aq)
env = Environment(CPPPATH=include)
.fi
.if n \{\
.RE
.\}
.sp
The directory list will be added to command lines through the automatically\-generated
\fB$_CPPINCFLAGS\fR
construction variable, which is constructed by respectively prepending and appending the value of the
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
construction variables to the beginning and end of each directory in
\fB$CPPPATH\fR\&. Any command lines you define that need the CPPPATH directory list should include
\fB$_CPPINCFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(CCCOM="my_compiler $_CPPINCFLAGS \-c \-o $TARGET $SOURCE")
.fi
.if n \{\
.RE
.\}
.RE
.PP
CPPSUFFIXES
.RS 4
The list of suffixes of files that will be scanned for C preprocessor implicit dependencies (#include lines)\&. The default list is:
.sp
.if n \{\
.RS 4
.\}
.nf
["\&.c", "\&.C", "\&.cxx", "\&.cpp", "\&.c++", "\&.cc",
"\&.h", "\&.H", "\&.hxx", "\&.hpp", "\&.hh",
"\&.F", "\&.fpp", "\&.FPP",
"\&.m", "\&.mm",
"\&.S", "\&.spp", "\&.SPP"]
.fi
.if n \{\
.RE
.\}
.RE
.PP
CXX
.RS 4
The C++ compiler\&.
.RE
.PP
CXXCOM
.RS 4
The command line used to compile a C++ source file to an object file\&. Any options specified in the
\fB$CXXFLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&.
.RE
.PP
CXXCOMSTR
.RS 4
The string displayed when a C++ source file is compiled to a (static) object file\&. If this is not set, then
\fB$CXXCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(CXXCOMSTR = "Compiling static object $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
CXXFILESUFFIX
.RS 4
The suffix for C++ source files\&. This is used by the internal CXXFile builder when generating C++ files from Lex (\&.ll) or YACC (\&.yy) input files\&. The default suffix is
\&.cc\&. SCons also treats files with the suffixes
\&.cpp,
\&.cxx,
\&.c++, and
\&.C++
as C++ files, and files with
\&.mm
suffixes as Objective C++ files\&. On case\-sensitive systems (Linux, UNIX, and other POSIX\-alikes), SCons also treats
\&.C
(upper case) files as C++ files\&.
.RE
.PP
CXXFLAGS
.RS 4
General options that are passed to the C++ compiler\&. By default, this includes the value of
\fB$CCFLAGS\fR, so that setting
\fB$CCFLAGS\fR
affects both C and C++ compilation\&. If you want to add C++\-specific flags, you must set or override the value of
\fB$CXXFLAGS\fR\&.
.RE
.PP
CXXVERSION
.RS 4
The version number of the C++ compiler\&. This may or may not be set, depending on the specific C++ compiler being used\&.
.RE
.PP
DC
.RS 4
The D compiler to use\&.
.RE
.PP
DCOM
.RS 4
The command line used to compile a D file to an object file\&. Any options specified in the
\fB$DFLAGS\fR
construction variable is included on this command line\&.
.RE
.PP
DDEBUG
.RS 4
List of debug tags to enable when compiling\&.
.RE
.PP
DDEBUGPREFIX
.RS 4
DDEBUGPREFIX\&.
.RE
.PP
DDEBUGSUFFIX
.RS 4
DDEBUGSUFFIX\&.
.RE
.PP
DESCRIPTION
.RS 4
A long description of the project being packaged\&. This is included in the relevant section of the file that controls the packaging build\&.
.RE
.PP
DESCRIPTION_lang
.RS 4
A language\-specific long description for the specified
\fIlang\fR\&. This is used to populate a
%description \-l
section of an RPM
\&.spec
file\&.
.RE
.PP
DFILESUFFIX
.RS 4
DFILESUFFIX\&.
.RE
.PP
DFLAGPREFIX
.RS 4
DFLAGPREFIX\&.
.RE
.PP
DFLAGS
.RS 4
General options that are passed to the D compiler\&.
.RE
.PP
DFLAGSUFFIX
.RS 4
DFLAGSUFFIX\&.
.RE
.PP
DINCPREFIX
.RS 4
DINCPREFIX\&.
.RE
.PP
DINCSUFFIX
.RS 4
DLIBFLAGSUFFIX\&.
.RE
.PP
Dir
.RS 4
A function that converts a string into a Dir instance relative to the target being built\&.
.sp
A function that converts a string into a Dir instance relative to the target being built\&.
.RE
.PP
Dirs
.RS 4
A function that converts a list of strings into a list of Dir instances relative to the target being built\&.
.RE
.PP
DLIB
.RS 4
Name of the lib tool to use for D codes\&.
.RE
.PP
DLIBCOM
.RS 4
The command line to use when creating libraries\&.
.RE
.PP
DLIBDIRPREFIX
.RS 4
DLIBLINKPREFIX\&.
.RE
.PP
DLIBDIRSUFFIX
.RS 4
DLIBLINKSUFFIX\&.
.RE
.PP
DLIBFLAGPREFIX
.RS 4
DLIBFLAGPREFIX\&.
.RE
.PP
DLIBFLAGSUFFIX
.RS 4
DLIBFLAGSUFFIX\&.
.RE
.PP
DLIBLINKPREFIX
.RS 4
DLIBLINKPREFIX\&.
.RE
.PP
DLIBLINKSUFFIX
.RS 4
DLIBLINKSUFFIX\&.
.RE
.PP
DLINK
.RS 4
Name of the linker to use for linking systems including D sources\&.
.RE
.PP
DLINKCOM
.RS 4
The command line to use when linking systems including D sources\&.
.RE
.PP
DLINKFLAGPREFIX
.RS 4
DLINKFLAGPREFIX\&.
.RE
.PP
DLINKFLAGS
.RS 4
List of linker flags\&.
.RE
.PP
DLINKFLAGSUFFIX
.RS 4
DLINKFLAGSUFFIX\&.
.RE
.PP
DOCBOOK_DEFAULT_XSL_EPUB
.RS 4
The default XSLT file for the
\fBDocbookEpub\fR
builder within the current environment, if no other XSLT gets specified via keyword\&.
.RE
.PP
DOCBOOK_DEFAULT_XSL_HTML
.RS 4
The default XSLT file for the
\fBDocbookHtml\fR
builder within the current environment, if no other XSLT gets specified via keyword\&.
.RE
.PP
DOCBOOK_DEFAULT_XSL_HTMLCHUNKED
.RS 4
The default XSLT file for the
\fBDocbookHtmlChunked\fR
builder within the current environment, if no other XSLT gets specified via keyword\&.
.RE
.PP
DOCBOOK_DEFAULT_XSL_HTMLHELP
.RS 4
The default XSLT file for the
\fBDocbookHtmlhelp\fR
builder within the current environment, if no other XSLT gets specified via keyword\&.
.RE
.PP
DOCBOOK_DEFAULT_XSL_MAN
.RS 4
The default XSLT file for the
\fBDocbookMan\fR
builder within the current environment, if no other XSLT gets specified via keyword\&.
.RE
.PP
DOCBOOK_DEFAULT_XSL_PDF
.RS 4
The default XSLT file for the
\fBDocbookPdf\fR
builder within the current environment, if no other XSLT gets specified via keyword\&.
.RE
.PP
DOCBOOK_DEFAULT_XSL_SLIDESHTML
.RS 4
The default XSLT file for the
\fBDocbookSlidesHtml\fR
builder within the current environment, if no other XSLT gets specified via keyword\&.
.RE
.PP
DOCBOOK_DEFAULT_XSL_SLIDESPDF
.RS 4
The default XSLT file for the
\fBDocbookSlidesPdf\fR
builder within the current environment, if no other XSLT gets specified via keyword\&.
.RE
.PP
DOCBOOK_FOP
.RS 4
The path to the PDF renderer
fop
or
xep, if one of them is installed (fop
gets checked first)\&.
.RE
.PP
DOCBOOK_FOPCOM
.RS 4
The full command\-line for the PDF renderer
fop
or
xep\&.
.RE
.PP
DOCBOOK_FOPCOMSTR
.RS 4
The string displayed when a renderer like
fop
or
xep
is used to create PDF output from an XML file\&.
.RE
.PP
DOCBOOK_FOPFLAGS
.RS 4
Additonal command\-line flags for the PDF renderer
fop
or
xep\&.
.RE
.PP
DOCBOOK_XMLLINT
.RS 4
The path to the external executable
xmllint, if it\*(Aqs installed\&. Note, that this is only used as last fallback for resolving XIncludes, if no libxml2 or lxml Python binding can be imported in the current system\&.
.RE
.PP
DOCBOOK_XMLLINTCOM
.RS 4
The full command\-line for the external executable
xmllint\&.
.RE
.PP
DOCBOOK_XMLLINTCOMSTR
.RS 4
The string displayed when
xmllint
is used to resolve XIncludes for a given XML file\&.
.RE
.PP
DOCBOOK_XMLLINTFLAGS
.RS 4
Additonal command\-line flags for the external executable
xmllint\&.
.RE
.PP
DOCBOOK_XSLTPROC
.RS 4
The path to the external executable
xsltproc
(or
saxon,
xalan), if one of them is installed\&. Note, that this is only used as last fallback for XSL transformations, if no libxml2 or lxml Python binding can be imported in the current system\&.
.RE
.PP
DOCBOOK_XSLTPROCCOM
.RS 4
The full command\-line for the external executable
xsltproc
(or
saxon,
xalan)\&.
.RE
.PP
DOCBOOK_XSLTPROCCOMSTR
.RS 4
The string displayed when
xsltproc
is used to transform an XML file via a given XSLT stylesheet\&.
.RE
.PP
DOCBOOK_XSLTPROCFLAGS
.RS 4
Additonal command\-line flags for the external executable
xsltproc
(or
saxon,
xalan)\&.
.RE
.PP
DOCBOOK_XSLTPROCPARAMS
.RS 4
Additonal parameters that are not intended for the XSLT processor executable, but the XSL processing itself\&. By default, they get appended at the end of the command line for
saxon
and
saxon\-xslt, respectively\&.
.RE
.PP
DPATH
.RS 4
List of paths to search for import modules\&.
.RE
.PP
DRPATHPREFIX
.RS 4
DRPATHPREFIX\&.
.RE
.PP
DRPATHSUFFIX
.RS 4
DRPATHSUFFIX\&.
.RE
.PP
DShLibSonameGenerator
.RS 4
DShLibSonameGenerator\&.
.RE
.PP
DSUFFIXES
.RS 4
The list of suffixes of files that will be scanned for imported D package files\&. The default list is:
.sp
.if n \{\
.RS 4
.\}
.nf
[\*(Aq\&.d\*(Aq]
.fi
.if n \{\
.RE
.\}
.RE
.PP
DVERPREFIX
.RS 4
DVERPREFIX\&.
.RE
.PP
DVERSIONS
.RS 4
List of version tags to enable when compiling\&.
.RE
.PP
DVERSUFFIX
.RS 4
DVERSUFFIX\&.
.RE
.PP
DVIPDF
.RS 4
The TeX DVI file to PDF file converter\&.
.RE
.PP
DVIPDFCOM
.RS 4
The command line used to convert TeX DVI files into a PDF file\&.
.RE
.PP
DVIPDFCOMSTR
.RS 4
The string displayed when a TeX DVI file is converted into a PDF file\&. If this is not set, then
\fB$DVIPDFCOM\fR
(the command line) is displayed\&.
.RE
.PP
DVIPDFFLAGS
.RS 4
General options passed to the TeX DVI file to PDF file converter\&.
.RE
.PP
DVIPS
.RS 4
The TeX DVI file to PostScript converter\&.
.RE
.PP
DVIPSFLAGS
.RS 4
General options passed to the TeX DVI file to PostScript converter\&.
.RE
.PP
ENV
.RS 4
A dictionary of environment variables to use when invoking commands\&. When
\fB$ENV\fR
is used in a command all list values will be joined using the path separator and any other non\-string values will simply be coerced to a string\&. Note that, by default,
scons
does
\fInot\fR
propagate the environment in force when you execute
scons
to the commands used to build target files\&. This is so that builds will be guaranteed repeatable regardless of the environment variables set at the time
scons
is invoked\&.
.sp
If you want to propagate your environment variables to the commands executed to build target files, you must do so explicitly:
.sp
.if n \{\
.RS 4
.\}
.nf
import os
env = Environment(ENV = os\&.environ)
.fi
.if n \{\
.RE
.\}
.sp
Note that you can choose only to propagate certain environment variables\&. A common example is the system
\fBPATH\fR
environment variable, so that
scons
uses the same utilities as the invoking shell (or other process):
.sp
.if n \{\
.RS 4
.\}
.nf
import os
env = Environment(ENV = {\*(AqPATH\*(Aq : os\&.environ[\*(AqPATH\*(Aq]})
.fi
.if n \{\
.RE
.\}
.RE
.PP
ESCAPE
.RS 4
A function that will be called to escape shell special characters in command lines\&. The function should take one argument: the command line string to escape; and should return the escaped command line\&.
.RE
.PP
F03
.RS 4
The Fortran 03 compiler\&. You should normally set the
\fB$FORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$F03\fR
if you need to use a specific compiler or compiler version for Fortran 03 files\&.
.RE
.PP
F03COM
.RS 4
The command line used to compile a Fortran 03 source file to an object file\&. You only need to set
\fB$F03COM\fR
if you need to use a specific command line for Fortran 03 files\&. You should normally set the
\fB$FORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
F03COMSTR
.RS 4
The string displayed when a Fortran 03 source file is compiled to an object file\&. If this is not set, then
\fB$F03COM\fR
or
\fB$FORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
F03FILESUFFIXES
.RS 4
The list of file extensions for which the F03 dialect will be used\&. By default, this is [\*(Aq\&.f03\*(Aq]
.RE
.PP
F03FLAGS
.RS 4
General user\-specified options that are passed to the Fortran 03 compiler\&. Note that this variable does
\fInot\fR
contain
\fB\-I\fR
(or similar) include search path options that scons generates automatically from
\fB$F03PATH\fR\&. See
\fB$_F03INCFLAGS\fR
below, for the variable that expands to those options\&. You only need to set
\fB$F03FLAGS\fR
if you need to define specific user options for Fortran 03 files\&. You should normally set the
\fB$FORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
_F03INCFLAGS
.RS 4
An automatically\-generated construction variable containing the Fortran 03 compiler command\-line options for specifying directories to be searched for include files\&. The value of
\fB$_F03INCFLAGS\fR
is created by appending
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
to the beginning and end of each directory in
\fB$F03PATH\fR\&.
.RE
.PP
F03PATH
.RS 4
The list of directories that the Fortran 03 compiler will search for include directories\&. The implicit dependency scanner will search these directories for include files\&. Don\*(Aqt explicitly put include directory arguments in
\fB$F03FLAGS\fR
because the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in
\fB$F03PATH\fR
will be looked\-up relative to the SConscript directory when they are used in a command\&. To force
scons
to look\-up a directory relative to the root of the source tree use #: You only need to set
\fB$F03PATH\fR
if you need to define a specific include path for Fortran 03 files\&. You should normally set the
\fB$FORTRANPATH\fR
variable, which specifies the include path for the default Fortran compiler for all Fortran versions\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F03PATH=\*(Aq#/include\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The directory look\-up can also be forced using the
\fBDir\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
include = Dir(\*(Aqinclude\*(Aq)
env = Environment(F03PATH=include)
.fi
.if n \{\
.RE
.\}
.sp
The directory list will be added to command lines through the automatically\-generated
\fB$_F03INCFLAGS\fR
construction variable, which is constructed by appending the values of the
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
construction variables to the beginning and end of each directory in
\fB$F03PATH\fR\&. Any command lines you define that need the F03PATH directory list should include
\fB$_F03INCFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F03COM="my_compiler $_F03INCFLAGS \-c \-o $TARGET $SOURCE")
.fi
.if n \{\
.RE
.\}
.RE
.PP
F03PPCOM
.RS 4
The command line used to compile a Fortran 03 source file to an object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$F03FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$F03PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 03 files\&. You should normally set the
\fB$FORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
F03PPCOMSTR
.RS 4
The string displayed when a Fortran 03 source file is compiled to an object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$F03PPCOM\fR
or
\fB$FORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
F03PPFILESUFFIXES
.RS 4
The list of file extensions for which the compilation + preprocessor pass for F03 dialect will be used\&. By default, this is empty
.RE
.PP
F08
.RS 4
The Fortran 08 compiler\&. You should normally set the
\fB$FORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$F08\fR
if you need to use a specific compiler or compiler version for Fortran 08 files\&.
.RE
.PP
F08COM
.RS 4
The command line used to compile a Fortran 08 source file to an object file\&. You only need to set
\fB$F08COM\fR
if you need to use a specific command line for Fortran 08 files\&. You should normally set the
\fB$FORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
F08COMSTR
.RS 4
The string displayed when a Fortran 08 source file is compiled to an object file\&. If this is not set, then
\fB$F08COM\fR
or
\fB$FORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
F08FILESUFFIXES
.RS 4
The list of file extensions for which the F08 dialect will be used\&. By default, this is [\*(Aq\&.f08\*(Aq]
.RE
.PP
F08FLAGS
.RS 4
General user\-specified options that are passed to the Fortran 08 compiler\&. Note that this variable does
\fInot\fR
contain
\fB\-I\fR
(or similar) include search path options that scons generates automatically from
\fB$F08PATH\fR\&. See
\fB$_F08INCFLAGS\fR
below, for the variable that expands to those options\&. You only need to set
\fB$F08FLAGS\fR
if you need to define specific user options for Fortran 08 files\&. You should normally set the
\fB$FORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
_F08INCFLAGS
.RS 4
An automatically\-generated construction variable containing the Fortran 08 compiler command\-line options for specifying directories to be searched for include files\&. The value of
\fB$_F08INCFLAGS\fR
is created by appending
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
to the beginning and end of each directory in
\fB$F08PATH\fR\&.
.RE
.PP
F08PATH
.RS 4
The list of directories that the Fortran 08 compiler will search for include directories\&. The implicit dependency scanner will search these directories for include files\&. Don\*(Aqt explicitly put include directory arguments in
\fB$F08FLAGS\fR
because the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in
\fB$F08PATH\fR
will be looked\-up relative to the SConscript directory when they are used in a command\&. To force
scons
to look\-up a directory relative to the root of the source tree use #: You only need to set
\fB$F08PATH\fR
if you need to define a specific include path for Fortran 08 files\&. You should normally set the
\fB$FORTRANPATH\fR
variable, which specifies the include path for the default Fortran compiler for all Fortran versions\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F08PATH=\*(Aq#/include\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The directory look\-up can also be forced using the
\fBDir\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
include = Dir(\*(Aqinclude\*(Aq)
env = Environment(F08PATH=include)
.fi
.if n \{\
.RE
.\}
.sp
The directory list will be added to command lines through the automatically\-generated
\fB$_F08INCFLAGS\fR
construction variable, which is constructed by appending the values of the
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
construction variables to the beginning and end of each directory in
\fB$F08PATH\fR\&. Any command lines you define that need the F08PATH directory list should include
\fB$_F08INCFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F08COM="my_compiler $_F08INCFLAGS \-c \-o $TARGET $SOURCE")
.fi
.if n \{\
.RE
.\}
.RE
.PP
F08PPCOM
.RS 4
The command line used to compile a Fortran 08 source file to an object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$F08FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$F08PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 08 files\&. You should normally set the
\fB$FORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
F08PPCOMSTR
.RS 4
The string displayed when a Fortran 08 source file is compiled to an object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$F08PPCOM\fR
or
\fB$FORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
F08PPFILESUFFIXES
.RS 4
The list of file extensions for which the compilation + preprocessor pass for F08 dialect will be used\&. By default, this is empty
.RE
.PP
F77
.RS 4
The Fortran 77 compiler\&. You should normally set the
\fB$FORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$F77\fR
if you need to use a specific compiler or compiler version for Fortran 77 files\&.
.RE
.PP
F77COM
.RS 4
The command line used to compile a Fortran 77 source file to an object file\&. You only need to set
\fB$F77COM\fR
if you need to use a specific command line for Fortran 77 files\&. You should normally set the
\fB$FORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
F77COMSTR
.RS 4
The string displayed when a Fortran 77 source file is compiled to an object file\&. If this is not set, then
\fB$F77COM\fR
or
\fB$FORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
F77FILESUFFIXES
.RS 4
The list of file extensions for which the F77 dialect will be used\&. By default, this is [\*(Aq\&.f77\*(Aq]
.RE
.PP
F77FLAGS
.RS 4
General user\-specified options that are passed to the Fortran 77 compiler\&. Note that this variable does
\fInot\fR
contain
\fB\-I\fR
(or similar) include search path options that scons generates automatically from
\fB$F77PATH\fR\&. See
\fB$_F77INCFLAGS\fR
below, for the variable that expands to those options\&. You only need to set
\fB$F77FLAGS\fR
if you need to define specific user options for Fortran 77 files\&. You should normally set the
\fB$FORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
_F77INCFLAGS
.RS 4
An automatically\-generated construction variable containing the Fortran 77 compiler command\-line options for specifying directories to be searched for include files\&. The value of
\fB$_F77INCFLAGS\fR
is created by appending
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
to the beginning and end of each directory in
\fB$F77PATH\fR\&.
.RE
.PP
F77PATH
.RS 4
The list of directories that the Fortran 77 compiler will search for include directories\&. The implicit dependency scanner will search these directories for include files\&. Don\*(Aqt explicitly put include directory arguments in
\fB$F77FLAGS\fR
because the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in
\fB$F77PATH\fR
will be looked\-up relative to the SConscript directory when they are used in a command\&. To force
scons
to look\-up a directory relative to the root of the source tree use #: You only need to set
\fB$F77PATH\fR
if you need to define a specific include path for Fortran 77 files\&. You should normally set the
\fB$FORTRANPATH\fR
variable, which specifies the include path for the default Fortran compiler for all Fortran versions\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F77PATH=\*(Aq#/include\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The directory look\-up can also be forced using the
\fBDir\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
include = Dir(\*(Aqinclude\*(Aq)
env = Environment(F77PATH=include)
.fi
.if n \{\
.RE
.\}
.sp
The directory list will be added to command lines through the automatically\-generated
\fB$_F77INCFLAGS\fR
construction variable, which is constructed by appending the values of the
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
construction variables to the beginning and end of each directory in
\fB$F77PATH\fR\&. Any command lines you define that need the F77PATH directory list should include
\fB$_F77INCFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F77COM="my_compiler $_F77INCFLAGS \-c \-o $TARGET $SOURCE")
.fi
.if n \{\
.RE
.\}
.RE
.PP
F77PPCOM
.RS 4
The command line used to compile a Fortran 77 source file to an object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$F77FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$F77PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 77 files\&. You should normally set the
\fB$FORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
F77PPCOMSTR
.RS 4
The string displayed when a Fortran 77 source file is compiled to an object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$F77PPCOM\fR
or
\fB$FORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
F77PPFILESUFFIXES
.RS 4
The list of file extensions for which the compilation + preprocessor pass for F77 dialect will be used\&. By default, this is empty
.RE
.PP
F90
.RS 4
The Fortran 90 compiler\&. You should normally set the
\fB$FORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$F90\fR
if you need to use a specific compiler or compiler version for Fortran 90 files\&.
.RE
.PP
F90COM
.RS 4
The command line used to compile a Fortran 90 source file to an object file\&. You only need to set
\fB$F90COM\fR
if you need to use a specific command line for Fortran 90 files\&. You should normally set the
\fB$FORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
F90COMSTR
.RS 4
The string displayed when a Fortran 90 source file is compiled to an object file\&. If this is not set, then
\fB$F90COM\fR
or
\fB$FORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
F90FILESUFFIXES
.RS 4
The list of file extensions for which the F90 dialect will be used\&. By default, this is [\*(Aq\&.f90\*(Aq]
.RE
.PP
F90FLAGS
.RS 4
General user\-specified options that are passed to the Fortran 90 compiler\&. Note that this variable does
\fInot\fR
contain
\fB\-I\fR
(or similar) include search path options that scons generates automatically from
\fB$F90PATH\fR\&. See
\fB$_F90INCFLAGS\fR
below, for the variable that expands to those options\&. You only need to set
\fB$F90FLAGS\fR
if you need to define specific user options for Fortran 90 files\&. You should normally set the
\fB$FORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
_F90INCFLAGS
.RS 4
An automatically\-generated construction variable containing the Fortran 90 compiler command\-line options for specifying directories to be searched for include files\&. The value of
\fB$_F90INCFLAGS\fR
is created by appending
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
to the beginning and end of each directory in
\fB$F90PATH\fR\&.
.RE
.PP
F90PATH
.RS 4
The list of directories that the Fortran 90 compiler will search for include directories\&. The implicit dependency scanner will search these directories for include files\&. Don\*(Aqt explicitly put include directory arguments in
\fB$F90FLAGS\fR
because the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in
\fB$F90PATH\fR
will be looked\-up relative to the SConscript directory when they are used in a command\&. To force
scons
to look\-up a directory relative to the root of the source tree use #: You only need to set
\fB$F90PATH\fR
if you need to define a specific include path for Fortran 90 files\&. You should normally set the
\fB$FORTRANPATH\fR
variable, which specifies the include path for the default Fortran compiler for all Fortran versions\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F90PATH=\*(Aq#/include\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The directory look\-up can also be forced using the
\fBDir\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
include = Dir(\*(Aqinclude\*(Aq)
env = Environment(F90PATH=include)
.fi
.if n \{\
.RE
.\}
.sp
The directory list will be added to command lines through the automatically\-generated
\fB$_F90INCFLAGS\fR
construction variable, which is constructed by appending the values of the
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
construction variables to the beginning and end of each directory in
\fB$F90PATH\fR\&. Any command lines you define that need the F90PATH directory list should include
\fB$_F90INCFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F90COM="my_compiler $_F90INCFLAGS \-c \-o $TARGET $SOURCE")
.fi
.if n \{\
.RE
.\}
.RE
.PP
F90PPCOM
.RS 4
The command line used to compile a Fortran 90 source file to an object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$F90FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$F90PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 90 files\&. You should normally set the
\fB$FORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
F90PPCOMSTR
.RS 4
The string displayed when a Fortran 90 source file is compiled after first running the file through the C preprocessor\&. If this is not set, then
\fB$F90PPCOM\fR
or
\fB$FORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
F90PPFILESUFFIXES
.RS 4
The list of file extensions for which the compilation + preprocessor pass for F90 dialect will be used\&. By default, this is empty
.RE
.PP
F95
.RS 4
The Fortran 95 compiler\&. You should normally set the
\fB$FORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$F95\fR
if you need to use a specific compiler or compiler version for Fortran 95 files\&.
.RE
.PP
F95COM
.RS 4
The command line used to compile a Fortran 95 source file to an object file\&. You only need to set
\fB$F95COM\fR
if you need to use a specific command line for Fortran 95 files\&. You should normally set the
\fB$FORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
F95COMSTR
.RS 4
The string displayed when a Fortran 95 source file is compiled to an object file\&. If this is not set, then
\fB$F95COM\fR
or
\fB$FORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
F95FILESUFFIXES
.RS 4
The list of file extensions for which the F95 dialect will be used\&. By default, this is [\*(Aq\&.f95\*(Aq]
.RE
.PP
F95FLAGS
.RS 4
General user\-specified options that are passed to the Fortran 95 compiler\&. Note that this variable does
\fInot\fR
contain
\fB\-I\fR
(or similar) include search path options that scons generates automatically from
\fB$F95PATH\fR\&. See
\fB$_F95INCFLAGS\fR
below, for the variable that expands to those options\&. You only need to set
\fB$F95FLAGS\fR
if you need to define specific user options for Fortran 95 files\&. You should normally set the
\fB$FORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
_F95INCFLAGS
.RS 4
An automatically\-generated construction variable containing the Fortran 95 compiler command\-line options for specifying directories to be searched for include files\&. The value of
\fB$_F95INCFLAGS\fR
is created by appending
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
to the beginning and end of each directory in
\fB$F95PATH\fR\&.
.RE
.PP
F95PATH
.RS 4
The list of directories that the Fortran 95 compiler will search for include directories\&. The implicit dependency scanner will search these directories for include files\&. Don\*(Aqt explicitly put include directory arguments in
\fB$F95FLAGS\fR
because the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in
\fB$F95PATH\fR
will be looked\-up relative to the SConscript directory when they are used in a command\&. To force
scons
to look\-up a directory relative to the root of the source tree use #: You only need to set
\fB$F95PATH\fR
if you need to define a specific include path for Fortran 95 files\&. You should normally set the
\fB$FORTRANPATH\fR
variable, which specifies the include path for the default Fortran compiler for all Fortran versions\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F95PATH=\*(Aq#/include\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The directory look\-up can also be forced using the
\fBDir\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
include = Dir(\*(Aqinclude\*(Aq)
env = Environment(F95PATH=include)
.fi
.if n \{\
.RE
.\}
.sp
The directory list will be added to command lines through the automatically\-generated
\fB$_F95INCFLAGS\fR
construction variable, which is constructed by appending the values of the
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
construction variables to the beginning and end of each directory in
\fB$F95PATH\fR\&. Any command lines you define that need the F95PATH directory list should include
\fB$_F95INCFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(F95COM="my_compiler $_F95INCFLAGS \-c \-o $TARGET $SOURCE")
.fi
.if n \{\
.RE
.\}
.RE
.PP
F95PPCOM
.RS 4
The command line used to compile a Fortran 95 source file to an object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$F95FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$F95PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 95 files\&. You should normally set the
\fB$FORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
F95PPCOMSTR
.RS 4
The string displayed when a Fortran 95 source file is compiled to an object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$F95PPCOM\fR
or
\fB$FORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
F95PPFILESUFFIXES
.RS 4
The list of file extensions for which the compilation + preprocessor pass for F95 dialect will be used\&. By default, this is empty
.RE
.PP
File
.RS 4
A function that converts a string into a File instance relative to the target being built\&.
.sp
A function that converts a string into a File instance relative to the target being built\&.
.RE
.PP
FORTRAN
.RS 4
The default Fortran compiler for all versions of Fortran\&.
.RE
.PP
FORTRANCOM
.RS 4
The command line used to compile a Fortran source file to an object file\&. By default, any options specified in the
\fB$FORTRANFLAGS\fR,
\fB$CPPFLAGS\fR,
\fB$_CPPDEFFLAGS\fR,
\fB$_FORTRANMODFLAG\fR, and
\fB$_FORTRANINCFLAGS\fR
construction variables are included on this command line\&.
.RE
.PP
FORTRANCOMSTR
.RS 4
The string displayed when a Fortran source file is compiled to an object file\&. If this is not set, then
\fB$FORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
FORTRANFILESUFFIXES
.RS 4
The list of file extensions for which the FORTRAN dialect will be used\&. By default, this is [\*(Aq\&.f\*(Aq, \*(Aq\&.for\*(Aq, \*(Aq\&.ftn\*(Aq]
.RE
.PP
FORTRANFLAGS
.RS 4
General user\-specified options that are passed to the Fortran compiler\&. Note that this variable does
\fInot\fR
contain
\fB\-I\fR
(or similar) include or module search path options that scons generates automatically from
\fB$FORTRANPATH\fR\&. See
\fB$_FORTRANINCFLAGS\fR
and
\fB$_FORTRANMODFLAG\fR, below, for the variables that expand those options\&.
.RE
.PP
_FORTRANINCFLAGS
.RS 4
An automatically\-generated construction variable containing the Fortran compiler command\-line options for specifying directories to be searched for include files and module files\&. The value of
\fB$_FORTRANINCFLAGS\fR
is created by respectively prepending and appending
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
to the beginning and end of each directory in
\fB$FORTRANPATH\fR\&.
.RE
.PP
FORTRANMODDIR
.RS 4
Directory location where the Fortran compiler should place any module files it generates\&. This variable is empty, by default\&. Some Fortran compilers will internally append this directory in the search path for module files, as well\&.
.RE
.PP
FORTRANMODDIRPREFIX
.RS 4
The prefix used to specify a module directory on the Fortran compiler command line\&. This will be prepended to the beginning of the directory in the
\fB$FORTRANMODDIR\fR
construction variables when the
\fB$_FORTRANMODFLAG\fR
variables is automatically generated\&.
.RE
.PP
FORTRANMODDIRSUFFIX
.RS 4
The suffix used to specify a module directory on the Fortran compiler command line\&. This will be appended to the end of the directory in the
\fB$FORTRANMODDIR\fR
construction variables when the
\fB$_FORTRANMODFLAG\fR
variables is automatically generated\&.
.RE
.PP
_FORTRANMODFLAG
.RS 4
An automatically\-generated construction variable containing the Fortran compiler command\-line option for specifying the directory location where the Fortran compiler should place any module files that happen to get generated during compilation\&. The value of
\fB$_FORTRANMODFLAG\fR
is created by respectively prepending and appending
\fB$FORTRANMODDIRPREFIX\fR
and
\fB$FORTRANMODDIRSUFFIX\fR
to the beginning and end of the directory in
\fB$FORTRANMODDIR\fR\&.
.RE
.PP
FORTRANMODPREFIX
.RS 4
The module file prefix used by the Fortran compiler\&. SCons assumes that the Fortran compiler follows the quasi\-standard naming convention for module files of
module_name\&.mod\&. As a result, this variable is left empty, by default\&. For situations in which the compiler does not necessarily follow the normal convention, the user may use this variable\&. Its value will be appended to every module file name as scons attempts to resolve dependencies\&.
.RE
.PP
FORTRANMODSUFFIX
.RS 4
The module file suffix used by the Fortran compiler\&. SCons assumes that the Fortran compiler follows the quasi\-standard naming convention for module files of
module_name\&.mod\&. As a result, this variable is set to "\&.mod", by default\&. For situations in which the compiler does not necessarily follow the normal convention, the user may use this variable\&. Its value will be appended to every module file name as scons attempts to resolve dependencies\&.
.RE
.PP
FORTRANPATH
.RS 4
The list of directories that the Fortran compiler will search for include files and (for some compilers) module files\&. The Fortran implicit dependency scanner will search these directories for include files (but not module files since they are autogenerated and, as such, may not actually exist at the time the scan takes place)\&. Don\*(Aqt explicitly put include directory arguments in FORTRANFLAGS because the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in FORTRANPATH will be looked\-up relative to the SConscript directory when they are used in a command\&. To force
scons
to look\-up a directory relative to the root of the source tree use #:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(FORTRANPATH=\*(Aq#/include\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The directory look\-up can also be forced using the
\fBDir\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
include = Dir(\*(Aqinclude\*(Aq)
env = Environment(FORTRANPATH=include)
.fi
.if n \{\
.RE
.\}
.sp
The directory list will be added to command lines through the automatically\-generated
\fB$_FORTRANINCFLAGS\fR
construction variable, which is constructed by respectively prepending and appending the values of the
\fB$INCPREFIX\fR
and
\fB$INCSUFFIX\fR
construction variables to the beginning and end of each directory in
\fB$FORTRANPATH\fR\&. Any command lines you define that need the FORTRANPATH directory list should include
\fB$_FORTRANINCFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(FORTRANCOM="my_compiler $_FORTRANINCFLAGS \-c \-o $TARGET $SOURCE")
.fi
.if n \{\
.RE
.\}
.RE
.PP
FORTRANPPCOM
.RS 4
The command line used to compile a Fortran source file to an object file after first running the file through the C preprocessor\&. By default, any options specified in the
\fB$FORTRANFLAGS\fR,
\fB$CPPFLAGS\fR,
\fB$_CPPDEFFLAGS\fR,
\fB$_FORTRANMODFLAG\fR, and
\fB$_FORTRANINCFLAGS\fR
construction variables are included on this command line\&.
.RE
.PP
FORTRANPPCOMSTR
.RS 4
The string displayed when a Fortran source file is compiled to an object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$FORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
FORTRANPPFILESUFFIXES
.RS 4
The list of file extensions for which the compilation + preprocessor pass for FORTRAN dialect will be used\&. By default, this is [\*(Aq\&.fpp\*(Aq, \*(Aq\&.FPP\*(Aq]
.RE
.PP
FORTRANSUFFIXES
.RS 4
The list of suffixes of files that will be scanned for Fortran implicit dependencies (INCLUDE lines and USE statements)\&. The default list is:
.sp
.if n \{\
.RS 4
.\}
.nf
["\&.f", "\&.F", "\&.for", "\&.FOR", "\&.ftn", "\&.FTN", "\&.fpp", "\&.FPP",
"\&.f77", "\&.F77", "\&.f90", "\&.F90", "\&.f95", "\&.F95"]
.fi
.if n \{\
.RE
.\}
.RE
.PP
FRAMEWORKPATH
.RS 4
On Mac OS X with gcc, a list containing the paths to search for frameworks\&. Used by the compiler to find framework\-style includes like #include <Fmwk/Header\&.h>\&. Used by the linker to find user\-specified frameworks when linking (see
\fB$FRAMEWORKS\fR)\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.AppendUnique(FRAMEWORKPATH=\*(Aq#myframeworkdir\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
will add
.sp
.if n \{\
.RS 4
.\}
.nf
\&.\&.\&. \-Fmyframeworkdir
.fi
.if n \{\
.RE
.\}
.sp
to the compiler and linker command lines\&.
.RE
.PP
_FRAMEWORKPATH
.RS 4
On Mac OS X with gcc, an automatically\-generated construction variable containing the linker command\-line options corresponding to
\fB$FRAMEWORKPATH\fR\&.
.RE
.PP
FRAMEWORKPATHPREFIX
.RS 4
On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH entries\&. (see
\fB$FRAMEWORKPATH\fR)\&. The default value is
\fB\-F\fR\&.
.RE
.PP
FRAMEWORKPREFIX
.RS 4
On Mac OS X with gcc, the prefix to be used for linking in frameworks (see
\fB$FRAMEWORKS\fR)\&. The default value is
\fB\-framework\fR\&.
.RE
.PP
_FRAMEWORKS
.RS 4
On Mac OS X with gcc, an automatically\-generated construction variable containing the linker command\-line options for linking with FRAMEWORKS\&.
.RE
.PP
FRAMEWORKS
.RS 4
On Mac OS X with gcc, a list of the framework names to be linked into a program or shared library or bundle\&. The default value is the empty list\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.AppendUnique(FRAMEWORKS=Split(\*(AqSystem Cocoa SystemConfiguration\*(Aq))
.fi
.if n \{\
.RE
.\}
.RE
.PP
FRAMEWORKSFLAGS
.RS 4
On Mac OS X with gcc, general user\-supplied frameworks options to be added at the end of a command line building a loadable module\&. (This has been largely superseded by the
\fB$FRAMEWORKPATH\fR,
\fB$FRAMEWORKPATHPREFIX\fR,
\fB$FRAMEWORKPREFIX\fR
and
\fB$FRAMEWORKS\fR
variables described above\&.)
.RE
.PP
GS
.RS 4
The Ghostscript program used, e\&.g\&. to convert PostScript to PDF files\&.
.RE
.PP
GSCOM
.RS 4
The full Ghostscript command line used for the conversion process\&. Its default value is
\(lq$GS $GSFLAGS \-sOutputFile=$TARGET $SOURCES\(rq\&.
.RE
.PP
GSCOMSTR
.RS 4
The string displayed when Ghostscript is called for the conversion process\&. If this is not set (the default), then
\fB$GSCOM\fR
(the command line) is displayed\&.
.RE
.PP
GSFLAGS
.RS 4
General options passed to the Ghostscript program, when converting PostScript to PDF files for example\&. Its default value is
\(lq\-dNOPAUSE \-dBATCH \-sDEVICE=pdfwrite\(rq
.RE
.PP
HOST_ARCH
.RS 4
The name of the host hardware architecture used to create the Environment\&. If a platform is specified when creating the Environment, then that Platform\*(Aqs logic will handle setting this value\&. This value is immutable, and should not be changed by the user after the Environment is initialized\&. Currently only set for Win32\&.
.sp
Sets the host architecture for Visual Studio compiler\&. If not set, default to the detected host architecture: note that this may depend on the python you are using\&. This variable must be passed as an argument to the Environment() constructor; setting it later has no effect\&.
.sp
Valid values are the same as for
\fB$TARGET_ARCH\fR\&.
.sp
This is currently only used on Windows, but in the future it will be used on other OSes as well\&.
.RE
.PP
HOST_OS
.RS 4
The name of the host operating system used to create the Environment\&. If a platform is specified when creating the Environment, then that Platform\*(Aqs logic will handle setting this value\&. This value is immutable, and should not be changed by the user after the Environment is initialized\&. Currently only set for Win32\&.
.RE
.PP
IDLSUFFIXES
.RS 4
The list of suffixes of files that will be scanned for IDL implicit dependencies (#include or import lines)\&. The default list is:
.sp
.if n \{\
.RS 4
.\}
.nf
["\&.idl", "\&.IDL"]
.fi
.if n \{\
.RE
.\}
.RE
.PP
IMPLIBNOVERSIONSYMLINKS
.RS 4
Used to override
\fB$SHLIBNOVERSIONSYMLINKS\fR/\fB$LDMODULENOVERSIONSYMLINKS\fR
when creating versioned import library for a shared library/loadable module\&. If not defined, then
\fB$SHLIBNOVERSIONSYMLINKS\fR/\fB$LDMODULENOVERSIONSYMLINKS\fR
is used to determine whether to disable symlink generation or not\&.
.RE
.PP
IMPLIBPREFIX
.RS 4
The prefix used for import library names\&. For example, cygwin uses import libraries (libfoo\&.dll\&.a) in pair with dynamic libraries (cygfoo\&.dll)\&. The
cyglink
linker sets
\fB$IMPLIBPREFIX\fR
to
\*(Aqlib\*(Aq
and
\fB$SHLIBPREFIX\fR
to
\*(Aqcyg\*(Aq\&.
.RE
.PP
IMPLIBSUFFIX
.RS 4
The suffix used for import library names\&. For example, cygwin uses import libraries (libfoo\&.dll\&.a) in pair with dynamic libraries (cygfoo\&.dll)\&. The
cyglink
linker sets
\fB$IMPLIBSUFFIX\fR
to
\*(Aq\&.dll\&.a\*(Aq
and
\fB$SHLIBSUFFIX\fR
to
\*(Aq\&.dll\*(Aq\&.
.RE
.PP
IMPLIBVERSION
.RS 4
Used to override
\fB$SHLIBVERSION\fR/\fB$LDMODULEVERSION\fR
when generating versioned import library for a shared library/loadable module\&. If undefined, the
\fB$SHLIBVERSION\fR/\fB$LDMODULEVERSION\fR
is used to determine the version of versioned import library\&.
.RE
.PP
IMPLICIT_COMMAND_DEPENDENCIES
.RS 4
Controls whether or not SCons will add implicit dependencies for the commands executed to build targets\&.
.sp
By default, SCons will add to each target an implicit dependency on the command represented by the first argument on any command line it executes\&. The specific file for the dependency is found by searching the
\fIPATH\fR
variable in the
\fIENV\fR
environment used to execute the command\&.
.sp
If the construction variable
\fB$IMPLICIT_COMMAND_DEPENDENCIES\fR
is set to a false value (None,
False,
0, etc\&.), then the implicit dependency will not be added to the targets built with that construction environment\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(IMPLICIT_COMMAND_DEPENDENCIES = 0)
.fi
.if n \{\
.RE
.\}
.RE
.PP
INCPREFIX
.RS 4
The prefix used to specify an include directory on the C compiler command line\&. This will be prepended to the beginning of each directory in the
\fB$CPPPATH\fR
and
\fB$FORTRANPATH\fR
construction variables when the
\fB$_CPPINCFLAGS\fR
and
\fB$_FORTRANINCFLAGS\fR
variables are automatically generated\&.
.RE
.PP
INCSUFFIX
.RS 4
The suffix used to specify an include directory on the C compiler command line\&. This will be appended to the end of each directory in the
\fB$CPPPATH\fR
and
\fB$FORTRANPATH\fR
construction variables when the
\fB$_CPPINCFLAGS\fR
and
\fB$_FORTRANINCFLAGS\fR
variables are automatically generated\&.
.RE
.PP
INSTALL
.RS 4
A function to be called to install a file into a destination file name\&. The default function copies the file into the destination (and sets the destination file\*(Aqs mode and permission bits to match the source file\*(Aqs)\&. The function takes the following arguments:
.sp
.if n \{\
.RS 4
.\}
.nf
def install(dest, source, env):
.fi
.if n \{\
.RE
.\}
.sp
\fIdest\fR
is the path name of the destination file\&.
\fIsource\fR
is the path name of the source file\&.
\fIenv\fR
is the construction environment (a dictionary of construction values) in force for this file installation\&.
.RE
.PP
INSTALLSTR
.RS 4
The string displayed when a file is installed into a destination file name\&. The default is:
.sp
.if n \{\
.RS 4
.\}
.nf
Install file: "$SOURCE" as "$TARGET"
.fi
.if n \{\
.RE
.\}
.RE
.PP
INTEL_C_COMPILER_VERSION
.RS 4
Set by the "intelc" Tool to the major version number of the Intel C compiler selected for use\&.
.RE
.PP
JAR
.RS 4
The Java archive tool\&.
.sp
The Java archive tool\&.
.RE
.PP
JARCHDIR
.RS 4
The directory to which the Java archive tool should change (using the
\fB\-C\fR
option)\&.
.sp
The directory to which the Java archive tool should change (using the
\fB\-C\fR
option)\&.
.RE
.PP
JARCOM
.RS 4
The command line used to call the Java archive tool\&.
.sp
The command line used to call the Java archive tool\&.
.RE
.PP
JARCOMSTR
.RS 4
The string displayed when the Java archive tool is called If this is not set, then
\fB$JARCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET")
.fi
.if n \{\
.RE
.\}
.sp
The string displayed when the Java archive tool is called If this is not set, then
\fB$JARCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
JARFLAGS
.RS 4
General options passed to the Java archive tool\&. By default this is set to
\fBcf\fR
to create the necessary
\fBjar\fR
file\&.
.sp
General options passed to the Java archive tool\&. By default this is set to
\fBcf\fR
to create the necessary
\fBjar\fR
file\&.
.RE
.PP
JARSUFFIX
.RS 4
The suffix for Java archives:
\&.jar
by default\&.
.sp
The suffix for Java archives:
\&.jar
by default\&.
.RE
.PP
JAVABOOTCLASSPATH
.RS 4
Specifies the list of directories that will be added to the
javac
command line via the
\fB\-bootclasspath\fR
option\&. The individual directory names will be separated by the operating system\*(Aqs path separate character (:
on UNIX/Linux/POSIX,
;
on Windows)\&.
.RE
.PP
JAVAC
.RS 4
The Java compiler\&.
.RE
.PP
JAVACCOM
.RS 4
The command line used to compile a directory tree containing Java source files to corresponding Java class files\&. Any options specified in the
\fB$JAVACFLAGS\fR
construction variable are included on this command line\&.
.RE
.PP
JAVACCOMSTR
.RS 4
The string displayed when compiling a directory tree of Java source files to corresponding Java class files\&. If this is not set, then
\fB$JAVACCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(JAVACCOMSTR = "Compiling class files $TARGETS from $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
JAVACFLAGS
.RS 4
General options that are passed to the Java compiler\&.
.RE
.PP
JAVACLASSDIR
.RS 4
The directory in which Java class files may be found\&. This is stripped from the beginning of any Java \&.class file names supplied to the
JavaH
builder\&.
.RE
.PP
JAVACLASSPATH
.RS 4
Specifies the list of directories that will be searched for Java
\&.class
file\&. The directories in this list will be added to the
javac
and
javah
command lines via the
\fB\-classpath\fR
option\&. The individual directory names will be separated by the operating system\*(Aqs path separate character (:
on UNIX/Linux/POSIX,
;
on Windows)\&.
.sp
Note that this currently just adds the specified directory via the
\fB\-classpath\fR
option\&.
SCons
does not currently search the
\fB$JAVACLASSPATH\fR
directories for dependency
\&.class
files\&.
.RE
.PP
JAVACLASSSUFFIX
.RS 4
The suffix for Java class files;
\&.class
by default\&.
.RE
.PP
JAVAH
.RS 4
The Java generator for C header and stub files\&.
.RE
.PP
JAVAHCOM
.RS 4
The command line used to generate C header and stub files from Java classes\&. Any options specified in the
\fB$JAVAHFLAGS\fR
construction variable are included on this command line\&.
.RE
.PP
JAVAHCOMSTR
.RS 4
The string displayed when C header and stub files are generated from Java classes\&. If this is not set, then
\fB$JAVAHCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(JAVAHCOMSTR = "Generating header/stub file(s) $TARGETS from $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
JAVAHFLAGS
.RS 4
General options passed to the C header and stub file generator for Java classes\&.
.RE
.PP
JAVAINCLUDES
.RS 4
Include path for Java header files (such as jni\&.h)
.RE
.PP
JAVASOURCEPATH
.RS 4
Specifies the list of directories that will be searched for input
\&.java
file\&. The directories in this list will be added to the
javac
command line via the
\fB\-sourcepath\fR
option\&. The individual directory names will be separated by the operating system\*(Aqs path separate character (:
on UNIX/Linux/POSIX,
;
on Windows)\&.
.sp
Note that this currently just adds the specified directory via the
\fB\-sourcepath\fR
option\&.
SCons
does not currently search the
\fB$JAVASOURCEPATH\fR
directories for dependency
\&.java
files\&.
.RE
.PP
JAVASUFFIX
.RS 4
The suffix for Java files;
\&.java
by default\&.
.RE
.PP
JAVAVERSION
.RS 4
Specifies the Java version being used by the
\fBJava\fR
builder\&. This is
\fInot\fR
currently used to select one version of the Java compiler vs\&. another\&. Instead, you should set this to specify the version of Java supported by your
javac
compiler\&. The default is
1\&.4\&.
.sp
This is sometimes necessary because Java 1\&.5 changed the file names that are created for nested anonymous inner classes, which can cause a mismatch with the files that
SCons
expects will be generated by the
javac
compiler\&. Setting
\fB$JAVAVERSION\fR
to
1\&.5
(or
1\&.6, as appropriate) can make
SCons
realize that a Java 1\&.5 or 1\&.6 build is actually up to date\&.
.RE
.PP
LATEX
.RS 4
The LaTeX structured formatter and typesetter\&.
.RE
.PP
LATEXCOM
.RS 4
The command line used to call the LaTeX structured formatter and typesetter\&.
.RE
.PP
LATEXCOMSTR
.RS 4
The string displayed when calling the LaTeX structured formatter and typesetter\&. If this is not set, then
\fB$LATEXCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(LATEXCOMSTR = "Building $TARGET from LaTeX input $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
LATEXFLAGS
.RS 4
General options passed to the LaTeX structured formatter and typesetter\&.
.RE
.PP
LATEXRETRIES
.RS 4
The maximum number of times that LaTeX will be re\-run if the
\&.log
generated by the
\fB$LATEXCOM\fR
command indicates that there are undefined references\&. The default is to try to resolve undefined references by re\-running LaTeX up to three times\&.
.RE
.PP
LATEXSUFFIXES
.RS 4
The list of suffixes of files that will be scanned for LaTeX implicit dependencies (\einclude
or
\eimport
files)\&. The default list is:
.sp
.if n \{\
.RS 4
.\}
.nf
["\&.tex", "\&.ltx", "\&.latex"]
.fi
.if n \{\
.RE
.\}
.RE
.PP
LDMODULE
.RS 4
The linker for building loadable modules\&. By default, this is the same as
\fB$SHLINK\fR\&.
.RE
.PP
LDMODULECOM
.RS 4
The command line for building loadable modules\&. On Mac OS X, this uses the
\fB$LDMODULE\fR,
\fB$LDMODULEFLAGS\fR
and
\fB$FRAMEWORKSFLAGS\fR
variables\&. On other systems, this is the same as
\fB$SHLINK\fR\&.
.RE
.PP
LDMODULECOMSTR
.RS 4
The string displayed when building loadable modules\&. If this is not set, then
\fB$LDMODULECOM\fR
(the command line) is displayed\&.
.RE
.PP
LDMODULEEMITTER
.RS 4
Contains the emitter specification for the
\fBLoadableModule\fR
builder\&. The manpage section "Builder Objects" contains general information on specifying emitters\&.
.RE
.PP
LDMODULEFLAGS
.RS 4
General user options passed to the linker for building loadable modules\&.
.RE
.PP
LDMODULENOVERSIONSYMLINKS
.RS 4
Instructs the
\fBLoadableModule\fR
builder to not automatically create symlinks for versioned modules\&. Defaults to
$SHLIBNOVERSIONSYMLINKS
.RE
.PP
LDMODULEPREFIX
.RS 4
The prefix used for loadable module file names\&. On Mac OS X, this is null; on other systems, this is the same as
\fB$SHLIBPREFIX\fR\&.
.RE
.PP
_LDMODULESONAME
.RS 4
A macro that automatically generates loadable module\*(Aqs SONAME based on $TARGET, $LDMODULEVERSION and $LDMODULESUFFIX\&. Used by
\fBLoadableModule\fR
builder when the linker tool supports SONAME (e\&.g\&.
gnulink)\&.
.RE
.PP
LDMODULESUFFIX
.RS 4
The suffix used for loadable module file names\&. On Mac OS X, this is null; on other systems, this is the same as $SHLIBSUFFIX\&.
.RE
.PP
LDMODULEVERSION
.RS 4
When this construction variable is defined, a versioned loadable module is created by
\fBLoadableModule\fR
builder\&. This activates the
\fB$_LDMODULEVERSIONFLAGS\fR
and thus modifies the
\fB$LDMODULECOM\fR
as required, adds the version number to the library name, and creates the symlinks that are needed\&.
\fB$LDMODULEVERSION\fR
versions should exist in the same format as
\fB$SHLIBVERSION\fR\&.
.RE
.PP
LDMODULEVERSIONFLAGS
.RS 4
Extra flags added to
\fB$LDMODULECOM\fR
when building versioned
\fBLoadableModule\fR\&. These flags are only used when
\fB$LDMODULEVERSION\fR
is set\&.
.RE
.PP
_LDMODULEVERSIONFLAGS
.RS 4
This macro automatically introduces extra flags to
\fB$LDMODULECOM\fR
when building versioned
\fBLoadableModule\fR
(that is when
\fB$LDMODULEVERSION\fR
is set)\&.
_LDMODULEVERSIONFLAGS
usually adds
\fB$SHLIBVERSIONFLAGS\fR
and some extra dynamically generated options (such as
\-Wl,\-soname=$_LDMODULESONAME)\&. It is unused by plain (unversioned) loadable modules\&.
.RE
.PP
LEX
.RS 4
The lexical analyzer generator\&.
.RE
.PP
LEXCOM
.RS 4
The command line used to call the lexical analyzer generator to generate a source file\&.
.RE
.PP
LEXCOMSTR
.RS 4
The string displayed when generating a source file using the lexical analyzer generator\&. If this is not set, then
\fB$LEXCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(LEXCOMSTR = "Lex\*(Aqing $TARGET from $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
LEXFLAGS
.RS 4
General options passed to the lexical analyzer generator\&.
.RE
.PP
LEXUNISTD
.RS 4
Used only on windows environments to set a lex flag to prevent \*(Aqunistd\&.h\*(Aq from being included\&. The default value is \*(Aq\-\-nounistd\*(Aq\&.
.RE
.PP
_LIBDIRFLAGS
.RS 4
An automatically\-generated construction variable containing the linker command\-line options for specifying directories to be searched for library\&. The value of
\fB$_LIBDIRFLAGS\fR
is created by respectively prepending and appending
\fB$LIBDIRPREFIX\fR
and
\fB$LIBDIRSUFFIX\fR
to the beginning and end of each directory in
\fB$LIBPATH\fR\&.
.RE
.PP
LIBDIRPREFIX
.RS 4
The prefix used to specify a library directory on the linker command line\&. This will be prepended to the beginning of each directory in the
\fB$LIBPATH\fR
construction variable when the
\fB$_LIBDIRFLAGS\fR
variable is automatically generated\&.
.RE
.PP
LIBDIRSUFFIX
.RS 4
The suffix used to specify a library directory on the linker command line\&. This will be appended to the end of each directory in the
\fB$LIBPATH\fR
construction variable when the
\fB$_LIBDIRFLAGS\fR
variable is automatically generated\&.
.RE
.PP
LIBEMITTER
.RS 4
Contains the emitter specification for the
\fBStaticLibrary\fR
builder\&. The manpage section "Builder Objects" contains general information on specifying emitters\&.
.RE
.PP
_LIBFLAGS
.RS 4
An automatically\-generated construction variable containing the linker command\-line options for specifying libraries to be linked with the resulting target\&. The value of
\fB$_LIBFLAGS\fR
is created by respectively prepending and appending
\fB$LIBLINKPREFIX\fR
and
\fB$LIBLINKSUFFIX\fR
to the beginning and end of each filename in
\fB$LIBS\fR\&.
.RE
.PP
LIBLINKPREFIX
.RS 4
The prefix used to specify a library to link on the linker command line\&. This will be prepended to the beginning of each library in the
\fB$LIBS\fR
construction variable when the
\fB$_LIBFLAGS\fR
variable is automatically generated\&.
.RE
.PP
LIBLINKSUFFIX
.RS 4
The suffix used to specify a library to link on the linker command line\&. This will be appended to the end of each library in the
\fB$LIBS\fR
construction variable when the
\fB$_LIBFLAGS\fR
variable is automatically generated\&.
.RE
.PP
LIBPATH
.RS 4
The list of directories that will be searched for libraries\&. The implicit dependency scanner will search these directories for include files\&. Don\*(Aqt explicitly put include directory arguments in
\fB$LINKFLAGS\fR
or
\fB$SHLINKFLAGS\fR
because the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in LIBPATH will be looked\-up relative to the SConscript directory when they are used in a command\&. To force
scons
to look\-up a directory relative to the root of the source tree use #:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(LIBPATH=\*(Aq#/libs\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The directory look\-up can also be forced using the
\fBDir\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
libs = Dir(\*(Aqlibs\*(Aq)
env = Environment(LIBPATH=libs)
.fi
.if n \{\
.RE
.\}
.sp
The directory list will be added to command lines through the automatically\-generated
\fB$_LIBDIRFLAGS\fR
construction variable, which is constructed by respectively prepending and appending the values of the
\fB$LIBDIRPREFIX\fR
and
\fB$LIBDIRSUFFIX\fR
construction variables to the beginning and end of each directory in
\fB$LIBPATH\fR\&. Any command lines you define that need the LIBPATH directory list should include
\fB$_LIBDIRFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS \-o $TARGET $SOURCE")
.fi
.if n \{\
.RE
.\}
.RE
.PP
LIBPREFIX
.RS 4
The prefix used for (static) library file names\&. A default value is set for each platform (posix, win32, os2, etc\&.), but the value is overridden by individual tools (ar, mslib, sgiar, sunar, tlib, etc\&.) to reflect the names of the libraries they create\&.
.RE
.PP
LIBPREFIXES
.RS 4
A list of all legal prefixes for library file names\&. When searching for library dependencies, SCons will look for files with these prefixes, the base library name, and suffixes in the
\fB$LIBSUFFIXES\fR
list\&.
.RE
.PP
LIBS
.RS 4
A list of one or more libraries that will be linked with any executable programs created by this environment\&.
.sp
The library list will be added to command lines through the automatically\-generated
\fB$_LIBFLAGS\fR
construction variable, which is constructed by respectively prepending and appending the values of the
\fB$LIBLINKPREFIX\fR
and
\fB$LIBLINKSUFFIX\fR
construction variables to the beginning and end of each filename in
\fB$LIBS\fR\&. Any command lines you define that need the LIBS library list should include
\fB$_LIBFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS \-o $TARGET $SOURCE")
.fi
.if n \{\
.RE
.\}
.sp
If you add a File object to the
\fB$LIBS\fR
list, the name of that file will be added to
\fB$_LIBFLAGS\fR, and thus the link line, as is, without
\fB$LIBLINKPREFIX\fR
or
\fB$LIBLINKSUFFIX\fR\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Append(LIBS=File(\*(Aq/tmp/mylib\&.so\*(Aq))
.fi
.if n \{\
.RE
.\}
.sp
In all cases, scons will add dependencies from the executable program to all the libraries in this list\&.
.RE
.PP
LIBSUFFIX
.RS 4
The suffix used for (static) library file names\&. A default value is set for each platform (posix, win32, os2, etc\&.), but the value is overridden by individual tools (ar, mslib, sgiar, sunar, tlib, etc\&.) to reflect the names of the libraries they create\&.
.RE
.PP
LIBSUFFIXES
.RS 4
A list of all legal suffixes for library file names\&. When searching for library dependencies, SCons will look for files with prefixes, in the
\fB$LIBPREFIXES\fR
list, the base library name, and these suffixes\&.
.RE
.PP
LICENSE
.RS 4
The abbreviated name, preferably the SPDX code, of the license under which this project is released (GPL\-3\&.0, LGPL\-2\&.1, BSD\-2\-Clause etc\&.)\&. See http://www\&.opensource\&.org/licenses/alphabetical for a list of license names and SPDX codes\&.
.RE
.PP
LINESEPARATOR
.RS 4
The separator used by the
\fBSubstfile\fR
and
\fBTextfile\fR
builders\&. This value is used between sources when constructing the target\&. It defaults to the current system line separator\&.
.RE
.PP
LINGUAS_FILE
.RS 4
The
\fB$LINGUAS_FILE\fR
defines file(s) containing list of additional linguas to be processed by
\fBPOInit\fR,
\fBPOUpdate\fR
or
\fBMOFiles\fR
builders\&. It also affects
\fBTranslate\fR
builder\&. If the variable contains a string, it defines name of the list file\&. The
\fB$LINGUAS_FILE\fR
may be a list of file names as well\&. If
\fB$LINGUAS_FILE\fR
is set to
True
(or non\-zero numeric value), the list will be read from default file named
LINGUAS\&.
.RE
.PP
LINK
.RS 4
The linker\&.
.RE
.PP
LINKCOM
.RS 4
The command line used to link object files into an executable\&.
.RE
.PP
LINKCOMSTR
.RS 4
The string displayed when object files are linked into an executable\&. If this is not set, then
\fB$LINKCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(LINKCOMSTR = "Linking $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
LINKFLAGS
.RS 4
General user options passed to the linker\&. Note that this variable should
\fInot\fR
contain
\fB\-l\fR
(or similar) options for linking with the libraries listed in
\fB$LIBS\fR, nor
\fB\-L\fR
(or similar) library search path options that scons generates automatically from
\fB$LIBPATH\fR\&. See
\fB$_LIBFLAGS\fR
above, for the variable that expands to library\-link options, and
\fB$_LIBDIRFLAGS\fR
above, for the variable that expands to library search path options\&.
.RE
.PP
M4
.RS 4
The M4 macro preprocessor\&.
.RE
.PP
M4COM
.RS 4
The command line used to pass files through the M4 macro preprocessor\&.
.RE
.PP
M4COMSTR
.RS 4
The string displayed when a file is passed through the M4 macro preprocessor\&. If this is not set, then
\fB$M4COM\fR
(the command line) is displayed\&.
.RE
.PP
M4FLAGS
.RS 4
General options passed to the M4 macro preprocessor\&.
.RE
.PP
MAKEINDEX
.RS 4
The makeindex generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&.
.RE
.PP
MAKEINDEXCOM
.RS 4
The command line used to call the makeindex generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&.
.RE
.PP
MAKEINDEXCOMSTR
.RS 4
The string displayed when calling the makeindex generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&. If this is not set, then
\fB$MAKEINDEXCOM\fR
(the command line) is displayed\&.
.RE
.PP
MAKEINDEXFLAGS
.RS 4
General options passed to the makeindex generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&.
.RE
.PP
MAXLINELENGTH
.RS 4
The maximum number of characters allowed on an external command line\&. On Win32 systems, link lines longer than this many characters are linked via a temporary file name\&.
.RE
.PP
MIDL
.RS 4
The Microsoft IDL compiler\&.
.RE
.PP
MIDLCOM
.RS 4
The command line used to pass files to the Microsoft IDL compiler\&.
.RE
.PP
MIDLCOMSTR
.RS 4
The string displayed when the Microsoft IDL compiler is called\&. If this is not set, then
\fB$MIDLCOM\fR
(the command line) is displayed\&.
.RE
.PP
MIDLFLAGS
.RS 4
General options passed to the Microsoft IDL compiler\&.
.RE
.PP
MOSUFFIX
.RS 4
Suffix used for
MO
files (default:
\*(Aq\&.mo\*(Aq)\&. See
msgfmt
tool and
\fBMOFiles\fR
builder\&.
.RE
.PP
MSGFMT
.RS 4
Absolute path to
\fBmsgfmt(1)\fR
binary, found by
\fBDetect()\fR\&. See
msgfmt
tool and
\fBMOFiles\fR
builder\&.
.RE
.PP
MSGFMTCOM
.RS 4
Complete command line to run
\fBmsgfmt(1)\fR
program\&. See
msgfmt
tool and
\fBMOFiles\fR
builder\&.
.RE
.PP
MSGFMTCOMSTR
.RS 4
String to display when
\fBmsgfmt(1)\fR
is invoked (default:
\*(Aq\*(Aq, which means ``print
\fB$MSGFMTCOM\fR\*(Aq\*(Aq)\&. See
msgfmt
tool and
\fBMOFiles\fR
builder\&.
.RE
.PP
MSGFMTFLAGS
.RS 4
Additional flags to
\fBmsgfmt(1)\fR\&. See
msgfmt
tool and
\fBMOFiles\fR
builder\&.
.RE
.PP
MSGINIT
.RS 4
Path to
\fBmsginit(1)\fR
program (found via
Detect())\&. See
msginit
tool and
\fBPOInit\fR
builder\&.
.RE
.PP
MSGINITCOM
.RS 4
Complete command line to run
\fBmsginit(1)\fR
program\&. See
msginit
tool and
\fBPOInit\fR
builder\&.
.RE
.PP
MSGINITCOMSTR
.RS 4
String to display when
\fBmsginit(1)\fR
is invoked (default:
\*(Aq\*(Aq, which means ``print
\fB$MSGINITCOM\fR\*(Aq\*(Aq)\&. See
msginit
tool and
\fBPOInit\fR
builder\&.
.RE
.PP
MSGINITFLAGS
.RS 4
List of additional flags to
\fBmsginit(1)\fR
(default:
[])\&. See
msginit
tool and
\fBPOInit\fR
builder\&.
.RE
.PP
_MSGINITLOCALE
.RS 4
Internal ``macro\*(Aq\*(Aq\&. Computes locale (language) name based on target filename (default:
\*(Aq${TARGET\&.filebase}\*(Aq)\&.
.sp
See
msginit
tool and
\fBPOInit\fR
builder\&.
.RE
.PP
MSGMERGE
.RS 4
Absolute path to
\fBmsgmerge(1)\fR
binary as found by
\fBDetect()\fR\&. See
msgmerge
tool and
\fBPOUpdate\fR
builder\&.
.RE
.PP
MSGMERGECOM
.RS 4
Complete command line to run
\fBmsgmerge(1)\fR
command\&. See
msgmerge
tool and
\fBPOUpdate\fR
builder\&.
.RE
.PP
MSGMERGECOMSTR
.RS 4
String to be displayed when
\fBmsgmerge(1)\fR
is invoked (default:
\*(Aq\*(Aq, which means ``print
\fB$MSGMERGECOM\fR\*(Aq\*(Aq)\&. See
msgmerge
tool and
\fBPOUpdate\fR
builder\&.
.RE
.PP
MSGMERGEFLAGS
.RS 4
Additional flags to
\fBmsgmerge(1)\fR
command\&. See
msgmerge
tool and
\fBPOUpdate\fR
builder\&.
.RE
.PP
MSSDK_DIR
.RS 4
The directory containing the Microsoft SDK (either Platform SDK or Windows SDK) to be used for compilation\&.
.RE
.PP
MSSDK_VERSION
.RS 4
The version string of the Microsoft SDK (either Platform SDK or Windows SDK) to be used for compilation\&. Supported versions include
6\&.1,
6\&.0A,
6\&.0,
2003R2
and
2003R1\&.
.RE
.PP
MSVC_BATCH
.RS 4
When set to any true value, specifies that SCons should batch compilation of object files when calling the Microsoft Visual C/C++ compiler\&. All compilations of source files from the same source directory that generate target files in a same output directory and were configured in SCons using the same construction environment will be built in a single call to the compiler\&. Only source files that have changed since their object files were built will be passed to each compiler invocation (via the
\fB$CHANGED_SOURCES\fR
construction variable)\&. Any compilations where the object (target) file base name (minus the
\&.obj) does not match the source file base name will be compiled separately\&.
.RE
.PP
MSVC_USE_SCRIPT
.RS 4
Use a batch script to set up Microsoft Visual Studio compiler
.sp
\fB$MSVC_USE_SCRIPT\fR
overrides
\fB$MSVC_VERSION\fR
and
\fB$TARGET_ARCH\fR\&. If set to the name of a Visual Studio \&.bat file (e\&.g\&. vcvars\&.bat), SCons will run that bat file and extract the relevant variables from the result (typically %INCLUDE%, %LIB%, and %PATH%)\&. Setting MSVC_USE_SCRIPT to None bypasses the Visual Studio autodetection entirely; use this if you are running SCons in a Visual Studio cmd window and importing the shell\*(Aqs environment variables\&.
.RE
.PP
MSVC_UWP_APP
.RS 4
Build libraries for a Universal Windows Platform (UWP) Application\&.
.sp
If
\fB$MSVC_UWP_APP\fR
is set, the Visual Studio environment will be set up to point to the Windows Store compatible libraries and Visual Studio runtimes\&. In doing so, any libraries that are built will be able to be used in a UWP App and published to the Windows Store\&. This flag will only have an effect with Visual Studio 2015+\&. This variable must be passed as an argument to the Environment() constructor; setting it later has no effect\&.
.sp
Valid values are \*(Aq1\*(Aq or \*(Aq0\*(Aq
.RE
.PP
MSVC_VERSION
.RS 4
Sets the preferred version of Microsoft Visual C/C++ to use\&.
.sp
If
\fB$MSVC_VERSION\fR
is not set, SCons will (by default) select the latest version of Visual C/C++ installed on your system\&. If the specified version isn\*(Aqt installed, tool initialization will fail\&. This variable must be passed as an argument to the Environment() constructor; setting it later has no effect\&.
.sp
Valid values for Windows are
14\&.2,
14\&.1,
14\&.0,
14\&.0Exp,
12\&.0,
12\&.0Exp,
11\&.0,
11\&.0Exp,
10\&.0,
10\&.0Exp,
9\&.0,
9\&.0Exp,
8\&.0,
8\&.0Exp,
7\&.1,
7\&.0, and
6\&.0\&. Versions ending in
Exp
refer to "Express" or "Express for Desktop" editions\&.
.RE
.PP
MSVS
.RS 4
When the Microsoft Visual Studio tools are initialized, they set up this dictionary with the following keys:
.PP
VERSION
.RS 4
the version of MSVS being used (can be set via
\fB$MSVS_VERSION\fR)
.RE
.PP
VERSIONS
.RS 4
the available versions of MSVS installed
.RE
.PP
VCINSTALLDIR
.RS 4
installed directory of Visual C++
.RE
.PP
VSINSTALLDIR
.RS 4
installed directory of Visual Studio
.RE
.PP
FRAMEWORKDIR
.RS 4
installed directory of the \&.NET framework
.RE
.PP
FRAMEWORKVERSIONS
.RS 4
list of installed versions of the \&.NET framework, sorted latest to oldest\&.
.RE
.PP
FRAMEWORKVERSION
.RS 4
latest installed version of the \&.NET framework
.RE
.PP
FRAMEWORKSDKDIR
.RS 4
installed location of the \&.NET SDK\&.
.RE
.PP
PLATFORMSDKDIR
.RS 4
installed location of the Platform SDK\&.
.RE
.PP
PLATFORMSDK_MODULES
.RS 4
dictionary of installed Platform SDK modules, where the dictionary keys are keywords for the various modules, and the values are 2\-tuples where the first is the release date, and the second is the version number\&.
.RE
.sp
If a value is not set, it was not available in the registry\&.
.RE
.PP
MSVS_ARCH
.RS 4
Sets the architecture for which the generated project(s) should build\&.
.sp
The default value is
x86\&.
amd64
is also supported by
SCons
for most Visual Studio versions\&. Since Visual Studio 2015
arm
is supported, and since Visual Studio 2017
arm64
is supported\&. Trying to set
\fB$MSVS_ARCH\fR
to an architecture that\*(Aqs not supported for a given Visual Studio version will generate an error\&.
.RE
.PP
MSVS_PROJECT_GUID
.RS 4
The string placed in a generated Microsoft Visual Studio project file as the value of the
ProjectGUID
attribute\&. There is no default value\&. If not defined, a new GUID is generated\&.
.RE
.PP
MSVS_SCC_AUX_PATH
.RS 4
The path name placed in a generated Microsoft Visual Studio project file as the value of the
SccAuxPath
attribute if the
\fBMSVS_SCC_PROVIDER\fR
construction variable is also set\&. There is no default value\&.
.RE
.PP
MSVS_SCC_CONNECTION_ROOT
.RS 4
The root path of projects in your SCC workspace, i\&.e the path under which all project and solution files will be generated\&. It is used as a reference path from which the relative paths of the generated Microsoft Visual Studio project and solution files are computed\&. The relative project file path is placed as the value of the
SccLocalPath
attribute of the project file and as the values of the
SccProjectFilePathRelativizedFromConnection[i]
(where [i] ranges from 0 to the number of projects in the solution) attributes of the
GlobalSection(SourceCodeControl)
section of the Microsoft Visual Studio solution file\&. Similarly the relative solution file path is placed as the values of the
SccLocalPath[i]
(where [i] ranges from 0 to the number of projects in the solution) attributes of the
GlobalSection(SourceCodeControl)
section of the Microsoft Visual Studio solution file\&. This is used only if the
\fBMSVS_SCC_PROVIDER\fR
construction variable is also set\&. The default value is the current working directory\&.
.RE
.PP
MSVS_SCC_PROJECT_NAME
.RS 4
The project name placed in a generated Microsoft Visual Studio project file as the value of the
SccProjectName
attribute if the
\fBMSVS_SCC_PROVIDER\fR
construction variable is also set\&. In this case the string is also placed in the
SccProjectName0
attribute of the
GlobalSection(SourceCodeControl)
section of the Microsoft Visual Studio solution file\&. There is no default value\&.
.RE
.PP
MSVS_SCC_PROVIDER
.RS 4
The string placed in a generated Microsoft Visual Studio project file as the value of the
SccProvider
attribute\&. The string is also placed in the
SccProvider0
attribute of the
GlobalSection(SourceCodeControl)
section of the Microsoft Visual Studio solution file\&. There is no default value\&.
.RE
.PP
MSVS_VERSION
.RS 4
Sets the preferred version of Microsoft Visual Studio to use\&.
.sp
If
\fB$MSVS_VERSION\fR
is not set,
SCons
will (by default) select the latest version of Visual Studio installed on your system\&. So, if you have version 6 and version 7 (MSVS \&.NET) installed, it will prefer version 7\&. You can override this by specifying the
\fBMSVS_VERSION\fR
variable in the Environment initialization, setting it to the appropriate version (\*(Aq6\&.0\*(Aq or \*(Aq7\&.0\*(Aq, for example)\&. If the specified version isn\*(Aqt installed, tool initialization will fail\&.
.sp
This is obsolete: use
\fB$MSVC_VERSION\fR
instead\&. If
\fB$MSVS_VERSION\fR
is set and
\fB$MSVC_VERSION\fR
is not,
\fB$MSVC_VERSION\fR
will be set automatically to
\fB$MSVS_VERSION\fR\&. If both are set to different values, scons will raise an error\&.
.RE
.PP
MSVSBUILDCOM
.RS 4
The build command line placed in a generated Microsoft Visual Studio project file\&. The default is to have Visual Studio invoke SCons with any specified build targets\&.
.RE
.PP
MSVSCLEANCOM
.RS 4
The clean command line placed in a generated Microsoft Visual Studio project file\&. The default is to have Visual Studio invoke SCons with the \-c option to remove any specified targets\&.
.RE
.PP
MSVSENCODING
.RS 4
The encoding string placed in a generated Microsoft Visual Studio project file\&. The default is encoding
Windows\-1252\&.
.RE
.PP
MSVSPROJECTCOM
.RS 4
The action used to generate Microsoft Visual Studio project files\&.
.RE
.PP
MSVSPROJECTSUFFIX
.RS 4
The suffix used for Microsoft Visual Studio project (DSP) files\&. The default value is
\&.vcproj
when using Visual Studio version 7\&.x (\&.NET) or later version, and
\&.dsp
when using earlier versions of Visual Studio\&.
.RE
.PP
MSVSREBUILDCOM
.RS 4
The rebuild command line placed in a generated Microsoft Visual Studio project file\&. The default is to have Visual Studio invoke SCons with any specified rebuild targets\&.
.RE
.PP
MSVSSCONS
.RS 4
The SCons used in generated Microsoft Visual Studio project files\&. The default is the version of SCons being used to generate the project file\&.
.RE
.PP
MSVSSCONSCOM
.RS 4
The default SCons command used in generated Microsoft Visual Studio project files\&.
.RE
.PP
MSVSSCONSCRIPT
.RS 4
The sconscript file (that is,
SConstruct
or
SConscript
file) that will be invoked by Visual Studio project files (through the
\fB$MSVSSCONSCOM\fR
variable)\&. The default is the same sconscript file that contains the call to
\fBMSVSProject\fR
to build the project file\&.
.RE
.PP
MSVSSCONSFLAGS
.RS 4
The SCons flags used in generated Microsoft Visual Studio project files\&.
.RE
.PP
MSVSSOLUTIONCOM
.RS 4
The action used to generate Microsoft Visual Studio solution files\&.
.RE
.PP
MSVSSOLUTIONSUFFIX
.RS 4
The suffix used for Microsoft Visual Studio solution (DSW) files\&. The default value is
\&.sln
when using Visual Studio version 7\&.x (\&.NET), and
\&.dsw
when using earlier versions of Visual Studio\&.
.RE
.PP
MT
.RS 4
The program used on Windows systems to embed manifests into DLLs and EXEs\&. See also
\fB$WINDOWS_EMBED_MANIFEST\fR\&.
.RE
.PP
MTEXECOM
.RS 4
The Windows command line used to embed manifests into executables\&. See also
\fB$MTSHLIBCOM\fR\&.
.RE
.PP
MTFLAGS
.RS 4
Flags passed to the
\fB$MT\fR
manifest embedding program (Windows only)\&.
.RE
.PP
MTSHLIBCOM
.RS 4
The Windows command line used to embed manifests into shared libraries (DLLs)\&. See also
\fB$MTEXECOM\fR\&.
.RE
.PP
MWCW_VERSION
.RS 4
The version number of the MetroWerks CodeWarrior C compiler to be used\&.
.RE
.PP
MWCW_VERSIONS
.RS 4
A list of installed versions of the MetroWerks CodeWarrior C compiler on this system\&.
.RE
.PP
NAME
.RS 4
Specfies the name of the project to package\&.
.RE
.PP
no_import_lib
.RS 4
When set to non\-zero, suppresses creation of a corresponding Windows static import lib by the
SharedLibrary
builder when used with MinGW, Microsoft Visual Studio or Metrowerks\&. This also suppresses creation of an export (\&.exp) file when using Microsoft Visual Studio\&.
.RE
.PP
OBJPREFIX
.RS 4
The prefix used for (static) object file names\&.
.RE
.PP
OBJSUFFIX
.RS 4
The suffix used for (static) object file names\&.
.RE
.PP
PACKAGEROOT
.RS 4
Specifies the directory where all files in resulting archive will be placed if applicable\&. The default value is "$NAME\-$VERSION"\&.
.RE
.PP
PACKAGETYPE
.RS 4
Selects the package type to build\&. Currently these are available:
.sp
* msi \- Microsoft Installer * rpm \- Redhat Package Manger * ipkg \- Itsy Package Management System * tarbz2 \- compressed tar * targz \- compressed tar * zip \- zip file * src_tarbz2 \- compressed tar source * src_targz \- compressed tar source * src_zip \- zip file source
.sp
This may be overridden with the "package_type" command line option\&.
.RE
.PP
PACKAGEVERSION
.RS 4
The version of the package (not the underlying project)\&. This is currently only used by the rpm packager and should reflect changes in the packaging, not the underlying project code itself\&.
.RE
.PP
PCH
.RS 4
The Microsoft Visual C++ precompiled header that will be used when compiling object files\&. This variable is ignored by tools other than Microsoft Visual C++\&. When this variable is defined SCons will add options to the compiler command line to cause it to use the precompiled header, and will also set up the dependencies for the PCH file\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env[\*(AqPCH\*(Aq] = \*(AqStdAfx\&.pch\*(Aq
.fi
.if n \{\
.RE
.\}
.RE
.PP
PCHCOM
.RS 4
The command line used by the
\fBPCH\fR
builder to generated a precompiled header\&.
.RE
.PP
PCHCOMSTR
.RS 4
The string displayed when generating a precompiled header\&. If this is not set, then
\fB$PCHCOM\fR
(the command line) is displayed\&.
.RE
.PP
PCHPDBFLAGS
.RS 4
A construction variable that, when expanded, adds the
/yD
flag to the command line only if the
\fB$PDB\fR
construction variable is set\&.
.RE
.PP
PCHSTOP
.RS 4
This variable specifies how much of a source file is precompiled\&. This variable is ignored by tools other than Microsoft Visual C++, or when the PCH variable is not being used\&. When this variable is define it must be a string that is the name of the header that is included at the end of the precompiled portion of the source files, or the empty string if the "#pragma hrdstop" construct is being used:
.sp
.if n \{\
.RS 4
.\}
.nf
env[\*(AqPCHSTOP\*(Aq] = \*(AqStdAfx\&.h\*(Aq
.fi
.if n \{\
.RE
.\}
.RE
.PP
PDB
.RS 4
The Microsoft Visual C++ PDB file that will store debugging information for object files, shared libraries, and programs\&. This variable is ignored by tools other than Microsoft Visual C++\&. When this variable is defined SCons will add options to the compiler and linker command line to cause them to generate external debugging information, and will also set up the dependencies for the PDB file\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
env[\*(AqPDB\*(Aq] = \*(Aqhello\&.pdb\*(Aq
.fi
.if n \{\
.RE
.\}
.sp
The Visual C++ compiler switch that SCons uses by default to generate PDB information is
\fB/Z7\fR\&. This works correctly with parallel (\fB\-j\fR) builds because it embeds the debug information in the intermediate object files, as opposed to sharing a single PDB file between multiple object files\&. This is also the only way to get debug information embedded into a static library\&. Using the
\fB/Zi\fR
instead may yield improved link\-time performance, although parallel builds will no longer work\&. You can generate PDB files with the
\fB/Zi\fR
switch by overriding the default
\fB$CCPDBFLAGS\fR
variable; see the entry for that variable for specific examples\&.
.RE
.PP
PDFCOM
.RS 4
A deprecated synonym for
\fB$DVIPDFCOM\fR\&.
.RE
.PP
PDFLATEX
.RS 4
The
pdflatex
utility\&.
.RE
.PP
PDFLATEXCOM
.RS 4
The command line used to call the
pdflatex
utility\&.
.RE
.PP
PDFLATEXCOMSTR
.RS 4
The string displayed when calling the
pdflatex
utility\&. If this is not set, then
\fB$PDFLATEXCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(PDFLATEX;COMSTR = "Building $TARGET from LaTeX input $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
PDFLATEXFLAGS
.RS 4
General options passed to the
pdflatex
utility\&.
.RE
.PP
PDFPREFIX
.RS 4
The prefix used for PDF file names\&.
.RE
.PP
PDFSUFFIX
.RS 4
The suffix used for PDF file names\&.
.RE
.PP
PDFTEX
.RS 4
The
pdftex
utility\&.
.RE
.PP
PDFTEXCOM
.RS 4
The command line used to call the
pdftex
utility\&.
.RE
.PP
PDFTEXCOMSTR
.RS 4
The string displayed when calling the
pdftex
utility\&. If this is not set, then
\fB$PDFTEXCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(PDFTEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
PDFTEXFLAGS
.RS 4
General options passed to the
pdftex
utility\&.
.RE
.PP
PKGCHK
.RS 4
On Solaris systems, the package\-checking program that will be used (along with
\fB$PKGINFO\fR) to look for installed versions of the Sun PRO C++ compiler\&. The default is
/usr/sbin/pgkchk\&.
.RE
.PP
PKGINFO
.RS 4
On Solaris systems, the package information program that will be used (along with
\fB$PKGCHK\fR) to look for installed versions of the Sun PRO C++ compiler\&. The default is
pkginfo\&.
.RE
.PP
PLATFORM
.RS 4
The name of the platform used to create the Environment\&. If no platform is specified when the Environment is created,
scons
autodetects the platform\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(tools = [])
if env[\*(AqPLATFORM\*(Aq] == \*(Aqcygwin\*(Aq:
Tool(\*(Aqmingw\*(Aq)(env)
else:
Tool(\*(Aqmsvc\*(Aq)(env)
.fi
.if n \{\
.RE
.\}
.RE
.PP
POAUTOINIT
.RS 4
The
\fB$POAUTOINIT\fR
variable, if set to
True
(on non\-zero numeric value), let the
msginit
tool to automatically initialize
\fImissing\fR
PO
files with
\fBmsginit(1)\fR\&. This applies to both,
\fBPOInit\fR
and
\fBPOUpdate\fR
builders (and others that use any of them)\&.
.RE
.PP
POCREATE_ALIAS
.RS 4
Common alias for all
PO
files created with
\fBPOInit\fR
builder (default:
\*(Aqpo\-create\*(Aq)\&. See
msginit
tool and
\fBPOInit\fR
builder\&.
.RE
.PP
POSUFFIX
.RS 4
Suffix used for
PO
files (default:
\*(Aq\&.po\*(Aq) See
msginit
tool and
\fBPOInit\fR
builder\&.
.RE
.PP
POTDOMAIN
.RS 4
The
\fB$POTDOMAIN\fR
defines default domain, used to generate
POT
filename as
\fB$POTDOMAIN\fR\&.pot
when no
POT
file name is provided by the user\&. This applies to
\fBPOTUpdate\fR,
\fBPOInit\fR
and
\fBPOUpdate\fR
builders (and builders, that use them, e\&.g\&.
\fBTranslate\fR)\&. Normally (if
\fB$POTDOMAIN\fR
is not defined), the builders use
messages\&.pot
as default
POT
file name\&.
.RE
.PP
POTSUFFIX
.RS 4
Suffix used for PO Template files (default:
\*(Aq\&.pot\*(Aq)\&. See
xgettext
tool and
\fBPOTUpdate\fR
builder\&.
.RE
.PP
POTUPDATE_ALIAS
.RS 4
Name of the common phony target for all PO Templates created with
\fBPOUpdate\fR
(default:
\*(Aqpot\-update\*(Aq)\&. See
xgettext
tool and
\fBPOTUpdate\fR
builder\&.
.RE
.PP
POUPDATE_ALIAS
.RS 4
Common alias for all
PO
files being defined with
\fBPOUpdate\fR
builder (default:
\*(Aqpo\-update\*(Aq)\&. See
msgmerge
tool and
\fBPOUpdate\fR
builder\&.
.RE
.PP
PRINT_CMD_LINE_FUNC
.RS 4
A Python function used to print the command lines as they are executed (assuming command printing is not disabled by the
\fB\-q\fR
or
\fB\-s\fR
options or their equivalents)\&. The function should take four arguments:
\fIs\fR, the command being executed (a string),
\fItarget\fR, the target being built (file node, list, or string name(s)),
\fIsource\fR, the source(s) used (file node, list, or string name(s)), and
\fIenv\fR, the environment being used\&.
.sp
The function must do the printing itself\&. The default implementation, used if this variable is not set or is None, is:
.sp
.if n \{\
.RS 4
.\}
.nf
def print_cmd_line(s, target, source, env):
sys\&.stdout\&.write(s + "\en")
.fi
.if n \{\
.RE
.\}
.sp
Here\*(Aqs an example of a more interesting function:
.sp
.if n \{\
.RS 4
.\}
.nf
def print_cmd_line(s, target, source, env):
sys\&.stdout\&.write("Building %s \-> %s\&.\&.\&.\en" %
(\*(Aq and \*(Aq\&.join([str(x) for x in source]),
\*(Aq and \*(Aq\&.join([str(x) for x in target])))
env=Environment(PRINT_CMD_LINE_FUNC=print_cmd_line)
env\&.Program(\*(Aqfoo\*(Aq, \*(Aqfoo\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
This just prints "Building
\fItargetname\fR
from
\fIsourcename\fR\&.\&.\&." instead of the actual commands\&. Such a function could also log the actual commands to a log file, for example\&.
.RE
.PP
PROGEMITTER
.RS 4
Contains the emitter specification for the
\fBProgram\fR
builder\&. The manpage section "Builder Objects" contains general information on specifying emitters\&.
.RE
.PP
PROGPREFIX
.RS 4
The prefix used for executable file names\&.
.RE
.PP
PROGSUFFIX
.RS 4
The suffix used for executable file names\&.
.RE
.PP
PSCOM
.RS 4
The command line used to convert TeX DVI files into a PostScript file\&.
.RE
.PP
PSCOMSTR
.RS 4
The string displayed when a TeX DVI file is converted into a PostScript file\&. If this is not set, then
\fB$PSCOM\fR
(the command line) is displayed\&.
.RE
.PP
PSPREFIX
.RS 4
The prefix used for PostScript file names\&.
.RE
.PP
PSSUFFIX
.RS 4
The prefix used for PostScript file names\&.
.RE
.PP
QT_AUTOSCAN
.RS 4
Turn off scanning for mocable files\&. Use the Moc Builder to explicitly specify files to run moc on\&.
.RE
.PP
QT_BINPATH
.RS 4
The path where the qt binaries are installed\&. The default value is \*(Aq\fB$QTDIR\fR/bin\*(Aq\&.
.RE
.PP
QT_CPPPATH
.RS 4
The path where the qt header files are installed\&. The default value is \*(Aq\fB$QTDIR\fR/include\*(Aq\&. Note: If you set this variable to None, the tool won\*(Aqt change the
\fB$CPPPATH\fR
construction variable\&.
.RE
.PP
QT_DEBUG
.RS 4
Prints lots of debugging information while scanning for moc files\&.
.RE
.PP
QT_LIB
.RS 4
Default value is \*(Aqqt\*(Aq\&. You may want to set this to \*(Aqqt\-mt\*(Aq\&. Note: If you set this variable to None, the tool won\*(Aqt change the
\fB$LIBS\fR
variable\&.
.RE
.PP
QT_LIBPATH
.RS 4
The path where the qt libraries are installed\&. The default value is \*(Aq\fB$QTDIR\fR/lib\*(Aq\&. Note: If you set this variable to None, the tool won\*(Aqt change the
\fB$LIBPATH\fR
construction variable\&.
.RE
.PP
QT_MOC
.RS 4
Default value is \*(Aq\fB$QT_BINPATH\fR/moc\*(Aq\&.
.RE
.PP
QT_MOCCXXPREFIX
.RS 4
Default value is \*(Aq\*(Aq\&. Prefix for moc output files, when source is a cxx file\&.
.RE
.PP
QT_MOCCXXSUFFIX
.RS 4
Default value is \*(Aq\&.moc\*(Aq\&. Suffix for moc output files, when source is a cxx file\&.
.RE
.PP
QT_MOCFROMCXXCOM
.RS 4
Command to generate a moc file from a cpp file\&.
.RE
.PP
QT_MOCFROMCXXCOMSTR
.RS 4
The string displayed when generating a moc file from a cpp file\&. If this is not set, then
\fB$QT_MOCFROMCXXCOM\fR
(the command line) is displayed\&.
.RE
.PP
QT_MOCFROMCXXFLAGS
.RS 4
Default value is \*(Aq\-i\*(Aq\&. These flags are passed to moc, when moccing a C++ file\&.
.RE
.PP
QT_MOCFROMHCOM
.RS 4
Command to generate a moc file from a header\&.
.RE
.PP
QT_MOCFROMHCOMSTR
.RS 4
The string displayed when generating a moc file from a cpp file\&. If this is not set, then
\fB$QT_MOCFROMHCOM\fR
(the command line) is displayed\&.
.RE
.PP
QT_MOCFROMHFLAGS
.RS 4
Default value is \*(Aq\*(Aq\&. These flags are passed to moc, when moccing a header file\&.
.RE
.PP
QT_MOCHPREFIX
.RS 4
Default value is \*(Aqmoc_\*(Aq\&. Prefix for moc output files, when source is a header\&.
.RE
.PP
QT_MOCHSUFFIX
.RS 4
Default value is \*(Aq\fB$CXXFILESUFFIX\fR\*(Aq\&. Suffix for moc output files, when source is a header\&.
.RE
.PP
QT_UIC
.RS 4
Default value is \*(Aq\fB$QT_BINPATH\fR/uic\*(Aq\&.
.RE
.PP
QT_UICCOM
.RS 4
Command to generate header files from \&.ui files\&.
.RE
.PP
QT_UICCOMSTR
.RS 4
The string displayed when generating header files from \&.ui files\&. If this is not set, then
\fB$QT_UICCOM\fR
(the command line) is displayed\&.
.RE
.PP
QT_UICDECLFLAGS
.RS 4
Default value is \*(Aq\*(Aq\&. These flags are passed to uic, when creating a a h file from a \&.ui file\&.
.RE
.PP
QT_UICDECLPREFIX
.RS 4
Default value is \*(Aq\*(Aq\&. Prefix for uic generated header files\&.
.RE
.PP
QT_UICDECLSUFFIX
.RS 4
Default value is \*(Aq\&.h\*(Aq\&. Suffix for uic generated header files\&.
.RE
.PP
QT_UICIMPLFLAGS
.RS 4
Default value is \*(Aq\*(Aq\&. These flags are passed to uic, when creating a cxx file from a \&.ui file\&.
.RE
.PP
QT_UICIMPLPREFIX
.RS 4
Default value is \*(Aquic_\*(Aq\&. Prefix for uic generated implementation files\&.
.RE
.PP
QT_UICIMPLSUFFIX
.RS 4
Default value is \*(Aq\fB$CXXFILESUFFIX\fR\*(Aq\&. Suffix for uic generated implementation files\&.
.RE
.PP
QT_UISUFFIX
.RS 4
Default value is \*(Aq\&.ui\*(Aq\&. Suffix of designer input files\&.
.RE
.PP
QTDIR
.RS 4
The qt tool tries to take this from os\&.environ\&. It also initializes all QT_* construction variables listed below\&. (Note that all paths are constructed with python\*(Aqs os\&.path\&.join() method, but are listed here with the \*(Aq/\*(Aq separator for easier reading\&.) In addition, the construction environment variables
\fB$CPPPATH\fR,
\fB$LIBPATH\fR
and
\fB$LIBS\fR
may be modified and the variables
\fB$PROGEMITTER\fR,
\fB$SHLIBEMITTER\fR
and
\fB$LIBEMITTER\fR
are modified\&. Because the build\-performance is affected when using this tool, you have to explicitly specify it at Environment creation:
.sp
.if n \{\
.RS 4
.\}
.nf
Environment(tools=[\*(Aqdefault\*(Aq,\*(Aqqt\*(Aq])
.fi
.if n \{\
.RE
.\}
.sp
The qt tool supports the following operations:
.sp
\fBAutomatic moc file generation from header files\&.\fR
You do not have to specify moc files explicitly, the tool does it for you\&. However, there are a few preconditions to do so: Your header file must have the same filebase as your implementation file and must stay in the same directory\&. It must have one of the suffixes \&.h, \&.hpp, \&.H, \&.hxx, \&.hh\&. You can turn off automatic moc file generation by setting QT_AUTOSCAN to 0\&. See also the corresponding
\fBMoc\fR() builder method\&.
.sp
\fBAutomatic moc file generation from cxx files\&.\fR
As stated in the qt documentation, include the moc file at the end of the cxx file\&. Note that you have to include the file, which is generated by the transformation ${QT_MOCCXXPREFIX}<basename>${QT_MOCCXXSUFFIX}, by default <basename>\&.moc\&. A warning is generated after building the moc file, if you do not include the correct file\&. If you are using VariantDir, you may need to specify duplicate=1\&. You can turn off automatic moc file generation by setting QT_AUTOSCAN to 0\&. See also the corresponding
\fBMoc\fR
builder method\&.
.sp
\fBAutomatic handling of \&.ui files\&.\fR
The implementation files generated from \&.ui files are handled much the same as yacc or lex files\&. Each \&.ui file given as a source of Program, Library or SharedLibrary will generate three files, the declaration file, the implementation file and a moc file\&. Because there are also generated headers, you may need to specify duplicate=1 in calls to VariantDir\&. See also the corresponding
\fBUic\fR
builder method\&.
.RE
.PP
RANLIB
.RS 4
The archive indexer\&.
.RE
.PP
RANLIBCOM
.RS 4
The command line used to index a static library archive\&.
.RE
.PP
RANLIBCOMSTR
.RS 4
The string displayed when a static library archive is indexed\&. If this is not set, then
\fB$RANLIBCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(RANLIBCOMSTR = "Indexing $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
RANLIBFLAGS
.RS 4
General options passed to the archive indexer\&.
.RE
.PP
RC
.RS 4
The resource compiler used to build a Microsoft Visual C++ resource file\&.
.RE
.PP
RCCOM
.RS 4
The command line used to build a Microsoft Visual C++ resource file\&.
.RE
.PP
RCCOMSTR
.RS 4
The string displayed when invoking the resource compiler to build a Microsoft Visual C++ resource file\&. If this is not set, then
\fB$RCCOM\fR
(the command line) is displayed\&.
.RE
.PP
RCFLAGS
.RS 4
The flags passed to the resource compiler by the RES builder\&.
.RE
.PP
RCINCFLAGS
.RS 4
An automatically\-generated construction variable containing the command\-line options for specifying directories to be searched by the resource compiler\&. The value of
\fB$RCINCFLAGS\fR
is created by respectively prepending and appending
\fB$RCINCPREFIX\fR
and
\fB$RCINCSUFFIX\fR
to the beginning and end of each directory in
\fB$CPPPATH\fR\&.
.RE
.PP
RCINCPREFIX
.RS 4
The prefix (flag) used to specify an include directory on the resource compiler command line\&. This will be prepended to the beginning of each directory in the
\fB$CPPPATH\fR
construction variable when the
\fB$RCINCFLAGS\fR
variable is expanded\&.
.RE
.PP
RCINCSUFFIX
.RS 4
The suffix used to specify an include directory on the resource compiler command line\&. This will be appended to the end of each directory in the
\fB$CPPPATH\fR
construction variable when the
\fB$RCINCFLAGS\fR
variable is expanded\&.
.RE
.PP
RDirs
.RS 4
A function that converts a string into a list of Dir instances by searching the repositories\&.
.RE
.PP
REGSVR
.RS 4
The program used on Windows systems to register a newly\-built DLL library whenever the
\fBSharedLibrary\fR
builder is passed a keyword argument of
register=1\&.
.RE
.PP
REGSVRCOM
.RS 4
The command line used on Windows systems to register a newly\-built DLL library whenever the
\fBSharedLibrary\fR
builder is passed a keyword argument of
register=1\&.
.RE
.PP
REGSVRCOMSTR
.RS 4
The string displayed when registering a newly\-built DLL file\&. If this is not set, then
\fB$REGSVRCOM\fR
(the command line) is displayed\&.
.RE
.PP
REGSVRFLAGS
.RS 4
Flags passed to the DLL registration program on Windows systems when a newly\-built DLL library is registered\&. By default, this includes the
\fB/s\fR
that prevents dialog boxes from popping up and requiring user attention\&.
.RE
.PP
RMIC
.RS 4
The Java RMI stub compiler\&.
.RE
.PP
RMICCOM
.RS 4
The command line used to compile stub and skeleton class files from Java classes that contain RMI implementations\&. Any options specified in the
\fB$RMICFLAGS\fR
construction variable are included on this command line\&.
.RE
.PP
RMICCOMSTR
.RS 4
The string displayed when compiling stub and skeleton class files from Java classes that contain RMI implementations\&. If this is not set, then
\fB$RMICCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(RMICCOMSTR = "Generating stub/skeleton class files $TARGETS from $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
RMICFLAGS
.RS 4
General options passed to the Java RMI stub compiler\&.
.RE
.PP
_RPATH
.RS 4
An automatically\-generated construction variable containing the rpath flags to be used when linking a program with shared libraries\&. The value of
\fB$_RPATH\fR
is created by respectively prepending
\fB$RPATHPREFIX\fR
and appending
\fB$RPATHSUFFIX\fR
to the beginning and end of each directory in
\fB$RPATH\fR\&.
.RE
.PP
RPATH
.RS 4
A list of paths to search for shared libraries when running programs\&. Currently only used in the GNU (gnulink), IRIX (sgilink) and Sun (sunlink) linkers\&. Ignored on platforms and toolchains that don\*(Aqt support it\&. Note that the paths added to RPATH are not transformed by
scons
in any way: if you want an absolute path, you must make it absolute yourself\&.
.RE
.PP
RPATHPREFIX
.RS 4
The prefix used to specify a directory to be searched for shared libraries when running programs\&. This will be prepended to the beginning of each directory in the
\fB$RPATH\fR
construction variable when the
\fB$_RPATH\fR
variable is automatically generated\&.
.RE
.PP
RPATHSUFFIX
.RS 4
The suffix used to specify a directory to be searched for shared libraries when running programs\&. This will be appended to the end of each directory in the
\fB$RPATH\fR
construction variable when the
\fB$_RPATH\fR
variable is automatically generated\&.
.RE
.PP
RPCGEN
.RS 4
The RPC protocol compiler\&.
.RE
.PP
RPCGENCLIENTFLAGS
.RS 4
Options passed to the RPC protocol compiler when generating client side stubs\&. These are in addition to any flags specified in the
\fB$RPCGENFLAGS\fR
construction variable\&.
.RE
.PP
RPCGENFLAGS
.RS 4
General options passed to the RPC protocol compiler\&.
.RE
.PP
RPCGENHEADERFLAGS
.RS 4
Options passed to the RPC protocol compiler when generating a header file\&. These are in addition to any flags specified in the
\fB$RPCGENFLAGS\fR
construction variable\&.
.RE
.PP
RPCGENSERVICEFLAGS
.RS 4
Options passed to the RPC protocol compiler when generating server side stubs\&. These are in addition to any flags specified in the
\fB$RPCGENFLAGS\fR
construction variable\&.
.RE
.PP
RPCGENXDRFLAGS
.RS 4
Options passed to the RPC protocol compiler when generating XDR routines\&. These are in addition to any flags specified in the
\fB$RPCGENFLAGS\fR
construction variable\&.
.RE
.PP
SCANNERS
.RS 4
A list of the available implicit dependency scanners\&. New file scanners may be added by appending to this list, although the more flexible approach is to associate scanners with a specific Builder\&. See the manpage sections "Builder Objects" and "Scanner Objects" for more information\&.
.RE
.PP
SCONS_HOME
.RS 4
The (optional) path to the SCons library directory, initialized from the external environment\&. If set, this is used to construct a shorter and more efficient search path in the
\fB$MSVSSCONS\fR
command line executed from Microsoft Visual Studio project files\&.
.RE
.PP
SHCC
.RS 4
The C compiler used for generating shared\-library objects\&.
.RE
.PP
SHCCCOM
.RS 4
The command line used to compile a C source file to a shared\-library object file\&. Any options specified in the
\fB$SHCFLAGS\fR,
\fB$SHCCFLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&.
.RE
.PP
SHCCCOMSTR
.RS 4
The string displayed when a C source file is compiled to a shared object file\&. If this is not set, then
\fB$SHCCCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(SHCCCOMSTR = "Compiling shared object $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
SHCCFLAGS
.RS 4
Options that are passed to the C and C++ compilers to generate shared\-library objects\&.
.RE
.PP
SHCFLAGS
.RS 4
Options that are passed to the C compiler (only; not C++) to generate shared\-library objects\&.
.RE
.PP
SHCXX
.RS 4
The C++ compiler used for generating shared\-library objects\&.
.RE
.PP
SHCXXCOM
.RS 4
The command line used to compile a C++ source file to a shared\-library object file\&. Any options specified in the
\fB$SHCXXFLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&.
.RE
.PP
SHCXXCOMSTR
.RS 4
The string displayed when a C++ source file is compiled to a shared object file\&. If this is not set, then
\fB$SHCXXCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(SHCXXCOMSTR = "Compiling shared object $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
SHCXXFLAGS
.RS 4
Options that are passed to the C++ compiler to generate shared\-library objects\&.
.RE
.PP
SHDC
.RS 4
The name of the compiler to use when compiling D source destined to be in a shared objects\&.
.RE
.PP
SHDCOM
.RS 4
The command line to use when compiling code to be part of shared objects\&.
.RE
.PP
SHDLIBVERSION
.RS 4
SHDLIBVERSION\&.
.RE
.PP
SHDLIBVERSIONFLAGS
.RS 4
SHDLIBVERSIONFLAGS\&.
.RE
.PP
SHDLINK
.RS 4
The linker to use when creating shared objects for code bases include D sources\&.
.RE
.PP
SHDLINKCOM
.RS 4
The command line to use when generating shared objects\&.
.RE
.PP
SHDLINKFLAGS
.RS 4
The list of flags to use when generating a shared object\&.
.RE
.PP
SHELL
.RS 4
A string naming the shell program that will be passed to the
\fB$SPAWN\fR
function\&. See the
\fB$SPAWN\fR
construction variable for more information\&.
.RE
.PP
SHF03
.RS 4
The Fortran 03 compiler used for generating shared\-library objects\&. You should normally set the
\fB$SHFORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$SHF03\fR
if you need to use a specific compiler or compiler version for Fortran 03 files\&.
.RE
.PP
SHF03COM
.RS 4
The command line used to compile a Fortran 03 source file to a shared\-library object file\&. You only need to set
\fB$SHF03COM\fR
if you need to use a specific command line for Fortran 03 files\&. You should normally set the
\fB$SHFORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
SHF03COMSTR
.RS 4
The string displayed when a Fortran 03 source file is compiled to a shared\-library object file\&. If this is not set, then
\fB$SHF03COM\fR
or
\fB$SHFORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHF03FLAGS
.RS 4
Options that are passed to the Fortran 03 compiler to generated shared\-library objects\&. You only need to set
\fB$SHF03FLAGS\fR
if you need to define specific user options for Fortran 03 files\&. You should normally set the
\fB$SHFORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
SHF03PPCOM
.RS 4
The command line used to compile a Fortran 03 source file to a shared\-library object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$SHF03FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$SHF03PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 03 files\&. You should normally set the
\fB$SHFORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
SHF03PPCOMSTR
.RS 4
The string displayed when a Fortran 03 source file is compiled to a shared\-library object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$SHF03PPCOM\fR
or
\fB$SHFORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHF08
.RS 4
The Fortran 08 compiler used for generating shared\-library objects\&. You should normally set the
\fB$SHFORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$SHF08\fR
if you need to use a specific compiler or compiler version for Fortran 08 files\&.
.RE
.PP
SHF08COM
.RS 4
The command line used to compile a Fortran 08 source file to a shared\-library object file\&. You only need to set
\fB$SHF08COM\fR
if you need to use a specific command line for Fortran 08 files\&. You should normally set the
\fB$SHFORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
SHF08COMSTR
.RS 4
The string displayed when a Fortran 08 source file is compiled to a shared\-library object file\&. If this is not set, then
\fB$SHF08COM\fR
or
\fB$SHFORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHF08FLAGS
.RS 4
Options that are passed to the Fortran 08 compiler to generated shared\-library objects\&. You only need to set
\fB$SHF08FLAGS\fR
if you need to define specific user options for Fortran 08 files\&. You should normally set the
\fB$SHFORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
SHF08PPCOM
.RS 4
The command line used to compile a Fortran 08 source file to a shared\-library object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$SHF08FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$SHF08PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 08 files\&. You should normally set the
\fB$SHFORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
SHF08PPCOMSTR
.RS 4
The string displayed when a Fortran 08 source file is compiled to a shared\-library object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$SHF08PPCOM\fR
or
\fB$SHFORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHF77
.RS 4
The Fortran 77 compiler used for generating shared\-library objects\&. You should normally set the
\fB$SHFORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$SHF77\fR
if you need to use a specific compiler or compiler version for Fortran 77 files\&.
.RE
.PP
SHF77COM
.RS 4
The command line used to compile a Fortran 77 source file to a shared\-library object file\&. You only need to set
\fB$SHF77COM\fR
if you need to use a specific command line for Fortran 77 files\&. You should normally set the
\fB$SHFORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
SHF77COMSTR
.RS 4
The string displayed when a Fortran 77 source file is compiled to a shared\-library object file\&. If this is not set, then
\fB$SHF77COM\fR
or
\fB$SHFORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHF77FLAGS
.RS 4
Options that are passed to the Fortran 77 compiler to generated shared\-library objects\&. You only need to set
\fB$SHF77FLAGS\fR
if you need to define specific user options for Fortran 77 files\&. You should normally set the
\fB$SHFORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
SHF77PPCOM
.RS 4
The command line used to compile a Fortran 77 source file to a shared\-library object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$SHF77FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$SHF77PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 77 files\&. You should normally set the
\fB$SHFORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
SHF77PPCOMSTR
.RS 4
The string displayed when a Fortran 77 source file is compiled to a shared\-library object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$SHF77PPCOM\fR
or
\fB$SHFORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHF90
.RS 4
The Fortran 90 compiler used for generating shared\-library objects\&. You should normally set the
\fB$SHFORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$SHF90\fR
if you need to use a specific compiler or compiler version for Fortran 90 files\&.
.RE
.PP
SHF90COM
.RS 4
The command line used to compile a Fortran 90 source file to a shared\-library object file\&. You only need to set
\fB$SHF90COM\fR
if you need to use a specific command line for Fortran 90 files\&. You should normally set the
\fB$SHFORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
SHF90COMSTR
.RS 4
The string displayed when a Fortran 90 source file is compiled to a shared\-library object file\&. If this is not set, then
\fB$SHF90COM\fR
or
\fB$SHFORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHF90FLAGS
.RS 4
Options that are passed to the Fortran 90 compiler to generated shared\-library objects\&. You only need to set
\fB$SHF90FLAGS\fR
if you need to define specific user options for Fortran 90 files\&. You should normally set the
\fB$SHFORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
SHF90PPCOM
.RS 4
The command line used to compile a Fortran 90 source file to a shared\-library object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$SHF90FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$SHF90PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 90 files\&. You should normally set the
\fB$SHFORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
SHF90PPCOMSTR
.RS 4
The string displayed when a Fortran 90 source file is compiled to a shared\-library object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$SHF90PPCOM\fR
or
\fB$SHFORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHF95
.RS 4
The Fortran 95 compiler used for generating shared\-library objects\&. You should normally set the
\fB$SHFORTRAN\fR
variable, which specifies the default Fortran compiler for all Fortran versions\&. You only need to set
\fB$SHF95\fR
if you need to use a specific compiler or compiler version for Fortran 95 files\&.
.RE
.PP
SHF95COM
.RS 4
The command line used to compile a Fortran 95 source file to a shared\-library object file\&. You only need to set
\fB$SHF95COM\fR
if you need to use a specific command line for Fortran 95 files\&. You should normally set the
\fB$SHFORTRANCOM\fR
variable, which specifies the default command line for all Fortran versions\&.
.RE
.PP
SHF95COMSTR
.RS 4
The string displayed when a Fortran 95 source file is compiled to a shared\-library object file\&. If this is not set, then
\fB$SHF95COM\fR
or
\fB$SHFORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHF95FLAGS
.RS 4
Options that are passed to the Fortran 95 compiler to generated shared\-library objects\&. You only need to set
\fB$SHF95FLAGS\fR
if you need to define specific user options for Fortran 95 files\&. You should normally set the
\fB$SHFORTRANFLAGS\fR
variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&.
.RE
.PP
SHF95PPCOM
.RS 4
The command line used to compile a Fortran 95 source file to a shared\-library object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$SHF95FLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&. You only need to set
\fB$SHF95PPCOM\fR
if you need to use a specific C\-preprocessor command line for Fortran 95 files\&. You should normally set the
\fB$SHFORTRANPPCOM\fR
variable, which specifies the default C\-preprocessor command line for all Fortran versions\&.
.RE
.PP
SHF95PPCOMSTR
.RS 4
The string displayed when a Fortran 95 source file is compiled to a shared\-library object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$SHF95PPCOM\fR
or
\fB$SHFORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHFORTRAN
.RS 4
The default Fortran compiler used for generating shared\-library objects\&.
.RE
.PP
SHFORTRANCOM
.RS 4
The command line used to compile a Fortran source file to a shared\-library object file\&.
.RE
.PP
SHFORTRANCOMSTR
.RS 4
The string displayed when a Fortran source file is compiled to a shared\-library object file\&. If this is not set, then
\fB$SHFORTRANCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHFORTRANFLAGS
.RS 4
Options that are passed to the Fortran compiler to generate shared\-library objects\&.
.RE
.PP
SHFORTRANPPCOM
.RS 4
The command line used to compile a Fortran source file to a shared\-library object file after first running the file through the C preprocessor\&. Any options specified in the
\fB$SHFORTRANFLAGS\fR
and
\fB$CPPFLAGS\fR
construction variables are included on this command line\&.
.RE
.PP
SHFORTRANPPCOMSTR
.RS 4
The string displayed when a Fortran source file is compiled to a shared\-library object file after first running the file through the C preprocessor\&. If this is not set, then
\fB$SHFORTRANPPCOM\fR
(the command line) is displayed\&.
.RE
.PP
SHLIBEMITTER
.RS 4
Contains the emitter specification for the
\fBSharedLibrary\fR
builder\&. The manpage section "Builder Objects" contains general information on specifying emitters\&.
.RE
.PP
SHLIBNOVERSIONSYMLINKS
.RS 4
Instructs the
\fBSharedLibrary\fR
builder to not create symlinks for versioned shared libraries\&.
.RE
.PP
SHLIBPREFIX
.RS 4
The prefix used for shared library file names\&.
.RE
.PP
_SHLIBSONAME
.RS 4
A macro that automatically generates shared library\*(Aqs SONAME based on $TARGET, $SHLIBVERSION and $SHLIBSUFFIX\&. Used by
\fBSharedLibrary\fR
builder when the linker tool supports SONAME (e\&.g\&.
gnulink)\&.
.RE
.PP
SHLIBSUFFIX
.RS 4
The suffix used for shared library file names\&.
.RE
.PP
SHLIBVERSION
.RS 4
When this construction variable is defined, a versioned shared library is created by the
\fBSharedLibrary\fR
builder\&. This activates the
\fB$_SHLIBVERSIONFLAGS\fR
and thus modifies the
\fB$SHLINKCOM\fR
as required, adds the version number to the library name, and creates the symlinks that are needed\&.
\fB$SHLIBVERSION\fR
versions should exist as alpha\-numeric, decimal\-delimited values as defined by the regular expression "\ew+[\e\&.\ew+]*"\&. Example
\fB$SHLIBVERSION\fR
values include \*(Aq1\*(Aq, \*(Aq1\&.2\&.3\*(Aq, and \*(Aq1\&.2\&.gitaa412c8b\*(Aq\&.
.RE
.PP
_SHLIBVERSIONFLAGS
.RS 4
This macro automatically introduces extra flags to
\fB$SHLINKCOM\fR
when building versioned
\fBSharedLibrary\fR
(that is when
\fB$SHLIBVERSION\fR
is set)\&.
_SHLIBVERSIONFLAGS
usually adds
\fB$SHLIBVERSIONFLAGS\fR
and some extra dynamically generated options (such as
\-Wl,\-soname=$_SHLIBSONAME\&. It is unused by "plain" (unversioned) shared libraries\&.
.RE
.PP
SHLIBVERSIONFLAGS
.RS 4
Extra flags added to
\fB$SHLINKCOM\fR
when building versioned
\fBSharedLibrary\fR\&. These flags are only used when
\fB$SHLIBVERSION\fR
is set\&.
.RE
.PP
SHLINK
.RS 4
The linker for programs that use shared libraries\&.
.RE
.PP
SHLINKCOM
.RS 4
The command line used to link programs using shared libraries\&.
.RE
.PP
SHLINKCOMSTR
.RS 4
The string displayed when programs using shared libraries are linked\&. If this is not set, then
\fB$SHLINKCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(SHLINKCOMSTR = "Linking shared $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
SHLINKFLAGS
.RS 4
General user options passed to the linker for programs using shared libraries\&. Note that this variable should
\fInot\fR
contain
\fB\-l\fR
(or similar) options for linking with the libraries listed in
\fB$LIBS\fR, nor
\fB\-L\fR
(or similar) include search path options that scons generates automatically from
\fB$LIBPATH\fR\&. See
\fB$_LIBFLAGS\fR
above, for the variable that expands to library\-link options, and
\fB$_LIBDIRFLAGS\fR
above, for the variable that expands to library search path options\&.
.RE
.PP
SHOBJPREFIX
.RS 4
The prefix used for shared object file names\&.
.RE
.PP
SHOBJSUFFIX
.RS 4
The suffix used for shared object file names\&.
.RE
.PP
SONAME
.RS 4
Variable used to hard\-code SONAME for versioned shared library/loadable module\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.SharedLibrary(\*(Aqtest\*(Aq, \*(Aqtest\&.c\*(Aq, SHLIBVERSION=\*(Aq0\&.1\&.2\*(Aq, SONAME=\*(Aqlibtest\&.so\&.2\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The variable is used, for example, by
gnulink
linker tool\&.
.RE
.PP
SOURCE
.RS 4
A reserved variable name that may not be set or used in a construction environment\&. (See the manpage section "Variable Substitution" for more information)\&.
.RE
.PP
SOURCE_URL
.RS 4
The URL (web address) of the location from which the project was retrieved\&. This is used to fill in the
Source:
field in the controlling information for Ipkg and RPM packages\&.
.RE
.PP
SOURCES
.RS 4
A reserved variable name that may not be set or used in a construction environment\&. (See the manpage section "Variable Substitution" for more information)\&.
.RE
.PP
SPAWN
.RS 4
A command interpreter function that will be called to execute command line strings\&. The function must expect the following arguments:
.sp
.if n \{\
.RS 4
.\}
.nf
def spawn(shell, escape, cmd, args, env):
.fi
.if n \{\
.RE
.\}
.sp
\fIsh\fR
is a string naming the shell program to use\&.
\fIescape\fR
is a function that can be called to escape shell special characters in the command line\&.
\fIcmd\fR
is the path to the command to be executed\&.
\fIargs\fR
is the arguments to the command\&.
\fIenv\fR
is a dictionary of the environment variables in which the command should be executed\&.
.RE
.PP
STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME
.RS 4
When this variable is true, static objects and shared objects are assumed to be the same; that is, SCons does not check for linking static objects into a shared library\&.
.RE
.PP
SUBST_DICT
.RS 4
The dictionary used by the
\fBSubstfile\fR
or
\fBTextfile\fR
builders for substitution values\&. It can be anything acceptable to the dict() constructor, so in addition to a dictionary, lists of tuples are also acceptable\&.
.RE
.PP
SUBSTFILEPREFIX
.RS 4
The prefix used for
\fBSubstfile\fR
file names, the null string by default\&.
.RE
.PP
SUBSTFILESUFFIX
.RS 4
The suffix used for
\fBSubstfile\fR
file names, the null string by default\&.
.RE
.PP
SUMMARY
.RS 4
A short summary of what the project is about\&. This is used to fill in the
Summary:
field in the controlling information for Ipkg and RPM packages, and as the
Description:
field in MSI packages\&.
.RE
.PP
SWIG
.RS 4
The scripting language wrapper and interface generator\&.
.RE
.PP
SWIGCFILESUFFIX
.RS 4
The suffix that will be used for intermediate C source files generated by the scripting language wrapper and interface generator\&. The default value is
_wrap\fB$CFILESUFFIX\fR\&. By default, this value is used whenever the
\fB\-c++\fR
option is
\fInot\fR
specified as part of the
\fB$SWIGFLAGS\fR
construction variable\&.
.RE
.PP
SWIGCOM
.RS 4
The command line used to call the scripting language wrapper and interface generator\&.
.RE
.PP
SWIGCOMSTR
.RS 4
The string displayed when calling the scripting language wrapper and interface generator\&. If this is not set, then
\fB$SWIGCOM\fR
(the command line) is displayed\&.
.RE
.PP
SWIGCXXFILESUFFIX
.RS 4
The suffix that will be used for intermediate C++ source files generated by the scripting language wrapper and interface generator\&. The default value is
_wrap\fB$CFILESUFFIX\fR\&. By default, this value is used whenever the
\-c++
option is specified as part of the
\fB$SWIGFLAGS\fR
construction variable\&.
.RE
.PP
SWIGDIRECTORSUFFIX
.RS 4
The suffix that will be used for intermediate C++ header files generated by the scripting language wrapper and interface generator\&. These are only generated for C++ code when the SWIG \*(Aqdirectors\*(Aq feature is turned on\&. The default value is
_wrap\&.h\&.
.RE
.PP
SWIGFLAGS
.RS 4
General options passed to the scripting language wrapper and interface generator\&. This is where you should set
\fB\-python\fR,
\fB\-perl5\fR,
\fB\-tcl\fR, or whatever other options you want to specify to SWIG\&. If you set the
\fB\-c++\fR
option in this variable,
scons
will, by default, generate a C++ intermediate source file with the extension that is specified as the
\fB$CXXFILESUFFIX\fR
variable\&.
.RE
.PP
_SWIGINCFLAGS
.RS 4
An automatically\-generated construction variable containing the SWIG command\-line options for specifying directories to be searched for included files\&. The value of
\fB$_SWIGINCFLAGS\fR
is created by respectively prepending and appending
\fB$SWIGINCPREFIX\fR
and
\fB$SWIGINCSUFFIX\fR
to the beginning and end of each directory in
\fB$SWIGPATH\fR\&.
.RE
.PP
SWIGINCPREFIX
.RS 4
The prefix used to specify an include directory on the SWIG command line\&. This will be prepended to the beginning of each directory in the
\fB$SWIGPATH\fR
construction variable when the
\fB$_SWIGINCFLAGS\fR
variable is automatically generated\&.
.RE
.PP
SWIGINCSUFFIX
.RS 4
The suffix used to specify an include directory on the SWIG command line\&. This will be appended to the end of each directory in the
\fB$SWIGPATH\fR
construction variable when the
\fB$_SWIGINCFLAGS\fR
variable is automatically generated\&.
.RE
.PP
SWIGOUTDIR
.RS 4
Specifies the output directory in which the scripting language wrapper and interface generator should place generated language\-specific files\&. This will be used by SCons to identify the files that will be generated by the
swig
call, and translated into the
swig \-outdir
option on the command line\&.
.RE
.PP
SWIGPATH
.RS 4
The list of directories that the scripting language wrapper and interface generate will search for included files\&. The SWIG implicit dependency scanner will search these directories for include files\&. The default value is an empty list\&.
.sp
Don\*(Aqt explicitly put include directory arguments in SWIGFLAGS; the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in SWIGPATH will be looked\-up relative to the SConscript directory when they are used in a command\&. To force
scons
to look\-up a directory relative to the root of the source tree use #:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(SWIGPATH=\*(Aq#/include\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
The directory look\-up can also be forced using the
\fBDir\fR() function:
.sp
.if n \{\
.RS 4
.\}
.nf
include = Dir(\*(Aqinclude\*(Aq)
env = Environment(SWIGPATH=include)
.fi
.if n \{\
.RE
.\}
.sp
The directory list will be added to command lines through the automatically\-generated
\fB$_SWIGINCFLAGS\fR
construction variable, which is constructed by respectively prepending and appending the values of the
\fB$SWIGINCPREFIX\fR
and
\fB$SWIGINCSUFFIX\fR
construction variables to the beginning and end of each directory in
\fB$SWIGPATH\fR\&. Any command lines you define that need the SWIGPATH directory list should include
\fB$_SWIGINCFLAGS\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(SWIGCOM="my_swig \-o $TARGET $_SWIGINCFLAGS $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
SWIGVERSION
.RS 4
The version number of the SWIG tool\&.
.RE
.PP
TAR
.RS 4
The tar archiver\&.
.RE
.PP
TARCOM
.RS 4
The command line used to call the tar archiver\&.
.RE
.PP
TARCOMSTR
.RS 4
The string displayed when archiving files using the tar archiver\&. If this is not set, then
\fB$TARCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(TARCOMSTR = "Archiving $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
TARFLAGS
.RS 4
General options passed to the tar archiver\&.
.RE
.PP
TARGET
.RS 4
A reserved variable name that may not be set or used in a construction environment\&. (See the manpage section "Variable Substitution" for more information)\&.
.RE
.PP
TARGET_ARCH
.RS 4
The name of the target hardware architecture for the compiled objects created by this Environment\&. This defaults to the value of HOST_ARCH, and the user can override it\&. Currently only set for Win32\&.
.sp
Sets the target architecture for Visual Studio compiler (i\&.e\&. the arch of the binaries generated by the compiler)\&. If not set, default to
\fB$HOST_ARCH\fR, or, if that is unset, to the architecture of the running machine\*(Aqs OS (note that the python build or architecture has no effect)\&. This variable must be passed as an argument to the Environment() constructor; setting it later has no effect\&. This is currently only used on Windows, but in the future it will be used on other OSes as well\&. If this is set and MSVC_VERSION is not set, this will search for all installed MSVC\*(Aqs that support the TARGET_ARCH, selecting the latest version for use\&.
.sp
Valid values for Windows are
x86,
arm,
i386
(for 32 bits);
amd64,
arm64,
emt64,
x86_64
(for 64 bits); and
ia64
(Itanium)\&. For example, if you want to compile 64\-bit binaries, you would set
TARGET_ARCH=\*(Aqx86_64\*(Aq
in your SCons environment\&.
.RE
.PP
TARGET_OS
.RS 4
The name of the target operating system for the compiled objects created by this Environment\&. This defaults to the value of HOST_OS, and the user can override it\&. Currently only set for Win32\&.
.RE
.PP
TARGETS
.RS 4
A reserved variable name that may not be set or used in a construction environment\&. (See the manpage section "Variable Substitution" for more information)\&.
.RE
.PP
TARSUFFIX
.RS 4
The suffix used for tar file names\&.
.RE
.PP
TEMPFILEARGJOIN
.RS 4
The string (or character) to be used to join the arguments passed to TEMPFILE when command line exceeds the limit set by
\fB$MAXLINELENGTH\fR\&. The default value is a space\&. However for MSVC, MSLINK the default is a line seperator characters as defined by os\&.linesep\&. Note this value is used literally and not expanded by the subst logic\&.
.RE
.PP
TEMPFILEPREFIX
.RS 4
The prefix for a temporary file used to store lines lines longer than $MAXLINELENGTH as operations which call out to a shell will fail if the line is too long, which particularly impacts linking\&. The default is \*(Aq@\*(Aq, which works for the Microsoft and GNU toolchains on Windows\&. Set this appropriately for other toolchains, for example \*(Aq\-@\*(Aq for the diab compiler or \*(Aq\-via\*(Aq for ARM toolchain\&.
.RE
.PP
TEMPFILESUFFIX
.RS 4
The suffix used for the temporary file name used for long command lines\&. The name should include the dot (\*(Aq\&.\*(Aq) if one is wanted as it will not be added automatically\&. The default is \*(Aq\&.lnk\*(Aq\&.
.RE
.PP
TEX
.RS 4
The TeX formatter and typesetter\&.
.RE
.PP
TEXCOM
.RS 4
The command line used to call the TeX formatter and typesetter\&.
.RE
.PP
TEXCOMSTR
.RS 4
The string displayed when calling the TeX formatter and typesetter\&. If this is not set, then
\fB$TEXCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(TEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
TEXFLAGS
.RS 4
General options passed to the TeX formatter and typesetter\&.
.RE
.PP
TEXINPUTS
.RS 4
List of directories that the LaTeX program will search for include directories\&. The LaTeX implicit dependency scanner will search these directories for \einclude and \eimport files\&.
.RE
.PP
TEXTFILEPREFIX
.RS 4
The prefix used for
\fBTextfile\fR
file names, the null string by default\&.
.RE
.PP
TEXTFILESUFFIX
.RS 4
The suffix used for
\fBTextfile\fR
file names;
\&.txt
by default\&.
.RE
.PP
TOOLS
.RS 4
A list of the names of the Tool specifications that are part of this construction environment\&.
.RE
.PP
UNCHANGED_SOURCES
.RS 4
A reserved variable name that may not be set or used in a construction environment\&. (See the manpage section "Variable Substitution" for more information)\&.
.RE
.PP
UNCHANGED_TARGETS
.RS 4
A reserved variable name that may not be set or used in a construction environment\&. (See the manpage section "Variable Substitution" for more information)\&.
.RE
.PP
VENDOR
.RS 4
The person or organization who supply the packaged software\&. This is used to fill in the
Vendor:
field in the controlling information for RPM packages, and the
Manufacturer:
field in the controlling information for MSI packages\&.
.RE
.PP
VERSION
.RS 4
The version of the project, specified as a string\&.
.RE
.PP
WIN32_INSERT_DEF
.RS 4
A deprecated synonym for
\fB$WINDOWS_INSERT_DEF\fR\&.
.RE
.PP
WIN32DEFPREFIX
.RS 4
A deprecated synonym for
\fB$WINDOWSDEFPREFIX\fR\&.
.RE
.PP
WIN32DEFSUFFIX
.RS 4
A deprecated synonym for
\fB$WINDOWSDEFSUFFIX\fR\&.
.RE
.PP
WIN32EXPPREFIX
.RS 4
A deprecated synonym for
\fB$WINDOWSEXPSUFFIX\fR\&.
.RE
.PP
WIN32EXPSUFFIX
.RS 4
A deprecated synonym for
\fB$WINDOWSEXPSUFFIX\fR\&.
.RE
.PP
WINDOWS_EMBED_MANIFEST
.RS 4
Set this variable to True or 1 to embed the compiler\-generated manifest (normally
${TARGET}\&.manifest) into all Windows exes and DLLs built with this environment, as a resource during their link step\&. This is done using
\fB$MT\fR
and
\fB$MTEXECOM\fR
and
\fB$MTSHLIBCOM\fR\&.
.RE
.PP
WINDOWS_INSERT_DEF
.RS 4
When this is set to true, a library build of a Windows shared library (\&.dll
file) will also build a corresponding
\&.def
file at the same time, if a
\&.def
file is not already listed as a build target\&. The default is 0 (do not build a
\&.def
file)\&.
.RE
.PP
WINDOWS_INSERT_MANIFEST
.RS 4
When this is set to true,
scons
will be aware of the
\&.manifest
files generated by Microsoft Visua C/C++ 8\&.
.RE
.PP
WINDOWSDEFPREFIX
.RS 4
The prefix used for Windows
\&.def
file names\&.
.RE
.PP
WINDOWSDEFSUFFIX
.RS 4
The suffix used for Windows
\&.def
file names\&.
.RE
.PP
WINDOWSEXPPREFIX
.RS 4
The prefix used for Windows
\&.exp
file names\&.
.RE
.PP
WINDOWSEXPSUFFIX
.RS 4
The suffix used for Windows
\&.exp
file names\&.
.RE
.PP
WINDOWSPROGMANIFESTPREFIX
.RS 4
The prefix used for executable program
\&.manifest
files generated by Microsoft Visual C/C++\&.
.RE
.PP
WINDOWSPROGMANIFESTSUFFIX
.RS 4
The suffix used for executable program
\&.manifest
files generated by Microsoft Visual C/C++\&.
.RE
.PP
WINDOWSSHLIBMANIFESTPREFIX
.RS 4
The prefix used for shared library
\&.manifest
files generated by Microsoft Visual C/C++\&.
.RE
.PP
WINDOWSSHLIBMANIFESTSUFFIX
.RS 4
The suffix used for shared library
\&.manifest
files generated by Microsoft Visual C/C++\&.
.RE
.PP
X_IPK_DEPENDS
.RS 4
This is used to fill in the
Depends:
field in the controlling information for Ipkg packages\&.
.RE
.PP
X_IPK_DESCRIPTION
.RS 4
This is used to fill in the
Description:
field in the controlling information for Ipkg packages\&. The default value is
$SUMMARY\en$DESCRIPTION
.RE
.PP
X_IPK_MAINTAINER
.RS 4
This is used to fill in the
Maintainer:
field in the controlling information for Ipkg packages\&.
.RE
.PP
X_IPK_PRIORITY
.RS 4
This is used to fill in the
Priority:
field in the controlling information for Ipkg packages\&.
.RE
.PP
X_IPK_SECTION
.RS 4
This is used to fill in the
Section:
field in the controlling information for Ipkg packages\&.
.RE
.PP
X_MSI_LANGUAGE
.RS 4
This is used to fill in the
Language:
attribute in the controlling information for MSI packages\&.
.RE
.PP
X_MSI_LICENSE_TEXT
.RS 4
The text of the software license in RTF format\&. Carriage return characters will be replaced with the RTF equivalent \e\epar\&.
.RE
.PP
X_MSI_UPGRADE_CODE
.RS 4
TODO
.RE
.PP
X_RPM_AUTOREQPROV
.RS 4
This is used to fill in the
AutoReqProv:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_BUILD
.RS 4
internal, but overridable
.RE
.PP
X_RPM_BUILDREQUIRES
.RS 4
This is used to fill in the
BuildRequires:
field in the RPM
\&.spec
file\&. Note this should only be used on a host managed by rpm as the dependencies will not be resolvable at build time otherwise\&.
.RE
.PP
X_RPM_BUILDROOT
.RS 4
internal, but overridable
.RE
.PP
X_RPM_CLEAN
.RS 4
internal, but overridable
.RE
.PP
X_RPM_CONFLICTS
.RS 4
This is used to fill in the
Conflicts:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_DEFATTR
.RS 4
This value is used as the default attributes for the files in the RPM package\&. The default value is
(\-,root,root)\&.
.RE
.PP
X_RPM_DISTRIBUTION
.RS 4
This is used to fill in the
Distribution:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_EPOCH
.RS 4
This is used to fill in the
Epoch:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_EXCLUDEARCH
.RS 4
This is used to fill in the
ExcludeArch:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_EXLUSIVEARCH
.RS 4
This is used to fill in the
ExclusiveArch:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_EXTRADEFS
.RS 4
A list used to supply extra defintions or flags to be added to the RPM
\&.spec
file\&. Each item is added as\-is with a carriage return appended\&. This is useful if some specific RPM feature not otherwise anticipated by SCons needs to be turned on or off\&. Note if this variable is omitted, SCons will by default supply the value
\*(Aq%global debug_package %{nil}\*(Aq
to disable debug package generation\&. To enable debug package generation, include this variable set either to None, or to a custom list that does not include the default line\&. Added in version 3\&.1\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env\&.Package(
NAME = \*(Aqfoo\*(Aq,
\&.\&.\&.
X_RPM_EXTRADEFS = [
\*(Aq%define _unpackaged_files_terminate_build 0\*(Aq
\*(Aq%define _missing_doc_files_terminate_build 0\*(Aq
],
\&.\&.\&. )
.fi
.if n \{\
.RE
.\}
.RE
.PP
X_RPM_GROUP
.RS 4
This is used to fill in the
Group:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_GROUP_lang
.RS 4
This is used to fill in the
Group(lang):
field in the RPM
\&.spec
file\&. Note that
\fIlang\fR
is not literal and should be replaced by the appropriate language code\&.
.RE
.PP
X_RPM_ICON
.RS 4
This is used to fill in the
Icon:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_INSTALL
.RS 4
internal, but overridable
.RE
.PP
X_RPM_PACKAGER
.RS 4
This is used to fill in the
Packager:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_POSTINSTALL
.RS 4
This is used to fill in the
%post:
section in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_POSTUNINSTALL
.RS 4
This is used to fill in the
%postun:
section in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_PREFIX
.RS 4
This is used to fill in the
Prefix:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_PREINSTALL
.RS 4
This is used to fill in the
%pre:
section in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_PREP
.RS 4
internal, but overridable
.RE
.PP
X_RPM_PREUNINSTALL
.RS 4
This is used to fill in the
%preun:
section in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_PROVIDES
.RS 4
This is used to fill in the
Provides:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_REQUIRES
.RS 4
This is used to fill in the
Requires:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_SERIAL
.RS 4
This is used to fill in the
Serial:
field in the RPM
\&.spec
file\&.
.RE
.PP
X_RPM_URL
.RS 4
This is used to fill in the
Url:
field in the RPM
\&.spec
file\&.
.RE
.PP
XGETTEXT
.RS 4
Path to
\fBxgettext(1)\fR
program (found via
\fBDetect()\fR)\&. See
xgettext
tool and
\fBPOTUpdate\fR
builder\&.
.RE
.PP
XGETTEXTCOM
.RS 4
Complete xgettext command line\&. See
xgettext
tool and
\fBPOTUpdate\fR
builder\&.
.RE
.PP
XGETTEXTCOMSTR
.RS 4
A string that is shown when
\fBxgettext(1)\fR
command is invoked (default:
\*(Aq\*(Aq, which means "print
\fB$XGETTEXTCOM\fR")\&. See
xgettext
tool and
\fBPOTUpdate\fR
builder\&.
.RE
.PP
_XGETTEXTDOMAIN
.RS 4
Internal "macro"\&. Generates
\fBxgettext\fR
domain name form source and target (default:
\*(Aq${TARGET\&.filebase}\*(Aq)\&.
.RE
.PP
XGETTEXTFLAGS
.RS 4
Additional flags to
\fBxgettext(1)\fR\&. See
xgettext
tool and
\fBPOTUpdate\fR
builder\&.
.RE
.PP
XGETTEXTFROM
.RS 4
Name of file containing list of
\fBxgettext(1)\fR\*(Aqs source files\&. Autotools\*(Aq users know this as
POTFILES\&.in
so they will in most cases set
XGETTEXTFROM="POTFILES\&.in"
here\&. The
\fB$XGETTEXTFROM\fR
files have same syntax and semantics as the well known GNU
POTFILES\&.in\&. See
xgettext
tool and
\fBPOTUpdate\fR
builder\&.
.RE
.PP
_XGETTEXTFROMFLAGS
.RS 4
Internal "macro"\&. Genrates list of
\-D<dir>
flags from the
\fB$XGETTEXTPATH\fR
list\&.
.RE
.PP
XGETTEXTFROMPREFIX
.RS 4
This flag is used to add single
\fB$XGETTEXTFROM\fR
file to
\fBxgettext(1)\fR\*(Aqs commandline (default:
\*(Aq\-f\*(Aq)\&.
.RE
.PP
XGETTEXTFROMSUFFIX
.RS 4
(default:
\*(Aq\*(Aq)
.RE
.PP
XGETTEXTPATH
.RS 4
List of directories, there
\fBxgettext(1)\fR
will look for source files (default:
[])\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
This variable works only together with
\fB$XGETTEXTFROM\fR
.sp .5v
.RE
See also
xgettext
tool and
\fBPOTUpdate\fR
builder\&.
.RE
.PP
_XGETTEXTPATHFLAGS
.RS 4
Internal "macro"\&. Generates list of
\-f<file>
flags from
\fB$XGETTEXTFROM\fR\&.
.RE
.PP
XGETTEXTPATHPREFIX
.RS 4
This flag is used to add single search path to
\fBxgettext(1)\fR\*(Aqs commandline (default:
\*(Aq\-D\*(Aq)\&.
.RE
.PP
XGETTEXTPATHSUFFIX
.RS 4
(default:
\*(Aq\*(Aq)
.RE
.PP
YACC
.RS 4
The parser generator\&.
.RE
.PP
YACCCOM
.RS 4
The command line used to call the parser generator to generate a source file\&.
.RE
.PP
YACCCOMSTR
.RS 4
The string displayed when generating a source file using the parser generator\&. If this is not set, then
\fB$YACCCOM\fR
(the command line) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(YACCCOMSTR = "Yacc\*(Aqing $TARGET from $SOURCES")
.fi
.if n \{\
.RE
.\}
.RE
.PP
YACCFLAGS
.RS 4
General options passed to the parser generator\&. If
\fB$YACCFLAGS\fR
contains a
\fB\-d\fR
option, SCons assumes that the call will also create a \&.h file (if the yacc source file ends in a \&.y suffix) or a \&.hpp file (if the yacc source file ends in a \&.yy suffix)
.RE
.PP
YACCHFILESUFFIX
.RS 4
The suffix of the C header file generated by the parser generator when the
\fB\-d\fR
option is used\&. Note that setting this variable does not cause the parser generator to generate a header file with the specified suffix, it exists to allow you to specify what suffix the parser generator will use of its own accord\&. The default value is
\&.h\&.
.RE
.PP
YACCHXXFILESUFFIX
.RS 4
The suffix of the C++ header file generated by the parser generator when the
\fB\-d\fR
option is used\&. Note that setting this variable does not cause the parser generator to generate a header file with the specified suffix, it exists to allow you to specify what suffix the parser generator will use of its own accord\&. The default value is
\&.hpp, except on Mac OS X, where the default is
${TARGET\&.suffix}\&.h\&. because the default
bison
parser generator just appends
\&.h
to the name of the generated C++ file\&.
.RE
.PP
YACCVCGFILESUFFIX
.RS 4
The suffix of the file containing the VCG grammar automaton definition when the
\fB\-\-graph=\fR
option is used\&. Note that setting this variable does not cause the parser generator to generate a VCG file with the specified suffix, it exists to allow you to specify what suffix the parser generator will use of its own accord\&. The default value is
\&.vcg\&.
.RE
.PP
ZIP
.RS 4
The zip compression and file packaging utility\&.
.RE
.PP
ZIPCOM
.RS 4
The command line used to call the zip utility, or the internal Python function used to create a zip archive\&.
.RE
.PP
ZIPCOMPRESSION
.RS 4
The
\fIcompression\fR
flag from the Python
zipfile
module used by the internal Python function to control whether the zip archive is compressed or not\&. The default value is
zipfile\&.ZIP_DEFLATED, which creates a compressed zip archive\&. This value has no effect if the
zipfile
module is unavailable\&.
.RE
.PP
ZIPCOMSTR
.RS 4
The string displayed when archiving files using the zip utility\&. If this is not set, then
\fB$ZIPCOM\fR
(the command line or internal Python function) is displayed\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(ZIPCOMSTR = "Zipping $TARGET")
.fi
.if n \{\
.RE
.\}
.RE
.PP
ZIPFLAGS
.RS 4
General options passed to the zip utility\&.
.RE
.PP
ZIPROOT
.RS 4
An optional zip root directory (default empty)\&. The filenames stored in the zip file will be relative to this directory, if given\&. Otherwise the filenames are relative to the current directory of the command\&. For instance:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
env\&.Zip(\*(Aqfoo\&.zip\*(Aq, \*(Aqsubdir1/subdir2/file1\*(Aq, ZIPROOT=\*(Aqsubdir1\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
will produce a zip file
foo\&.zip
containing a file with the name
subdir2/file1
rather than
subdir1/subdir2/file1\&.
.RE
.PP
ZIPSUFFIX
.RS 4
The suffix used for zip file names\&.
.RE
.PP
Construction variables can be retrieved and set using the
\fBDictionary\fR
method of the construction environment:
.sp
.if n \{\
.RS 4
.\}
.nf
cvars = env\&.Dictionary()
cvars["CC"] = "cc"
.fi
.if n \{\
.RE
.\}
.PP
or using the key lookup operator
[]
directly on the construction environment:
.sp
.if n \{\
.RS 4
.\}
.nf
env["CC"] = "cc"
.fi
.if n \{\
.RE
.\}
.PP
Construction variables can also be passed to the construction environment constructor:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(CC="cc")
.fi
.if n \{\
.RE
.\}
.PP
or when copying a construction environment using the
\fBClone\fR
method:
.sp
.if n \{\
.RS 4
.\}
.nf
env2 = env\&.Clone(CC="cl\&.exe")
.fi
.if n \{\
.RE
.\}
.SS "Configure Contexts"
.PP
\fBscons\fR
supports
\fIconfigure contexts,\fR
an integrated mechanism similar to the various AC_CHECK macros in GNU autoconf for testing for the existence of C header files, libraries, etc\&. In contrast to autoconf,
\fBscons\fR
does not maintain an explicit cache of the tested values, but uses its normal dependency tracking to keep the checked values up to date\&. However, users may override this behaviour with the
\fB\-\-config\fR
command line option\&.
.PP
The following methods can be used to perform checks:
.PP
Configure(\fIenv\fR, [\fIcustom_tests\fR, \fIconf_dir\fR, \fIlog_file\fR, \fIconfig_h\fR, \fIclean\fR, \fIhelp])\fR, env\&.Configure([\fIcustom_tests\fR, \fIconf_dir\fR, \fIlog_file\fR, \fIconfig_h\fR, \fIclean\fR, \fIhelp])\fR
.RS 4
This creates a configure context, which can be used to perform checks\&.
\fIenv\fR
specifies the environment for building the tests\&. This environment may be modified when performing checks\&.
\fIcustom_tests\fR
is a dictionary containing custom tests\&. See also the section about custom tests below\&. By default, no custom tests are added to the configure context\&.
\fIconf_dir\fR
specifies a directory where the test cases are built\&. Note that this directory is not used for building normal targets\&. The default value is the directory #/\&.sconf_temp\&.
\fIlog_file\fR
specifies a file which collects the output from commands that are executed to check for the existence of header files, libraries, etc\&. The default is the file #/config\&.log\&. If you are using the
\fBVariantDir\fR() method, you may want to specify a subdirectory under your variant directory\&.
\fIconfig_h\fR
specifies a C header file where the results of tests will be written, e\&.g\&. #define HAVE_STDIO_H, #define HAVE_LIBM, etc\&. The default is to not write a
\fBconfig\&.h\fR
file\&. You can specify the same
\fBconfig\&.h\fR
file in multiple calls to Configure, in which case
\fBscons\fR
will concatenate all results in the specified file\&. Note that SCons uses its normal dependency checking to decide if it\*(Aqs necessary to rebuild the specified
\fIconfig_h\fR
file\&. This means that the file is not necessarily re\-built each time scons is run, but is only rebuilt if its contents will have changed and some target that depends on the
\fIconfig_h\fR
file is being built\&.
.sp
The optional
\fBclean\fR
and
\fBhelp\fR
arguments can be used to suppress execution of the configuration tests when the
\fB\-c/\-\-clean\fR
or
\fB\-H/\-h/\-\-help\fR
options are used, respectively\&. The default behavior is always to execute configure context tests, since the results of the tests may affect the list of targets to be cleaned or the help text\&. If the configure tests do not affect these, then you may add the
\fBclean=False\fR
or
\fBhelp=False\fR
arguments (or both) to avoid unnecessary test execution\&.
.RE
.PP
A created
\fBConfigure\fR
instance has the following associated methods:
.PP
SConf\&.Finish(\fIcontext\fR), \fIsconf\fR\&.Finish()
.RS 4
This method should be called after configuration is done\&. It returns the environment as modified by the configuration checks performed\&. After this method is called, no further checks can be performed with this configuration context\&. However, you can create a new Configure context to perform additional checks\&. Only one context should be active at a time\&.
.sp
The following Checks are predefined\&. (This list will likely grow larger as time goes by and developers contribute new useful tests\&.)
.RE
.PP
SConf\&.CheckHeader(\fIcontext\fR, \fIheader\fR, [\fIinclude_quotes\fR, \fIlanguage\fR]), \fIsconf\fR\&.CheckHeader(\fIheader\fR, [\fIinclude_quotes\fR, \fIlanguage\fR])
.RS 4
Checks if
\fIheader\fR
is usable in the specified language\&.
\fIheader\fR
may be a list, in which case the last item in the list is the header file to be checked, and the previous list items are header files whose
\fB#include\fR
lines should precede the header line being checked for\&. The optional argument
\fIinclude_quotes\fR
must be a two character string, where the first character denotes the opening quote and the second character denotes the closing quote\&. By default, both characters are " (double quote)\&. The optional argument
\fIlanguage\fR
should be either
\fBC\fR
or
\fBC++\fR
and selects the compiler to be used for the check\&. Returns 1 on success and 0 on failure\&.
.RE
.PP
SConf\&.CheckCHeader(\fIcontext\fR, \fIheader\fR, [\fIinclude_quotes\fR]), \fIsconf\fR\&.CheckCHeader(\fIheader\fR, [\fIinclude_quotes\fR])
.RS 4
This is a wrapper around
\fBSConf\&.CheckHeader\fR
which checks if
\fIheader\fR
is usable in the C language\&.
\fIheader\fR
may be a list, in which case the last item in the list is the header file to be checked, and the previous list items are header files whose
\fB#include\fR
lines should precede the header line being checked for\&. The optional argument
\fIinclude_quotes\fR
must be a two character string, where the first character denotes the opening quote and the second character denotes the closing quote (both default to \eN\*(Aq34\*(Aq)\&. Returns 1 on success and 0 on failure\&.
.RE
.PP
SConf\&.CheckCXXHeader(\fIcontext\fR, \fIheader\fR, [\fIinclude_quotes\fR]), \fIsconf\fR\&.CheckCXXHeader(\fIheader\fR, [\fIinclude_quotes\fR])
.RS 4
This is a wrapper around
\fBSConf\&.CheckHeader\fR
which checks if
\fIheader\fR
is usable in the C++ language\&.
\fIheader\fR
may be a list, in which case the last item in the list is the header file to be checked, and the previous list items are header files whose
\fB#include\fR
lines should precede the header line being checked for\&. The optional argument
\fIinclude_quotes\fR
must be a two character string, where the first character denotes the opening quote and the second character denotes the closing quote (both default to \eN\*(Aq34\*(Aq)\&. Returns 1 on success and 0 on failure\&.
.RE
.PP
SConf\&.CheckFunc(\fIcontext,\fR, \fIfunction_name\fR, [\fIheader\fR, \fIlanguage\fR]), \fIsconf\fR\&.CheckFunc(\fIfunction_name\fR, [\fIheader\fR, \fIlanguage\fR])
.RS 4
Checks if the specified C or C++ function is available\&.
\fIfunction_name\fR
is the name of the function to check for\&. The optional
\fIheader\fR
argument is a string that will be placed at the top of the test file that will be compiled to check if the function exists; the default is:
.sp
.if n \{\
.RS 4
.\}
.nf
#ifdef __cplusplus
extern "C"
#endif
char function_name();
.fi
.if n \{\
.RE
.\}
.sp
The optional
\fIlanguage\fR
argument should be
\fBC\fR
or
\fBC++\fR
and selects the compiler to be used for the check; the default is "C"\&.
.RE
.PP
SConf\&.CheckLib(\fIcontext\fR, [\fIlibrary\fR, \fIsymbol\fR, \fIheader\fR, \fIlanguage\fR, \fIautoadd=1\fR]), \fIsconf\fR\&.CheckLib([\fIlibrary\fR, \fIsymbol\fR, \fIheader\fR, \fIlanguage\fR, \fIautoadd=1\fR])
.RS 4
Checks if
\fIlibrary\fR
provides
\fIsymbol\fR\&. If the value of
\fIautoadd\fR
is 1 and the library provides the specified
\fIsymbol\fR, appends the library to the LIBS construction environment variable\&.
\fIlibrary\fR
may also be None (the default), in which case
\fIsymbol\fR
is checked with the current LIBS variable, or a list of library names, in which case each library in the list will be checked for
\fIsymbol\fR\&. If
\fIsymbol\fR
is not set or is
\fBNone\fR, then
\fBSConf\&.CheckLib\fR() just checks if you can link against the specified
\fIlibrary\fR\&. The optional
\fIlanguage\fR
argument should be
\fBC\fR
or
\fBC++\fR
and selects the compiler to be used for the check; the default is "C"\&. The default value for
\fIautoadd\fR
is 1\&. This method returns 1 on success and 0 on error\&.
.RE
.PP
SConf\&.CheckLibWithHeader(\fIcontext\fR, \fIlibrary\fR, \fIheader\fR, \fIlanguage\fR, [\fIcall\fR, \fIautoadd\fR]), \fIsconf\fR\&.CheckLibWithHeader(\fIlibrary\fR, \fIheader\fR, \fIlanguage\fR, [\fIcall\fR, \fIautoadd\fR])
.RS 4
In contrast to the SConf\&.CheckLib call, this call provides a more sophisticated way to check against libraries\&. Again,
\fIlibrary\fR
specifies the library or a list of libraries to check\&.
\fIheader\fR
specifies a header to check for\&.
\fIheader\fR
may be a list, in which case the last item in the list is the header file to be checked, and the previous list items are header files whose
\fB#include\fR
lines should precede the header line being checked for\&.
\fIlanguage\fR
may be one of \*(AqC\*(Aq,\*(Aqc\*(Aq,\*(AqCXX\*(Aq,\*(Aqcxx\*(Aq,\*(AqC++\*(Aq and \*(Aqc++\*(Aq\&.
\fIcall\fR
can be any valid expression (with a trailing \*(Aq;\*(Aq)\&. If
\fIcall\fR
is not set, the default simply checks that you can link against the specified
\fIlibrary\fR\&.
\fIautoadd\fR
specifies whether to add the library to the environment (only if the check succeeds)\&. This method returns 1 on success and 0 on error\&.
.RE
.PP
SConf\&.CheckType(\fIcontext\fR, \fItype_name\fR, [\fIincludes\fR, \fIlanguage\fR]), \fIsconf\fR\&.CheckType(\fItype_name\fR, [\fIincludes\fR, \fIlanguage\fR])
.RS 4
Checks for the existence of a type defined by
\fBtypedef\fR\&.
\fItype_name\fR
specifies the typedef name to check for\&.
\fIincludes\fR
is a string containing one or more
\fB#include\fR
lines that will be inserted into the program that will be run to test for the existence of the type\&. The optional
\fIlanguage\fR
argument should be
\fBC\fR
or
\fBC++\fR
and selects the compiler to be used for the check; the default is "C"\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
sconf\&.CheckType(\*(Aqfoo_type\*(Aq, \*(Aq#include "my_types\&.h"\*(Aq, \*(AqC++\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Configure\&.CheckCC(\fIself\fR)
.RS 4
Checks whether the C compiler (as defined by the CC construction variable) works by trying to compile a small source file\&.
.sp
By default, SCons only detects if there is a program with the correct name, not if it is a functioning compiler\&.
.sp
This uses the exact same command than the one used by the object builder for C source file, so it can be used to detect if a particular compiler flag works or not\&.
.RE
.PP
Configure\&.CheckCXX(\fIself\fR)
.RS 4
Checks whether the C++ compiler (as defined by the CXX construction variable) works by trying to compile a small source file\&. By default, SCons only detects if there is a program with the correct name, not if it is a functioning compiler\&.
.sp
This uses the exact same command than the one used by the object builder for CXX source files, so it can be used to detect if a particular compiler flag works or not\&.
.RE
.PP
Configure\&.CheckSHCC(\fIself\fR)
.RS 4
Checks whether the C compiler (as defined by the SHCC construction variable) works by trying to compile a small source file\&. By default, SCons only detects if there is a program with the correct name, not if it is a functioning compiler\&.
.sp
This uses the exact same command than the one used by the object builder for C source file, so it can be used to detect if a particular compiler flag works or not\&. This does not check whether the object code can be used to build a shared library, only that the compilation (not link) succeeds\&.
.RE
.PP
Configure\&.CheckSHCXX(\fIself\fR)
.RS 4
Checks whether the C++ compiler (as defined by the SHCXX construction variable) works by trying to compile a small source file\&. By default, SCons only detects if there is a program with the correct name, not if it is a functioning compiler\&.
.sp
This uses the exact same command than the one used by the object builder for CXX source files, so it can be used to detect if a particular compiler flag works or not\&. This does not check whether the object code can be used to build a shared library, only that the compilation (not link) succeeds\&.
.RE
.PP
Example of a typical Configure usage:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
conf = Configure( env )
if not conf\&.CheckCHeader( \*(Aqmath\&.h\*(Aq ):
print(\*(AqWe really need math\&.h!\*(Aq)
Exit(1)
if conf\&.CheckLibWithHeader( \*(Aqqt\*(Aq, \*(Aqqapp\&.h\*(Aq, \*(Aqc++\*(Aq,
\*(AqQApplication qapp(0,0);\*(Aq ):
# do stuff for qt \- usage, e\&.g\&.
conf\&.env\&.Append( CPPFLAGS = \*(Aq\-DWITH_QT\*(Aq )
env = conf\&.Finish()
.fi
.if n \{\
.RE
.\}
.PP
SConf\&.CheckTypeSize(\fIcontext\fR, \fItype_name\fR, [\fIheader\fR, \fIlanguage\fR, \fIexpect\fR]), \fIsconf\fR\&.CheckTypeSize(\fItype_name\fR, [\fIheader\fR, \fIlanguage\fR, \fIexpect\fR])
.RS 4
Checks for the size of a type defined by
\fBtypedef\fR\&.
\fItype_name\fR
specifies the typedef name to check for\&. The optional
\fIheader\fR
argument is a string that will be placed at the top of the test file that will be compiled to check if the function exists; the default is empty\&. The optional
\fIlanguage\fR
argument should be
\fBC\fR
or
\fBC++\fR
and selects the compiler to be used for the check; the default is "C"\&. The optional
\fIexpect\fR
argument should be an integer\&. If this argument is used, the function will only check whether the type given in type_name has the expected size (in bytes)\&. For example,
\fBCheckTypeSize(\*(Aqshort\*(Aq, expect = 2)\fR
will return success only if short is two bytes\&.
.sp
.if n \{\
.RS 4
.\}
.nf
.fi
.if n \{\
.RE
.\}
.RE
.PP
SConf\&.CheckDeclaration(\fIcontext\fR, \fIsymbol\fR, [\fIincludes\fR, \fIlanguage\fR]), \fIsconf\fR\&.CheckDeclaration(\fIsymbol\fR, [\fIincludes\fR, \fIlanguage\fR])
.RS 4
Checks if the specified
\fIsymbol\fR
is declared\&.
\fIincludes\fR
is a string containing one or more
\fB#include\fR
lines that will be inserted into the program that will be run to test for the existence of the type\&. The optional
\fIlanguage\fR
argument should be
\fBC\fR
or
\fBC++\fR
and selects the compiler to be used for the check; the default is "C"\&.
.RE
.PP
SConf\&.Define(\fIcontext\fR, \fIsymbol\fR, [\fIvalue\fR, \fIcomment\fR]), \fIsconf\fR\&.Define(\fIsymbol\fR, [\fIvalue\fR, \fIcomment\fR])
.RS 4
This function does not check for anything, but defines a preprocessor symbol that will be added to the configuration header file\&. It is the equivalent of AC_DEFINE, and defines the symbol
\fIname\fR
with the optional
\fBvalue\fR
and the optional comment
\fBcomment\fR\&.
.RE
.PP
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
conf = Configure( env )
# Puts the following line in the config header file:
# #define A_SYMBOL
conf\&.Define(\*(AqA_SYMBOL\*(Aq)
# Puts the following line in the config header file:
# #define A_SYMBOL 1
conf\&.Define(\*(AqA_SYMBOL\*(Aq, 1)
.fi
.if n \{\
.RE
.\}
.PP
Be careful about quoting string values, though:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
conf = Configure( env )
# Puts the following line in the config header file:
# #define A_SYMBOL YA
conf\&.Define(\*(AqA_SYMBOL\*(Aq, "YA")
# Puts the following line in the config header file:
# #define A_SYMBOL "YA"
conf\&.Define(\*(AqA_SYMBOL\*(Aq, \*(Aq"YA"\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
For comment:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
conf = Configure( env )
# Puts the following lines in the config header file:
# /* Set to 1 if you have a symbol */
# #define A_SYMBOL 1
conf\&.Define(\*(AqA_SYMBOL\*(Aq, 1, \*(AqSet to 1 if you have a symbol\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
You can define your own custom checks\&. in addition to the predefined checks\&. These are passed in a dictionary to the Configure function\&. This dictionary maps the names of the checks to user defined Python callables (either Python functions or class instances implementing the
\fI__call__\fR
method)\&. The first argument of the call is always a
\fICheckContext\fR
instance followed by the arguments, which must be supplied by the user of the check\&. These CheckContext instances define the following methods:
.PP
CheckContext\&.Message(\fIself\fR, \fItext\fR)
.RS 4
Usually called before the check is started\&.
\fItext\fR
will be displayed to the user, e\&.g\&. \*(AqChecking for library X\&.\&.\&.\*(Aq
.RE
.PP
CheckContext\&.Result(\fIself,\fR, \fIres\fR)
.RS 4
Usually called after the check is done\&.
\fIres\fR
can be either an integer or a string\&. In the former case, \*(Aqyes\*(Aq (res != 0) or \*(Aqno\*(Aq (res == 0) is displayed to the user, in the latter case the given string is displayed\&.
.RE
.PP
CheckContext\&.TryCompile(\fIself\fR, \fItext\fR, \fIextension\fR)
.RS 4
Checks if a file with the specified
\fIextension\fR
(e\&.g\&. \*(Aq\&.c\*(Aq) containing
\fItext\fR
can be compiled using the environment\*(Aqs
\fBObject\fR
builder\&. Returns 1 on success and 0 on failure\&.
.RE
.PP
CheckContext\&.TryLink(\fIself\fR, \fItext\fR, \fIextension\fR)
.RS 4
Checks, if a file with the specified
\fIextension\fR
(e\&.g\&. \*(Aq\&.c\*(Aq) containing
\fItext\fR
can be compiled using the environment\*(Aqs
\fBProgram\fR
builder\&. Returns 1 on success and 0 on failure\&.
.RE
.PP
CheckContext\&.TryRun(\fIself\fR, \fItext\fR, \fIextension\fR)
.RS 4
Checks, if a file with the specified
\fIextension\fR
(e\&.g\&. \*(Aq\&.c\*(Aq) containing
\fItext\fR
can be compiled using the environment\*(Aqs
\fBProgram\fR
builder\&. On success, the program is run\&. If the program executes successfully (that is, its return status is 0), a tuple
\fI(1, outputStr)\fR
is returned, where
\fIoutputStr\fR
is the standard output of the program\&. If the program fails execution (its return status is non\-zero), then (0, \*(Aq\*(Aq) is returned\&.
.RE
.PP
CheckContext\&.TryAction(\fIself\fR, \fIaction\fR, [\fItext\fR, \fIextension\fR])
.RS 4
Checks if the specified
\fIaction\fR
with an optional source file (contents
\fItext\fR
, extension
\fIextension\fR
= \*(Aq\*(Aq ) can be executed\&.
\fIaction\fR
may be anything which can be converted to a
\fBscons\fR
Action\&. On success,
\fI(1, outputStr)\fR
is returned, where
\fIoutputStr\fR
is the content of the target file\&. On failure
\fI(0, \*(Aq\*(Aq)\fR
is returned\&.
.RE
.PP
CheckContext\&.TryBuild(\fIself\fR, \fIbuilder\fR, [\fItext\fR, \fIextension\fR])
.RS 4
Low level implementation for testing specific builds; the methods above are based on this method\&. Given the Builder instance
\fIbuilder\fR
and the optional
\fItext\fR
of a source file with optional
\fIextension\fR, this method returns 1 on success and 0 on failure\&. In addition,
\fIself\&.lastTarget\fR
is set to the build target node, if the build was successful\&.
.RE
.PP
Example for implementing and using custom tests:
.sp
.if n \{\
.RS 4
.\}
.nf
def CheckQt(context, qtdir):
context\&.Message( \*(AqChecking for qt \&.\&.\&.\*(Aq )
lastLIBS = context\&.env[\*(AqLIBS\*(Aq]
lastLIBPATH = context\&.env[\*(AqLIBPATH\*(Aq]
lastCPPPATH= context\&.env[\*(AqCPPPATH\*(Aq]
context\&.env\&.Append(LIBS = \*(Aqqt\*(Aq, LIBPATH = qtdir + \*(Aq/lib\*(Aq, CPPPATH = qtdir + \*(Aq/include\*(Aq )
ret = context\&.TryLink("""
#include <qapp\&.h>
int main(int argc, char **argv) {
QApplication qapp(argc, argv);
return 0;
}
""")
if not ret:
context\&.env\&.Replace(LIBS = lastLIBS, LIBPATH=lastLIBPATH, CPPPATH=lastCPPPATH)
context\&.Result( ret )
return ret
env = Environment()
conf = Configure( env, custom_tests = { \*(AqCheckQt\*(Aq : CheckQt } )
if not conf\&.CheckQt(\*(Aq/usr/lib/qt\*(Aq):
print(\*(AqWe really need qt!\*(Aq)
Exit(1)
env = conf\&.Finish()
.fi
.if n \{\
.RE
.\}
.SS "Command\-Line Construction Variables"
.PP
Often when building software, some variables must be specified at build time\&. For example, libraries needed for the build may be in non\-standard locations, or site\-specific compiler options may need to be passed to the compiler\&.
\fBscons\fR
provides a
\fBVariables\fR
object to support overriding construction variables on the command line:
.sp
.if n \{\
.RS 4
.\}
.nf
$ scons VARIABLE=foo
.fi
.if n \{\
.RE
.\}
.PP
The variable values can also be specified in a text\-based SConscript file\&. To create a Variables object, call the Variables() function:
.PP
Variables([\fIfiles\fR], [\fIargs\fR])
.RS 4
This creates a Variables object that will read construction variables from the file or list of filenames specified in
\fIfiles\fR\&. If no files are specified, or the
\fIfiles\fR
argument is
\fBNone\fR, then no files will be read\&. The optional argument
\fIargs\fR
is a dictionary of values that will override anything read from the specified files; it is primarily intended to be passed the
\fBARGUMENTS\fR
dictionary that holds variables specified on the command line\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
vars = Variables(\*(Aqcustom\&.py\*(Aq)
vars = Variables(\*(Aqoverrides\&.py\*(Aq, ARGUMENTS)
vars = Variables(None, {FOO:\*(Aqexpansion\*(Aq, BAR:7})
.fi
.if n \{\
.RE
.\}
.sp
Variables objects have the following methods:
.RE
.PP
Add(\fIkey\fR, [\fIhelp\fR, \fIdefault\fR, \fIvalidator\fR, \fIconverter\fR])
.RS 4
This adds a customizable construction variable to the Variables object\&.
\fIkey\fR
is the name of the variable\&.
\fIhelp\fR
is the help text for the variable\&.
\fIdefault\fR
is the default value of the variable; if the default value is
\fBNone\fR
and there is no explicit value specified, the construction variable will
\fInot\fR
be added to the construction environment\&.
\fIvalidator\fR
is called to validate the value of the variable, and should take three arguments: key, value, and environment\&. The recommended way to handle an invalid value is to raise an exception (see example below)\&.
\fIconverter\fR
is called to convert the value before putting it in the environment, and should take either a value, or the value and environment, as parameters\&. The
\fIconverter\fR
must return a value, which will be converted into a string before being validated by the
\fIvalidator\fR
(if any) and then added to the environment\&.
.sp
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
vars\&.Add(\*(AqCC\*(Aq, \*(AqThe C compiler\*(Aq)
def validate_color(key, val, env):
if not val in [\*(Aqred\*(Aq, \*(Aqblue\*(Aq, \*(Aqyellow\*(Aq]:
raise Exception("Invalid color value \*(Aq%s\*(Aq" % val)
vars\&.Add(\*(AqCOLOR\*(Aq, validator=valid_color)
.fi
.if n \{\
.RE
.\}
.RE
.PP
AddVariables(\fIlist\fR)
.RS 4
A wrapper script that adds multiple customizable construction variables to a Variables object\&.
\fIlist\fR
is a list of tuple or list objects that contain the arguments for an individual call to the
\fBAdd\fR
method\&.
.sp
.if n \{\
.RS 4
.\}
.nf
opt\&.AddVariables(
(\*(Aqdebug\*(Aq, \*(Aq\*(Aq, 0),
(\*(AqCC\*(Aq, \*(AqThe C compiler\*(Aq),
(\*(AqVALIDATE\*(Aq, \*(AqAn option for testing validation\*(Aq,
\*(Aqnotset\*(Aq, validator, None),
)
.fi
.if n \{\
.RE
.\}
.RE
.PP
Update(\fIenv\fR, [\fIargs\fR])
.RS 4
This updates a construction environment
\fIenv\fR
with the customized construction variables\&. Any specified variables that are
\fInot\fR
configured for the Variables object will be saved and may be retrieved with the
\fBUnknownVariables\fR() method, below\&.
.sp
Normally this method is not called directly, but is called indirectly by passing the Variables object to the Environment() function:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(variables=vars)
.fi
.if n \{\
.RE
.\}
.RE
.PP
The text file(s) that were specified when the Variables object was created are executed as Python scripts, and the values of (global) Python variables set in the file are added to the construction environment\&.
.PP
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
CC = \*(Aqmy_cc\*(Aq
.fi
.if n \{\
.RE
.\}
.PP
UnknownVariables(\fI)\fR
.RS 4
Returns a dictionary containing any variables that were specified either in the files or the dictionary with which the Variables object was initialized, but for which the Variables object was not configured\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(variables=vars)
for key, value in vars\&.UnknownVariables():
print("unknown variable: %s=%s" % (key, value))
.fi
.if n \{\
.RE
.\}
.RE
.PP
Save(\fIfilename\fR, \fIenv\fR)
.RS 4
This saves the currently set variables into a script file named
\fIfilename\fR
that can be used on the next invocation to automatically load the current settings\&. This method combined with the Variables method can be used to support caching of variables between runs\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
vars = Variables([\*(Aqvariables\&.cache\*(Aq, \*(Aqcustom\&.py\*(Aq])
vars\&.Add(\&.\&.\&.)
vars\&.Update(env)
vars\&.Save(\*(Aqvariables\&.cache\*(Aq, env)
.fi
.if n \{\
.RE
.\}
.RE
.PP
GenerateHelpText(\fIenv\fR, [\fIsort\fR])
.RS 4
This generates help text documenting the customizable construction variables suitable to passing in to the Help() function\&.
\fIenv\fR
is the construction environment that will be used to get the actual values of customizable variables\&. Calling with an optional
\fIsort\fR
function will cause the output to be sorted by the specified argument\&. The specific
\fIsort\fR
function should take two arguments and return \-1, 0 or 1 (like the standard Python
\fIcmp\fR
function)\&. Optionally a Boolean value of True for
\fIsort\fR
will cause a standard alphabetical sort to be performed
.sp
.if n \{\
.RS 4
.\}
.nf
Help(vars\&.GenerateHelpText(env))
Help(vars\&.GenerateHelpText(env, sort=cmp))
.fi
.if n \{\
.RE
.\}
.RE
.PP
FormatVariableHelpText(\fIenv\fR, \fIopt\fR, \fIhelp\fR, \fIdefault\fR, \fIactual\fR)
.RS 4
This method returns a formatted string containing the printable help text for one option\&. It is normally not called directly, but is called by the
\fIGenerateHelpText\fR() method to create the returned help text\&. It may be overridden with your own function that takes the arguments specified above and returns a string of help text formatted to your liking\&. Note that the
\fIGenerateHelpText\fR() will not put any blank lines or extra characters in between the entries, so you must add those characters to the returned string if you want the entries separated\&.
.sp
.if n \{\
.RS 4
.\}
.nf
def my_format(env, opt, help, default, actual):
fmt = "\en%s: default=%s actual=%s (%s)\en"
return fmt % (opt, default\&. actual, help)
vars\&.FormatVariableHelpText = my_format
.fi
.if n \{\
.RE
.\}
.sp
To make it more convenient to work with customizable Variables,
\fBscons\fR
provides a number of functions that make it easy to set up various types of Variables:
.RE
.PP
BoolVariable(\fIkey\fR, \fIhelp\fR, \fIdefault\fR)
.RS 4
Return a tuple of arguments to set up a Boolean option\&. The option will use the specified name
\fIkey\fR, have a default value of
\fIdefault\fR, and display the specified
\fIhelp\fR
text\&. The option will interpret the values
\fBy\fR,
\fByes\fR,
\fBt\fR,
\fBtrue\fR,
1,
\fBon\fR
and
\fBall\fR
as true, and the values
\fBn\fR,
\fBno\fR,
\fBf\fR,
\fBfalse\fR,
0,
\fBoff\fR
and
\fBnone\fR
as false\&.
.RE
.PP
EnumVariable(\fIkey\fR, \fIhelp\fR, \fIdefault\fR, \fIallowed_values\fR, [\fImap\fR, \fIignorecase\fR])
.RS 4
Return a tuple of arguments to set up an option whose value may be one of a specified list of legal enumerated values\&. The option will use the specified name
\fIkey\fR, have a default value of
\fIdefault\fR, and display the specified
\fIhelp\fR
text\&. The option will only support those values in the
\fIallowed_values\fR
list\&. The optional
\fImap\fR
argument is a dictionary that can be used to convert input values into specific legal values in the
\fIallowed_values\fR
list\&. If the value of
\fIignore_case\fR
is
0
(the default), then the values are case\-sensitive\&. If the value of
\fIignore_case\fR
is
1, then values will be matched case\-insensitive\&. If the value of
\fIignore_case\fR
is
2, then values will be matched case\-insensitive, and all input values will be converted to lower case\&.
.RE
.PP
ListVariable(\fIkey\fR, \fIhelp\fR, \fIdefault\fR, \fInames\fR, [\fI,\fRmap\fI])\fR
.RS 4
Return a tuple of arguments to set up an option whose value may be one or more of a specified list of legal enumerated values\&. The option will use the specified name
\fIkey\fR, have a default value of
\fIdefault\fR, and display the specified
\fIhelp\fR
text\&. The option will only support the values
\fBall\fR,
\fBnone\fR, or the values in the
\fInames\fR
list\&. More than one value may be specified, with all values separated by commas\&. The default may be a string of comma\-separated default values, or a list of the default values\&. The optional
\fImap\fR
argument is a dictionary that can be used to convert input values into specific legal values in the
\fInames\fR
list\&.
.RE
.PP
PackageVariable(\fIkey\fR, \fIhelp\fR, \fIdefault\fR)
.RS 4
Return a tuple of arguments to set up an option whose value is a path name of a package that may be enabled, disabled or given an explicit path name\&. The option will use the specified name
\fIkey\fR, have a default value of
\fIdefault\fR, and display the specified
\fIhelp\fR
text\&. The option will support the values
\fByes\fR,
\fBtrue\fR,
\fBon\fR,
\fBenable\fR
or
\fBsearch\fR, in which case the specified
\fIdefault\fR
will be used, or the option may be set to an arbitrary string (typically the path name to a package that is being enabled)\&. The option will also support the values
\fBno\fR,
\fBfalse\fR,
\fBoff\fR
or
\fBdisable\fR
to disable use of the specified option\&.
.RE
.PP
PathVariable(\fIkey\fR, \fIhelp\fR, \fIdefault\fR, [\fIvalidator\fR])
.RS 4
Return a tuple of arguments to set up an option whose value is expected to be a path name\&. The option will use the specified name
\fIkey\fR, have a default value of
\fIdefault\fR, and display the specified
\fIhelp\fR
text\&. An additional
\fIvalidator\fR
may be specified that will be called to verify that the specified path is acceptable\&. SCons supplies the following ready\-made validators:
\fBPathVariable\&.PathExists\fR
(the default), which verifies that the specified path exists;
\fBPathVariable\&.PathIsFile\fR, which verifies that the specified path is an existing file;
\fBPathVariable\&.PathIsDir\fR, which verifies that the specified path is an existing directory;
\fBPathVariable\&.PathIsDirCreate\fR, which verifies that the specified path is a directory and will create the specified directory if the path does not exist; and
\fBPathVariable\&.PathAccept\fR, which simply accepts the specific path name argument without validation, and which is suitable if you want your users to be able to specify a directory path that will be created as part of the build process, for example\&. You may supply your own
\fIvalidator\fR
function, which must take three arguments (\fIkey\fR, the name of the variable to be set;
\fIval\fR, the specified value being checked; and
\fIenv\fR, the construction environment) and should raise an exception if the specified value is not acceptable\&.
.RE
.PP
These functions make it convenient to create a number of variables with consistent behavior in a single call to the
\fBAddVariables\fR
method:
.sp
.if n \{\
.RS 4
.\}
.nf
vars\&.AddVariables(
BoolVariable(\*(Aqwarnings\*(Aq, \*(Aqcompilation with \-Wall and similiar\*(Aq, 1),
EnumVariable(\*(Aqdebug\*(Aq, \*(Aqdebug output and symbols\*(Aq, \*(Aqno\*(Aq
allowed_values=(\*(Aqyes\*(Aq, \*(Aqno\*(Aq, \*(Aqfull\*(Aq),
map={}, ignorecase=0), # case sensitive
ListVariable(\*(Aqshared\*(Aq,
\*(Aqlibraries to build as shared libraries\*(Aq,
\*(Aqall\*(Aq,
names = list_of_libs),
PackageVariable(\*(Aqx11\*(Aq,
\*(Aquse X11 installed here (yes = search some places)\*(Aq,
\*(Aqyes\*(Aq),
PathVariable(\*(Aqqtdir\*(Aq, \*(Aqwhere the root of Qt is installed\*(Aq, qtdir),
PathVariable(\*(Aqfoopath\*(Aq, \*(Aqwhere the foo library is installed\*(Aq, foopath,
PathVariable\&.PathIsDir),
)
.fi
.if n \{\
.RE
.\}
.SS "File and Directory Nodes"
.PP
The
\fIFile\fR() and
\fIDir\fR() functions return
\fIFile\fR
and
\fIDir\fR
Nodes, respectively\&. Python objects, respectively\&. Those objects have several user\-visible attributes and methods that are often useful:
.PP
path
.RS 4
The build path of the given file or directory\&. This path is relative to the top\-level directory (where the
\fBSConstruct\fR
file is found)\&. The build path is the same as the source path if
\fIvariant_dir\fR
is not being used\&.
.RE
.PP
abspath
.RS 4
The absolute build path of the given file or directory\&.
.RE
.PP
srcnode()
.RS 4
The
\fIsrcnode\fR() method returns another
\fIFile\fR
or
\fIDir\fR
object representing the
\fIsource\fR
path of the given
\fIFile\fR
or
\fIDir\fR\&. The
.sp
.if n \{\
.RS 4
.\}
.nf
# Get the current build dir\*(Aqs path, relative to top\&.
Dir(\*(Aq\&.\*(Aq)\&.path
# Current dir\*(Aqs absolute path
Dir(\*(Aq\&.\*(Aq)\&.abspath
# Next line is always \*(Aq\&.\*(Aq, because it is the top dir\*(Aqs path relative to itself\&.
Dir(\*(Aq#\&.\*(Aq)\&.path
File(\*(Aqfoo\&.c\*(Aq)\&.srcnode()\&.path # source path of the given source file\&.
# Builders also return File objects:
foo = env\&.Program(\*(Aqfoo\&.c\*(Aq)
print("foo will be built in %s"%foo\&.path)
.fi
.if n \{\
.RE
.\}
.sp
A
\fIDir\fR
Node or
\fIFile\fR
Node can also be used to create file and subdirectory Nodes relative to the generating Node\&. A
\fIDir\fR
Node will place the new Nodes within the directory it represents\&. A
\fIFile\fR
node will place the new Nodes within its parent directory (that is, "beside" the file in question)\&. If
\fId\fR
is a
\fIDir\fR
(directory) Node and
\fIf\fR
is a
\fIFile\fR
(file) Node, then these methods are available:
.RE
.PP
\fId\fR\&.Dir(\fIname\fR)
.RS 4
Returns a directory Node for a subdirectory of
\fId\fR
named
\fIname\fR\&.
.RE
.PP
\fId\fR\&.File(\fIname\fR)
.RS 4
Returns a file Node for a file within
\fId\fR
named
\fIname\fR\&.
.RE
.PP
\fId\fR\&.Entry(\fIname\fR)
.RS 4
Returns an unresolved Node within
\fId\fR
named
\fIname\fR\&.
.RE
.PP
\fIf\fR\&.Dir(\fIname\fR)
.RS 4
Returns a directory named
\fIname\fR
within the parent directory of
\fIf\fR\&.
.RE
.PP
\fIf\fR\&.File(\fIname\fR)
.RS 4
Returns a file named
\fIname\fR
within the parent directory of
\fIf\fR\&.
.RE
.PP
\fIf\fR\&.Entry(\fIname\fR)
.RS 4
Returns an unresolved Node named
\fIname\fR
within the parent directory of
\fIf\fR\&.
.RE
.PP
For example:
.sp
.if n \{\
.RS 4
.\}
.nf
# Get a Node for a file within a directory
incl = Dir(\*(Aqinclude\*(Aq)
f = incl\&.File(\*(Aqheader\&.h\*(Aq)
# Get a Node for a subdirectory within a directory
dist = Dir(\*(Aqproject\-3\&.2\&.1\*(Aq)
src = dist\&.Dir(\*(Aqsrc\*(Aq)
# Get a Node for a file in the same directory
cfile = File(\*(Aqsample\&.c\*(Aq)
hfile = cfile\&.File(\*(Aqsample\&.h\*(Aq)
# Combined example
docs = Dir(\*(Aqdocs\*(Aq)
html = docs\&.Dir(\*(Aqhtml\*(Aq)
index = html\&.File(\*(Aqindex\&.html\*(Aq)
css = index\&.File(\*(Aqapp\&.css\*(Aq)
.fi
.if n \{\
.RE
.\}
.SH "EXTENDING SCONS"
.SS "Builder Objects"
.PP
\fBscons\fR
can be extended to build different types of targets by adding new Builder objects to a construction environment\&.
\fIIn general\fR, you should only need to add a new Builder object when you want to build a new type of file or other external target\&. If you just want to invoke a different compiler or other tool to build a Program, Object, Library, or any other type of output file for which
\fBscons\fR
already has an existing Builder, it is generally much easier to use those existing Builders in a construction environment that sets the appropriate construction variables (CC, LINK, etc\&.)\&.
.PP
Builder objects are created using the
\fBBuilder\fR
function\&. The
\fBBuilder\fR
function accepts the following arguments:
.PP
action
.RS 4
The command line string used to build the target from the source\&.
\fBaction\fR
can also be: a list of strings representing the command to be executed and its arguments (suitable for enclosing white space in an argument), a dictionary mapping source file name suffixes to any combination of command line strings (if the builder should accept multiple source file extensions), a Python function; an Action object (see the next section); or a list of any of the above\&.
.sp
An action function takes three arguments:
\fIsource\fR
\- a list of source nodes,
\fItarget\fR
\- a list of target nodes,
\fIenv\fR
\- the construction environment\&.
.RE
.PP
prefix
.RS 4
The prefix that will be prepended to the target file name\&. This may be specified as a:
*
\fIstring\fR,
.sp
*
\fIcallable object\fR
\- a function or other callable that takes two arguments (a construction environment and a list of sources) and returns a prefix,
.sp
*
\fIdictionary\fR
\- specifies a mapping from a specific source suffix (of the first source specified) to a corresponding target prefix\&. Both the source suffix and target prefix specifications may use environment variable substitution, and the target prefix (the \*(Aqvalue\*(Aq entries in the dictionary) may also be a callable object\&. The default target prefix may be indicated by a dictionary entry with a key value of None\&.
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
b = Builder("build_it < $SOURCE > $TARGET",
prefix = "file\-")
def gen_prefix(env, sources):
return "file\-" + env[\*(AqPLATFORM\*(Aq] + \*(Aq\-\*(Aq
b = Builder("build_it < $SOURCE > $TARGET",
prefix = gen_prefix)
b = Builder("build_it < $SOURCE > $TARGET",
suffix = { None: "file\-",
"$SRC_SFX_A": gen_prefix })
.fi
.if n \{\
.RE
.\}
.PP
suffix
.RS 4
The suffix that will be appended to the target file name\&. This may be specified in the same manner as the prefix above\&. If the suffix is a string, then
\fBscons\fR
will append a \*(Aq\&.\*(Aq to the beginning of the suffix if it\*(Aqs not already there\&. The string returned by callable object (or obtained from the dictionary) is untouched and must append its own \*(Aq\&.\*(Aq to the beginning if one is desired\&.
.sp
.if n \{\
.RS 4
.\}
.nf
b = Builder("build_it < $SOURCE > $TARGET"
suffix = "\-file")
def gen_suffix(env, sources):
return "\&." + env[\*(AqPLATFORM\*(Aq] + "\-file"
b = Builder("build_it < $SOURCE > $TARGET",
suffix = gen_suffix)
b = Builder("build_it < $SOURCE > $TARGET",
suffix = { None: "\&.sfx1",
"$SRC_SFX_A": gen_suffix })
.fi
.if n \{\
.RE
.\}
.RE
.PP
ensure_suffix
.RS 4
When set to any true value, causes
\fBscons\fR
to add the target suffix specified by the
\fIsuffix\fR
keyword to any target strings that have a different suffix\&. (The default behavior is to leave untouched any target file name that looks like it already has any suffix\&.)
.sp
.if n \{\
.RS 4
.\}
.nf
b1 = Builder("build_it < $SOURCE > $TARGET"
suffix = "\&.out")
b2 = Builder("build_it < $SOURCE > $TARGET"
suffix = "\&.out",
ensure_suffix)
env = Environment()
env[\*(AqBUILDERS\*(Aq][\*(AqB1\*(Aq] = b1
env[\*(AqBUILDERS\*(Aq][\*(AqB2\*(Aq] = b2
# Builds "foo\&.txt" because ensure_suffix is not set\&.
env\&.B1(\*(Aqfoo\&.txt\*(Aq, \*(Aqfoo\&.in\*(Aq)
# Builds "bar\&.txt\&.out" because ensure_suffix is set\&.
env\&.B2(\*(Aqbar\&.txt\*(Aq, \*(Aqbar\&.in\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
src_suffix
.RS 4
The expected source file name suffix\&. This may be a string or a list of strings\&.
.RE
.PP
target_scanner
.RS 4
A Scanner object that will be invoked to find implicit dependencies for this target file\&. This keyword argument should be used for Scanner objects that find implicit dependencies based only on the target file and the construction environment,
\fInot\fR
for implicit dependencies based on source files\&. (See the section "Scanner Objects" below, for information about creating Scanner objects\&.)
.RE
.PP
source_scanner
.RS 4
A Scanner object that will be invoked to find implicit dependencies in any source files used to build this target file\&. This is where you would specify a scanner to find things like
\fB#include\fR
lines in source files\&. The pre\-built
\fBDirScanner\fR
Scanner object may be used to indicate that this Builder should scan directory trees for on\-disk changes to files that
\fBscons\fR
does not know about from other Builder or function calls\&. (See the section "Scanner Objects" below, for information about creating your own Scanner objects\&.)
.RE
.PP
target_factory
.RS 4
A factory function that the Builder will use to turn any targets specified as strings into SCons Nodes\&. By default, SCons assumes that all targets are files\&. Other useful target_factory values include
\fBDir\fR, for when a Builder creates a directory target, and
\fBEntry\fR, for when a Builder can create either a file or directory target\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
MakeDirectoryBuilder = Builder(action=my_mkdir, target_factory=Dir)
env = Environment()
env\&.Append(BUILDERS = {\*(AqMakeDirectory\*(Aq:MakeDirectoryBuilder})
env\&.MakeDirectory(\*(Aqnew_directory\*(Aq, [])
.fi
.if n \{\
.RE
.\}
.sp
Note that the call to the MakeDirectory Builder needs to specify an empty source list to make the string represent the builder\*(Aqs target; without that, it would assume the argument is the source, and would try to deduce the target name from it, which in the absence of an automatically\-added prefix or suffix would lead to a matching target and source name and a circular dependency\&.
.RE
.PP
source_factory
.RS 4
A factory function that the Builder will use to turn any sources specified as strings into SCons Nodes\&. By default, SCons assumes that all source are files\&. Other useful source_factory values include
\fBDir\fR, for when a Builder uses a directory as a source, and
\fBEntry\fR, for when a Builder can use files or directories (or both) as sources\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
CollectBuilder = Builder(action=my_mkdir, source_factory=Entry)
env = Environment()
env\&.Append(BUILDERS = {\*(AqCollect\*(Aq:CollectBuilder})
env\&.Collect(\*(Aqarchive\*(Aq, [\*(Aqdirectory_name\*(Aq, \*(Aqfile_name\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
emitter
.RS 4
A function or list of functions to manipulate the target and source lists before dependencies are established and the target(s) are actually built\&.
\fBemitter\fR
can also be a string containing a construction variable to expand to an emitter function or list of functions, or a dictionary mapping source file suffixes to emitter functions\&. (Only the suffix of the first source file is used to select the actual emitter function from an emitter dictionary\&.)
.sp
An emitter function takes three arguments:
\fIsource\fR
\- a list of source nodes,
\fItarget\fR
\- a list of target nodes,
\fIenv\fR
\- the construction environment\&. An emitter must return a tuple containing two lists, the list of targets to be built by this builder, and the list of sources for this builder\&.
.sp
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
def e(target, source, env):
return (target + [\*(Aqfoo\&.foo\*(Aq], source + [\*(Aqfoo\&.src\*(Aq])
# Simple association of an emitter function with a Builder\&.
b = Builder("my_build < $TARGET > $SOURCE",
emitter = e)
def e2(target, source, env):
return (target + [\*(Aqbar\&.foo\*(Aq], source + [\*(Aqbar\&.src\*(Aq])
# Simple association of a list of emitter functions with a Builder\&.
b = Builder("my_build < $TARGET > $SOURCE",
emitter = [e, e2])
# Calling an emitter function through a construction variable\&.
env = Environment(MY_EMITTER = e)
b = Builder("my_build < $TARGET > $SOURCE",
emitter = \*(Aq$MY_EMITTER\*(Aq)
# Calling a list of emitter functions through a construction variable\&.
env = Environment(EMITTER_LIST = [e, e2])
b = Builder("my_build < $TARGET > $SOURCE",
emitter = \*(Aq$EMITTER_LIST\*(Aq)
# Associating multiple emitters with different file
# suffixes using a dictionary\&.
def e_suf1(target, source, env):
return (target + [\*(Aqanother_target_file\*(Aq], source)
def e_suf2(target, source, env):
return (target, source + [\*(Aqanother_source_file\*(Aq])
b = Builder("my_build < $TARGET > $SOURCE",
emitter = {\*(Aq\&.suf1\*(Aq : e_suf1,
\*(Aq\&.suf2\*(Aq : e_suf2})
.fi
.if n \{\
.RE
.\}
.RE
.PP
multi
.RS 4
Specifies whether this builder is allowed to be called multiple times for the same target file(s)\&. The default is 0, which means the builder can not be called multiple times for the same target file(s)\&. Calling a builder multiple times for the same target simply adds additional source files to the target; it is not allowed to change the environment associated with the target, specify additional environment overrides, or associate a different builder with the target\&.
.RE
.PP
env
.RS 4
A construction environment that can be used to fetch source code using this Builder\&. (Note that this environment is
\fInot\fR
used for normal builds of normal target files, which use the environment that was used to call the Builder for the target file\&.)
.RE
.PP
generator
.RS 4
A function that returns a list of actions that will be executed to build the target(s) from the source(s)\&. The returned action(s) may be an Action object, or anything that can be converted into an Action object (see the next section)\&.
.sp
The generator function takes four arguments:
\fIsource\fR
\- a list of source nodes,
\fItarget\fR
\- a list of target nodes,
\fIenv\fR
\- the construction environment,
\fIfor_signature\fR
\- a Boolean value that specifies whether the generator is being called for generating a build signature (as opposed to actually executing the command)\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
def g(source, target, env, for_signature):
return [["gcc", "\-c", "\-o"] + target + source]
b = Builder(generator=g)
.fi
.if n \{\
.RE
.\}
.sp
The
\fIgenerator\fR
and
\fIaction\fR
arguments must not both be used for the same Builder\&.
.RE
.PP
src_builder
.RS 4
Specifies a builder to use when a source file name suffix does not match any of the suffixes of the builder\&. Using this argument produces a multi\-stage builder\&.
.RE
.PP
single_source
.RS 4
Specifies that this builder expects exactly one source file per call\&. Giving more than one source file without target files results in implicitly calling the builder multiple times (once for each source given)\&. Giving multiple source files together with target files results in a UserError exception\&.
.RE
.PP
The
\fIgenerator\fR
and
\fIaction\fR
arguments must not both be used for the same Builder\&.
.PP
source_ext_match
.RS 4
When the specified
\fIaction\fR
argument is a dictionary, the default behavior when a builder is passed multiple source files is to make sure that the extensions of all the source files match\&. If it is legal for this builder to be called with a list of source files with different extensions, this check can be suppressed by setting
\fBsource_ext_match\fR
to
\fBNone\fR
or some other non\-true value\&. When
\fBsource_ext_match\fR
is disable,
\fBscons\fR
will use the suffix of the first specified source file to select the appropriate action from the
\fIaction\fR
dictionary\&.
.sp
In the following example, the setting of
\fBsource_ext_match\fR
prevents
\fBscons\fR
from exiting with an error due to the mismatched suffixes of
\fBfoo\&.in\fR
and
\fBfoo\&.extra\fR\&.
.sp
.if n \{\
.RS 4
.\}
.nf
b = Builder(action={\*(Aq\&.in\*(Aq : \*(Aqbuild $SOURCES > $TARGET\*(Aq},
source_ext_match = None)
env = Environment(BUILDERS = {\*(AqMyBuild\*(Aq:b})
env\&.MyBuild(\*(Aqfoo\&.out\*(Aq, [\*(Aqfoo\&.in\*(Aq, \*(Aqfoo\&.extra\*(Aq])
.fi
.if n \{\
.RE
.\}
.RE
.PP
env
.RS 4
A construction environment that can be used to fetch source code using this Builder\&. (Note that this environment is
\fInot\fR
used for normal builds of normal target files, which use the environment that was used to call the Builder for the target file\&.)
.sp
.if n \{\
.RS 4
.\}
.nf
b = Builder(action="build < $SOURCE > $TARGET")
env = Environment(BUILDERS = {\*(AqMyBuild\*(Aq : b})
env\&.MyBuild(\*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq, my_arg = \*(Aqxyzzy\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
chdir
.RS 4
A directory from which scons will execute the action(s) specified for this Builder\&. If the
\fBchdir\fR
argument is a string or a directory Node, scons will change to the specified directory\&. If the
\fBchdir\fR
is not a string or Node and is non\-zero, then scons will change to the target file\*(Aqs directory\&.
.sp
Note that scons will
\fInot\fR
automatically modify its expansion of construction variables like
\fB$TARGET\fR
and
\fB$SOURCE\fR
when using the chdir keyword argument\-\-that is, the expanded file names will still be relative to the top\-level SConstruct directory, and consequently incorrect relative to the chdir directory\&. Builders created using chdir keyword argument, will need to use construction variable expansions like
\fB${TARGET\&.file}\fR
and
\fB${SOURCE\&.file}\fR
to use just the filename portion of the targets and source\&.
.sp
.if n \{\
.RS 4
.\}
.nf
b = Builder(action="build < ${SOURCE\&.file} > ${TARGET\&.file}",
chdir=1)
env = Environment(BUILDERS = {\*(AqMyBuild\*(Aq : b})
env\&.MyBuild(\*(Aqsub/dir/foo\&.out\*(Aq, \*(Aqsub/dir/foo\&.in\*(Aq)
.fi
.if n \{\
.RE
.\}
.sp
\fBWARNING:\fR
Python only keeps one current directory location for all of the threads\&. This means that use of the
\fBchdir\fR
argument will
\fInot\fR
work with the SCons
\fB\-j\fR
option, because individual worker threads spawned by SCons interfere with each other when they start changing directory\&.
.RE
.PP
Any additional keyword arguments supplied when a Builder object is created (that is, when the Builder() function is called) will be set in the executing construction environment when the Builder object is called\&. The canonical example here would be to set a construction variable to the repository of a source code system\&.
.PP
Any additional keyword arguments supplied when a Builder
\fIobject\fR
is called will only be associated with the target created by that particular Builder call (and any other files built as a result of the call)\&.
.PP
These extra keyword arguments are passed to the following functions: command generator functions, function Actions, and emitter functions\&.
.SS "Action Objects"
.PP
The
\fBBuilder\fR() function will turn its
\fBaction\fR
keyword argument into an appropriate internal Action object\&. You can also explicitly create Action objects using the
\fBAction\fR() global function, which can then be passed to the
\fBBuilder\fR() function\&. This can be used to configure an Action object more flexibly, or it may simply be more efficient than letting each separate Builder object create a separate Action when multiple Builder objects need to do the same thing\&.
.PP
The
\fBAction\fR() global function returns an appropriate object for the action represented by the type of the first argument:
.PP
Action
.RS 4
If the first argument is already an Action object, the object is simply returned\&.
.RE
.PP
String
.RS 4
If the first argument is a string, a command\-line Action is returned\&. Note that the command\-line string may be preceded by an
\fB@\fR
(at\-sign) to suppress printing of the specified command line, or by a
\fB\-\fR
(hyphen) to ignore the exit status from the specified command:
.sp
.if n \{\
.RS 4
.\}
.nf
Action(\*(Aq$CC \-c \-o $TARGET $SOURCES\*(Aq)
# Doesn\*(Aqt print the line being executed\&.
Action(\*(Aq@build $TARGET $SOURCES\*(Aq)
# Ignores return value
Action(\*(Aq\-build $TARGET $SOURCES\*(Aq)
.fi
.if n \{\
.RE
.\}
.RE
.PP
List
.RS 4
If the first argument is a list, then a list of Action objects is returned\&. An Action object is created as necessary for each element in the list\&. If an element
\fIwithin\fR
the list is itself a list, the internal list is the command and arguments to be executed via the command line\&. This allows white space to be enclosed in an argument by defining a command in a list within a list:
.sp
.if n \{\
.RS 4
.\}
.nf
Action([[\*(Aqcc\*(Aq, \*(Aq\-c\*(Aq, \*(Aq\-DWHITE SPACE\*(Aq, \*(Aq\-o\*(Aq, \*(Aq$TARGET\*(Aq, \*(Aq$SOURCES\*(Aq]])
.fi
.if n \{\
.RE
.\}
.RE
.PP
Function
.RS 4
If the first argument is a Python function, a function Action is returned\&. The Python function must take three keyword arguments,
\fBtarget\fR
(a Node object representing the target file),
\fBsource\fR
(a Node object representing the source file) and
\fBenv\fR
(the construction environment used for building the target file)\&. The
\fBtarget\fR
and
\fBsource\fR
arguments may be lists of Node objects if there is more than one target file or source file\&. The actual target and source file name(s) may be retrieved from their Node objects via the built\-in Python
\fBstr\fR
function:
.sp
.if n \{\
.RS 4
.\}
.nf
target_file_name = str(target)
source_file_names = [str(x) for x in source]
.fi
.if n \{\
.RE
.\}
.sp
The function should return
0
or
\fBNone\fR
to indicate a successful build of the target file(s)\&. The function may raise an exception or return a non\-zero exit status to indicate an unsuccessful build\&.
.sp
.if n \{\
.RS 4
.\}
.nf
def build_it(target = None, source = None, env = None):
# build the target from the source
return 0
a = Action(build_it)
.fi
.if n \{\
.RE
.\}
.sp
If the action argument is not one of the above, None is returned\&.
.RE
.PP
The second argument is optional and is used to define the output which is printed when the Action is actually performed\&. In the absence of this parameter, or if it\*(Aqs an empty string, a default output depending on the type of the action is used\&. For example, a command\-line action will print the executed command\&. The argument must be either a Python function or a string\&.
.PP
In the first case, it\*(Aqs a function that returns a string to be printed to describe the action being executed\&. The function may also be specified by the
\fIstrfunction\fR= keyword argument\&. Like a function to build a file, this function must take three keyword arguments:
\fBtarget\fR
(a Node object representing the target file),
\fBsource\fR
(a Node object representing the source file) and
\fBenv\fR
(a construction environment)\&. The
\fBtarget\fR
and
\fBsource\fR
arguments may be lists of Node objects if there is more than one target file or source file\&.
.PP
In the second case, you provide the string itself\&. The string may also be specified by the
\fIcmdstr\fR= keyword argument\&. The string typically contains variables, notably $TARGET(S) and $SOURCE(S), or consists of just a single variable, which is optionally defined somewhere else\&. SCons itself heavily uses the latter variant\&.
.PP
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
def build_it(target, source, env):
# build the target from the source
return 0
def string_it(target, source, env):
return "building \*(Aq%s\*(Aq from \*(Aq%s\*(Aq" % (target[0], source[0])
# Use a positional argument\&.
f = Action(build_it, string_it)
s = Action(build_it, "building \*(Aq$TARGET\*(Aq from \*(Aq$SOURCE\*(Aq")
# Alternatively, use a keyword argument\&.
f = Action(build_it, strfunction=string_it)
s = Action(build_it, cmdstr="building \*(Aq$TARGET\*(Aq from \*(Aq$SOURCE\*(Aq")
# You can provide a configurable variable\&.
l = Action(build_it, \*(Aq$STRINGIT\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
The third and succeeding arguments, if present, may either be a construction variable or a list of construction variables whose values will be included in the signature of the Action when deciding whether a target should be rebuilt because the action changed\&. The variables may also be specified by a
\fIvarlist\fR= keyword parameter; if both are present, they are combined\&. This is necessary whenever you want a target to be rebuilt when a specific construction variable changes\&. This is not often needed for a string action, as the expanded variables will normally be part of the command line, but may be needed if a Python function action uses the value of a construction variable when generating the command line\&.
.sp
.if n \{\
.RS 4
.\}
.nf
def build_it(target, source, env):
# build the target from the \*(AqXXX\*(Aq construction variable
open(target[0], \*(Aqw\*(Aq)\&.write(env[\*(AqXXX\*(Aq])
return 0
# Use positional arguments\&.
a = Action(build_it, \*(Aq$STRINGIT\*(Aq, [\*(AqXXX\*(Aq])
# Alternatively, use a keyword argument\&.
a = Action(build_it, varlist=[\*(AqXXX\*(Aq])
.fi
.if n \{\
.RE
.\}
.PP
The
Action
global function can be passed the following optional keyword arguments to modify the Action object\*(Aqs behavior:
.PP
\fIchdir\fR
specifies that scons will execute the action after changing to the specified directory\&. If the
\fBchdir\fR
argument is a string or a directory Node, scons will change to the specified directory\&. If the
\fBchdir\fR
argument is not a string or Node and is non\-zero, then scons will change to the target file\*(Aqs directory\&.
.PP
Note that scons will
\fInot\fR
automatically modify its expansion of construction variables like
\fB$TARGET\fR
and
\fB$SOURCE\fR
when using the chdir keyword argument\-\-that is, the expanded file names will still be relative to the top\-level SConstruct directory, and consequently incorrect relative to the chdir directory\&. Builders created using chdir keyword argument, will need to use construction variable expansions like
\fB${TARGET\&.file}\fR
and
\fB${SOURCE\&.file}\fR
to use just the filename portion of the targets and source\&.
.sp
.if n \{\
.RS 4
.\}
.nf
a = Action("build < ${SOURCE\&.file} > ${TARGET\&.file}",
chdir=1)
.fi
.if n \{\
.RE
.\}
.PP
\fIexitstatfunc\fR
specifies a function that is passed the exit status (or return value) from the specified action and can return an arbitrary or modified value\&. This can be used, for example, to specify that an Action object\*(Aqs return value should be ignored under special conditions and SCons should, therefore, consider that the action always suceeds:
.sp
.if n \{\
.RS 4
.\}
.nf
def always_succeed(s):
# Always return 0, which indicates success\&.
return 0
a = Action("build < ${SOURCE\&.file} > ${TARGET\&.file}",
exitstatfunc=always_succeed)
.fi
.if n \{\
.RE
.\}
.PP
\fIbatch_key\fR
specifies that the Action can create multiple target files by processing multiple independent source files simultaneously\&. (The canonical example is "batch compilation" of multiple object files by passing multiple source files to a single invocation of a compiler such as Microsoft\*(Aqs Visual C / C++ compiler\&.) If the
\fBbatch_key\fR
argument evaluates True and is not a callable object, the configured Action object will cause
\fBscons\fR
to collect all targets built with the Action object and configured with the same construction environment into single invocations of the Action object\*(Aqs command line or function\&. Command lines will typically want to use the
\fBCHANGED_SOURCES\fR
construction variable (and possibly
\fBCHANGED_TARGETS\fR
as well) to only pass to the command line those sources that have actually changed since their targets were built\&.
.PP
Example:
.sp
.if n \{\
.RS 4
.\}
.nf
a = Action(\*(Aqbuild $CHANGED_SOURCES\*(Aq, batch_key=True)
.fi
.if n \{\
.RE
.\}
.PP
The
\fBbatch_key\fR
argument may also be a callable function that returns a key that will be used to identify different "batches" of target files to be collected for batch building\&. A
\fBbatch_key\fR
function must accept the following arguments:
.PP
action
.RS 4
The action object\&.
.RE
.PP
env
.RS 4
The construction environment configured for the target\&.
.RE
.PP
target
.RS 4
The list of targets for a particular configured action\&.
.RE
.PP
source
.RS 4
The list of source for a particular configured action\&.
.sp
The returned key should typically be a tuple of values derived from the arguments, using any appropriate logic to decide how multiple invocations should be batched\&. For example, a
\fBbatch_key\fR
function may decide to return the value of a specific construction variable from the
\fBenv\fR
argument which will cause
\fBscons\fR
to batch\-build targets with matching values of that variable, or perhaps return the
\fBid\fR() of the entire construction environment, in which case
\fBscons\fR
will batch\-build all targets configured with the same construction environment\&. Returning
\fBNone\fR
indicates that the particular target should
\fInot\fR
be part of any batched build, but instead will be built by a separate invocation of action\*(Aqs command or function\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
def batch_key(action, env, target, source):
tdir = target[0]\&.dir
if tdir\&.name == \*(Aqspecial\*(Aq:
# Don\*(Aqt batch\-build any target
# in the special/ subdirectory\&.
return None
return (id(action), id(env), tdir)
a = Action(\*(Aqbuild $CHANGED_SOURCES\*(Aq, batch_key=batch_key)
.fi
.if n \{\
.RE
.\}
.RE
.SS "Miscellaneous Action Functions"
.PP
\fBscons\fR
supplies a number of functions that arrange for various common file and directory manipulations to be performed\&. These are similar in concept to "tasks" in the Ant build tool, although the implementation is slightly different\&. These functions do not actually perform the specified action at the time the function is called, but instead return an Action object that can be executed at the appropriate time\&. (In Object\-Oriented terminology, these are actually Action
\fIFactory\fR
functions that return Action objects\&.)
.PP
In practice, there are two natural ways that these Action Functions are intended to be used\&.
.PP
First, if you need to perform the action at the time the SConscript file is being read, you can use the
\fBExecute\fR
global function to do so:
.sp
.if n \{\
.RS 4
.\}
.nf
Execute(Touch(\*(Aqfile\*(Aq))
.fi
.if n \{\
.RE
.\}
.PP
Second, you can use these functions to supply Actions in a list for use by the
\fBCommand\fR
method\&. This can allow you to perform more complicated sequences of file manipulation without relying on platform\-specific external commands:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(TMPBUILD = \*(Aq/tmp/builddir\*(Aq)
env\&.Command(\*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq,
[Mkdir(\*(Aq$TMPBUILD\*(Aq),
Copy(\*(Aq$TMPBUILD\*(Aq, \*(Aq${SOURCE\&.dir}\*(Aq),
"cd $TMPBUILD && make",
Delete(\*(Aq$TMPBUILD\*(Aq)])
.fi
.if n \{\
.RE
.\}
.PP
Chmod(\fIdest\fR, \fImode\fR)
.RS 4
Returns an Action object that changes the permissions on the specified
\fIdest\fR
file or directory to the specified
\fImode\fR
which can be octal or string, similar to the bash command\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Execute(Chmod(\*(Aqfile\*(Aq, 0o755))
env\&.Command(\*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq,
[Copy(\*(Aq$TARGET\*(Aq, \*(Aq$SOURCE\*(Aq),
Chmod(\*(Aq$TARGET\*(Aq, 0o755)])
Execute(Chmod(\*(Aqfile\*(Aq, "ugo+w"))
env\&.Command(\*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq,
[Copy(\*(Aq$TARGET\*(Aq, \*(Aq$SOURCE\*(Aq),
Chmod(\*(Aq$TARGET\*(Aq, "ugo+w")])
.fi
.if n \{\
.RE
.\}
.RE
.PP
Copy(\fIdest\fR, \fIsrc\fR)
.RS 4
Returns an Action object that will copy the
\fIsrc\fR
source file or directory to the
\fIdest\fR
destination file or directory\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Execute(Copy(\*(Aqfoo\&.output\*(Aq, \*(Aqfoo\&.input\*(Aq))
env\&.Command(\*(Aqbar\&.out\*(Aq, \*(Aqbar\&.in\*(Aq,
Copy(\*(Aq$TARGET\*(Aq, \*(Aq$SOURCE\*(Aq))
.fi
.if n \{\
.RE
.\}
.RE
.PP
Delete(\fIentry\fR, [\fImust_exist\fR])
.RS 4
Returns an Action that deletes the specified
\fIentry\fR, which may be a file or a directory tree\&. If a directory is specified, the entire directory tree will be removed\&. If the
\fImust_exist\fR
flag is set, then a Python error will be thrown if the specified entry does not exist; the default is
\fBmust_exist=0\fR, that is, the Action will silently do nothing if the entry does not exist\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Execute(Delete(\*(Aq/tmp/buildroot\*(Aq))
env\&.Command(\*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq,
[Delete(\*(Aq${TARGET\&.dir}\*(Aq),
MyBuildAction])
Execute(Delete(\*(Aqfile_that_must_exist\*(Aq, must_exist=1))
.fi
.if n \{\
.RE
.\}
.RE
.PP
Mkdir(\fIdir\fR)
.RS 4
Returns an Action that creates the specified directory
\fIdir \&.\fR
Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Execute(Mkdir(\*(Aq/tmp/outputdir\*(Aq))
env\&.Command(\*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq,
[Mkdir(\*(Aq/tmp/builddir\*(Aq),
Copy(\*(Aq/tmp/builddir/foo\&.in\*(Aq, \*(Aq$SOURCE\*(Aq),
"cd /tmp/builddir && make",
Copy(\*(Aq$TARGET\*(Aq, \*(Aq/tmp/builddir/foo\&.out\*(Aq)])
.fi
.if n \{\
.RE
.\}
.RE
.PP
Move(\fIdest\fR, \fIsrc\fR)
.RS 4
Returns an Action that moves the specified
\fIsrc\fR
file or directory to the specified
\fIdest\fR
file or directory\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Execute(Move(\*(Aqfile\&.destination\*(Aq, \*(Aqfile\&.source\*(Aq))
env\&.Command(\*(Aqoutput_file\*(Aq, \*(Aqinput_file\*(Aq,
[MyBuildAction,
Move(\*(Aq$TARGET\*(Aq, \*(Aqfile_created_by_MyBuildAction\*(Aq)])
.fi
.if n \{\
.RE
.\}
.RE
.PP
Touch(\fIfile\fR)
.RS 4
Returns an Action that updates the modification time on the specified
\fIfile\fR\&. Examples:
.sp
.if n \{\
.RS 4
.\}
.nf
Execute(Touch(\*(Aqfile_to_be_touched\*(Aq))
env\&.Command(\*(Aqmarker\*(Aq, \*(Aqinput_file\*(Aq,
[MyBuildAction,
Touch(\*(Aq$TARGET\*(Aq)])
.fi
.if n \{\
.RE
.\}
.RE
.SS "Variable Substitution"
.PP
Before executing a command,
\fBscons\fR
performs construction variable interpolation on the string that makes up the command line of the builder\&. Variables are introduced in such strings by a
$
prefix\&. Besides regular construction variables, scons provides the following special variables for each command execution:
.PP
CHANGED_SOURCES
.RS 4
The file names of all sources of the build command that have changed since the target was last built\&.
.RE
.PP
CHANGED_TARGETS
.RS 4
The file names of all targets that would be built from sources that have changed since the target was last built\&.
.RE
.PP
SOURCE
.RS 4
The file name of the source of the build command, or the file name of the first source if multiple sources are being built\&.
.RE
.PP
SOURCES
.RS 4
The file names of the sources of the build command\&.
.RE
.PP
TARGET
.RS 4
The file name of the target being built, or the file name of the first target if multiple targets are being built\&.
.RE
.PP
TARGETS
.RS 4
The file names of all targets being built\&.
.RE
.PP
UNCHANGED_SOURCES
.RS 4
The file names of all sources of the build command that have
\fInot\fR
changed since the target was last built\&.
.RE
.PP
UNCHANGED_TARGETS
.RS 4
The file names of all targets that would be built from sources that have
\fInot\fR
changed since the target was last built\&.
.RE
.PP
Note that the above variables are reserved and may not be set in a construction environment\&.
.PP
For example, given the construction variables
CC=\*(Aqcc\*(Aq,
targets=[\*(Aqfoo\*(Aq]
and
sources=[\*(Aqfoo\&.c\*(Aq, \*(Aqbar\&.c\*(Aq]:
.sp
.if n \{\
.RS 4
.\}
.nf
action=\*(Aq$CC \-c \-o $TARGET $SOURCES\*(Aq
.fi
.if n \{\
.RE
.\}
.PP
would produce the command line:
.sp
.if n \{\
.RS 4
.\}
.nf
cc \-c \-o foo foo\&.c bar\&.c
.fi
.if n \{\
.RE
.\}
.PP
Variable names may be surrounded by curly braces
\fB{ }\fR
to separate the name from surrounding characters which are not part of the name\&. Within the curly braces, a variable name may have a Python slice subscript appended to select one or more items from a list\&. In the previous example, the string:
.sp
.if n \{\
.RS 4
.\}
.nf
${SOURCES[1]}
.fi
.if n \{\
.RE
.\}
.PP
would produce:
.sp
.if n \{\
.RS 4
.\}
.nf
bar\&.c
.fi
.if n \{\
.RE
.\}
.PP
Additionally, a variable name may have the following special modifiers appended within the enclosing curly braces to modify the interpolated string:
.PP
base
.RS 4
The base path of the file name, including the directory path but excluding any suffix\&.
.RE
.PP
dir
.RS 4
The name of the directory in which the file exists\&.
.RE
.PP
file
.RS 4
The file name, minus any directory portion\&.
.RE
.PP
filebase
.RS 4
Just the basename of the file, minus any suffix and minus the directory\&.
.RE
.PP
suffix
.RS 4
Just the file suffix\&.
.RE
.PP
abspath
.RS 4
The absolute path name of the file\&.
.RE
.PP
posix
.RS 4
The POSIX form of the path, with directories separated by
\fB/\fR
(forward slashes) not backslashes\&. This is sometimes necessary on Windows systems when a path references a file on other (POSIX) systems\&.
.RE
.PP
srcpath
.RS 4
The directory and file name to the source file linked to this file through
\fBVariantDir\fR()\&. If this file isn\*(Aqt linked, it just returns the directory and filename unchanged\&.
.RE
.PP
srcdir
.RS 4
The directory containing the source file linked to this file through
\fBVariantDir\fR()\&. If this file isn\*(Aqt linked, it just returns the directory part of the filename\&.
.RE
.PP
rsrcpath
.RS 4
The directory and file name to the source file linked to this file through
\fBVariantDir\fR()\&. If the file does not exist locally but exists in a Repository, the path in the Repository is returned\&. If this file isn\*(Aqt linked, it just returns the directory and filename unchanged\&.
.RE
.PP
rsrcdir
.RS 4
The Repository directory containing the source file linked to this file through
\fBVariantDir\fR()\&. If this file isn\*(Aqt linked, it just returns the directory part of the filename\&.
.RE
.PP
For example, the specified target will expand as follows for the corresponding modifiers:
.sp
.if n \{\
.RS 4
.\}
.nf
$TARGET => sub/dir/file\&.x
${TARGET\&.base} => sub/dir/file
${TARGET\&.dir} => sub/dir
${TARGET\&.file} => file\&.x
${TARGET\&.filebase} => file
${TARGET\&.suffix} => \&.x
${TARGET\&.abspath} => /top/dir/sub/dir/file\&.x
SConscript(\*(Aqsrc/SConscript\*(Aq, variant_dir=\*(Aqsub/dir\*(Aq)
$SOURCE => sub/dir/file\&.x
${SOURCE\&.srcpath} => src/file\&.x
${SOURCE\&.srcdir} => src
Repository(\*(Aq/usr/repository\*(Aq)
$SOURCE => sub/dir/file\&.x
${SOURCE\&.rsrcpath} => /usr/repository/src/file\&.x
${SOURCE\&.rsrcdir} => /usr/repository/src
.fi
.if n \{\
.RE
.\}
.PP
Note that curly braces braces may also be used to enclose arbitrary Python code to be evaluated\&. (In fact, this is how the above modifiers are substituted, they are simply attributes of the Python objects that represent TARGET, SOURCES, etc\&.) See the section "Python Code Substitution" below, for more thorough examples of how this can be used\&.
.PP
Lastly, a variable name may be a callable Python function associated with a construction variable in the environment\&. The function should accept four arguments:
.PP
\fItarget\fR
.RS 4
a list of target nodes
.RE
.PP
\fIsource\fR
.RS 4
a list of source nodes
.RE
.PP
\fIenv\fR
.RS 4
the construction environment
.RE
.PP
\fIfor_signature\fR
.RS 4
a Boolean value that specifies whether the function is being called for generating a build signature\&.
.RE
.PP
SCons will insert whatever the called function returns into the expanded string:
.sp
.if n \{\
.RS 4
.\}
.nf
def foo(target, source, env, for_signature):
return "bar"
# Will expand $BAR to "bar baz"
env=Environment(FOO=foo, BAR="$FOO baz")
.fi
.if n \{\
.RE
.\}
.PP
You can use this feature to pass arguments to a Python function by creating a callable class that stores one or more arguments in an object, and then uses them when the
\fB__call__()\fR
method is called\&. Note that in this case, the entire variable expansion must be enclosed by curly braces so that the arguments will be associated with the instantiation of the class:
.sp
.if n \{\
.RS 4
.\}
.nf
class foo(object):
def __init__(self, arg):
self\&.arg = arg
def __call__(self, target, source, env, for_signature):
return self\&.arg + " bar"
# Will expand $BAR to "my argument bar baz"
env=Environment(FOO=foo, BAR="${FOO(\*(Aqmy argument\*(Aq)} baz")
.fi
.if n \{\
.RE
.\}
.PP
The special pseudo\-variables
\fB$(\fR
and
\fB$)\fR
may be used to surround parts of a command line that may change
\fIwithout\fR
causing a rebuild\-\-that is, which are not included in the signature of target files built with this command\&. All text between
\fB$(\fR
and
\fB$)\fR
will be removed from the command line before it is added to file signatures, and the
\fB$(\fR
and
\fB$)\fR
will be removed before the command is executed\&. For example, the command line:
.sp
.if n \{\
.RS 4
.\}
.nf
echo Last build occurred $( $TODAY $)\&. > $TARGET
.fi
.if n \{\
.RE
.\}
.PP
would execute the command:
.sp
.if n \{\
.RS 4
.\}
.nf
echo Last build occurred $TODAY\&. > $TARGET
.fi
.if n \{\
.RE
.\}
.PP
but the command signature added to any target files would be:
.sp
.if n \{\
.RS 4
.\}
.nf
echo Last build occurred \&. > $TARGET
.fi
.if n \{\
.RE
.\}
.SS "Python Code Substitution"
.PP
Any Python code within curly braces
\fB{ }\fR
and introduced by the variable prefix
\fB$\fR
gets evaluated by the Python
\fBeval\fR
statement, with the Python globals set to the current environment\*(Aqs set of construction variables\&. So in the following case:
.sp
.if n \{\
.RS 4
.\}
.nf
env[\*(AqCOND\*(Aq] = 0
env\&.Command(\*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq,
\*(Aq\*(Aq\*(Aqecho ${COND==1 and \*(AqFOO\*(Aq or \*(AqBAR\*(Aq} > $TARGET\*(Aq\*(Aq\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
the command executed will be either
.sp
.if n \{\
.RS 4
.\}
.nf
echo FOO > foo\&.out
.fi
.if n \{\
.RE
.\}
.PP
or
.sp
.if n \{\
.RS 4
.\}
.nf
echo BAR > foo\&.out
.fi
.if n \{\
.RE
.\}
.PP
according to the current value of
env[\*(AqCOND\*(Aq]
when the command is executed\&. The evaluation takes place when the target is being built, not when the SConscript is being read\&. So if
env[\*(AqCOND\*(Aq]
is changed later in the SConscript, the final value will be used\&.
.PP
Here\*(Aqs a more interesting example\&. Note that all of
\fBCOND\fR,
\fBFOO\fR, and
\fBBAR\fR
are construction variables, and their values are substituted into the final command\&.
\fBFOO\fR
is a list, so its elements are interpolated separated by spaces\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env=Environment()
env[\*(AqCOND\*(Aq] = 0
env[\*(AqFOO\*(Aq] = [\*(Aqfoo1\*(Aq, \*(Aqfoo2\*(Aq]
env[\*(AqBAR\*(Aq] = \*(Aqbarbar\*(Aq
env\&.Command(\*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq,
\*(Aqecho ${COND==1 and FOO or BAR} > $TARGET\*(Aq)
# Will execute this:
# echo foo1 foo2 > foo\&.out
.fi
.if n \{\
.RE
.\}
.PP
SCons uses the following rules when converting construction variables into command lines:
.PP
String
.RS 4
When the value is a string it is interpreted as a space delimited list of command line arguments\&.
.RE
.PP
List
.RS 4
When the value is a list it is interpreted as a list of command line arguments\&. Each element of the list is converted to a string\&.
.RE
.PP
Other
.RS 4
Anything that is not a list or string is converted to a string and interpreted as a single command line argument\&.
.RE
.PP
Newline
.RS 4
Newline characters (\en) delimit lines\&. The newline parsing is done after all other parsing, so it is not possible for arguments (e\&.g\&. file names) to contain embedded newline characters\&. This limitation will likely go away in a future version of SCons\&.
.RE
.SS "Scanner Objects"
.PP
You can use the
\fBScanner\fR
function to define objects to scan new file types for implicit dependencies\&. The
\fBScanner\fR
function accepts the following arguments:
.PP
function
.RS 4
This can be either: 1) a Python function that will process the Node (file) and return a list of File Nodes representing the implicit dependencies (file names) found in the contents; or: 2) a dictionary that maps keys (typically the file suffix, but see below for more discussion) to other Scanners that should be called\&.
.sp
If the argument is actually a Python function, the function must take three or four arguments:
.sp
def scanner_function(node, env, path):
.sp
def scanner_function(node, env, path, arg=None):
.sp
The
\fBnode\fR
argument is the internal SCons node representing the file\&. Use
\fBstr(node)\fR
to fetch the name of the file, and
\fBnode\&.get_contents()\fR
to fetch contents of the file\&. Note that the file is
\fInot\fR
guaranteed to exist before the scanner is called, so the scanner function should check that if there\*(Aqs any chance that the scanned file might not exist (for example, if it\*(Aqs built from other files)\&.
.sp
The
\fBenv\fR
argument is the construction environment for the scan\&. Fetch values from it using the
\fBenv\&.Dictionary()\fR
method or using the key lookup operator directly on the construction environment\&.
.sp
The
\fBpath\fR
argument is a tuple (or list) of directories that can be searched for files\&. This will usually be the tuple returned by the
\fBpath_function\fR
argument (see below)\&.
.sp
The
\fBarg\fR
argument is the argument supplied when the scanner was created, if any\&.
.RE
.PP
name
.RS 4
The name of the Scanner\&. This is mainly used to identify the Scanner internally\&.
.RE
.PP
argument
.RS 4
An optional argument that, if specified, will be passed to the scanner function (described above) and the path function (specified below)\&.
.RE
.PP
skeys
.RS 4
An optional list that can be used to determine which scanner should be used for a given Node\&. In the usual case of scanning for file names, this argument will be a list of suffixes for the different file types that this Scanner knows how to scan\&. If the argument is a string, then it will be expanded into a list by the current environment\&.
.RE
.PP
path_function
.RS 4
A Python function that takes four or five arguments: a construction environment, a Node for the directory containing the SConscript file in which the first target was defined, a list of target nodes, a list of source nodes, and an optional argument supplied when the scanner was created\&. The
\fBpath_function\fR
returns a tuple of directories that can be searched for files to be returned by this Scanner object\&. (Note that the
\fBFindPathDirs\fR() function can be used to return a ready\-made
\fBpath_function\fR
for a given construction variable name, instead of having to write your own function from scratch\&.)
.RE
.PP
node_class
.RS 4
The class of Node that should be returned by this Scanner object\&. Any strings or other objects returned by the scanner function that are not of this class will be run through the
\fBnode_factory\fR
function\&.
.RE
.PP
node_factory
.RS 4
A Python function that will take a string or other object and turn it into the appropriate class of Node to be returned by this Scanner object\&.
.RE
.PP
scan_check
.RS 4
An optional Python function that takes two arguments, a Node (file) and a construction environment, and returns whether the Node should, in fact, be scanned for dependencies\&. This check can be used to eliminate unnecessary calls to the scanner function when, for example, the underlying file represented by a Node does not yet exist\&.
.RE
.PP
recursive
.RS 4
An optional flag that specifies whether this scanner should be re\-invoked on the dependency files returned by the scanner\&. When this flag is not set, the Node subsystem will only invoke the scanner on the file being scanned, and not (for example) also on the files specified by the #include lines in the file being scanned\&.
\fIrecursive\fR
may be a callable function, in which case it will be called with a list of Nodes found and should return a list of Nodes that should be scanned recursively; this can be used to select a specific subset of Nodes for additional scanning\&.
.RE
.PP
Note that
\fBscons\fR
has a global
\fBSourceFileScanner\fR
object that is used by the
\fBObject\fR(),
\fBSharedObject\fR(), and
\fBStaticObject\fR() builders to decide which scanner should be used for different file extensions\&. You can using the
\fBSourceFileScanner\&.add_scanner\fR() method to add your own Scanner object to the
\fBscons\fR
infrastructure that builds target programs or libraries from a list of source files of different types:
.sp
.if n \{\
.RS 4
.\}
.nf
def xyz_scan(node, env, path):
contents = node\&.get_text_contents()
# Scan the contents and return the included files\&.
XYZScanner = Scanner(xyz_scan)
SourceFileScanner\&.add_scanner(\*(Aq\&.xyz\*(Aq, XYZScanner)
env\&.Program(\*(Aqmy_prog\*(Aq, [\*(Aqfile1\&.c\*(Aq, \*(Aqfile2\&.f\*(Aq, \*(Aqfile3\&.xyz\*(Aq])
.fi
.if n \{\
.RE
.\}
.SH "SYSTEM-SPECIFIC BEHAVIOR"
.PP
SCons and its configuration files are very portable, due largely to its implementation in Python\&. There are, however, a few portability issues waiting to trap the unwary\&.
.SS "\&.C file suffix"
.PP
SCons handles the upper\-case
\fB\&.C\fR
file suffix differently, depending on the capabilities of the underlying system\&. On a case\-sensitive system such as Linux or UNIX, SCons treats a file with a
\fB\&.C\fR
suffix as a C++ source file\&. On a case\-insensitive system such as Windows, SCons treats a file with a
\fB\&.C\fR
suffix as a C source file\&.
.SS "\&.F file suffix"
.PP
SCons handles the upper\-case
\fB\&.F\fR
file suffix differently, depending on the capabilities of the underlying system\&. On a case\-sensitive system such as Linux or UNIX, SCons treats a file with a
\fB\&.F\fR
suffix as a Fortran source file that is to be first run through the standard C preprocessor\&. On a case\-insensitive system such as Windows, SCons treats a file with a
\fB\&.F\fR
suffix as a Fortran source file that should
\fInot\fR
be run through the C preprocessor\&.
.SS "Windows: Cygwin Tools and Cygwin Python vs\&. Windows Pythons"
.PP
Cygwin supplies a set of tools and utilities that let users work on a Windows system using a more POSIX\-like environment\&. The Cygwin tools, including Cygwin Python, do this, in part, by sharing an ability to interpret UNIX\-like path names\&. For example, the Cygwin tools will internally translate a Cygwin path name like
/cygdrive/c/mydir
to an equivalent Windows pathname of
C:/mydir
(equivalent to
C:\emydir)\&.
.PP
Versions of Python that are built for native Windows execution, such as the python\&.org and ActiveState versions, do not have the Cygwin path name semantics\&. This means that using a native Windows version of Python to build compiled programs using Cygwin tools (such as
\fBgcc\fR,
\fBbison\fR, and
\fBflex\fR) may yield unpredictable results\&. "Mixing and matching" in this way can be made to work, but it requires careful attention to the use of path names in your SConscript files\&.
.PP
In practice, users can sidestep the issue by adopting the following rules: When using gcc, use the Cygwin\-supplied Python interpreter to run SCons; when using Microsoft Visual C/C++ (or some other Windows compiler) use the python\&.org or ActiveState version of Python to run SCons\&.
.SS "Windows: scons\&.bat file"
.PP
On Windows systems, SCons is executed via a wrapper
\fBscons\&.bat\fR
file\&. This has (at least) two ramifications:
.PP
First, Windows command\-line users that want to use variable assignment on the command line may have to put double quotes around the assignments:
.sp
.if n \{\
.RS 4
.\}
.nf
scons "FOO=BAR" "BAZ=BLEH"
.fi
.if n \{\
.RE
.\}
.PP
Second, the Cygwin shell does not recognize this file as being the same as an
\fBscons\fR
command issued at the command\-line prompt\&. You can work around this either by executing
\fBscons\&.bat\fR
from the Cygwin command line, or by creating a wrapper shell script named
\fBscons \&.\fR
.SS "MinGW"
.PP
The MinGW bin directory must be in your PATH environment variable or the PATH variable under the ENV construction variable for SCons to detect and use the MinGW tools\&. When running under the native Windows Python interpreter, SCons will prefer the MinGW tools over the Cygwin tools, if they are both installed, regardless of the order of the bin directories in the PATH variable\&. If you have both MSVC and MinGW installed and you want to use MinGW instead of MSVC, then you must explicitly tell SCons to use MinGW by passing
.sp
.if n \{\
.RS 4
.\}
.nf
tools=[\*(Aqmingw\*(Aq]
.fi
.if n \{\
.RE
.\}
.PP
to the Environment() function, because SCons will prefer the MSVC tools over the MinGW tools\&.
.SH "EXAMPLES"
.PP
To help you get started using SCons, this section contains a brief overview of some common tasks\&.
.SS "Basic Compilation From a Single Source File"
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
env\&.Program(target = \*(Aqfoo\*(Aq, source = \*(Aqfoo\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
Note: Build the file by specifying the target as an argument ("scons foo" or "scons foo\&.exe")\&. or by specifying a dot ("scons \&.")\&.
.SS "Basic Compilation From Multiple Source Files"
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
env\&.Program(target = \*(Aqfoo\*(Aq, source = Split(\*(Aqf1\&.c f2\&.c f3\&.c\*(Aq))
.fi
.if n \{\
.RE
.\}
.SS "Setting a Compilation Flag"
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(CCFLAGS = \*(Aq\-g\*(Aq)
env\&.Program(target = \*(Aqfoo\*(Aq, source = \*(Aqfoo\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.SS "Search The Local Directory For \&.h Files"
.PP
Note: You do
\fInot\fR
need to set CCFLAGS to specify \-I options by hand\&. SCons will construct the right \-I options from CPPPATH\&.
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(CPPPATH = [\*(Aq\&.\*(Aq])
env\&.Program(target = \*(Aqfoo\*(Aq, source = \*(Aqfoo\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.SS "Search Multiple Directories For \&.h Files"
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(CPPPATH = [\*(Aqinclude1\*(Aq, \*(Aqinclude2\*(Aq])
env\&.Program(target = \*(Aqfoo\*(Aq, source = \*(Aqfoo\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.SS "Building a Static Library"
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
env\&.StaticLibrary(target = \*(Aqfoo\*(Aq, source = Split(\*(Aql1\&.c l2\&.c\*(Aq))
env\&.StaticLibrary(target = \*(Aqbar\*(Aq, source = [\*(Aql3\&.c\*(Aq, \*(Aql4\&.c\*(Aq])
.fi
.if n \{\
.RE
.\}
.SS "Building a Shared Library"
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
env\&.SharedLibrary(target = \*(Aqfoo\*(Aq, source = [\*(Aql5\&.c\*(Aq, \*(Aql6\&.c\*(Aq])
env\&.SharedLibrary(target = \*(Aqbar\*(Aq, source = Split(\*(Aql7\&.c l8\&.c\*(Aq))
.fi
.if n \{\
.RE
.\}
.SS "Linking a Local Library Into a Program"
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment(LIBS = \*(Aqmylib\*(Aq, LIBPATH = [\*(Aq\&.\*(Aq])
env\&.Library(target = \*(Aqmylib\*(Aq, source = Split(\*(Aql1\&.c l2\&.c\*(Aq))
env\&.Program(target = \*(Aqprog\*(Aq, source = [\*(Aqp1\&.c\*(Aq, \*(Aqp2\&.c\*(Aq])
.fi
.if n \{\
.RE
.\}
.SS "Defining Your Own Builder Object"
.PP
Notice that when you invoke the Builder, you can leave off the target file suffix, and SCons will add it automatically\&.
.sp
.if n \{\
.RS 4
.\}
.nf
bld = Builder(action = \*(Aqpdftex < $SOURCES > $TARGET\*(Aq
suffix = \*(Aq\&.pdf\*(Aq,
src_suffix = \*(Aq\&.tex\*(Aq)
env = Environment(BUILDERS = {\*(AqPDFBuilder\*(Aq : bld})
env\&.PDFBuilder(target = \*(Aqfoo\&.pdf\*(Aq, source = \*(Aqfoo\&.tex\*(Aq)
# The following creates "bar\&.pdf" from "bar\&.tex"
env\&.PDFBuilder(target = \*(Aqbar\*(Aq, source = \*(Aqbar\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
Note also that the above initialization overwrites the default Builder objects, so the Environment created above can not be used call Builders like env\&.Program(), env\&.Object(), env\&.StaticLibrary(), etc\&.
.SS "Adding Your Own Builder Object to an Environment"
.sp
.if n \{\
.RS 4
.\}
.nf
bld = Builder(action = \*(Aqpdftex < $SOURCES > $TARGET\*(Aq
suffix = \*(Aq\&.pdf\*(Aq,
src_suffix = \*(Aq\&.tex\*(Aq)
env = Environment()
env\&.Append(BUILDERS = {\*(AqPDFBuilder\*(Aq : bld})
env\&.PDFBuilder(target = \*(Aqfoo\&.pdf\*(Aq, source = \*(Aqfoo\&.tex\*(Aq)
env\&.Program(target = \*(Aqbar\*(Aq, source = \*(Aqbar\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
You also can use other Pythonic techniques to add to the BUILDERS construction variable, such as:
.sp
.if n \{\
.RS 4
.\}
.nf
env = Environment()
env[\*(AqBUILDERS][\*(AqPDFBuilder\*(Aq] = bld
.fi
.if n \{\
.RE
.\}
.SS "Defining Your Own Scanner Object"
.PP
The following example shows adding an extremely simple scanner (the
\fBkfile_scan\fR() function) that doesn\*(Aqt use a search path at all and simply returns the file names present on any
\fBinclude\fR
lines in the scanned file\&. This would implicitly assume that all included files live in the top\-level directory:
.sp
.if n \{\
.RS 4
.\}
.nf
import re
include_re = re\&.compile(r\*(Aq^include\es+(\eS+)$\*(Aq, re\&.M)
def kfile_scan(node, env, path, arg):
contents = node\&.get_text_contents()
includes = include_re\&.findall(contents)
return env\&.File(includes)
kscan = Scanner(name = \*(Aqkfile\*(Aq,
function = kfile_scan,
argument = None,
skeys = [\*(Aq\&.k\*(Aq])
scanners = DefaultEnvironment()[\*(AqSCANNERS\*(Aq]
scanners\&.append(kscan)
env = Environment(SCANNERS=scanners)
env\&.Command(\*(Aqfoo\*(Aq, \*(Aqfoo\&.k\*(Aq, \*(Aqkprocess < $SOURCES > $TARGET\*(Aq)
bar_in = File(\*(Aqbar\&.in\*(Aq)
env\&.Command(\*(Aqbar\*(Aq, bar_in, \*(Aqkprocess $SOURCES > $TARGET\*(Aq)
bar_in\&.target_scanner = kscan
.fi
.if n \{\
.RE
.\}
.PP
It is important to note that you have to return a list of File nodes from the scan function, simple strings for the file names won\*(Aqt do\&. As in the examples we are showing here, you can use the
\fBFile()\fR
function of your current Environment in order to create nodes on the fly from a sequence of file names with relative paths\&.
.PP
Here is a similar but more complete example that adds a scanner which searches a path of directories (specified as the
\fBMYPATH\fR
construction variable) for files that actually exist:
.sp
.if n \{\
.RS 4
.\}
.nf
import re
import os
include_re = re\&.compile(r\*(Aq^include\es+(\eS+)$\*(Aq, re\&.M)
def my_scan(node, env, path, arg):
contents = node\&.get_text_contents()
includes = include_re\&.findall(contents)
if includes == []:
return []
results = []
for inc in includes:
for dir in path:
file = str(dir) + os\&.sep + inc
if os\&.path\&.exists(file):
results\&.append(file)
break
return env\&.File(results)
scanner = Scanner(name=\*(Aqmyscanner\*(Aq,
function=my_scan,
argument=None,
skeys=[\*(Aq\&.x\*(Aq],
path_function=FindPathDirs(\*(AqMYPATH\*(Aq)
)
scanners = DefaultEnvironment()[\*(AqSCANNERS\*(Aq]
scanners\&.append(scanner)
env = Environment(SCANNERS=scanners, MYPATH=[\*(Aqincs\*(Aq])
env\&.Command(\*(Aqfoo\*(Aq, \*(Aqfoo\&.x\*(Aq, \*(Aqxprocess < $SOURCES > $TARGET\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
The
\fBFindPathDirs\fR() function used in the previous example returns a function (actually a callable Python object) that will return a list of directories specified in the
\fB$MYPATH\fR
construction variable\&. It lets SCons detect the file
\fBincs/foo\&.inc\fR, even if
\fBfoo\&.x\fR
contains the line
\fBinclude foo\&.inc\fR
only\&. If you need to customize how the search path is derived, you would provide your own
\fBpath_function\fR
argument when creating the Scanner object, as follows:
.sp
.if n \{\
.RS 4
.\}
.nf
# MYPATH is a list of directories to search for files in
def pf(env, dir, target, source, arg):
top_dir = Dir(\*(Aq#\*(Aq)\&.abspath
results = []
if \*(AqMYPATH\*(Aq in env:
for p in env[\*(AqMYPATH\*(Aq]:
results\&.append(top_dir + os\&.sep + p)
return results
scanner = Scanner(name=\*(Aqmyscanner\*(Aq,
function=my_scan,
argument=None,
skeys=[\*(Aq\&.x\*(Aq],
path_function=pf
)
.fi
.if n \{\
.RE
.\}
.SS "Creating a Hierarchical Build"
.PP
Notice that the file names specified in a subdirectory\*(Aqs SConscript file are relative to that subdirectory\&.
.sp
.if n \{\
.RS 4
.\}
.nf
SConstruct:
env = Environment()
env\&.Program(target = \*(Aqfoo\*(Aq, source = \*(Aqfoo\&.c\*(Aq)
SConscript(\*(Aqsub/SConscript\*(Aq)
sub/SConscript:
env = Environment()
# Builds sub/foo from sub/foo\&.c
env\&.Program(target = \*(Aqfoo\*(Aq, source = \*(Aqfoo\&.c\*(Aq)
SConscript(\*(Aqdir/SConscript\*(Aq)
sub/dir/SConscript:
env = Environment()
# Builds sub/dir/foo from sub/dir/foo\&.c
env\&.Program(target = \*(Aqfoo\*(Aq, source = \*(Aqfoo\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.SS "Sharing Variables Between SConscript Files"
.PP
You must explicitly Export() and Import() variables that you want to share between SConscript files\&.
.sp
.if n \{\
.RS 4
.\}
.nf
SConstruct:
env = Environment()
env\&.Program(target = \*(Aqfoo\*(Aq, source = \*(Aqfoo\&.c\*(Aq)
Export("env")
SConscript(\*(Aqsubdirectory/SConscript\*(Aq)
subdirectory/SConscript:
Import("env")
env\&.Program(target = \*(Aqfoo\*(Aq, source = \*(Aqfoo\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.SS "Building Multiple Variants From the Same Source"
.PP
Use the variant_dir keyword argument to the SConscript function to establish one or more separate variant build directory trees for a given source directory:
.sp
.if n \{\
.RS 4
.\}
.nf
SConstruct:
cppdefines = [\*(AqFOO\*(Aq]
Export("cppdefines")
SConscript(\*(Aqsrc/SConscript\*(Aq, variant_dir=\*(Aqfoo\*(Aq)
cppdefines = [\*(AqBAR\*(Aq]
Export("cppdefines")
SConscript(\*(Aqsrc/SConscript\*(Aq, variant_dir=\*(Aqbar\*(Aq)
src/SConscript:
Import("cppdefines")
env = Environment(CPPDEFINES = cppdefines)
env\&.Program(target = \*(Aqsrc\*(Aq, source = \*(Aqsrc\&.c\*(Aq)
.fi
.if n \{\
.RE
.\}
.PP
Note the use of the Export() method to set the "cppdefines" variable to a different value each time we call the SConscript function\&.
.SS "Hierarchical Build of Two Libraries Linked With a Program"
.sp
.if n \{\
.RS 4
.\}
.nf
SConstruct:
env = Environment(LIBPATH=[\*(Aq#libA\*(Aq, \*(Aq#libB\*(Aq])
Export(\*(Aqenv\*(Aq)
SConscript(\*(AqlibA/SConscript\*(Aq)
SConscript(\*(AqlibB/SConscript\*(Aq)
SConscript(\*(AqMain/SConscript\*(Aq)
libA/SConscript:
Import(\*(Aqenv\*(Aq)
env\&.Library(\*(Aqa\*(Aq, Split(\*(Aqa1\&.c a2\&.c a3\&.c\*(Aq))
libB/SConscript:
Import(\*(Aqenv\*(Aq)
env\&.Library(\*(Aqb\*(Aq, Split(\*(Aqb1\&.c b2\&.c b3\&.c\*(Aq))
Main/SConscript:
Import(\*(Aqenv\*(Aq)
e = env\&.Clone(LIBS=[\*(Aqa\*(Aq, \*(Aqb\*(Aq])
e\&.Program(\*(Aqfoo\*(Aq, Split(\*(Aqm1\&.c m2\&.c m3\&.c\*(Aq))
.fi
.if n \{\
.RE
.\}
.PP
The \*(Aq#\*(Aq in the LIBPATH directories specify that they\*(Aqre relative to the top\-level directory, so they don\*(Aqt turn into "Main/libA" when they\*(Aqre used in Main/SConscript\&.
.PP
Specifying only \*(Aqa\*(Aq and \*(Aqb\*(Aq for the library names allows SCons to append the appropriate library prefix and suffix for the current platform (for example, \*(Aqliba\&.a\*(Aq on POSIX systems, \*(Aqa\&.lib\*(Aq on Windows)\&.
.SS "Customizing construction variables from the command line\&."
.PP
The following would allow the C compiler to be specified on the command line or in the file custom\&.py\&.
.sp
.if n \{\
.RS 4
.\}
.nf
vars = Variables(\*(Aqcustom\&.py\*(Aq)
vars\&.Add(\*(AqCC\*(Aq, \*(AqThe C compiler\&.\*(Aq)
env = Environment(variables=vars)
Help(vars\&.GenerateHelpText(env))
.fi
.if n \{\
.RE
.\}
.PP
The user could specify the C compiler on the command line:
.sp
.if n \{\
.RS 4
.\}
.nf
scons "CC=my_cc"
.fi
.if n \{\
.RE
.\}
.PP
or in the custom\&.py file:
.sp
.if n \{\
.RS 4
.\}
.nf
CC = \*(Aqmy_cc\*(Aq
.fi
.if n \{\
.RE
.\}
.PP
or get documentation on the options:
.sp
.if n \{\
.RS 4
.\}
.nf
$ scons \-h
CC: The C compiler\&.
default: None
actual: cc
.fi
.if n \{\
.RE
.\}
.SS "Using Microsoft Visual C++ precompiled headers"
.PP
Since windows\&.h includes everything and the kitchen sink, it can take quite some time to compile it over and over again for a bunch of object files, so Microsoft provides a mechanism to compile a set of headers once and then include the previously compiled headers in any object file\&. This technology is called precompiled headers\&. The general recipe is to create a file named "StdAfx\&.cpp" that includes a single header named "StdAfx\&.h", and then include every header you want to precompile in "StdAfx\&.h", and finally include "StdAfx\&.h" as the first header in all the source files you are compiling to object files\&. For example:
.PP
StdAfx\&.h:
.sp
.if n \{\
.RS 4
.\}
.nf
#include <windows\&.h>
#include <my_big_header\&.h>
.fi
.if n \{\
.RE
.\}
.PP
StdAfx\&.cpp:
.sp
.if n \{\
.RS 4
.\}
.nf
#include <StdAfx\&.h>
.fi
.if n \{\
.RE
.\}
.PP
Foo\&.cpp:
.sp
.if n \{\
.RS 4
.\}
.nf
#include <StdAfx\&.h>
/* do some stuff */
.fi
.if n \{\
.RE
.\}
.PP
Bar\&.cpp:
.sp
.if n \{\
.RS 4
.\}
.nf
#include <StdAfx\&.h>
/* do some other stuff */
.fi
.if n \{\
.RE
.\}
.PP
SConstruct:
.sp
.if n \{\
.RS 4
.\}
.nf
env=Environment()
env[\*(AqPCHSTOP\*(Aq] = \*(AqStdAfx\&.h\*(Aq
env[\*(AqPCH\*(Aq] = env\&.PCH(\*(AqStdAfx\&.cpp\*(Aq)[0]
env\&.Program(\*(AqMyApp\*(Aq, [\*(AqFoo\&.cpp\*(Aq, \*(AqBar\&.cpp\*(Aq])
.fi
.if n \{\
.RE
.\}
.PP
For more information see the document for the PCH builder, and the PCH and PCHSTOP construction variables\&. To learn about the details of precompiled headers consult the MSDN documentation for /Yc, /Yu, and /Yp\&.
.SS "Using Microsoft Visual C++ external debugging information"
.PP
Since including debugging information in programs and shared libraries can cause their size to increase significantly, Microsoft provides a mechanism for including the debugging information in an external file called a PDB file\&. SCons supports PDB files through the PDB construction variable\&.
.PP
SConstruct:
.sp
.if n \{\
.RS 4
.\}
.nf
env=Environment()
env[\*(AqPDB\*(Aq] = \*(AqMyApp\&.pdb\*(Aq
env\&.Program(\*(AqMyApp\*(Aq, [\*(AqFoo\&.cpp\*(Aq, \*(AqBar\&.cpp\*(Aq])
.fi
.if n \{\
.RE
.\}
.PP
For more information see the document for the PDB construction variable\&.
.SH "ENVIRONMENT"
.PP
In general,
scons
is not controlled by environment variables set in the shell used to invoke it, leaving it up to the SConscript file author to import those if desired\&. However the following variables are imported by
scons
itself if set:
.PP
SCONS_LIB_DIR
.RS 4
Specifies the directory that contains the
scons
Python module directory (for example,
/home/aroach/scons\-src\-0\&.01/src/engine)\&.
.RE
.PP
SCONSFLAGS
.RS 4
A string of options that will be used by
scons
in addition to those passed on the command line\&.
.RE
.PP
SCONS_CACHE_MSVC_CONFIG
.RS 4
(Windows only)\&. If set, save the shell environment variables generated when setting up the Microsoft Visual C++ compiler (and/or Build Tools) to a file to give these settings, which are expensive to generate, persistence across
scons
invocations\&. Use of this option is primarily intended to aid performance in tightly controlled Continuous Integration setups\&.
.sp
If set to a True\-like value ("1",
"true"
or
"True") will cache to a file named
\&.scons_msvc_cache
in the user\*(Aqs home directory\&. If set to a pathname, will use that pathname for the cache\&.
.sp
Note: use this cache with caution as it might be somewhat fragile: while each major toolset version (e\&.g\&. Visual Studio 2017 vs 2019) and architecture pair will get separate cache entries, if toolset updates cause a change to settings within a given release series,
scons
will not detect the change and will reuse old settings\&. Remove the cache file in case of problems with this\&.
scons
will ignore failures reading or writing the file and will silently revert to non\-cached behavior in such cases\&.
.sp
Since
scons
3\&.1\&.
.RE
.SH "SEE ALSO"
.PP
\fBscons\fR
User Manual,
\fBscons\fR
Design Document,
\fBscons\fR
source code\&.
.SH "AUTHORS"
.PP
Originally: Steven Knight
knight@baldmt\&.com
and Anthony Roach
aroach@electriceyeball\&.com\&. Since 2010: The SCons Development Team
scons\-dev@scons\&.org\&.
.SH "AUTHORS"
.PP
\fBSteven Knight\fR
.RS 4
Author.
.RE
.PP
\fBSteven Knight and the SCons Development Team\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2004 - 2019 The SCons Foundation
.br