'\" t .\" Title: SCONS .\" Author: The SCons Development Team .\" Generator: DocBook XSL Stylesheets v1.76.1 .\" Date: Released Wed, 26 Aug 2026 21:18:42 -0700 .\" Manual: SCons 4.11.1 .\" Source: SCons 4.11.1 Version 4.11.1 .\" Language: English .\" .TH "SCONS" "1" "Released Wed, 26 Aug 2026 21:18:42 -0700" "SCons 4\&.11\&.1 Version 4.11." "SCons 4\&.11\&.1" .\" ----------------------------------------------------------------- .\" * 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\fR=\fIval\fR...] [\fItargets\fR...] .SH "DESCRIPTION" .PP SCons is an extensible open source build system that orchestrates the construction of software (and other tangible products such as documentation files) by determining which component pieces must be built or rebuilt and invoking the necessary commands to build them\&. SCons offers many features to improve developer productivity such as parallel builds, caching of build artifacts, automatic dependency scanning, and a database of information about previous builds so details do not have to be recalculated each run\&. .PP \fBscons\fR requires Python 3\&.7 or later to run; there should be no other dependencies or requirements, unless the experimental Ninja tool is used (requires the ninja package)\&. .PP \fIChanged in version 4\&.3\&.0:\fR support for Python 3\&.5 is removed\&. The CPython project retired 3\&.5 in Sept 2020: \m[blue]\fB\%https://peps.python.org/pep-0478\fR\m[]\&. .PP \fIChanged in version 4\&.9\&.0:\fR support for Python 3\&.6 is removed\&. The CPython project retired 3\&.6 in Sept 2021: \m[blue]\fB\%https://peps.python.org/pep-0494\fR\m[]\&. .PP \fIChanged in version 4\&.11\&.0:\fR support for Python 3\&.7 is deprecated and will be removed in a future SCons release\&. The CPython project retired 3\&.7 in June 2023: \m[blue]\fB\%https://peps.python.org/pep-0537\fR\m[]\&. .PP \fIChanged in version 4\&.11\&.0:\fR support for Python 3\&.8 is deprecated and will be removed in a future SCons release\&. The CPython project retired 3\&.8 in Sept 2024: \m[blue]\fB\%https://peps.python.org/pep-0569\fR\m[]\&. .PP You set up an SCons build by writing a script that describes things to build (targets), and, if necessary, the rules to build those files (actions)\&. SCons comes with a collection of Builder methods which supply premade Actions for building many common software components such as executable programs, object files and libraries, so that for many software projects, only the targets and input files (sources) need be specified in a call to a builder\&. .PP SCons operates at a level of abstraction above that of pure filenames\&. For example if you specify a shared library target named "foo", SCons keeps track of the actual operating system dependent filename (such as libfoo\&.so on a GNU/Linux system and foo\&.dll on Windows), and gives you a handle to refer to that target in other steps, so you don\*(Aqt have to use system\-specific strings yourself\&. SCons can also scan automatically for dependency information, such as header files included by source code files (for example, #include preprocessor directives in C or C++ files), so these implicit dependencies do not have to be specified manually\&. SCons supports the ability to define new scanners to support additional input file types\&. .PP Information about files involved in the build, including a cryptographic hash of the contents of source files, is cached for later reuse\&. By default, this hash (the content signature) is used to decide if a file has changed since the last build, although other algorithms can be used by selecting an appropriate \fBDecider\fR function\&. Implicit dependency files are also part of out\-of\-date computation\&. The scanned implicit dependency information can optionally be cached and used to speed up future builds\&. A hash of each executed build action (the build signature) is also cached, so that changes to build instructions (changing flags, etc\&.) or to the build tools themselves (e\&.g\&. a compiler upgrade) can also trigger a rebuild\&. .PP SCons supports separated source and build directories (also called "out\-of\-tree builds") through the definition of variant directories Using a separated build directory helps keep the source directory clean of artifacts when doing searches, allows setting up differing builds ("variants") without conflicts, and allows resetting the build by just removing the build directory (note that SCons does have a "clean" mode as well)\&. See the \fBVariantDir\fR description for more details\&. .PP When invoked, \fBscons\fR looks for a file describing the build configuration in the current directory and reads that in\&. The file is by default named SConstruct, although some variants of that, or a developer\-chosen name, are also accepted (see the section called \(lqSConscript Files\(rq)\&. If found, the current directory is set as the project top directory\&. Certain command\-line options specify alternate places to look for SConstruct (see \fB\-C\fR, \fB\-D\fR, \fB\-u\fR and \fB\-U\fR), which will set the project top directory to the path found\&. A path to the build configuration can also be specified with the \fB\-f\fR option, which leaves the current directory as the project top directory\&. .PP The build configuration may be split into multiple files: the SConstruct file can specify additional configuration files by calling the \fBSConscript\fR function, and any file thus invoked may include further files in the same way\&. By convention, these subsidiary files are named SConscript, although any name may be used\&. As a result of this naming convention, the term SConscript files is used to refer generically to the complete set of configuration files for a project (including the SConstruct file), regardless of the actual file names or number of such files\&. A hierarchical build is not recursive \- all of the SConscript files are processed in a single pass so that \fBscons\fR has a picture of the complete dependency tree when it begins considering what needs building\&. Each SConscript file is processed in a separate context so settings made in one script do not leak into another; information can however be shared explicitly between scripts\&. .PP Before reading the SConscript files, \fBscons\fR looks for a site directory \- a directory named site_scons is searched for in various system directories and in the project top directory, or if the \fB\-\-site\-dir\fR option is given, checks only for that directory\&. Found site directories are prepended to the Python module search path (\fIsys\&.path\fR), thus allowing modules in such directories to be imported in the normal Python way in SConscript files\&. For each found site directory, (1) if it contains a file site_init\&.py that file is evaluated, and (2) if it contains a directory site_tools the path to that directory is prepended to the default toolpath\&. See the \fB\-\-site\-dir\fR and \fB\-\-no\-site\-dir\fR options for details on default paths and controlling the site directories\&. .PP SConscript files are written in the Python programming language\&. For many tasks, the simple syntax can be understood from examples, so it is normally not necessary to be a Python programmer to use SCons effectively\&. SConscript files are executed in a context that makes the facilities described in this manual page directly available (that is, no need to import)\&. Standard Python scripting capabilities such as flow control, data manipulation, and imported Python modules are available to use in more complicated build configurations\&. Other Python files can be made a part of the build system, but they do not automatically have the SCons context and need to import it if they need access (described later)\&. .PP SCons reads and executes all of the included SConscript files \fIbefore\fR it begins building any targets\&. Progress messages show this behavior (the state change lines \- those beginning with the scons: tag \- may be suppressed using the \fB\-Q\fR option): .sp .if n \{\ .RS 4 .\} .nf $ \fBscons foo\&.out\fR 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 To assure reproducible builds, SCons uses a restricted execution environment for running external commands used to build targets, rather than propagating the full environment in effect at the time \fBscons\fR was called\&. This helps avoid problems like picking up accidental or malicious settings, temporary debug values that are no longer needed, or a developer having different settings than another (or than the CI pipeline)\&. Environment variables needed for the proper operation of such commands must be set in the execution environment explicitly, either by assigning the desired values, or by picking those values individually or collectively out of environment variables exposed by the Python os\&.environ dictionary (as external program inputs they should be validated before use)\&. The execution environment for a given construction environment is its \fB$ENV\fR value\&. A small number of environment variables are picked up automatically by \fBscons\fR itself (see the section called \(lqENVIRONMENT\(rq)\&. .PP In particular, if a compiler or other external command needed to build a target file is not in \fBscons\fR\*(Aq idea of a standard system location, it will not be found at runtime unless you explicitly add the location into the execution environment\*(Aqs \fIPATH\fR element\&. This is a particular consideration on Windows platforms, where it is common for a command to install into an app\-specific location and depend on setting \fIPATH\fR in order for them to be found, which does not automatically work for SCons\&. .PP One example approach is to extract the entire \fBPATH\fR environment variable and set that into the execution environment: .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 specific external environment variables that \fBscons\fR does not recognize, they can be propagated into the execution environment: .sp .if n \{\ .RS 4 .\} .nf import os env = Environment( ENV={ \*(AqPATH\*(Aq: os\&.environ[\*(AqPATH\*(Aq], \*(AqMODULEPATH\*(Aq: os\&.environ[\*(AqMODULEPATH\*(Aq], \*(AqPKG_CONFIG_PATH\*(Aq: os\&.environ[\*(AqPKG_CONFIG_PATH\*(Aq], } ) .fi .if n \{\ .RE .\} .PP Or you can explicitly propagate the invoking user\*(Aqs complete external environment: .sp .if n \{\ .RS 4 .\} .nf import os env = Environment(ENV=os\&.environ\&.copy()) .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 some configurations\&. It should not cause problems if done in a build setup which tightly controls how the environment is set up before invoking \fBscons\fR, as in many continuous integration setups\&. .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 .PP The above fragments are intended to illustrate a concept\&. It is normally not a good idea to wipe out the entire default value of the execution environment (env["ENV"]), as it may carry important information for the execution of build commands\&. .sp .5v .RE .PP \fBscons\fR is normally executed in a top\-level directory containing an SConstruct file (the project top directory)\&. When \fBscons\fR is invoked, the command line (including the contents of the \fBSCONSFLAGS\fR environment variable, if set) is processed\&. Command\-line options (see the section called \(lqOPTIONS\(rq) are consumed\&. Any variable argument assignments are collected, and remaining arguments are taken as targets to build\&. .PP Values of variables to be passed to the SConscript files may be specified on the command line: .sp .if n \{\ .RS 4 .\} .nf \fBscons debug=1\fR .fi .if n \{\ .RE .\} .PP These variables are available through the \fIARGUMENTS\fR dictionary, and can be used in the SConscript files to modify the build in any way: .sp .if n \{\ .RS 4 .\} .nf if ARGUMENTS\&.get("debug", ""): env = Environment(CCFLAGS="\-g") else: env = Environment() .fi .if n \{\ .RE .\} .PP The command\-line variable arguments are also available in the \fIARGLIST\fR list, indexed by their order on the command line\&. This allows you to process them in order rather than by name, if necessary\&. Each \fIARGLIST\fR entry is a tuple consisting of the name and the value\&. .PP See the section called \(lqCommand-Line Construction Variables\(rq for more information\&. .PP \fBscons\fR can maintain a cache of target (derived) files that can be shared between multiple builds\&. When derived\-file caching is enabled in an 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 By default, \fBscons\fR searches for known programming tools on various systems and initializes itself based on what is found\&. On Windows systems which identify as \fIwin32\fR, \fBscons\fR searches in order for the Microsoft Visual C++ tools, the MinGW tool chain, the Intel compiler tools, the GCC tools, the LLVM/clang tools, and the PharLap ETS compiler\&. On Windows system which identify as \fIcygwin\fR (that is, if \fBscons\fR is invoked from a cygwin shell), the order changes to prefer the GCC toolchain over the MSVC tools\&. 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 Oracle Solaris systems, \fBscons\fR searches for the native compiler tools (MIPSpro, Visual Age, aCC, and Forte tools respectively) and the GCC tool chain\&. On FreeBSD and OpenBSD, \fBscons\fR searches in order for the LLVM/clang tools, the GCC tool chain, and the Intel compiler tools\&. On all other platforms, including POSIX (Linux and UNIX) and macOS platforms, \fBscons\fR searches in order for the GCC tool chain, the LLVM/clang tools, and the Intel compiler tools\&. The default tool selection can be pre\-empted through the use of the \fItools\fR argument to construction environment creation methods, explicitly calling the \fBTool\fR loader, the through the setting of various setting of construction variables\&. .SS "Target Selection" .PP SCons acts on the selected targets, whether the requested operation is build, no\-exec or clean\&. Targets are selected as follows: .sp .RS 4 .ie n \{\ \h'-04' 1.\h'+01'\c .\} .el \{\ .sp -1 .IP " 1." 4.2 .\} Targets specified on the command line\&. These may be files, directories, or phony targets defined using the \fBAlias\fR function\&. Directory targets are scanned by \fBscons\fR for any targets that may be found with a destination in or under that directory\&. The targets listed on the command line are made available in the \fICOMMAND_LINE_TARGETS\fR list\&. .RE .sp .RS 4 .ie n \{\ \h'-04' 2.\h'+01'\c .\} .el \{\ .sp -1 .IP " 2." 4.2 .\} If no targets are specified on the command line, \fBscons\fR will select those targets specified in the SConscript files via calls to the \fBDefault\fR function\&. These are known as the default targets, and are made available in the \fIDEFAULT_TARGETS\fR list\&. .RE .sp .RS 4 .ie n \{\ \h'-04' 3.\h'+01'\c .\} .el \{\ .sp -1 .IP " 3." 4.2 .\} If no targets are selected by the previous steps, \fBscons\fR selects the current directory for scanning, unless command\-line options which affect the directory for target scanning are present (\fB\-C\fR, \fB\-D\fR, \fB\-u\fR, \fB\-U\fR)\&. Since targets thus selected were not the result of user instructions, this target list is not made available for direct inspection; use the \fB\-\-debug=explain\fR option if they need to be examined\&. .RE .sp .RS 4 .ie n \{\ \h'-04' 4.\h'+01'\c .\} .el \{\ .sp -1 .IP " 4." 4.2 .\} \fBscons\fR always adds to the selected targets any intermediate targets which are necessary to build the specified ones\&. For example, if constructing a shared library or dll from C source files, \fBscons\fR will also build the object files which will make up the library\&. .RE .PP To ignore the default targets specified through calls to \fBDefault\fR and instead build all target files in or below the current directory specify the current directory (\&.) as a command\-line target: .sp .if n \{\ .RS 4 .\} .nf \fBscons \&.\fR .fi .if n \{\ .RE .\} .PP To build all target files, including any files outside of the current directory, supply a command\-line target of the root directory (on POSIX systems): .sp .if n \{\ .RS 4 .\} .nf \fBscons /\fR .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 \fBscons C:\e D:\e\fR .fi .if n \{\ .RE .\} .PP A subset of a hierarchical tree may be built by remaining at the project top directory and specifying the subdirectory as the target to build: .sp .if n \{\ .RS 4 .\} .nf \fBscons src/subdir\fR .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 SConstruct file, and then builds targets relatively to the current subdirectory (see also the related \fB\-D\fR and \fB\-U\fR options): .sp .if n \{\ .RS 4 .\} .nf \fBcd src/subdir\fR \fBscons \-u \&.\fR .fi .if n \{\ .RE .\} .PP In all cases, more files may be built than are requested, as \fBscons\fR needs to make sure any dependent files are built\&. .PP Specifying "cleanup" targets in SConscript files is usually not necessary\&. The \fB\-c\fR flag removes all selected targets: .sp .if n \{\ .RS 4 .\} .nf \fBscons \-c \&.\fR .fi .if n \{\ .RE .\} .PP to remove all target files in or under the current directory, or: .sp .if n \{\ .RS 4 .\} .nf \fBscons \-c build export\fR .fi .if n \{\ .RE .\} .PP to remove target files under build and export\&. .PP Additional files or directories to remove can be specified using the \fBClean\fR function in the SConscript files\&. Conversely, targets that would normally be removed by the \fB\-c\fR invocation can be retained by calling the \fBNoClean\fR function with those targets\&. .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 \fBscons \-j 4\fR .fi .if n \{\ .RE .\} .PP builds four targets in parallel, for example\&. .SH "OPTIONS" .PP In general, \fBscons\fR supports the same command\-line options as GNU Make and many of those supported by cons\&. .PP \fB\-b\fR .RS 4 Ignored for compatibility with non\-GNU versions of Make .RE .PP \fB\-c\fR, \fB\-\-clean\fR, \fB\-\-remove\fR .RS 4 Set clean mode\&. Clean up by removing the selected targets, well as any files or directories associated with a selected target through calls to the \fBClean\fR function\&. Will not remove any targets which are marked for preservation through calls to the \fBNoClean\fR function\&. .sp While clean mode removes targets rather than building them, work which is done directly in Python code in SConscript files will still be carried out\&. If it is important to avoid some such work from taking place in clean mode, it should be protected\&. An SConscript file can determine which mode is active by querying \fBGetOption\fR, as in the call if GetOption("clean"): .RE .PP \fB\-\-cache\-debug=\fR\fB\fIfile\fR\fR .RS 4 Write debug information about derived\-file caching to the specified \fIfile\fR\&. If \fIfile\fR is a hyphen (\-), the debug information is printed to standard output\&. The messages describe cache operations, such as which build signature is being searched for, retrieved, or stored in the cache specified by \fBCacheDir\fR\&. .RE .PP \fB\-\-cache\-disable\fR, \fB\-\-no\-cache\fR .RS 4 Disable derived\-file caching\&. \fBscons\fR will neither retrieve files from the cache nor copy files to the cache\&. This option allows temporarily disabling the cache without modifying build scripts\&. .RE .PP \fB\-\-cache\-force\fR, \fB\-\-cache\-populate\fR .RS 4 When using \fBCacheDir\fR, populate a derived\-file cache by copying any existing, up\-to\-date derived files to it, in addition to files built during this invocation\&. This is useful for initializing a new cache with current derived files or adding files that were recently built with caching disabled (via the \fB\-\-cache\-disable\fR option\&. .RE .PP \fB\-\-cache\-readonly\fR .RS 4 Use the derived\-file cache, if enabled, to retrieve files, but do not not update the cache with any files built during this invocation\&. .RE .PP \fB\-\-cache\-show\fR .RS 4 When using a derived\-file cache, display the command that would have been executed to build the file (or the corresponding *COMSTR contents if set), even if the file is retrieved from the cache\&. Without this option, \fBscons\fR shows a cache retrieval message\&. This ensures consistent output in build logs, regardless of whether the file was rebuilt or retrieved from the cache\&. .RE .PP \fB\-\-config=\fR\fB\fImode\fR\fR .RS 4 Control how the \fBConfigure\fR call should use or generate the results of configuration tests\&. \fImode\fR should be one of the following choices: .PP \fBauto\fR .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 dependencies explicitly\&. This is the default behavior\&. .RE .PP \fBforce\fR .RS 4 If this mode 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 \fBcache\fR .RS 4 If this mode is specified, no configuration tests will be rerun and all results will be taken from cache\&. \fBscons\fR will report an error if \fB\-\-config=cache\fR is specified and a necessary test does not have any results in the cache\&. .RE .sp .RE .PP \fB\-C \fR\fB\fIdirectory\fR\fR, \fB\-\-directory=\fR\fB\fIdirectory\fR\fR .RS 4 Run as if \fBscons\fR was started in \fIdirectory\fR instead of the current working directory\&. That is, change directory before searching for the SConstruct, Sconstruct, sconstruct, SConstruct\&.py, Sconstruct\&.py or sconstruct\&.py file or doing anything else\&. When multiple \fB\-C\fR options are given, each subsequent non\-absolute \fB\-C\fR \fIdirectory\fR is interpreted relative to the preceding one\&. See also options \fB\-u\fR, \fB\-U\fR and \fB\-D\fR to change the SConstruct search behavior when this option is used\&. .RE .PP \fB\-D\fR .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 \fB\-\-debug=\fR\fB\fItype\fR\fR\fB[\fR\fB\fI,type\fR\fR\fB\&.\&.\&.]\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 types are recognized: .PP \fBaction\-timestamps\fR .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 \fINew in version 3\&.1\&.\fR .RE .PP \fBcount\fR .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 *\&.pyo files)\&. .RE .PP \fBduplicate\fR .RS 4 Print a line for each unlink/relink (or copy) of a file in a variant directory from its source file\&. Includes debugging info for unlinking stale variant directory files, as well as unlinking old targets before building them\&. .RE .PP \fBexplain\fR .RS 4 Print an explanation of why \fBscons\fR is deciding to (re\-)build the targets it selects for building\&. .RE .PP \fBfindlibs\fR .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 \fBincludes\fR .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 $ \fBscons \-\-debug=includes foo\&.o\fR .fi .if n \{\ .RE .\} .RE .PP \fBjson\fR .RS 4 Write info to a JSON file for any of the following debug options if they are enabled: \fImemory\fR, \fIcount\fR, \fItime\fR, \fIaction\-timestamps\fR .sp The default output file is scons_stats\&.json .sp The file name/path can be modified by using \fBDebugOptions\fR for example DebugOptions(json=\*(Aqpath/to/file\&.json\*(Aq) .sp .if n \{\ .RS 4 .\} .nf $ \fBscons \-\-debug=memory,json foo\&.o\fR .fi .if n \{\ .RE .\} .RE .PP \fBmemoizer\fR .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 \fBmemory\fR .RS 4 Prints how much memory SCons uses before and after reading the SConscript files and before and after building targets\&. .RE .PP \fBobjects\fR .RS 4 Prints a list of the various objects of the various classes used internally by SCons\&. .RE .PP \fBpdb\fR .RS 4 Run \fBscons\fR under control of the pdb Python debugger\&. .sp .if n \{\ .RS 4 .\} .nf $ \fBscons \-\-debug=pdb\fR > /usr/lib/python3\&.11/site\-packages/SCons/Script/Main\&.py(869)_main() \-> options = parser\&.values (Pdb) .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 pdb will stop at the beginning of the \fBscons\fR main routine on startup\&. The search path (sys\&.path) at that point will include the location of the running \fBscons\fR, but not of the project itself\&. If you need to set breakpoints in your project files, you will either need to add to the path, or use absolute pathnames when referring to project files\&. A \&.pdbrc file in the project root can be used to add the current directory to the search path to avoid having to enter it by hand, along these lines: .sp .if n \{\ .RS 4 .\} .nf sys\&.path\&.append(\*(Aq\&.\*(Aq) .fi .if n \{\ .RE .\} .sp Due to the implementation of the pdb module, the \fBbreak\fR, \fBtbreak\fR and \fBclear\fR commands only understand references to filenames which have a \&.py extension\&. (although the suffix itself can be omitted), \fIexcept\fR if you use an absolute path\&. As a special exception to that rule, the names SConstruct and SConscript are recognized without needing the \&.py extension\&. .sp \fIChanged in version 4\&.6\&.0\fR: The names SConstruct and SConscript are now recognized without requiring \&.py suffix\&. .sp \fIChanged in version 4\&.8\&.0\fR: The name SCsub is now recognized without requiring \&.py suffix\&. .sp .5v .RE .RE .PP \fBprepare\fR .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 \fB\-\-debug=explain\fR)\&. 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 \fBpresub\fR .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 $ \fBscons \-\-debug=presub\fR Building myprog\&.o with action(s): $SHCC $SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPINCFLAGS \-c \-o $TARGET $SOURCES \&.\&.\&. .fi .if n \{\ .RE .\} .RE .PP \fBstacktrace\fR .RS 4 Prints an internal Python stack trace when encountering an otherwise unexplained error\&. .RE .PP \fBtime\fR .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 SCons itself spent 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 \fBSConscript\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 \fBsconscript\fR .RS 4 Enables output indicating entering and exiting each SConscript file\&. .RE .sp .RE .PP \fB\-\-diskcheck=\fR\fB\fItype\fR\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) when searching for source and include files\&. \fItype\fR can be an available diskcheck type or the special tokens all or none\&. A comma\-separated string can be used to select multiple checks\&. The default setting is all\&. .sp Current available checks are: .PP \fBmatch\fR .RS 4 to check that files and directories on disk match SCons\*(Aq expected configuration\&. .RE .sp 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\&. .RE .PP \fB\-\-duplicate=\fR\fB\fIORDER\fR\fR .RS 4 There are three ways to duplicate files in a build tree: hard links, soft (symbolic) links and copies\&. The default policy is to prefer hard links to soft links to copies\&. You can specify a different policy 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 \fB\-\-enable\-virtualenv\fR .RS 4 Import virtualenv\-related variables to SCons\&. .RE .PP \fB\-\-experimental=\fR\fB\fIfeature\fR\fR .RS 4 Enable experimental features and/or tools\&. \fIfeature\fR can be an available feature name or the special tokens all or none\&. A comma\-separated string can be used to select multiple features\&. The default setting is none\&. .sp Current available features are ninja (\fInew in version 4\&.2\fR) and legacy_sched_deprecated (\fInew in, and deprecated since, version 4\&.11\&.0\fR)\&. .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 The legacy scheduler is not strictly an experimental feature\&. The feature flag selects the job scheduler which was the SCons default prior to version 4\&.7\&. The feature flag was introduced as legacy_sched in version 4\&.7\&. The legacy scheduler is due to be removed in a future release, so the feature flag is now deprecated\&. In version 4\&.11\&.0, it was renamed to legacy_sched_deprecated, so that existing users will receive a signal \- due to the nature of experimental feature flags it is not possible to use the standard SCons deprecation warning mechanism here\&. .sp .5v .RE .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBCaution\fR .ps -1 .br Experimental features come with no compatibility promises \- a given feature could change significantly in a future release, or disappear completely\&. .sp .5v .RE \fIOption added in version 4\&.2\&.\fR .RE .PP \fB\-f \fR\fB\fIfile\fR\fR, \fB\-\-file=\fR\fB\fIfile\fR\fR, \fB\-\-makefile=\fR\fB\fIfile\fR\fR, \fB\-\-sconstruct=\fR\fB\fIfile\fR\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 \fB\-h\fR, \fB\-\-help\fR .RS 4 Print a local help message for this project, if one is defined in the SConscript files (see the \fBHelp\fR function), plus a line that refers to the standard SCons help message\&. If no local help message is defined, prints the standard SCons help message (as for the \fB\-H\fR option) plus help for any local options defined through \fBAddOption\fR\&. Exits after displaying the appropriate message\&. .sp Note that use of this option requires SCons to process the SConscript files, so syntax errors may cause the help message not to be displayed\&. .RE .PP \fB\-\-hash\-chunksize=\fR\fB\fIKILOBYTES\fR\fR .RS 4 Set the block size used when computing content signatures to \fIKILOBYTES\fR\&. This value determines the size of the chunks which are read in at once when computing signature hashes\&. 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\&. .sp \fINew in version 4\&.1\&.\fR .RE .PP \fB\-\-hash\-format=\fR\fB\fIALGORITHM\fR\fR .RS 4 Set the hashing algorithm used by SCons to \fIALGORITHM\fR\&. This value determines the hashing algorithm used in generating content signatures, build signatures and \fBCacheDir\fR keys\&. .sp The supported list of values are: \fImd5\fR, \fIsha1\fR and \fIsha256\fR\&. However, the Python interpreter used to run \fBscons\fR must have the corresponding support available in the hashlib module to use the specified algorithm\&. .sp If this option is omitted, the first supported hash format found is selected\&. Typically, this is MD5, however, on a FIPS\-compliant system using a version of Python older than 3\&.9, SHA1 or SHA256 is chosen as the default\&. Python 3\&.9 and onwards clients always default to MD5, even in FIPS mode\&. .sp Specifying this option changes the name of the SConsign database\&. The default database is \&.sconsign\&.dblite\&. In the presence of this option, \fIALGORITHM\fR is included in the name to indicate the difference, even if the argument is \fImd5\fR\&. For example, \fB\-\-hash\-format=sha256\fR uses a SConsign database named \&.sconsign_sha256\&.dblite\&. .sp \fINew in version 4\&.1\&.\fR .RE .PP \fB\-H\fR, \fB\-\-help\-options\fR .RS 4 Print the standard help message about SCons command\-line options and exit\&. .RE .PP \fB\-i\fR, \fB\-\-ignore\-errors\fR .RS 4 Ignore all errors from commands executed to rebuild files\&. .RE .PP \fB\-I \fR\fB\fIdirectory\fR\fR, \fB\-\-include\-dir=\fR\fB\fIdirectory\fR\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 \fB\-\-ignore\-virtualenv\fR .RS 4 Suppress importing virtualenv\-related variables to SCons\&. .RE .PP \fB\-\-implicit\-cache\fR .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: .sp \fBscons\fR will not detect changes to implicit dependency search paths (e\&.g\&. \fB$CPPPATH\fR, \fB$LIBPATH\fR) that would ordinarily cause different versions of same\-named files to be used\&. .sp \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\&. \fB$CPPPATH\fR, \fB$LIBPATH\fR) than a current implicit dependency with the same name\&. .RE .PP \fB\-\-implicit\-deps\-changed\fR .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 \fB\-\-implicit\-deps\-unchanged\fR .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 \fB\-\-install\-sandbox=\fR\fB\fIsandbox_path\fR\fR .RS 4 When using the \fBInstall\fR builders, prepend \fIsandbox_path\fR to the installation paths such that all installed files will be placed under that directory\&. This option is unavailable if one of \fBInstall\fR, \fBInstallAs\fR or \fBInstallVersionedLib\fR is not used in the SConscript files\&. .RE .PP \fB\-\-interactive\fR .RS 4 Starts SCons in interactive mode\&. The SConscript files are read once and a scons>>> 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\fB\fI[OPTIONS] [TARGETS] \&.\&.\&.\fR\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 for \fBbuild\fR\&. .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 .\} .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)\&. .RE .PP \fBclean \fR\fB\fI[OPTIONS] [TARGETS] \&.\&.\&.\fR\fR .RS 4 Cleans the specified \fITARGETS\fR (and their dependencies) with the specified \fIOPTIONS\fR\&. \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 UNIX or Linux systems, (Ctrl+Z on Windows systems)\&. .RE .PP \fBhelp \fR\fB\fI[COMMAND]\fR\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\fB\fI[COMMANDLINE]\fR\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 .sp 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 $ \fBscons \-\-interactive\fR scons: Reading SConscript files \&.\&.\&. scons: done reading SConscript files\&. scons>>> build \-n prog scons>>> exit .fi .if n \{\ .RE .\} .RE .PP \fB\-j \fR\fB\fIN\fR\fR, \fB\-\-jobs=\fR\fB\fIN\fR\fR .RS 4 Specifies the maximum number of concurrent jobs (commands) to run\&. If there is more than one \fB\-j\fR option, the last one is effective\&. .RE .PP \fB\-k\fR, \fB\-\-keep\-going\fR .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 \fB\-m\fR .RS 4 Ignored for compatibility with non\-GNU versions of Make\&. .RE .PP \fB\-\-max\-drift=\fR\fB\fISECONDS\fR\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 (hash) 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 \fB\-\-md5\-chunksize=\fR\fB\fIKILOBYTES\fR\fR .RS 4 A deprecated synonym for \fB\-\-hash\-chunksize\fR\&. .sp \fIChanged in version 4\&.2:\fR deprecated\&. .RE .PP \fB\-n\fR, \fB\-\-no\-exec\fR, \fB\-\-just\-print\fR, \fB\-\-dry\-run\fR, \fB\-\-recon\fR .RS 4 Set no\-exec mode\&. Print the commands that would be executed to build any out\-of\-date targets, but do not execute those commands\&. .sp Only target building is suppressed \- any work in the build system that is done directly (in regular Python code) will still be carried out\&. You can add guards around code which should not be executed in no\-exec mode by checking the value of the option at run time with \fBGetOption\fR: .sp .if n \{\ .RS 4 .\} .nf if not GetOption("no_exec"): # run regular instructions .fi .if n \{\ .RE .\} .sp The output is a best effort, as SCons cannot always precisely determine what would be built\&. For example, if a file generated by a builder action is also used as a source in the build, that file is not available to scan for dependencies at all in an unbuilt tree, and may contain out\-of\-date information in a previously built tree\&. .sp SCons cannot perform \fBConfigure\fR checks in no\-exec mode, as they would make changes to the filesystem (see \fB$CONFIGUREDIR\fR and \fB$CONFIGURELOG\fR)\&. It can use stored information from a previous build, if it is not out\-of\-date, so a "priming" build may make subsequent no\-exec runs more useful\&. .RE .PP \fB\-\-no\-site\-dir\fR .RS 4 Do not read site directories\&. Neither the standard site directories (site_scons) nor the path specified via a previous \fB\-\-site\-dir\fR option are added to the module search path \fIsys\&.path\fR, searched for a site_init\&.py file, or have their site_tools directory included in the tool search path\&. Can be overridden by a subsequent \fB\-\-site\-dir\fR option\&. .RE .PP \fB\-\-package\-type=\fR\fB\fItype\fR\fR .RS 4 The type of package to create when using the \fBPackage\fR builder\&. Multiple types can be specified by using a comma\-separated string, in which case SCons will try to build for all of those package types\&. Note this option is only available if the packaging tool has been enabled\&. .RE .PP \fB\-\-profile=\fR\fB\fIfile\fR\fR .RS 4 Run SCons under the Python profiler and save the results to \fIfile\fR\&. The results may be analyzed using the Python pstats module\&. .RE .PP \fB\-q\fR, \fB\-\-question\fR .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 \fB\-Q\fR .RS 4 Suppress status messages about reading SConscript files, building targets and entering directories\&. Commands that are executed to rebuild target files are still printed\&. .RE .PP \fB\-\-random\fR .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 \fB\-s\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR .RS 4 Silent\&. Do not print commands that are executed to rebuild target files\&. Also suppresses SCons status messages\&. .RE .PP \fB\-S\fR, \fB\-\-no\-keep\-going\fR, \fB\-\-stop\fR .RS 4 Ignored for compatibility with GNU Make .RE .PP \fB\-\-site\-dir=\fR\fB\fIpath\fR\fR .RS 4 Use \fIpath\fR as the site directory rather than searching the list of default site directories\&. This directory will be prepended to \fIsys\&.path\fR, the module \fIpath\fR/site_init\&.py will be loaded if it exists, and \fIpath\fR/site_tools will be included in the tool search path\&. The option is not additive \- if given more than once, the last \fIpath\fR wins\&. .sp The default set of site directories searched when \fB\-\-site\-dir\fR is not specified depends on the system platform, as follows\&. Users or system administrators can tune site\-specific or project\-specific SCons behavior by setting up a site directory in one or more of these locations\&. Directories are examined in the order given, from most generic ("system" directories) to most specific (in the current project), so the last\-executed site_init\&.py file is the most specific one, giving it the chance to override everything else), and the directories are prepended to the paths, again so the last directory examined comes first in the resulting path\&. .PP Windows: .RS 4 .sp .if n \{\ .RS 4 .\} .nf %ALLUSERSPROFILE%/scons/site_scons %LOCALAPPDATA%/scons/site_scons %APPDATA%/scons/site_scons %USERPROFILE%/\&.scons/site_scons \&./site_scons .fi .if n \{\ .RE .\} .sp Note earlier versions of the documentation listed a different path for the "system" site directory, this path is still checked but its use is discouraged: .sp .if n \{\ .RS 4 .\} .nf %ALLUSERSPROFILE%/Application Data/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 .RE .PP \fB\-\-stack\-size=\fR\fB\fIKILOBYTES\fR\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 threads execute the actions of the builders for the nodes that are out\-of\-date\&. This option has no effect unless the number of concurrent build jobs is larger than one (as set by \fB\-j N\fR or \fB\-\-jobs=N\fR on the command line or \fBSetOption\fR in a script)\&. .sp 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\&. 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 \fB\-t\fR, \fB\-\-touch\fR .RS 4 Ignored for compatibility with GNU Make\&. (Touching a file to make it appear up\-to\-date is unnecessary when using \fBscons\fR\&.) .RE .PP \fB\-\-taskmastertrace=\fR\fB\fIfile\fR\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 \fB\-\-tree=\fR\fB\fItype\fR\fR\fB[\fR\fB\fI,type\fR\fR\fB\&.\&.\&.]\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 \fItype\fR specified: .PP \fBall\fR .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 \fBderived\fR .RS 4 Restricts the tree output to only derived (target) files, not source files\&. .RE .PP \fBlinedraw\fR .RS 4 Draw the tree output using Unicode line\-drawing characters instead of plain ASCII text\&. This option acts as a modifier to the selected \fItype\fR(s)\&. If specified alone, without any \fItype\fR, it behaves as if \fBall\fR had been specified\&. .sp \fINew in version 4\&.0\&.\fR .RE .PP \fBstatus\fR .RS 4 Prints status information for each displayed node\&. .RE .PP \fBprune\fR .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 .sp Multiple \fItype\fR choices may be specified, separated by commas: .sp .if n \{\ .RS 4 .\} .nf # Prints only derived files, with status information: \fBscons \-\-tree=derived,status\fR # Prints all dependencies of target, with status information # and pruning dependencies of already\-visited Nodes: \fBscons \-\-tree=all,prune,status target\fR .fi .if n \{\ .RE .\} .RE .PP \fB\-u\fR, \fB\-\-up\fR, \fB\-\-search\-up\fR .RS 4 Walks up the directory structure until an SConstruct, Sconstruct, sconstruct, SConstruct\&.py, Sconstruct\&.py or sconstruct\&.py file is found, and uses that as the project top directory\&. If no targets are specified on the command line, only targets at or below the current directory will be built\&. .RE .PP \fB\-U\fR .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 file(s) in the current directory are built, regardless of what directory the resultant targets end up in\&. .RE .PP \fB\-v\fR, \fB\-\-version\fR .RS 4 Print the \fBscons\fR version, copyright information, list of authors, and any other relevant information\&. Then exit\&. .RE .PP \fB\-w\fR, \fB\-\-print\-directory\fR .RS 4 Print a message containing the working directory before and after other processing\&. .RE .PP \fB\-\-no\-print\-directory\fR .RS 4 Turn off \-w, even if it was turned on implicitly\&. .RE .PP \fB\-\-warn=\fR\fB\fItype\fR\fR, \fB\-\-warn=no\-\fR\fB\fItype\fR\fR .RS 4 Enable or disable (with the prefix "no\-") warnings (\fB\-\-warning\fR is a synonym)\&. \fItype\fR specifies the type of warnings to be enabled or disabled: .PP \fBall\fR .RS 4 All warnings\&. .RE .PP \fBcache\-version\fR .RS 4 Warnings about the derived\-file cache directory specified by \fBCacheDir\fR not using the latest configuration information\&. These warnings are enabled by default\&. .RE .PP \fBcache\-write\-error\fR .RS 4 Warnings about errors trying to write a copy of a built file to a specified derived\-file cache specified by \fBCacheDir\fR\&. These warnings are disabled by default\&. .RE .PP \fBcache\-cleanup\-error\fR .RS 4 Warnings about errors when a file retrieved from the derived\-file cache could not be removed\&. .RE .PP \fBcorrupt\-sconsign\fR .RS 4 Warnings about unfamiliar signature data in \&.sconsign files\&. These warnings are enabled by default\&. .RE .PP \fBdependency\fR .RS 4 Warnings about dependencies\&. These warnings are disabled by default\&. .RE .PP \fBdeprecated\fR .RS 4 Warnings about use of currently deprecated features\&. These warnings are enabled by default\&. Not all deprecation warnings can be disabled with the \fB\-\-warn=no\-deprecated\fR option as some deprecated features which are late in the deprecation cycle may have been designated as mandatory warnings, and these will still display\&. Warnings for certain deprecated features may also be enabled or disabled individually; see below\&. .RE .PP \fBduplicate\-environment\fR .RS 4 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 \fBfortran\-cxx\-mix\fR .RS 4 Warnings about linking Fortran and C++ object files in a single executable, which can yield unpredictable behavior with some compilers\&. .RE .PP \fBfuture\-reserved\-variable\fR .RS 4 Warnings about construction variables which are currently allowed, but will become reserved variables in a future release\&. .RE .PP \fBfuture\-deprecated\fR .RS 4 Warnings about features that will be deprecated in the future\&. Such warnings are disabled by default\&. Enabling future deprecation warnings is 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 \fBlink\fR .RS 4 Warnings about link steps\&. .RE .PP \fBmisleading\-keywords\fR .RS 4 Warnings about the use of two commonly misspelled keywords \fItargets\fR and \fIsources\fR to \fBBuilder\fR calls\&. The correct spelling is the singular form, even though \fItarget\fR and \fIsource\fR can themselves refer to lists of names or nodes\&. .RE .PP \fBno\-object\-count\fR .RS 4 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\&. .sp Note the "no\-" prefix is part of the name of this warning\&. Add another "\-no" to disable\&. .RE .PP \fBno\-parallel\-support\fR .RS 4 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\&. .sp Note the "no\-" prefix is part of the name of this warning\&. Add another "\-no" to disable\&. .RE .PP \fBpython\-version\fR .RS 4 Warnings about running SCons using a version of Python that has been deprecated\&. These warnings are enabled by default\&. .RE .PP \fBreserved\-variable\fR .RS 4 Warnings about attempts to set the reserved construction variable names \fB$CHANGED_SOURCES\fR, \fB$CHANGED_TARGETS\fR, \fB$TARGET\fR, \fB$TARGETS\fR, \fB$SOURCE\fR, \fB$SOURCES\fR, \fB$UNCHANGED_SOURCES\fR or \fB$UNCHANGED_TARGETS\fR\&. These warnings are disabled by default\&. .RE .PP \fBstack\-size\fR .RS 4 Warnings about requests to set the stack size that could not be honored\&. These warnings are enabled by default\&. .RE .PP \fBtarget\-not\-built\fR .RS 4 Warnings about a build rule not building the expected targets\&. These warnings are disabled by default\&. .RE .sp .RE .PP \fB\-Y \fR\fB\fIrepository\fR\fR, \fB\-\-repository=\fR\fB\fIrepository\fR\fR, \fB\-\-srcdir=\fR\fB\fIrepository\fR\fR .RS 4 Search \fIrepository\fR for any input and target files not found in the local directory hierarchy\&. Multiple \fB\-Y\fR options may be specified, with repositories searched in the given order\&. See \fBRepository\fR for more information\&. .RE .SH "SCONSCRIPT FILE REFERENCE" .SS "SConscript Files" .PP The build configuration is described by one or more files, known as SConscript files\&. There must be at least one file for a valid build (\fBscons\fR will quit if it does not find one)\&. \fBscons\fR by default looks for this file by the name SConstruct in the directory from which you run \fBscons\fR, though if necessary, also looks for alternative file names Sconstruct, sconstruct, SConstruct\&.py, Sconstruct\&.py and sconstruct\&.py in that order\&. A different file name (which can include a pathname part) may be specified via the \fB\-f\fR option\&. Except for the SConstruct file, these files are not searched for automatically; you add additional configuration files to the build by calling the \fBSConscript\fR function\&. This allows parts of the build to be conditionally included or excluded at run\-time depending on how \fBscons\fR is invoked\&. .PP Each SConscript file in a build configuration is invoked independently in a separate context\&. This provides necessary isolation so that different parts of the build don\*(Aqt accidentally step on each other\&. You have to be explicit about sharing information, by using the \fBExport\fR function or the \fIexports\fR argument to the \fBSConscript\fR function, as well as the \fBReturn\fR function in a called SConscript file, and consume shared information by using the \fBImport\fR function\&. .PP The following sections describe the various SCons facilities that can be used in SConscript files\&. Quick links: .RS 4 Construction Environments .RE .RS 4 Tools .RE .RS 4 Builder Methods .RE .RS 4 Functions and Environment Methods .RE .RS 4 SConscript Variables .RE .RS 4 Construction Variables .RE .RS 4 Configure Contexts .RE .RS 4 Command\-Line Construction Variables .RE .RS 4 Node Objects .RE .SS "Construction Environments" .PP A Construction Environment is the basic means by which you communicate build information to SCons\&. A new construction environment is created using the \fBEnvironment\fR function: .sp .if n \{\ .RS 4 .\} .nf env = Environment() .fi .if n \{\ .RE .\} .PP Construction environment attributes called Construction Variables may be set either by specifying them as keyword arguments when the object is created or by assigning them a value after the object is created\&. These two are nominally equivalent: .sp .if n \{\ .RS 4 .\} .nf env = Environment(FOO=\*(Aqfoo\*(Aq) env[\*(AqFOO\*(Aq] = \*(Aqfoo\*(Aq .fi .if n \{\ .RE .\} .PP Note that certain settings which affect tool detection are referenced only when the tools are initialized, so you need either to supply them as part of the call to \fBEnvironment\fR, or defer tool initialization\&. For example, initializing the Microsoft Visual C++ version you wish to use: .sp .if n \{\ .RS 4 .\} .nf # initializes msvc to v14\&.1 env = Environment(MSVC_VERSION="14\&.1") env = Environment() # msvc tool was initialized to default, does not reinitialize env[\*(AqMSVC_VERSION\*(Aq] = "14\&.1" env = Environment(tools=[]) env[\*(AqMSVC_VERSION\*(Aq] = "14\&.1" # msvc tool initialization was deferred, so will pick up new value env\&.Tool(\*(Aqdefault\*(Aq) .fi .if n \{\ .RE .\} .PP As a convenience, construction variables may also be set or modified by the \fIparse_flags\fR keyword argument during object creation, which has the effect of the \fBenv\&.MergeFlags\fR method being applied 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 need to be distributed to a number of construction variables\&. \fBenv\&.ParseFlags\fR describes how these arguments are distributed to 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 the \fB$CPPPATH\fR construction variable, \*(AqEBUG\*(Aq to \fB$CPPDEFINES\fR, and \*(Aqm\*(Aq to \fB$LIBS\fR\&. .PP An existing construction environment can be duplicated by calling the \fBenv\&.Clone\fR method\&. Without arguments, it will be a copy with the same settings\&. Otherwise, \fBenv\&.Clone\fR takes the same arguments as \fBEnvironment\fR, and uses the arguments to create a modified copy\&. .PP SCons provides a special construction environment called the Default Environment\&. The default environment is used only for global functions, that is, build requests called without the context of a regular construction environment\&. See \fBDefaultEnvironment\fR for more information\&. .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\&. The optional \fIplatform\fR keyword argument may be used to specify that the construction environment should be initialized for a different platform: .sp .if n \{\ .RS 4 .\} .nf env = Environment(platform=\*(Aqcygwin\*(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 that platform\&. .PP Note that the win32 platform adds the \fISystemDrive\fR and \fISystemRoot\fR variables from the user\*(Aqs external environment to the construction environment\*(Aqs \fIENV\fR dictionary\&. This is so that any executed commands that use sockets to connect with other systems will work on Windows systems\&. .PP The \fIplatform\fR argument may be a string value representing one of the pre\-defined platforms (aix, cygwin, darwin, hpux, irix, os2, posix, sunos or win32), or a callable platform object returned by a call to \fBPlatform\fR selecting a pre\-defined platform, or it may be a user\-supplied callable, in which case the \fBEnvironment\fR method will call it 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 Note that supplying a non\-default platform or custom function for initialization may bypass settings that should happen for the host system and should be used with care\&. It is most useful in the case where the platform is an alternative for the one that would be auto\-detected, such as platform="cygwin" on a system which would otherwise identify as win32\&. .PP The optional \fItools\fR and \fItoolpath\fR keyword arguments affect the way tools available to the environment are initialized\&. See the section called \(lqTools\(rq for details\&. .PP The optional \fIvariables\fR keyword argument allows passing a Variables object which will be used in the initialization of the construction environment See the section called \(lqCommand-Line Construction Variables\(rq for details\&. .SS "Tools" .PP SCons has many included tool modules (more properly, tool specification modules) which are used to help initialize the construction environment prior to building, and more can be written to suit a particular purpose, or added from external sources (a repository of contributed tools is available)\&. More information on writing custom tools can be found in the Extending SCons section and specifically Tool Modules\&. .PP An SCons tool is only responsible for setup\&. For example, if an SConscript file declares the need to construct an object file from a C\-language source file by calling the \fBObject\fR builder, then a tool module representing an available C compiler needs to have run first, to set up that builder and all the construction variables it needs in the associated construction environment\&. The tool itself is not called in the process of the build\&. Tool setup happens when a construction environment is constructed, and in the basic case needs no intervention \- platform\-specific lists of default tools are used to examine the specific capabilities of that platform and configure the environment, skipping those tools which are not applicable\&. .PP If necessary, a specific set of tools to initialize in an environment during creation may be specified using the optional keyword argument \fItools\fR\&. \fItools\fR must be a list, even if there are one (or zero) tools\&. This is useful to override the defaults, to specify non\-default built\-in tools, and to cause added tools to be called: .sp .if n \{\ .RS 4 .\} .nf env = Environment(tools=[\*(Aqmsvc\*(Aq, \*(Aqlex\*(Aq]) .fi .if n \{\ .RE .\} .PP The \fItools\fR argument overrides the default 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 specify a tool for at least a compiler and a linker, as in tools=[\*(Aqclang\*(Aq, \*(Aqlink\*(Aq]\&. .PP If the \fItools\fR argument is omitted, or if \fItools\fR includes the reserved name \*(Aqdefault\*(Aq, then SCons will auto\-detect usable tools, using the search path from the execution environment (that is, \fI\fIenv\fR\fR\fI[\*(AqENV\*(Aq][\*(AqPATH\*(Aq]\fR) for looking up any external programs, and the platform name in effect to determine the default tools for that platform\&. Note the contents of \fBPATH\fR from the external environment \fIos\&.environ\fR is \fInot\fR used\&. Changing the \fIPATH\fR in the execution environment after the construction environment is constructed will not cause the tools to be re\-detected\&. .PP Tools can also be directly called by using the \fBTool\fR method (see below)\&. .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$CCDEPFLAGS\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$CCCOMSTR\fR, \fB$PLATFORM\fR, \fB$SHCCCOMSTR\fR\&. .RE .PP clang .RS 4 Set construction variables for the Clang C compiler\&. .sp Sets: \fB$CC\fR, \fB$CCDEPFLAGS\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 compilation_db .RS 4 Sets up \fBCompilationDatabase\fR builder which generates a clang tooling compatible compilation database\&. .sp Sets: \fB$COMPILATIONDB_COMSTR\fR, \fB$COMPILATIONDB_PATH_FILTER\fR, \fB$COMPILATIONDB_USE_ABSPATH\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, \fB$SHCXXCOMSTR\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 \fB$TOOLS\fR construction variable in the construction environment\&. .sp On all platforms, the tools from the following list are selected if their 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 ar\&. 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 as; 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 On the BSD systems whose base compiler is LLVM/clang (FreeBSD and OpenBSD), the default tools list matches the Linux one except that the C compiler is selected (first\-found) from clang, gcc, intelc, icc, cc and the C++ compiler from clangxx, g++, intelc, icc, cXX\&. .sp Default lists for other platforms can be found by examining the \fBscons\fR 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$DVERPREFIX\fR, \fB$DVERSIONS\fR, \fB$DVERSUFFIX\fR, \fB$SHDC\fR, \fB$SHDCOM\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 \fBPATH\fR 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 .\} 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 \fIxsl\fR 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$FORTRANCOMMONFLAGS\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$FORTRANCOMMONFLAGS\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$FORTRANCOMMONFLAGS\fR, \fB$FORTRANCOMSTR\fR, \fB$FORTRANFLAGS\fR, \fB$FORTRANPPCOMSTR\fR, \fB$SHF77COMSTR\fR, \fB$SHF77PPCOMSTR\fR, \fB$SHFORTRANCOMSTR\fR, \fB$SHFORTRANFLAGS\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$FORTRANCOMMONFLAGS\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$FORTRANCOMMONFLAGS\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$CPPFLAGS\fR, \fB$FORTRANCOMSTR\fR, \fB$FORTRANPPCOMSTR\fR, \fB$SHFORTRANCOMSTR\fR, \fB$SHFORTRANPPCOMSTR\fR, \fB$_CPPDEFFLAGS\fR\&. .RE .PP g++ .RS 4 Set construction variables for the g++ 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\&. .sp Sets: \fB$F77\fR, \fB$F77COM\fR, \fB$F77FILESUFFIXES\fR, \fB$F77PPCOM\fR, \fB$F77PPFILESUFFIXES\fR, \fB$FORTRAN\fR, \fB$FORTRANCOM\fR, \fB$FORTRANPPCOM\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\&. .sp Uses: \fB$F77FLAGS\fR, \fB$FORTRANCOMMONFLAGS\fR, \fB$FORTRANFLAGS\fR\&. .RE .PP gas .RS 4 Sets construction variables for the gas assembler\&. Calls the as tool\&. .sp Sets: \fB$AS\fR\&. .RE .PP gcc .RS 4 Set construction variables for the gcc C compiler\&. .sp Sets: \fB$CC\fR, \fB$CCDEPFLAGS\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$DVERPREFIX\fR, \fB$DVERSIONS\fR, \fB$DVERSUFFIX\fR, \fB$SHDC\fR, \fB$SHDCOM\fR, \fB$SHDLIBVERSIONFLAGS\fR, \fB$SHDLINK\fR, \fB$SHDLINKCOM\fR, \fB$SHDLINKFLAGS\fR\&. .RE .PP gettext .RS 4 A toolset supporting internationalization and localization of software being constructed with SCons\&. The toolset loads the following tools: .sp .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} xgettext \- 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 \- initialize PO files during initial translation of a project\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} msgmerge \- 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 \- compile textual PO files to binary installable MO files\&. .RE .sp When you enable gettext, it internally loads all the above\-mentioned 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 \fBTranslate\fR builder\&. .sp To use the gettext tools, add the \*(Aqgettext\*(Aq tool to your construction 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 Fortran compiler\&. Calls the fortran Tool module to set variables\&. .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 \fBTool\fR sets the required construction variables for working with the Ghostscript software\&. It also registers an appropriate Action with the \fBPDF\fR Builder, such that the conversion from PS/EPS to PDF happens automatically for the TeX/LaTeX toolchain\&. Finally, it adds an explicit \fBGs\fR Builder for Ghostscript 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 aCC compilers 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) tool 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$DVERPREFIX\fR, \fB$DVERSIONS\fR, \fB$DVERSUFFIX\fR, \fB$SHDC\fR, \fB$SHDCOM\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 analyzer\&. .sp Sets: \fB$LEX\fR, \fB$LEXCOM\fR, \fB$LEXFLAGS\fR, \fB$LEXUNISTD\fR\&. .sp Uses: \fB$LEXCOMSTR\fR, \fB$LEXFLAGS\fR, \fB$LEX_HEADER_FILE\fR, \fB$LEX_TABLES_FILE\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 tool is a part of the gettext toolset\&. It provides SCons an interface to the \fBmsgfmt(1)\fR command by setting up the \fBMOFiles\fR builder, which generates binary message catalog (MO) files from a textual translation description (PO files)\&. .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 tool is a part of scons gettext toolset\&. It provides SCons an interface to the \fBmsginit(1)\fR program, by setting up the \fBPOInit\fR builder, which creates a new PO file, initializing the meta information with values from the construction 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 tool is a part of scons gettext toolset\&. It provides SCons an interface to the \fBmsgmerge(1)\fR command, by setting up the \fBPOUpdate\fR builder, 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$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++ compiler\&. .sp Sets: \fB$BUILDERS\fR, \fB$CC\fR, \fB$CCCOM\fR, \fB$CCDEPFLAGS\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$MSVC_NOTFOUND_POLICY\fR, \fB$MSVC_SCRIPTERROR_POLICY\fR, \fB$MSVC_SCRIPT_ARGS\fR, \fB$MSVC_SDK_VERSION\fR, \fB$MSVC_SPECTRE_LIBS\fR, \fB$MSVC_TOOLSET_VERSION\fR, \fB$MSVC_USE_SCRIPT\fR, \fB$MSVC_USE_SCRIPT_ARGS\fR, \fB$MSVC_USE_SETTINGS\fR, \fB$MSVC_VERSION\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 ninja .RS 4 Sets up the \fBNinja\fR builder, which generates a ninja build file, and then optionally runs ninja\&. .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 is an experimental feature\&. This functionality is subject to change and/or removal without a deprecation cycle\&. .sp .5v .RE Sets: \fB$IMPLICIT_COMMAND_DEPENDENCIES\fR, \fB$NINJA_ALIAS_NAME\fR, \fB$NINJA_CMD_ARGS\fR, \fB$NINJA_COMPDB_EXPAND\fR, \fB$NINJA_DEPFILE_PARSE_FORMAT\fR, \fB$NINJA_DIR\fR, \fB$NINJA_DISABLE_AUTO_RUN\fR, \fB$NINJA_ENV_VAR_CACHE\fR, \fB$NINJA_FILE_NAME\fR, \fB$NINJA_FORCE_SCONS_BUILD\fR, \fB$NINJA_GENERATED_SOURCE_ALIAS_NAME\fR, \fB$NINJA_GENERATED_SOURCE_SUFFIXES\fR, \fB$NINJA_MSVC_DEPS_PREFIX\fR, \fB$NINJA_POOL\fR, \fB$NINJA_REGENERATE_DEPS\fR, \fB$NINJA_SCONS_DAEMON_KEEP_ALIVE\fR, \fB$NINJA_SCONS_DAEMON_PORT\fR, \fB$NINJA_SYNTAX\fR, \fB$_NINJA_REGENERATE_DEPS_FUNC\fR\&. .sp Uses: \fB$AR\fR, \fB$ARCOM\fR, \fB$ARFLAGS\fR, \fB$CC\fR, \fB$CCCOM\fR, \fB$CCDEPFLAGS\fR, \fB$CCFLAGS\fR, \fB$CXX\fR, \fB$CXXCOM\fR, \fB$ESCAPE\fR, \fB$LINK\fR, \fB$LINKCOM\fR, \fB$PLATFORM\fR, \fB$PRINT_CMD_LINE_FUNC\fR, \fB$PROGSUFFIX\fR, \fB$RANLIB\fR, \fB$RANLIBCOM\fR, \fB$SHCCCOM\fR, \fB$SHCXXCOM\fR, \fB$SHLINK\fR, \fB$SHLINKCOM\fR\&. .RE .PP packaging .RS 4 Sets construction variables for the \fBPackage\fR Builder\&. If this tool is enabled, the \fB\-\-package\-type\fR command\-line option is made available\&. .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 python .RS 4 Loads the Python source scanner into the invoking environment\&. When loaded, the scanner will attempt to find implicit dependencies for any Python source files in the list of sources provided to an Action that uses this environment\&. .sp \fIAvailable since \fR\fI\fBscons\fR\fR\fI 4\&.0\&.\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 compiler\&. .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$FILE_ENCODING\fR, \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 Borland tlib 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 tool is a part of the gettext toolset\&. It provides SCons an interface to the \fBxgettext(1)\fR program, which extracts internationalized messages from source code\&. The tool sets up the \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 parser generator\&. .sp Sets: \fB$YACC\fR, \fB$YACCCOM\fR, \fB$YACCFLAGS\fR, \fB$YACCHFILESUFFIX\fR, \fB$YACCHXXFILESUFFIX\fR, \fB$YACCVCGFILESUFFIX\fR, \fB$YACC_GRAPH_FILE_SUFFIX\fR\&. .sp Uses: \fB$YACCCOMSTR\fR, \fB$YACCFLAGS\fR, \fB$YACC_GRAPH_FILE\fR, \fB$YACC_HEADER_FILE\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 Builder methods are special functions used to declare relationships in the build dependency graph\&. Calling a Builder does not build anything directly, but records the target or targets (what you want built), sources (what it\(cqs built from), and the construction environment to use for build settings\&. The builder itself will typically have information about producing targets which is also used, except \fBCommand\fR, where the caller is responsible for specifying the action\&. The SCons job runner later decides if and when to initiate a build using this information\&. .PP All true Builder methods share the same function calling syntax\&. For the sake of brevity, this common signature is not included in the listing of Builders\&. Pseudo\-Builders have more flexibility in how they are called, and do not necessarily follow this convention, as described in the text of the respective entries\&. .sp .if n \{\ .RS 4 .\} .nf \fBBuildername\fR(\fItarget, source, [key=val, \&.\&.\&.]\fR) .fi .if n \{\ .RE .\} .PP The \fItarget\fR and \fIsource\fR arguments can be specified either as positional or keyword arguments\&. Some additional keyword arguments are recognized for all builders, and any unknown keyword arguments are treated as temporary construction variable assignments\&. You can specify sources and targets as a scalar or a list, composed of either strings or nodes\&. For convenience, the \fBSplit\fR method can be used to split a single whitespace\-separated string into a list\&. .PP SCons can resolve paths to sources and targets specified in several different forms\&. The \fItarget\fR and \fIsource\fR arguments can be scalar (string or Node) or a collection (of strings or Nodes)\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Nodes always work, as they are the result of a previous successful path resolution; if a path string is resolved correctly it is stored internally as a Node in the dependency graph\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Plain file names (no pathname separators) are searched for in the current directory\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Absolute paths (begin with a pathname separator) are resolved by walking the path components starting from root of the filesystem or current volume\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Relative paths (no leading pathname separator) are resolved by walking the path components starting from the current directory\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Top\-relative paths are relative paths whose first character is \fB#\fR\&. They are walked starting from the project top\-level directory (usually, the directory where the SConstruct file is found)\&. Top\-relative paths are always relative paths, so the initial character can be followed by a pathname separator, which is ignored and does not affect resolution\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} UNC paths (Windows) start with exactly two pathname separators\&. They take the form \e\eserver_name\eshare_name\efile_path\&. The \fIfile_path\fR portion is looked up as an absolute path starting from the root of the resource described by \e\eserver_name\eshare_name\&. Since UNC paths are never relative, the top\-relative path form does not apply\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} URL\-style strings and Python pathlib objects are not recognized\&. .RE .PP The "current directory" for relative path resolution has options\&. SCons by default changes to the directory containing the SConscript file (including SConstruct) it is currently processing\&. Use of the \fBSConscriptChdir\fR function toggles the default behavior off/on\&. The \fIsrcdir\fR builder argument affects where source file paths are looked for (see details below)\&. Specifying one or more source code repositories via the \fBRepository\fR function or the \fB\-Y/\-\-repository\fR option tells SCons to look additional places after the actual current directory\&. The concept of current directory changes for targets (and in some cases sources) if a variant directory is set up using the \fBVariantDir\fR function or the \fIvariant_dir=\fR parameter to the \fBSConscript\fR function\&. These options do not affect top\-relative paths\&. .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 .PP On Windows, DOS paths may begin with a volume or drive letter followed by the volume separator (:)\&. The remainder of the path is absolute or relative; if the volume specifier is present, resolution starts at the root of the specified drive for absolute paths and the current directory on the specified drive for relative paths\&. If the specified drive letter is different than the current drive, a relative path is missing context: since SCons is a console (command\-line) application, it may inherit state from the terminal it was started in, including saved current directories for other drives; SCons has no way of knowing what those would be\&. Use of a drive letter in the path also precludes the use of the top\-relative form\&. .sp .5v .RE .PP 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 Additional examples of source and target paths: .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 .PP Top\-relative paths only work where SCons will interpret the path (see examples)\&. The string must first be converted to a relative or absolute path to be used in other contexts (such as pure Python code that does not involve an SCons API call), A suitable string can be extracted from the Node created from a top\-relative path\&. Additionally, some paths are handled by SCons but are not directly build participants, so are not evaluated for the # since no Nodes are created\&. You can explcitly create a \fBFile\fR or \fBDir\fR node to force evaluation, such as when specifying a path to the derived\-file cache: CacheDir(Dir(\*(Aq#cache\*(Aq))\&. .sp .5v .RE .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) # os\&.path\&.exists() is pure Python, so this fails: if os\&.path\&.exists(\*(Aq#inc/foo\&.h\*(Aq): env\&.Append(CPPPATH=\*(Aq#inc\*(Aq) # create a Node to make it work: if os\&.path\&.exists(File(\*(Aq#inc/foo\&.h\*(Aq)): env\&.Append(CPPPATH=\*(Aq#inc\*(Aq) .fi .if n \{\ .RE .\} .PP If SCons can deduce the target name from the source(s), the \fItarget\fR argument may be omitted\&. If the Builder supports it, SCons will take the base name of the first source file and use it as the base name of the target, adding the appropriate prefix/suffix\&. For Builders designated as single\-source, a separate target is built for each source file\&. If multiple sources are passed to a single\-source builder, the target argument \fImust\fR be omitted, and each target will be given a name deduced from the corresponding source file\&. .PP The optional \fIsrcdir\fR keyword argument specifies that source file strings that are not absolute or top\-relative paths are to be interpreted relative to the value of \fIsrcdir\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, rather than looking for them in the directory of of the SConscript file being evaluated\&. .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 The optional \fIparse_flags\fR keyword argument causes behavior similar to the \fBenv\&.MergeFlags\fR method, where the argument value is broken into individual settings and merged into the appropriate construction variables\&. The following example adds \*(Aqinclude\*(Aq to the \fB$CPPPATH\fR construction variable, \*(AqEBUG\*(Aq to \fB$CPPDEFINES\fR, and \*(Aqm\*(Aq to \fB$LIBS\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 The optional \fIchdir\fR keyword argument specifies that the Builder\*(Aqs action(s) should be executed after changing directory\&. If the \fIchdir\fR argument is a path string or a directory Node, scons will change to the specified directory\&. If the \fIchdir\fR is not a string or Node and evaluates true, then \fBscons\fR will change to the target file\*(Aqs directory\&. The original directory is restored after the action is complete\&. .sp .if n \{\ .RS 4 .\} .nf # scons will change to the "sub/dir" subdirectory # before executing the Copy action function env\&.Command( target=\*(Aqsub/dir/foo\&.out\*(Aq, source=\*(Aqsub/dir/foo\&.in\*(Aq, action=Copy(\*(Aq${TARGET\&.file}\*(Aq, \*(Aq${SOURCE\&.file}\*(Aq), chdir=\*(Aqsub/dir\*(Aq, ) # Here, chdir is not a string, so scons will change to the # target\*(Aqs directory ("sub/dir") to execute the action\&. env\&.Command(\*(Aq target=\*(Aqsub/dir/foo\&.out\*(Aq, source=\*(Aqsub/dir/foo\&.in\*(Aq, action=Copy(\*(Aq${TARGET\&.file}\*(Aq, \*(Aq${SOURCE\&.file}\*(Aq), chdir=True ) .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 \fBWarning\fR .ps -1 .br .PP Python only tracks one current directory location, even if there are multiple executing threads\&. This means that use of the \fIchdir\fR argument will \fInot\fR work with SCons in multi\-threaded mode (the \fB\-j\fR option), because individual worker threads spawned by SCons interfere with each other when they start changing directory\&. .sp .5v .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 .PP SCons does not account for \fIchdir\fR when it expands construction variables like \fB$TARGET\fR and \fB$SOURCE\fR, so they will be incorrect relative to the chdir directory\&. If you use the \fIchdir\fR keyword argument, you will typically need to supply a different command line using expansions like ${TARGET\&.file} and ${SOURCE\&.file}, which expand to the filename portion of the target and source\&. .sp .5v .RE .PP Keyword arguments that are not specifically recognized are treated as construction variable overrides, which replace or add those variables on a limited basis\&. These overrides will only be in effect when building the target of the builder call, 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( target=\*(Aqword\*(Aq, source=\*(Aqword\&.cpp\*(Aq, SHLIBSUFFIX=\*(Aq\&.ocx\*(Aq, LIBSUFFIXES=[\*(Aq\&.ocx\*(Aq], ) .fi .if n \{\ .RE .\} .PP Note that both the \fB$SHLIBSUFFIX\fR and \fB$LIBSUFFIXES\fR construction variables must be set if you want \fBscons\fR to search automatically for dependencies on the non\-standard library names; see the descriptions of these variables for more information\&. .PP Although the builder methods defined by \fBscons\fR are, in fact, methods of a construction environment object, many 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 If called this way, the builder will internally use the Default 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 (indicated in the listing of builders below without a leading \fIenv\&.\fR) 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 A builder \fImay\fR add additional targets beyond those requested if an attached Emitter chooses to do so (see the section called \(lqBuilder Objects\(rq for more information\&. \fB$PROGEMITTER\fR is an example)\&. For example, the GNU linker takes a command\-line argument \fB\-Map=\fR\fB\fImapfile\fR\fR, which causes it to produce a linker map file in addition to the executable file actually being linked\&. If the \fBProgram\fR builder\*(Aqs emitter is configured to add this mapfile if the option is set, then two targets will be returned when you only provided for one\&. .PP For this reason, builder methods always return a NodeList, a list\-like object whose elements are Nodes\&. Nodes are the internal representation of build targets or sources (see the section called \(lqNode Objects\(rq for more information)\&. The returned NodeList object can be passed to other builder methods as source(s) or to other SCons functions or methods where a path string would normally be accepted\&. .PP For example, to add a specific preprocessor define when compiling one specific object file but not the others: .sp .if n \{\ .RS 4 .\} .nf bar_obj_list = env\&.StaticObject(\*(Aqbar\&.c\*(Aq, CPPDEFINES=\*(Aq\-DBAR\*(Aq) env\&.Program("prog", [\*(Aqfoo\&.c\*(Aq, bar_obj_list, \*(Aqmain\&.c\*(Aq]) .fi .if n \{\ .RE .\} .PP Using a Node as in this example makes for a more portable build by avoiding having to specify a platform\-specific object suffix when calling the \fBProgram\fR builder method\&. .PP The NodeList object is also convenient to pass to the \fBDefault\fR function, for the same reason of avoiding a platform\-specific name: .sp .if n \{\ .RS 4 .\} .nf tgt = env\&.Program("prog", ["foo\&.c", "bar\&.c", "main\&.c"]) Default(tgt) .fi .if n \{\ .RE .\} .PP The Node representing the explicitly\-requested target is always the first element of the returned NodeList, and can be retrieved via list indexing (e\&.g\&. bar_obj_list[0])\&. The path name for a Node\*(Aqs file can be obtained by using Python\*(Aqs string constructor \fBstr\fR (e\&.g\&. str(bar_obj_list[0]))\&. .PP Builder calls will automatically "flatten" lists passed as source and target, so they are free to contain elements which are themselves lists, such as \fIbar_obj_list\fR returned by the \fBStaticObject\fR call\&. If you need to manipulate a list of lists returned by builders directly in Python code, you can either build a new 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 obj in objects: print(str(obj)) .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 obj in objects: print(str(obj)) .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 \fBNote\fR .ps -1 .br .PP Since builder calls return a list\-like object, not an actual Python list, it is not appropriate to 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 NodeList 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 += here: # 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 .\} .sp .5v .RE .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 All targets of builder methods automatically depend on their sources\&. SCons scans source files in various programming languages for known dependency indications (e\&.g\&. #include directives for sources that will be fed to the C preprocessor), largely eliminating the need for explicit dependency specification\&. You can also specify an explicit dependency using the \fBenv\&.Depends\fR method of a construction environment, although this is discouraged unless the dependency cannot reliably be detected by an existing scanner\&. .PP By default, SCons can scan C source files, C++ source files, Fortran source files with specific file extensions (\&.F (POSIX systems only), \&.fpp, or \&.FPP) and assembly language files with speicific file extensions (\&.S (POSIX systems only), \&.spp, or \&.SPP) for C preprocessor dependencies\&. SCons also has default support for scanning D, Java, SWIG and LaTeX source files\&. .PP Builders are created at runtime for efficiency and added to the construction environment as methods\&. SCons provides templates for many Builders for known build types, and additional Builders can be written to add to a project\&. The templates usually exist in Tool specification modules, which, when run, can probe for the presence of required external tools, such as a compiler binary, and for other necessary conditions, before instantiating the Builder\&. The Builders available in a given construction environment thus vary with the type of platform, how the platform is provisioned, and the tools selected for loading\&. The available builder methods are registered as key\-value pairs in the \fB$BUILDERS\fR attribute of the construction environment\&. Although a Builder is created as a method of a construction environment, they may also be called as a global function\&. A Builder called this way will internally use the Default Environment to look up construction variables: .sp .if n \{\ .RS 4 .\} .nf Program(\*(Aqhello\*(Aq, \*(Aqhello\&.c\*(Aq) SharedLibrary(\*(Aqword\*(Aq, \*(Aqword\&.cpp\*(Aq) .fi .if n \{\ .RE .\} .PP Builders called in the global function style are automatically in scope inside SConscript files\&. They are not in scope in project\-specific Python modules that you include via the Python import statement from an SConscript file, and you will need to add them to that module\(cqs global scope explicitly\&. You can do that by adding the following import to the Python module: \fBfrom SCons\&.Script import *\fR\&. .PP The following builder methods have templates in the SCons core software distribution\&. .PP \fBCFile\fR(), \fIenv\fR\&.CFile() .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(), \fIenv\fR\&.Command() .RS 4 There is actually no Builder named \fBCommand\fR, rather the term "Command Builder" refers to a function which, on each call, creates and calls an anonymous Builder\&. This is useful for "one\-off" builds where a full Builder is not needed\&. Since the anonymous Builder is never hooked into the standard Builder framework, an Action must always be specified\&. See the \fBCommand\fR function description for the calling syntax and details\&. .RE .PP \fBCompilationDatabase\fR(), \fIenv\fR\&.CompilationDatabase() .RS 4 \fBCompilationDatabase\fR is a special builder which adds a target to create a JSON formatted compilation database compatible with clang tooling (see the \m[blue]\fBLLVM specification\fR\m[]\&\s-2\u[1]\d\s+2)\&. This database is suitable for consumption by various tools and editors who can use it to obtain build and dependency information which otherwise would be internal to SCons\&. The builder does not require any source files to be specified, rather it arranges to emit information about all of the C, C++ and assembler source/output pairs identified in the build that are not excluded by the optional filter \fB$COMPILATIONDB_PATH_FILTER\fR\&. The target is subject to the usual SCons target selection rules\&. .sp If called with no arguments, the builder will default to a target name of compile_commands\&.json\&. .sp If called with a single positional argument, \fBscons\fR will "deduce" the target name from that source argument, giving it the same name, and then ignore the source\&. This is the usual way to call the builder if a non\-default target name is wanted\&. .sp If called with either the \fItarget=\fR or \fIsource=\fR keyword arguments, the value of the argument is taken as the target name\&. If called with both, the \fItarget=\fR value is used and \fIsource=\fR is ignored\&. If called with multiple sources, the source list will be ignored, since there is no way to deduce what the intent was; in this case the default target name will be used\&. .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 must load the compilation_db tool prior to specifying any part of your build or some source/output files will not show up in the compilation database\&. .sp .5v .RE \fIAvailable since \fR\fI\fBscons\fR\fR\fI 4\&.0\&.\fR .RE .PP \fBCXXFile\fR(), \fIenv\fR\&.CXXFile() .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(), \fIenv\fR\&.DocbookEpub() .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(), \fIenv\fR\&.DocbookHtml() .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(), \fIenv\fR\&.DocbookHtmlChunked() .RS 4 A pseudo\-Builder providing a Docbook toolchain for chunked HTML output\&. It supports the \fIbase\&.dir\fR 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 \fIroot\&.filename\fR 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 \fIbase\&.dir\fR parameter is provided\&. You can add the \fIbase_dir\fR 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(), \fIenv\fR\&.DocbookHtmlhelp() .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 \fIroot\&.filename\fR 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 \(lq\fBscons \-c\fR\(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 \fIbase\&.dir\fR parameter is provided\&. You can add the \fIbase_dir\fR 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(), \fIenv\fR\&.DocbookMan() .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(), \fIenv\fR\&.DocbookPdf() .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(), \fIenv\fR\&.DocbookSlidesHtml() .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 \fItitlefoil\&.html\fR 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 \(lq\fBscons \-c\fR\(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 \fIbase\&.dir\fR parameter is provided\&. You can add the \fIbase_dir\fR 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(), \fIenv\fR\&.DocbookSlidesPdf() .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(), \fIenv\fR\&.DocbookXInclude() .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(), \fIenv\fR\&.DocbookXslt() .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 \fIxsl\fR parameter to be set\&. .RE .PP \fBDVI\fR(), \fIenv\fR\&.DVI() .RS 4 Builds a \&.dvi file from a \&.tex, \&.ltx or \&.latex input file\&. If the source file suffix is \&.tex, \fBscons\fR 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(), \fIenv\fR\&.Gs() .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(), \fIenv\fR\&.Install() .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(target=\*(Aq/usr/local/bin\*(Aq, source=[\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq]) .fi .if n \{\ .RE .\} .sp Note that if target paths chosen for the \fBInstall\fR builder (and the related \fBInstallAs\fR and \fBInstallVersionedLib\fR builders) are outside the project tree, such as in the example above, they may not be selected for "building" by default, since in the absence of other instructions \fBscons\fR builds targets that are underneath the top directory (the directory that contains the SConstruct file, usually the current directory)\&. Use command line targets or the \fBDefault\fR function in this case\&. .sp If the \fB\-\-install\-sandbox\fR option is given, the target directory will be prefixed by the directory path specified\&. This is useful to test installation behavior 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(), \fIenv\fR\&.InstallAs() .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 .\} .sp See the note under \fBInstall\fR\&. .RE .PP \fBInstallVersionedLib\fR(), \fIenv\fR\&.InstallVersionedLib() .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 .\} .sp See the note under \fBInstall\fR\&. .RE .PP \fBJar\fR(), \fIenv\fR\&.Jar() .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(), \fIenv\fR\&.Java() .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 portability, it\*(Aqs best if the encoding is hard\-coded, so that the compilation works when run 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(), \fIenv\fR\&.JavaH() .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="classdir", source="src") env\&.JavaH(target="java_native\&.h", source=classes) # builds include/package_foo\&.h and include/package_bar\&.h env\&.JavaH(target="include", source=["package/foo\&.class", "package/bar\&.class"]) # builds export/foo\&.h and export/bar\&.h env\&.JavaH( target="export", source=["classes/foo\&.class", "classes/bar\&.class"], JAVACLASSDIR="classes", ) .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 Java versions starting with 10\&.0 no longer use the \fBjavah\fR command for generating JNI headers/sources, and indeed have removed the command entirely (see Java Enhancement Proposal \m[blue]\fBJEP 313\fR\m[]\&\s-2\u[2]\d\s+2), making this tool harder to use for that purpose\&. SCons may autodiscover a \fBjavah\fR belonging to an older release if there are multiple Java versions on the system, which will lead to incorrect results\&. To use with a newer Java, override the default values of \fB$JAVAH\fR (to contain the path to the \fBjavac\fR) and \fB$JAVAHFLAGS\fR (to contain at least a \fB\-h\fR flag) and note that generating headers with \fBjavac\fR requires supplying source \&.java files only, not \&.class files\&. .sp .5v .RE .RE .PP \fBLibrary\fR(), \fIenv\fR\&.Library() .RS 4 A synonym for the \fBStaticLibrary\fR builder method\&. .RE .PP \fBLoadableModule\fR(), \fIenv\fR\&.LoadableModule() .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(), \fIenv\fR\&.M4() .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 \fBMOFiles\fR(), \fIenv\fR\&.MOFiles() .RS 4 This builder is set up by the msgfmt tool\&. The builder compiles PO files to MO files\&. \fBMOFiles\fR is a single\-source builder\&. The \fIsource\fR parameter can also be omitted if \fB$LINGUAS_FILE\fR is set\&. .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=True) .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=True) .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] = True env\&.MOFiles() .fi .if n \{\ .RE .\} .RE .PP \fBMSVSProject\fR(), \fIenv\fR\&.MSVSProject() .RS 4 Build a Microsoft Visual C++ project file and solution file\&. .sp Builds a Microsoft Visual C++ project file based on the version of Visual Studio (or to be more precise, of MSBuild) that is configured: either the latest installed version, or the version specified by \fB$MSVC_VERSION\fR in the current construction environment\&. For Visual Studio 6\&.0 a \&.dsp file is generated\&. For Visual Studio versions 2002\-2008, a \&.vcproj file is generated\&. For Visual Studio 2010 and later a \&.vcxproj file is generated\&. Note there are multiple versioning schemes involved in the Microsoft compilation environment \- see the description of \fB$MSVC_VERSION\fR for equivalences\&. Note SCons does not know how to construct project files for other languages (e\&.g\&. \&.csproj for C#, \&.vbproj for Visual Basic or \&.pyproject for Python)\&. .sp For the \&.vcxproj file, the underlying format is the MSBuild XML Schema, and the details conform to: \m[blue]\fBhttps://learn\&.microsoft\&.com/en\-us/cpp/build/reference/vcxproj\-file\-structure\fR\m[]\&\s-2\u[3]\d\s+2\&. The generated solution file enables Visual Studio to understand the project structure, and allows building it using MSBuild to call back to SCons\&. The project file encodes a toolset version that has been selected by SCons as described above\&. Since recent Visual Studio versions support multiple concurrent toolsets, use \fB$MSVC_VERSION\fR to select the desired one if it does not match the SCons default\&. The project file also includes entries which describe how to call SCons to build the project from within Visual Studio (or from an MSBuild command line)\&. In some situations SCons may generate this incorrectly \- notably when using the \fIscons\-local\fR distribution, which is not installed in a way that that matches the default invocation line\&. If so, the \fB$SCONS_HOME\fR construction variable can be used to describe the right way to locate the SCons code so that it can be imported\&. .sp By default, a matching solution file for the project is also generated\&. This behavior may be disabled by specifying \fIauto_build_solution=0\fR to the \fBMSVSProject\fR builder\&. The solution file can also be independently generated by calling the \fBMSVSSolution\fR builder, such as in the case where a solution should describe multiple projects\&. See the \fBMSVSSolution\fR description for further information\&. .sp The \fBMSVSProject\fR builder accepts several keyword arguments describing lists of filenames to be placed into the project file\&. Currently, \fIsrcs\fR, \fIincs\fR, \fIlocalincs\fR, \fIresources\fR, and \fImisc\fR are recognized\&. The names are intended to be self\-explanatory, but note that the filenames need to be specified as strings, \fInot\fR as SCons File Nodes (for example if you generate files for inclusion by using the \fBGlob\fR function, the results should be converted to a list of strings before passing them to \fBMSVSProject\fR)\&. This is because Visual Studio and MSBuild know nothing about SCons Node types\&. Each of the filename lists are individually optional, but at least one list 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 as keyword arguments: .PP \fItarget\fR .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 \fIvariant\fR .RS 4 The name of this particular variant\&. Except for Visual Studio 6 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 \fIcmdargs\fR .RS 4 Additional command line arguments for the different variants\&. The number of \fIcmdargs\fR entries must match the number of \fIvariant\fR entries, or be empty (not specified)\&. If you give only one, it will automatically be propagated to all variants\&. .RE .PP \fIcppdefines\fR .RS 4 Preprocessor definitions for the different variants\&. The number of \fIcppdefines\fR entries must match the number of \fIvariant\fR 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 \fB$CPPDEFINES\fR entry for all variants\&. .RE .PP \fIcppflags\fR .RS 4 Compiler flags for the different variants\&. If a \fB/std:c++\fR flag is found then \fB/Zc:__cplusplus\fR is appended to the flags if not already found, this ensures that Intellisense uses the \fB/std:c++\fR switch\&. The number of \fIcppflags\fR entries must match the number of \fIvariant\fR 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 combine the invoking environment\*(Aqs \fB$CCFLAGS\fR, \fB$CXXFLAGS\fR, \fB$CPPFLAGS\fR entries for all variants\&. .RE .PP \fIcpppaths\fR .RS 4 Compiler include paths for the different variants\&. The number of \fIcpppaths\fR entries must match the number of \fIvariant\fR 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 \fB$CPPPATH\fR entry for all variants\&. .RE .PP \fIbuildtarget\fR .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 \fIbuildtarget\fR entries must match the number of \fIvariant\fR entries\&. .RE .PP \fIrunfile\fR .RS 4 The name of the file that Visual Studio 7 and later will run and debug\&. This appears as the value of the \fIOutput\fR field in the resulting Microsoft Visual C++ project file\&. If this is not specified, the default is the same as the specified \fIbuildtarget\fR value\&. .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 \fBNote\fR .ps -1 .br SCons and Microsoft Visual Studio understand projects in different ways, and the mapping is sometimes imperfect: .sp 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 directory of the SConstruct file, 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 Microsoft Visual C++ \fB/FC\fR 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 If the project file is only used to teach the Visual Studio project browser about the file layout there should be no issues, However, Visual Studio should not be used to make changes to the project structure, build options, etc\&. as these will (a) not feed back to the SCons description of the project and (b) be lost if SCons regenerates the project file\&. The SConscript files should remain the definitive description of the build\&. .sp If the project file is used to drive MSBuild (such as selecting "build" from the Visual Studio interface) you lose the direct control of target selection and command\-line options you would have if launching the build directly from SCons, because these will be hard\-coded in the project file to the values specified in the \fBMSVSProject\fR call\&. You can regain some of this control by defining multiple variants, using multiple \fBMSVSProject\fR calls to arrange different build targets, arguments, defines, flags and paths for different variants\&. .sp If the build is divided into a solution with multiple MSBuild projects the mapping is further strained\&. In this case, it is important not to set Visual Studio to do parallel builds, as it will then launch the separate project builds in parallel, and SCons does not work well if called that way\&. Instead, you can set up the SCons build for parallel building \- see the \fBSetOption\fR function for how to do this with \fInum_jobs\fR\&. .sp .5v .RE 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 .\} .PP \fIDebugSettings\fR .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 for \fIcmdargs\fR, you can specify a \fIDebugSettings\fR dictionary per variant\&. If you give only one, it will be propagated to all variants\&. .sp \fIChanged in version 2\&.4:\fR Added the optional \fIDebugSettings\fR parameter\&. .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 C++ project 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=f\*(Aqvc={msvcver}\*(Aq, DebugSettings=(dbgSettings, {}), ) .fi .if n \{\ .RE .\} .RE .PP \fBMSVSSolution\fR(), \fIenv\fR\&.MSVSSolution() .RS 4 Build a Microsoft Visual Studio Solution file\&. .sp 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$MSVC_VERSION\fR in the construction environment\&. For Visual Studio 6, a \&.dsw file is generated\&. For Visual Studio \&.NET 2002 and later, it will generate a \&.sln file\&. Note there are multiple versioning schemes involved in the Microsoft compilation environment \- see the description of \fB$MSVC_VERSION\fR for equivalences\&. .sp The solution file is a container for one or more projects, and follows the format described at \m[blue]\fBhttps://learn\&.microsoft\&.com/en\-us/visualstudio/extensibility/internals/solution\-dot\-sln\-file\fR\m[]\&\s-2\u[4]\d\s+2\&. .sp The following values must be specified: .PP \fItarget\fR .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 \fIvariant\fR .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 \fIprojects\fR .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\&. Note that these filenames need to be specified as strings, NOT as SCons File Nodes\&. This is because the solution file will be interpreted by MSBuild and by Visual Studio, which know nothing about SCons Node types\&. .RE .sp In addition to the mandatory arguments above, the following optional values may be specified as keyword arguments: .PP \fIauto_filter_projects\fR .RS 4 Under certain circumstances, solution file names or solution file nodes may be present in the \fIprojects\fR argument list\&. When solution file names or nodes are present in the \fIprojects\fR argument list, the generated solution file may contain erroneous Project records resulting in VS IDE error messages when opening the generated solution file\&. By default, an exception is raised when a solution file name or solution file node is detected in the \fIprojects\fR argument list\&. .sp The accepted values for \fIauto_filter_projects\fR are: .PP \fINone\fR .RS 4 An exception is raised when a solution file name or solution file node is detected in the \fIprojects\fR argument list\&. .sp \fINone\fR is the default value\&. .RE .PP \fITrue or evaluates True\fR .RS 4 Automatically remove solution file names and solution file nodes from the \fIprojects\fR argument list\&. .RE .PP \fIFalse or evaluates False\fR .RS 4 Leave the solution file names and solution file nodes in the \fIprojects\fR argument list\&. An exception is not raised\&. .sp When opening the generated solution file with the VS IDE, the VS IDE will likely report that there are erroneous Project records that are not supported or that need to be modified\&. .RE .RE .sp Example Usage: .sp .if n \{\ .RS 4 .\} .nf env\&.MSVSSolution( target="Bar" + env["MSVSSOLUTIONSUFFIX"], projects=["bar" + env["MSVSPROJECTSUFFIX"]], variant="Release", ) .fi .if n \{\ .RE .\} .RE .PP \fBNinja\fR(), \fIenv\fR\&.Ninja() .RS 4 A special builder which adds a target to create a Ninja build file\&. The builder does not require any source files to be specified\&. .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 is an experimental feature\&. To enable it you must use one of the following methods .sp .if n \{\ .RS 4 .\} .nf # On the command line \-\-experimental=ninja # Or in your SConstruct SetOption(\*(Aqexperimental\*(Aq, \*(Aqninja\*(Aq) .fi .if n \{\ .RE .\} .sp This functionality is subject to change and/or removal without deprecation cycle\&. .sp To use this tool you need to install the Python ninja package, as the tool by default depends on being able to do an import of the package This can be done via: .sp .if n \{\ .RS 4 .\} .nf python \-m pip install ninja .fi .if n \{\ .RE .\} .sp .5v .RE If called with no arguments, the builder will default to a target name of ninja\&.build\&. .sp If called with a single positional argument, \fBscons\fR will "deduce" the target name from that source argument, giving it the same name, and then ignore the source\&. This is the usual way to call the builder if a non\-default target name is wanted\&. .sp If called with either the \fItarget=\fR or \fIsource=\fR keyword arguments, the value of the argument is taken as the target name\&. If called with both, the \fItarget=\fR value is used and \fIsource=\fR is ignored\&. If called with multiple sources, the source list will be ignored, since there is no way to deduce what the intent was; in this case the default target name will be used\&. .sp \fIAvailable since \fR\fI\fBscons\fR\fR\fI 4\&.2\&.\fR .RE .PP \fBObject\fR(), \fIenv\fR\&.Object() .RS 4 A synonym for the \fBStaticObject\fR builder method\&. .RE .PP \fBPackage\fR(), \fIenv\fR\&.Package() .RS 4 Builds software distribution packages\&. A package is a container format which includes files to install along with metadata\&. Packaging is optional, and must be enabled by specifying the packaging tool\&. For example: .sp .if n \{\ .RS 4 .\} .nf env = Environment(tools=[\*(Aqdefault\*(Aq, \*(Aqpackaging\*(Aq]) .fi .if n \{\ .RE .\} .sp SCons can build packages in a number of well known packaging formats\&. The target package type may be selected with the \fB$PACKAGETYPE\fR construction variable or the \fB\-\-package\-type\fR command line option\&. The package type may be a list, in which case SCons will attempt to build packages for each type in the list\&. Example: .sp .if n \{\ .RS 4 .\} .nf env\&.Package(PACKAGETYPE=[\*(Aqsrc_zip\*(Aq, \*(Aqsrc_targz\*(Aq], \fI\&.\&.\&.other args\&.\&.\&.\fR) .fi .if n \{\ .RE .\} .sp The currently supported packagers are: .TS allbox tab(:); l l l l l l l l l l l l l l l l l l l l l l. T{ msi T}:T{ Microsoft Installer package T} T{ rpm T}:T{ RPM Package Manager package T} T{ ipkg T}:T{ Itsy Package Management package T} T{ tarbz2 T}:T{ bzip2\-compressed tar file T} T{ targz T}:T{ gzip\-compressed tar file T} T{ tarxz T}:T{ xz\-compressed tar file T} T{ zip T}:T{ zip file T} T{ src_tarbz2 T}:T{ bzip2\-compressed tar file suitable as source to another packager T} T{ src_targz T}:T{ gzip\-compressed tar file suitable as source to another packager T} T{ src_tarxz T}:T{ xz\-compressed tar file suitable as source to another packager T} T{ src_zip T}:T{ zip file suitable as source to another packager T} .TE .sp 1 The file list to include in the package may be specified with the \fIsource\fR keyword argument\&. If omitted, the \fBFindInstalledFiles\fR function is called behind the scenes to select all files that have an \fBInstall\fR, \fBInstallAs\fR or \fBInstallVersionedLib\fR Builder attached\&. If the \fItarget\fR keyword argument is omitted, the target name(s) will be deduced from the package type(s)\&. .sp The metadata comes partly from attributes of the files to be packaged, and partly from packaging tags\&. Tags can be passed as keyword arguments to the \fBPackage\fR builder call, and may also be attached to files (or more accurately, Nodes representing files) with the \fBTag\fR function\&. Some package\-level tags are mandatory, and will lead to errors if omitted\&. The mandatory tags vary depending on the package type\&. .sp While packaging, the builder uses a temporary location named by the value of the \fB$PACKAGEROOT\fR variable \- the package sources are copied there before packaging\&. .sp Packaging example: .sp .if n \{\ .RS 4 .\} .nf env = Environment(tools=["default", "packaging"]) env\&.Install("/bin/", "my_program") env\&.Package( NAME="foo", VERSION="1\&.2\&.3", PACKAGEVERSION=0, PACKAGETYPE="rpm", LICENSE="gpl", SUMMARY="balalalalal", DESCRIPTION="this should be really really long", X_RPM_GROUP="Application/fu", SOURCE_URL="https://foo\&.org/foo\-1\&.2\&.3\&.tar\&.gz", ) .fi .if n \{\ .RE .\} .sp In this example, the target /bin/my_program created by the \fBInstall\fR call would not be built by default since it is not under the project top directory\&. However, since no \fIsource\fR is specified to the \fBPackage\fR builder, it is selected for packaging by the default sources rule\&. Since packaging is done using \fB$PACKAGEROOT\fR, no write is actually done to the system\*(Aqs /bin directory, and the target \fIwill\fR be selected since after rebasing to underneath \fB$PACKAGEROOT\fR it is now under the top directory of the project\&. .RE .PP \fBPCH\fR(), \fIenv\fR\&.PCH() .RS 4 Builds a Microsoft Visual C++ precompiled header\&. Calling this builder returns a list of two target nodes: the PCH as the first element, and the object file as the second element\&. Normally the object file is ignored\&. The \fBPCH\fR builder is generally used in conjunction with the \fB$PCH\fR 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 .\} .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 builder is specific to the PCH implementation in Microsoft Visual C++\&. Other compiler chains also implement precompiled header support, but \fBPCH\fR does not work with them at this time\&. As a result, the builder is only generated into the construction environment when Microsoft Visual C++ is being used as the compiler\&. .sp The builder only works correctly in a C++ project\&. The Microsoft implementation distinguishes between precompiled headers from C and C++\&. Use of the builder will cause the PCH generation to happen with a flag that tells cl\&.exe all of the files are C++ files; if that PCH file is then supplied when compiling a C source file, cl\&.exe will fail the build with a compatibility violation\&. .sp If possible, arrange the project so that a C++ source file passed to the \fBPCH\fR builder is not also included in the list of sources to be otherwise compiled in the project\&. SCons will correctly track that file in the dependency tree as a result of the \fBPCH\fR call, and (for MSVC 11\&.0 and greater) automatically add the corresponding object file to the link line\&. If the source list is automatically generated, for example using the \fBGlob\fR function, it may be necessary to remove that file from the list\&. .sp .5v .RE .RE .PP \fBPDF\fR(), \fIenv\fR\&.PDF() .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\&. \fBPDF\fR is a single\-source builder\&. 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(), \fIenv\fR\&.POInit() .RS 4 This builder is set up by the msginit tool\&. The builder initializes missing PO file(s) if \fB$POAUTOINIT\fR is set\&. If \fB$POAUTOINIT\fR is not set (the default), \fBPOInit\fR prints instruction for the user (such as 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\&. \fBPOInit\fR is a single\-source builder\&. The \fIsource\fR parameter can also be omitted if \fB$LINGUAS_FILE\fR is set\&. .sp Target nodes defined through \fBPOInit\fR are not built by default (they\*(Aqre Ignored from \*(Aq\&.\*(Aq node) but are added to special \fBAlias\fR (\*(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 the \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=True) # 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=True) .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] = True env[\*(AqLINGUAS_FILE\*(Aq] = True 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=True, LINGUAS_FILE=True, POTDOMAIN=\*(Aqfoo\*(Aq) .fi .if n \{\ .RE .\} .RE .PP \fBPostScript\fR(), \fIenv\fR\&.PostScript() .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\&. \fBPostScript\fR is a single\-source builder\&. 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(), \fIenv\fR\&.POTUpdate() .RS 4 The builder is set up by the xgettext tool, part of the gettext toolset\&. The builder updates the target POT file if exists or creates it if it doesn\*(Aqt\&. The target node is \fInot\fR selected for building by default (e\&.g\&. \fBscons \&.\fR), but only on demand (i\&.e\&. when the given POT file is required or when special alias is invoked)\&. This builder adds its target 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 $ scons # Does not create foo\&.pot nor bar\&.pot $ scons foo\&.pot # Updates or creates foo\&.pot $ scons pot\-update # Updates or creates foo\&.pot and bar\&.pot $ 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 \fItarget\fR argument can be omitted, in which case the default target name messages\&.pot is used\&. The target may also be overridden by setting the \fB$POTDOMAIN\fR construction variable or providing it as an override to the \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 \fIsource\fR parameter may also be omitted, if it is specified in a 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 can use \fB$XGETTEXTPATH\fR to define the 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 like this: .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 as 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(), \fIenv\fR\&.POUpdate() .RS 4 The builder is set up by the msgmerge tool\&. part of the gettext toolset\&. The builder updates PO files with \fBmsgmerge(1)\fR, or initializes missing PO files as described in the documentation of the msginit tool and the \fBPOInit\fR builder (see also \fB$POAUTOINIT\fR)\&. \fBPOUpdate\fR is a single\-source builder\&. The \fIsource\fR parameter can also be omitted if \fB$LINGUAS_FILE\fR is set\&. .sp The target nodes are \fInot\fR selected for building by default (e\&.g\&. \fBscons \&.\fR)\&. Instead, they are added automatically to special \fBAlias\fR (\*(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\&. Note that \fBPOUpdate\fR does not add its targets to the po\-create alias as \fBPOInit\fR does\&. .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=True) # 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=True, 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=True) .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=True, POAUTOINIT=True) .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] = True env[\*(AqLINGUAS_FILE\*(Aq] = True env[\*(AqPOTDOMAIN\*(Aq] = \*(Aqfoo\*(Aq env\&.POUpdate() .fi .if n \{\ .RE .\} .RE .PP \fBProgram\fR(), \fIenv\fR\&.Program() .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(), \fIenv\fR\&.ProgramAllAtOnce() .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 \fBscons\fR \fBObject\fR and \fBProgram\fR 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(), \fIenv\fR\&.RES() .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(), \fIenv\fR\&.RMIC() .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(), \fIenv\fR\&.RPCGenClient() .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(), \fIenv\fR\&.RPCGenHeader() .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(), \fIenv\fR\&.RPCGenService() .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(), \fIenv\fR\&.RPCGenXDR() .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(), \fIenv\fR\&.SharedLibrary() .RS 4 Builds a shared library given one or more object files and/or C, C++, D or Fortran source files\&. Any source files listed in the \fIsource\fR parameter will be automatically compiled to object files suitable for use in a shared library\&. Any object files listed in the \fIsource\fR parameter must have been built for a shared library (that is, using the \fBSharedObject\fR builder method)\&. \fBscons\fR will raise an error if there is any mismatch\&. .sp 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 (if not already present) to the target name to make up the library filename\&. On a POSIX system, if the \fB$SHLIBVERSION\fR construction variable is set, it is appended (following a period) to the resulting library name\&. .sp 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 library (\&.lib) in addition to the shared library (\&.dll), 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 library (\&.dll\&.a) in addition to the shared library (\&.dll), adding a \&.dll\&.a library with the same basename if there is not already a \&.dll\&.a file explicitly listed in the targets\&. .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 If \fB$SHLIBVERSION\fR is defined, a versioned shared library is created\&. This modifies \fB$SHLINKFLAGS\fR as required, adds the version number to the library name, and creates any symbolic links 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, supplying a simple version string (no dots) creates exactly one symbolic link: SHLIBVERSION="1" would create (for example) library libbar\&.so\&.1 and symbolic link libbar\&.so\&. Supplying a dotted version string will create two symbolic links (irrespective of the number of segments in the version): SHLIBVERSION="1\&.5\&.2" for the same library would create library libbar\&.so\&.1\&.5\&.2 and symbolic links libbar\&.so and libbar\&.so\&.1\&. A Darwin (OSX) system creates one symlink in either case, for the second example the library would be libbar\&.1\&.5\&.2\&.dylib and the link would be libbar\&.dylib\&. .sp On Windows systems, specifying the \fIregister=1\fR keyword argument will cause the \&.dll to be registered after it is built\&. The command that is run is determined by the \fB$REGSVR\fR construction variable (\fBregsvr32\fR by default), 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(), \fIenv\fR\&.SharedObject() .RS 4 Builds an object file intended for inclusion in a shared library\&. Source files must have one of the same set of extensions specified for the \fBStaticObject\fR builder method\&. 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\&. \fBSharedObject\fR is a single\-source builder\&. 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) env\&.SharedObject(source=Glob(\*(Aq*\&.c\*(Aq)) .fi .if n \{\ .RE .\} .sp On some platforms building a shared object requires additional compiler option(s) (e\&.g\&. \fB\-fPIC\fR for \fBgcc\fR) in addition to those needed to build a normal (static) object\&. If shared and static objects differ, SCons will allow only shared objects to be linked into a shared library, and will use a different suffix for shared objects to help indicate and track the difference\&. .sp Source files will be scanned according to the suffix mappings in the SourceFileScanner object\&. See the manpage section "Scanner Objects" for more information\&. .RE .PP \fBStaticLibrary\fR(), \fIenv\fR\&.StaticLibrary() .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 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 \fIsource\fR must have been built for a static library (that is, using the \fBStaticObject\fR builder method)\&. \fBscons\fR will raise an error if there is any mismatch\&. .RE .PP \fBStaticObject\fR(), \fIenv\fR\&.StaticObject() .RS 4 Builds a static object file from one or more C, C++, D, or Fortran source files\&. The file extension mapping is shown in the table: .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 (empty string 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\&. \fBStaticObject\fR is a single\-source builder\&. 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) env\&.StaticObject(source=Glob(\*(Aq*\&.c\*(Aq)) .fi .if n \{\ .RE .\} .sp Source files will be scanned according to the suffix mappings in the SourceFileScanner object\&. See the manpage section "Scanner Objects" for more information\&. .RE .PP \fBSubstfile\fR(), \fIenv\fR\&.Substfile() .RS 4 The \fBSubstfile\fR builder creates a single text file from a template consisting of a file or set of files (or nodes), replacing text using the \fB$SUBST_DICT\fR construction variable (if set)\&. If a set, they are concatenated into the target file using the value of the \fB$LINESEPARATOR\fR construction variable as a separator between contents; the separator is not emitted after the contents of the last file\&. Nested lists of source files are flattened\&. See also \fBTextfile\fR\&. .sp By default, the target file encoding is "utf\-8" and can be changed by \fB$FILE_ENCODING\fR Examples: .sp If a single source file name is specified and has a \&.in suffix, the suffix is stripped and the remainder of the name is used as the default target name\&. .sp The prefix and suffix specified by the \fB$SUBSTFILEPREFIX\fR and \fB$SUBSTFILESUFFIX\fR construction variables (an empty 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 (\fIkey\fR, \fIvalue\fR) tuples\&. If it is a dictionary it is converted into a list of tuples with unspecified order, so if one key is a prefix of another key or if one substitution could be further expanded by another substitution, 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 further 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(), \fIenv\fR\&.Tar() .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 \fBscons\fR 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(), \fIenv\fR\&.Textfile() .RS 4 The \fBTextfile\fR builder generates a single text file from a template consisting of a list of strings, replacing text using the \fB$SUBST_DICT\fR construction variable (if set) \- see \fBSubstfile\fR for a description of replacement\&. The strings will be separated in the target file using the value of the \fB$LINESEPARATOR\fR construction variable; the line separator is not emitted after the last string\&. Nested lists of source strings are flattened\&. Source strings need not literally be Python strings: they can be Nodes or Python objects that convert cleanly to \fBValue\fR nodes\&. .sp The prefix and suffix specified by the \fB$TEXTFILEPREFIX\fR and \fB$TEXTFILESUFFIX\fR construction variables (by default an empty string and \&.txt, respectively) are automatically added to the target if they are not already present\&. .sp By default, the target file encoding is "utf\-8" and can be changed by \fB$FILE_ENCODING\fR 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 wrapping 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, ) .fi .if n \{\ .RE .\} .sp Results: .sp foo\&.txt .sp .if n \{\ .RS 4 .\} .nf Goethe 42 Schiller .fi .if n \{\ .RE .\} .sp bar\&.txt .sp .if n \{\ .RS 4 .\} .nf lalala|*tanteratei .fi .if n \{\ .RE .\} .sp blob\&.txt .sp .if n \{\ .RS 4 .\} .nf lalala Goethe 42 Schiller tanteratei .fi .if n \{\ .RE .\} .RE .PP \fBTranslate\fR(), \fIenv\fR\&.Translate() .RS 4 This pseudo\-Builder is part of the gettext toolset\&. The builder extracts internationalized messages from source files, updates the 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 account 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] = True 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 the conventional style known from autotools, i\&.e\&. using POTFILES\&.in and LINGUAS files to specify the targets and sources: .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] = True env[\*(AqXGETTEXTPATH\*(Aq] = [\*(Aq\&.\&./\*(Aq] env\&.Translate(LINGUAS_FILE=True, 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)\&. Additionally, 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 the 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=False) env[\*(AqPOAUTOINIT\*(Aq] = True 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=True, 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=True) .fi .if n \{\ .RE .\} .sp Such a setup produces POT and PO files under the source tree in src/po/ and binary MO files under the 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)\&. .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 the above example, the PO files are not updated, nor created automatically when you issue the command \fBscons \&.\fR\&. The files must be updated (created) by hand via \fBscons po\-update\fR and then MO files can be compiled by running \fBscons \&.\fR\&. .sp .5v .RE .RE .PP \fBTypeLibrary\fR(), \fIenv\fR\&.TypeLibrary() .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 \fBZip\fR(), \fIenv\fR\&.Zip() .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 \fBscons\fR 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 .SS "SCons Functions and Environment Methods" .PP SCons provides a variety of construction environment methods and global functions to manipulate the build configuration\&. Often, a construction environment method and a global function with the same name exist for convenience\&. In this section, both forms are shown if the function can be called in either way\&. The documentation style for these is as follows: .sp .if n \{\ .RS 4 .\} .nf \fBFunction\fR(\fIarguments, [optional arguments, \&.\&.\&.]\fR) # Global function \fIenv\fR\&.Function(\fIarguments, [optional arguments, \&.\&.\&.]\fR) # Environment method .fi .if n \{\ .RE .\} .PP In these function signatures, arguments in brackets ([]) are optional, and ellipses (\&.\&.\&.) indicate possible repetition\&. Positional vs\&. keyword arguments are usually detailed in the following text, not in the signature itself\&. The Python positional\-only (/) and keyword\-only (*) markers are not used\&. .PP When the Python keyword=value style is shown, it can have two meanings\&. If the keyword argument is known to the function, the value is the default for that argument if it is omitted\&. If the keyword is unknown to the function, some methods treat it as a construction variable assignment; otherwise an exception is raised for an unknown argument\&. .PP A global function and a same\-named construction environment method have the same base functionality, with two key differences: .sp .RS 4 .ie n \{\ \h'-04' 1.\h'+01'\c .\} .el \{\ .sp -1 .IP " 1." 4.2 .\} Construction environment methods that read from or change the environment act on the environment instance from which they are called, while the corresponding global functions read from a special \(lqhidden\(rq construction environment called the Default Environment\&. In some cases, a global function may take an extra initial argument giving the object to operate on\&. .RE .sp .RS 4 .ie n \{\ \h'-04' 2.\h'+01'\c .\} .el \{\ .sp -1 .IP " 2." 4.2 .\} String\-valued arguments (including strings in list\-valued arguments) are subject to construction variable expansion by the environment method form; variable expansion is not immediately performed in the global function\&. For example, \fBDefault(\*(Aq$MYTARGET\*(Aq)\fR adds \*(Aq$MYTARGET\*(Aq to the list of default targets, while if the value in \fIenv\fR of MYTARGET is \*(Aqmine\*(Aq, \fBenv\&.Default(\*(Aq$MYTARGET\*(Aq\fR adds \*(Aqmine\*(Aq to the default targets\&. For more details on construction variable expansion, see the Construction variables section\&. .RE .PP Global functions are automatically in scope inside SConscript files\&. If your project adds Python modules that you include via the Python import statement from an SConscript file, such code will need to add the functions to that module\(cqs global scope explicitly\&. You can do that by adding the following import to the Python module: \fBfrom SCons\&.Script import *\fR\&. .PP SCons provides the following construction environment methods and global functions\&. The list can be augmented on a project basis using \fBAddMethod\fR .PP \fBAction\fR(\fIaction, [output, [var, \&.\&.\&.]] [key=value, \&.\&.\&.]\fR), \fIenv\fR\&.Action(\fIaction, [output, [var, \&.\&.\&.]] [key=value, \&.\&.\&.]\fR) .RS 4 A factory function to create 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 construction environment through which \fBenv\&.Action\fR was called\&. The \fBAction\fR global function form delays all variable expansion until the Action object is actually used\&. .RE .PP \fBAddMethod\fR(\fIobject, function, [name]\fR), \fIenv\fR\&.AddMethod(\fIfunction, [name]\fR) .RS 4 Adds \fIfunction\fR to an object as a method\&. \fIfunction\fR will be called with an instance object as the first argument as for other methods\&. If \fIname\fR is given, it is used as the name of the new method, else the name of \fIfunction\fR is used\&. .sp When the global function \fBAddMethod\fR is called, the object to add the method to must be passed as the first argument; typically this will be \fBEnvironment\fR, in order to create a method which applies to all construction environments subsequently constructed\&. When called using the \fBenv\&.AddMethod\fR form, the method is added to the specified construction environment only\&. Added methods propagate through \fBenv\&.Clone\fR calls\&. .sp More examples: .sp .if n \{\ .RS 4 .\} .nf # Function to add must accept an instance argument\&. # The Python convention is to call this \*(Aqself\*(Aq\&. def my_method(self, arg): print("my_method() got", arg) # Use the global function to add a method to the Environment class: AddMethod(Environment, my_method) env = Environment() env\&.my_method(\*(Aqarg\*(Aq) # Use the optional name argument to set the name of the method: env\&.AddMethod(my_method, \*(Aqother_method_name\*(Aq) env\&.other_method_name(\*(Aqanother arg\*(Aq) .fi .if n \{\ .RE .\} .RE .PP \fBAddOption\fR(\fIopt_str, \&.\&.\&., attr=value, \&.\&.\&.\fR) .RS 4 Adds a local (project\-specific) command\-line option\&. One or more \fIopt_str\fR values are the strings representing how the option can be called, while the keyword arguments define attributes of the option\&. For the most part these are the same as for the \fBOptionParser\&.add_option\fR method in the standard Python library module optparse, but with a few additional capabilities noted below\&. See the \m[blue]\fBoptparse documentation\fR\m[]\&\s-2\u[5]\d\s+2 for a thorough discussion of its option\-processing capabilities\&. All options added through \fBAddOption\fR are placed in a special "Local Options" option group\&. .sp In addition to the arguments and values supported by the optparse \fBadd_option\fR method, \fBAddOption\fR allows setting the \fInargs\fR keyword value to a string \*(Aq?\*(Aq (question mark) to indicate that the option argument for that option string may be omitted\&. If the option string is present on the command line but has no matching option argument, the value of the \fIconst\fR keyword argument is produced as the value of the option\&. If the option string is omitted from the command line, the value of the \fIdefault\fR keyword argument is produced, as usual; if there is no \fIdefault\fR keyword argument in the \fBAddOption\fR call, \fBNone\fR is produced\&. .sp optparse recognizes abbreviations of long option names, as long as they can be unambiguously resolved\&. For example, if \fBadd_option\fR is called to define a \fB\-\-devicename\fR option, it will also recognize \fB\-\-device\fR, \fB\-\-dev\fR and so forth as long as there is no other option which could also match to the same abbreviation\&. Options added via \fBAddOption\fR do not support the automatic recognition of abbreviations\&. Instead, to allow specific abbreviations, include them as synonyms in the \fBAddOption\fR call itself\&. .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\&. If the \fIsettable=True\fR argument was supplied in the \fBAddOption\fR call, the value may also be set later using \fBSetOption\fR or \fBenv\&.SetOption\fR, if conditions in an SConscript file require overriding any default value\&. Note however that a value specified on the command line will \fIalways\fR override a value set in an SConscript file\&. .sp \fIChanged in 4\&.8\&.0\fR: added the \fIsettable\fR keyword argument to enable an added option to be settable via \fBSetOption\fR\&. .sp Help text for an option is a combination of the string supplied in the \fIhelp\fR keyword argument to \fBAddOption\fR and information collected from the other keyword arguments\&. Such help is displayed if the \fB\-h\fR command line option is used (but not with \fB\-H\fR)\&. Help for all local options is displayed under the separate heading \fBLocal Options\fR\&. The options are unsorted \- they 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 .\} .sp For that example, the following help text would be produced: .sp .if n \{\ .RS 4 .\} .nf Local Options: \-\-prefix=DIR installation prefix .fi .if n \{\ .RE .\} .sp Help text for local options may be unavailable if the \fBHelp\fR function has been called, see the \fBHelp\fR documentation for details\&. .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 Prior to version 4\&.11\&.0, the behavior when options added by \fBAddOption\fR are specified with whitespace was undefined and discouraged\&. Such usage covers both the use of a space as the separator (\-\-opt arg vs \-\-opt=arg), and where the number of option arguments (\fInargs\fR) is specified as greater than one\&. While this issue has been corrected, developers should be aware of it in case the project is built with an older SCons version\&. .sp .5v .RE .RE .PP \fBAddPostAction\fR(\fItarget, action\fR), \fIenv\fR\&.AddPostAction(\fItarget, action\fR) .RS 4 Arrange for the specified \fIaction\fR to be performed after the specified \fItarget\fR has been built\&. \fIaction\fR 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\&. .sp .if n \{\ .RS 4 .\} .nf foo = Program(\*(Aqfoo\&.c\*(Aq) # remove execute permission from binary: AddPostAction(foo, Chmod(\*(Aq$TARGET\*(Aq, "a\-x")) .fi .if n \{\ .RE .\} .sp If a \fItarget\fR is an \fBAlias\fR, \fIaction\fR is associated with the action of the alias, if specified\&. .RE .PP \fBAddPreAction\fR(\fItarget, action\fR), \fIenv\fR\&.AddPreAction(\fItarget, action\fR) .RS 4 Arrange for the specified \fIaction\fR to be performed before the specified \fItarget\fR is built\&. \fIaction\fR 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 action step that specifically generates the specified target(s)\&. It may not always be obvious if the process is multi\-step \- for example, if you use the \fBProgram\fR builder to construct an executable program from a \&.c source file, \fBscons\fR builds an intermediate object file first; the pre\-action is invoked after this step and just before the link command to generate the executable program binary\&. Example: .sp .if n \{\ .RS 4 .\} .nf foo = Program(\*(Aqfoo\&.c\*(Aq) AddPreAction(foo, \*(Aqecho "Running pre\-action"\*(Aq) .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf $ scons \-Q gcc \-o foo\&.o \-c foo\&.c echo "Running pre\-action" Running pre\-action gcc \-o foo foo\&.o .fi .if n \{\ .RE .\} .sp If a \fItarget\fR is an \fBAlias\fR, \fIaction\fR is associated with the action of the alias, if specified\&. .RE .PP \fBAlias\fR(\fIalias, [source, [action]]\fR), \fIenv\fR\&.Alias(\fIalias, [source, [action]]\fR) .RS 4 Create an Alias node that can be used as a reference to zero or more other targets, specified by the optional \fIsource\fR parameter\&. Aliases provide a way to give a shorter or more descriptive name to specific targets, and to group multiple targets under a single name\&. The alias name, or an Alias Node object, may be used as a dependency of any other target, including another alias\&. .sp \fIalias\fR and \fIsource\fR may each be a string or Node object, or a list of strings or Node objects; if Nodes are used for \fIalias\fR they must be Alias nodes\&. If \fIsource\fR is omitted, the alias is created but has no reference; if selected for building this will result in a \(lqNothing to be done\&.\(rq message\&. An empty alias can be used to define the alias in a visible place in the project; it can later be appended to in a subsidiary SConscript file with the actual target(s) to refer to\&. The optional \fIaction\fR parameter specifies an action or list of actions that will be executed whenever the any of the alias targets are out\-of\-date\&. .sp \fBAlias\fR can be called for an existing alias, which appends the \fIalias\fR and/or \fIaction\fR arguments to the existing lists for that alias\&. .sp Returns a list of Alias Node objects representing the alias(es), which exist outside of any physical file system\&. The alias name space is separate from the name space for tangible targets; to avoid confusion do not reuse target names as alias names\&. .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 \fBAllowSubstExceptions\fR(\fI[exception, \&.\&.\&.]\fR) .RS 4 Specifies the exceptions that will be ignored when expanding construction variables\&. By default, any construction variable expansions that generate a NameError or IndexError exception will expand to a \*(Aq\*(Aq (an empty string) and not cause \fBscons\fR 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 ignored exceptions\&. Calling it with no arguments means no exceptions will be ignored\&. .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 evaluate to \*(Aq\*(Aq\&. AllowSubstExceptions(IndexError, NameError, ZeroDivisionError) .fi .if n \{\ .RE .\} .RE .PP \fBAlwaysBuild\fR(\fItarget, \&.\&.\&.\fR), \fIenv\fR\&.AlwaysBuild(\fItarget, \&.\&.\&.\fR) .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 \fIenv\fR\&.Append(\fIkey=val, [\&.\&.\&.]\fR) .RS 4 Appends value(s) intelligently to construction variables in \fIenv\fR\&. The construction variables and values to add to them are passed as \fIkey=val\fR pairs (Python keyword arguments)\&. \fBenv\&.Append\fR is designed to allow adding values without having to think about the data type of an existing construction variable\&. Regular Python syntax can also be used to manipulate the construction variable, but for that you may need to know the types involved, for example pure Python lets you directly "add" two lists of strings, but adding a string to a list or a list to a string requires different syntax \- things \fBAppend\fR takes care of\&. Some pre\-defined construction variables do have type expectations based on how SCons will use them: for example \fB$CPPDEFINES\fR is often a string or a list of strings, but can also be a list of tuples or a dictionary; while \fB$LIBEMITTER\fR is expected to be a callable or list of callables, and \fB$BUILDERS\fR is expected to be a dictionary\&. Consult the documentation for the various construction variables for more details\&. .sp The following descriptions apply to both the \fBAppend\fR and \fBPrepend\fR methods, as well as their \fBUnique\fR variants, with the differences being the insertion point of the added values and whether duplication is allowed\&. .sp \fIval\fR can be almost any type\&. If \fIenv\fR does not have a construction variable named \fIkey\fR, then \fIkey\fR is simply stored with a value of \fIval\fR\&. Otherwise, \fIval\fR is combined with the existing value, possibly converting into an appropriate type which can hold the expanded contents\&. There are a few special cases to be aware of\&. Normally, when two strings are combined, the result is a new string containing their concatenation (and you are responsible for supplying any needed separation); however, the contents of \fB$CPPDEFINES\fR will be post\-processed by adding a prefix and/or suffix to each entry when the command line is produced, so SCons keeps them separate \- appending a string will result in a separate string entry, not a combined string\&. For \fB$CPPDEFINES\fR\&. as well as \fB$LIBS\fR, and the various *PATH variables, SCons will amend the variable by supplying the compiler\-specific syntax (e\&.g\&. prepending a \-D or /D prefix for \fB$CPPDEFINES\fR), so you should omit this syntax when adding values to these variables\&. Examples (gcc syntax shown in the expansion of \fICPPDEFINES\fR): .sp .if n \{\ .RS 4 .\} .nf env = Environment(CXXFLAGS="\-std=c11", CPPDEFINES="RELEASE") print(f"CXXFLAGS = {env[\*(AqCXXFLAGS\*(Aq]}, CPPDEFINES = {env[\*(AqCPPDEFINES\*(Aq]}") # notice including a leading space in CXXFLAGS addition env\&.Append(CXXFLAGS=" \-O", CPPDEFINES="EXTRA") print(f"CXXFLAGS = {env[\*(AqCXXFLAGS\*(Aq]}, CPPDEFINES = {env[\*(AqCPPDEFINES\*(Aq]}") print("CPPDEFINES will expand to", env\&.subst(\*(Aq$_CPPDEFFLAGS\*(Aq)) .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf $ scons \-Q CXXFLAGS = \-std=c11, CPPDEFINES = RELEASE CXXFLAGS = \-std=c11 \-O, CPPDEFINES = deque([\*(AqRELEASE\*(Aq, \*(AqEXTRA\*(Aq]) CPPDEFINES will expand to \-DRELEASE \-DEXTRA scons: `\&.\*(Aq is up to date\&. .fi .if n \{\ .RE .\} .sp Because \fB$CPPDEFINES\fR is intended for command\-line specification of C/C++ preprocessor macros, additional syntax is accepted when adding to it\&. The preprocessor accepts arguments to predefine a macro name by itself (\-DFOO for most compilers, /DFOO for Microsoft C++), which gives it an implicit value of \fB1\fR, or can be given with a replacement value (\-DBAR=TEXT)\&. SCons follows these rules when adding to \fB$CPPDEFINES\fR: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A string is split on spaces, giving an easy way to enter multiple macros in one addition\&. Use an = to specify a valued macro\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A tuple is treated as a valued macro\&. Use the value \fBNone\fR if the macro should not have a value\&. It is an error to supply more than two elements in such a tuple\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A list is processed in order, adding each item without further interpretation\&. In this case, space\-separated strings are not split\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A dictionary is processed in order, adding each key\-value pair as a valued macro\&. Use the value \fBNone\fR if the macro should not have a value\&. .RE .sp Examples: .sp .if n \{\ .RS 4 .\} .nf env = Environment(CPPDEFINES="FOO") print("CPPDEFINES =", env[\*(AqCPPDEFINES\*(Aq]) env\&.Append(CPPDEFINES="BAR=1") print("CPPDEFINES =", env[\*(AqCPPDEFINES\*(Aq]) env\&.Append(CPPDEFINES=[("OTHER", 2)]) print("CPPDEFINES =", env[\*(AqCPPDEFINES\*(Aq]) env\&.Append(CPPDEFINES={"EXTRA": "arg"}) print("CPPDEFINES =", env[\*(AqCPPDEFINES\*(Aq]) print("CPPDEFINES will expand to", env\&.subst(\*(Aq$_CPPDEFFLAGS\*(Aq)) .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf $ scons \-Q CPPDEFINES = FOO CPPDEFINES = deque([\*(AqFOO\*(Aq, \*(AqBAR=1\*(Aq]) CPPDEFINES = deque([\*(AqFOO\*(Aq, \*(AqBAR=1\*(Aq, (\*(AqOTHER\*(Aq, 2)]) CPPDEFINES = deque([\*(AqFOO\*(Aq, \*(AqBAR=1\*(Aq, (\*(AqOTHER\*(Aq, 2), (\*(AqEXTRA\*(Aq, \*(Aqarg\*(Aq)]) CPPDEFINES will expand to \-DFOO \-DBAR=1 \-DOTHER=2 \-DEXTRA=arg scons: `\&.\*(Aq is up to date\&. .fi .if n \{\ .RE .\} .sp Examples of adding multiple macros: .sp .if n \{\ .RS 4 .\} .nf env = Environment() env\&.Append(CPPDEFINES=[("ONE", 1), "TWO", ("THREE", )]) print("CPPDEFINES =", env[\*(AqCPPDEFINES\*(Aq]) env\&.Append(CPPDEFINES={"FOUR": 4, "FIVE": None}) print("CPPDEFINES =", env[\*(AqCPPDEFINES\*(Aq]) print("CPPDEFINES will expand to", env\&.subst(\*(Aq$_CPPDEFFLAGS\*(Aq)) .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf $ scons \-Q CPPDEFINES = [(\*(AqONE\*(Aq, 1), \*(AqTWO\*(Aq, (\*(AqTHREE\*(Aq,)] CPPDEFINES = deque([(\*(AqONE\*(Aq, 1), \*(AqTWO\*(Aq, (\*(AqTHREE\*(Aq,), (\*(AqFOUR\*(Aq, 4), (\*(AqFIVE\*(Aq, None)]) CPPDEFINES will expand to \-DONE=1 \-DTWO \-DTHREE \-DFOUR=4 \-DFIVE scons: `\&.\*(Aq is up to date\&. .fi .if n \{\ .RE .\} .sp \fIChanged in version 4\&.5\fR: clarified the use of tuples vs\&. other types, handling is now consistent across the four functions\&. .sp .if n \{\ .RS 4 .\} .nf env = Environment() env\&.Append(CPPDEFINES=("MACRO1", "MACRO2")) print("CPPDEFINES =", env[\*(AqCPPDEFINES\*(Aq]) env\&.Append(CPPDEFINES=[("MACRO3", "MACRO4")]) print("CPPDEFINES =", env[\*(AqCPPDEFINES\*(Aq]) print("CPPDEFINES will expand to", env\&.subst(\*(Aq$_CPPDEFFLAGS\*(Aq)) .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf $ scons \-Q CPPDEFINES = (\*(AqMACRO1\*(Aq, \*(AqMACRO2\*(Aq) CPPDEFINES = deque([\*(AqMACRO1\*(Aq, \*(AqMACRO2\*(Aq, (\*(AqMACRO3\*(Aq, \*(AqMACRO4\*(Aq)]) CPPDEFINES will expand to \-DMACRO1 \-DMACRO2 \-DMACRO3=MACRO4 scons: `\&.\*(Aq is up to date\&. .fi .if n \{\ .RE .\} .sp See \fB$CPPDEFINES\fR for more details\&. .sp Appending a string \fIval\fR to a dictionary\-typed construction variable enters \fIval\fR as the key in the dictionary, and None as its value\&. Using a tuple type to supply a key\-value pair only works for the special case of \fB$CPPDEFINES\fR described above\&. .sp Although most combinations of types work without needing to know the details, some combinations do not make sense and Python raises an exception\&. .sp When using \fBenv\&.Append\fR to modify construction variables which are path specifications (conventionally, the names of such end in PATH), it is recommended to add the values as a list of strings, even if you are only adding a single string\&. The same goes for adding library names to \fB$LIBS\fR\&. .sp .if n \{\ .RS 4 .\} .nf env\&.Append(CPPPATH=["#/include"]) .fi .if n \{\ .RE .\} .sp See also \fBenv\&.AppendUnique\fR, \fBenv\&.Prepend\fR and \fBenv\&.PrependUnique\fR\&. .RE .PP \fIenv\fR\&.AppendENVPath(\fIname, newpath, [envname, sep, delete_existing=False]\fR) .RS 4 Append directory paths from \fInewpath\fR to a search\-path entry \fIname\fR in construction variable \fIenvname\fR in the current enviromment (\fIenv\fR)\&. If \fIenvname\fR is not given, the default is "ENV" (see \fB$ENV\fR)\&. \fIenvname\fR is expected to refer to a dictionary\-like object; if it does not exist in \fIenv\fR it will be created as an initially empty dict\&. \fInewpath\fR may be specified as a string, a directory node, or a list of strings\&. If a string, it may contain multiple paths separated by the system path separator (os\&.pathsep), or, if specified, by the value of \fIsep\fR\&. Top\-relative path strings (starting with #) are recognized\&. The type of the existing value of \fIname\fR is preserved\&. .sp Paths will only appear once\&. Duplicate paths in \fInewpath\fR are removed, preserving the last occurrence to maintain path order\&. If \fIdelete_existing\fR is true (the default), existing duplicates are removed before appending, otherwise, new duplicates are skipped\&. During comparisons, paths are normalized, to avoid issues with case differences (on case\-insensitive filesystems) and with relative paths that may refer back to the same directory\&. The stored values are not modified by this process\&. .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]) .fi .if n \{\ .RE .\} .sp Yields: .sp .if n \{\ .RS 4 .\} .nf before: /foo:/biz after: /biz:/foo/bar:/foo .fi .if n \{\ .RE .\} .sp See also \fBenv\&.PrependENVPath\fR\&. .RE .PP \fIenv\fR\&.AppendUnique(\fIkey=val, [\&.\&.\&.], [delete_existing=False]\fR) .RS 4 Append values to construction variables in the current construction environment, maintaining uniqueness\&. Works like \fBenv\&.Append\fR, except that values that would become duplicates are not added\&. If \fIdelete_existing\fR is set to a true value, then for any duplicate, the existing instance of \fIval\fR is first removed, then \fIval\fR is appended, having the effect of moving it to the end\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf env\&.AppendUnique(CCFLAGS=\*(Aq\-g\*(Aq, FOO=[\*(Aqfoo\&.yyy\*(Aq]) .fi .if n \{\ .RE .\} .sp See also \fBenv\&.Append\fR, \fBenv\&.Prepend\fR and \fBenv\&.PrependUnique\fR\&. .RE .PP \fBBuilder\fR(\fIaction, [arguments]\fR), \fIenv\fR\&.Builder(\fIaction, [arguments]\fR) .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 \fBCacheDir\fR(\fIcache_dir, custom_class=None\fR), \fIenv\fR\&.CacheDir(\fIcache_dir, custom_class=None\fR) .RS 4 Direct \fBscons\fR to maintain a derived\-file cache in \fIcache_dir\fR\&. Cached files are shared across builds that specify the same \fIcache_dir\fR\&. Setting \fIcache_dir\fR to \fBNone\fR disables caching\&. .sp The environment method \fBenv\&.CacheDir\fR applies caching only to targets built through that specific construction environment\&. The global function \fBCacheDir\fR sets a default that applies to all targets unless overridden by an environment\-specific call\&. .sp Caching behavior can be customized by passing a subclass of SCons\&.CacheDir\&.CacheDir as the optional \fIcustom_class\fR parameter\&. If omitted or set to \fBNone\fR, SCons uses the default class\&. .sp When caching is enabled and \fBscons\fR needs to rebuild a derived file, it first checks the cache for a matching build signature (indicating identical inputs and build actions)\&. If found, the file is retrieved from the cache\&. Otherwise, \fBscons\fR builds the file and stores a copy the cache under its build signature\&. .sp By default, \fBscons\fR reports Retrieved `file\*(Aq from cache on cache hits\&. Use the \fB\-\-cache\-show\fR option to hide that the cache was involved and display the normal build string instead, for consistent log output\&. .sp Disable caching for a specific invocation with the \fB\-\-cache\-disable\fR option\&. To allow retreival but prevent updates, use \fB\-\-cache\-readonly\fR\&. .sp The \fB\-\-cache\-force\fR option copies \fIall\fR derived files into the cache, even pre\-existing ones\&. This helps populate a new cache or update it after building with cache updating disabled (\fB\-\-cache\-disable\fR or \fB\-\-cache\-readonly\fR)\&. .sp Use \fBNoCache\fR to exclude specific files from caching, such as those with unpredictable inputs or outputs, or excessively large output files\&. .sp SCons does not provide built\-in tools for cache management\&. You will need to handle pruning, expiration, access control, and other maintenance tasks manually\&. .RE .PP \fBClean\fR(\fItargets, files\fR), \fIenv\fR\&.Clean(\fItargets, files\fR) .RS 4 Set additional \fIfiles\fR for removal when any of \fItargets\fR are selected for cleaning (\fB\-c\fR command line option)\&. \fItargets\fR and \fIfiles\fR can each be a single filename or node, or a list of filenames or nodes\&. These can refer to files or directories\&. Calling this method repeatedly has an additive effect\&. .sp The related \fBNoClean\fR method has higher priority: any target specified to \fBNoClean\fR will not be cleaned even if also given as a \fIfiles\fR parameter to \fBClean\fR\&. .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 SCons does not directly track directories as targets \- they are created if needed and not normally removed in clean mode\&. In this example, installing the project creates a subdirectory for the documentation\&. The \fBClean\fR call ensures that the subdirectory is removed if the project is uninstalled\&. .sp .if n \{\ .RS 4 .\} .nf Clean(docdir, os\&.path\&.join(docdir, projectname)) .fi .if n \{\ .RE .\} .RE .PP \fIenv\fR\&.Clone(\fI[key=val, \&.\&.\&.]\fR) .RS 4 Returns an independent copy of a construction environment\&. If there are any unrecognized keyword arguments specified, they are added as construction variables in the copy, overwriting any existing values for those keywords\&. See the manpage section "Construction Environments" for more details\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf env2 = env\&.Clone() env3 = env\&.Clone(CCFLAGS=\*(Aq\-g\*(Aq) .fi .if n \{\ .RE .\} .sp A list of \fItools\fR and a \fItoolpath\fR may be specified, as in the \fBEnvironment\fR 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 .\} .sp The \fIvariables\fR keyword argument is also recognized, to allow (re)initializing construction variables from a Variables object\&. .sp \fIChanged in version 4\&.8\&.0:\fR the \fIvariables\fR parameter was added\&. .RE .PP \fBCommand\fR(\fItarget, source, action, [key=val, \&.\&.\&.]\fR), \fIenv\fR\&.Command(\fItarget, source, action, [key=val, \&.\&.\&.]\fR) .RS 4 Creates an anonymous builder and calls it, thus recording \fIaction\fR to build \fItarget\fR from \fIsource\fR into the dependency tree\&. This can be more convenient for a single special\-case build than having to define and add a new named Builder\&. .sp The \fBCommand\fR function accepts the \fIsource_scanner\fR and \fItarget_scanner\fR keyword arguments which are used to specify custom scanners for the specified sources or targets\&. The value must be a Scanner object\&. 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 or function calls\&. .sp The \fBCommand\fR function also accepts the \fIsource_factory\fR and \fItarget_factory\fR keyword arguments which are used to specify factory functions to create SCons Nodes from any sources or targets specified as strings\&. If any sources or targets are already Node objects, they are not further transformed even if a factory is specified for them\&. The default for each is the \fBEntry\fR factory\&. .sp These four arguments, if given, are used in the creation of the Builder\&. Other Builder\-specific keyword arguments are not recognized as such\&. See the manpage section "Builder Objects" for more information about how these arguments work in a Builder\&. .sp Any remaining keyword arguments are passed on to the generated builder when it is called, and behave as described in the manpage section "Builder Methods", in short: recognized arguments have their specified meanings, while the rest are used to override any same\-named existing construction variables from the construction environment\&. .sp \fIaction\fR 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( target=\*(Aqfoo\&.out\*(Aq, source=\*(Aqfoo\&.in\*(Aq, action="$FOO_BUILD < $SOURCES > $TARGET" ) env\&.Command( target=\*(Aqbar\&.out\*(Aq, source=\*(Aqbar\&.in\*(Aq, action=["rm \-f $TARGET", "$BAR_BUILD < $SOURCES > $TARGET"], ENV={\*(AqPATH\*(Aq: \*(Aq/usr/local/bin/\*(Aq}, ) import os def rename(env, target, source): os\&.rename(\*(Aq\&.tmp\*(Aq, target[0]) env\&.Command( target=\*(Aqbaz\&.out\*(Aq, source=\*(Aqbaz\&.in\*(Aq, action=["$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 \fBConfigure\fR(\fIenv, [custom_tests, conf_dir, log_file, config_h]\fR), \fIenv\fR\&.Configure(\fI[custom_tests, conf_dir, log_file, config_h]\fR) .RS 4 Creates a \fBConfigure\fR object for integrated functionality similar to GNU \fBautoconf\fR\&. See the manpage section "Configure Contexts" for a complete explanation of the arguments and behavior\&. .RE .PP \fBDebugOptions\fR(\fI[json]\fR) .RS 4 Allows setting values for SCons debug options\&. Currently, the only supported value is \fIjson\fR which sets the path to the JSON file created when the \fB\-\-debug=json\fR argument is given\&. .sp .if n \{\ .RS 4 .\} .nf DebugOptions(json=\*(Aq#/build/output/scons_stats\&.json\*(Aq) .fi .if n \{\ .RE .\} .sp \fINew in version 4\&.6\&.0\&.\fR .RE .PP \fBDecider\fR(\fIfunction\fR), \fIenv\fR\&.Decider(\fIfunction\fR) .RS 4 Specifies that all up\-to\-date decisions for targets built through this construction environment will be handled by \fIfunction\fR\&. \fIfunction\fR can be the name of a function or one of the following strings that specify a predefined decider function: .PP "content" .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 by performing a checksum on the dependency\*(Aqs contents using the selected hash function, and comparing it to the checksum recorded the last time the target was built\&. content is the default decider\&. .sp \fIChanged in version 4\&.1:\fR The decider was renamed to content since the hash function is now selectable\&. The former name, MD5, can still be used as a synonym, but is deprecated\&. .RE .PP "content\-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 content 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\&. .sp \fIChanged in version 4\&.1:\fR The decider was renamed to content\-timestamp since the hash function is now selectable\&. The former name, MD5\-timestamp, can still be used as a synonym, but is deprecated\&. .RE .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 .sp Examples: .sp .if n \{\ .RS 4 .\} .nf # Use exact timestamp matches by default\&. Decider(\*(Aqtimestamp\-match\*(Aq) # Use hash 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 a Python function you supply\&. Such a function must accept the following four 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 time \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 If set, use this Node instead of the one specified by \fIdependency\fR to determine if the dependency has changed\&. This argument is optional so should be written as a default argument (typically it would be written as \fIrepo_node=None\fR)\&. A caller will normally only set this if the target only exists in a Repository\&. .RE .sp The \fIfunction\fR should return a value which evaluates \fBTrue\fR if the \fIdependency\fR has "changed" since the last time the \fItarget\fR was built (indicating that the target \fIshould\fR be rebuilt), and a value which evaluates \fBFalse\fR otherwise (indicating that the target should \fInot\fR be rebuilt)\&. Note that the decision can be made using whatever criteria are appropriate\&. 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 \fBDefault\fR(\fItarget[, \&.\&.\&.]\fR), \fIenv\fR\&.Default(\fItarget[, \&.\&.\&.]\fR) .RS 4 Specify default targets to the SCons target selection mechanism\&. Any call to \fBDefault\fR will cause SCons to use the defined default target list instead of its built\-in algorithm for determining default targets (see the manpage section "Target Selection")\&. .sp \fItarget\fR may be one or more strings, a list of strings, a NodeList as returned by a Builder, or \fBNone\fR\&. A string \fItarget\fR may be the name of a file or directory, or a target previously defined by a call to \fBAlias\fR (defining the alias later will still create the alias, but it will not be recognized as a default)\&. Calls to \fBDefault\fR are additive\&. A \fItarget\fR of None will clear any existing default target list; subsequent calls to \fBDefault\fR will add to the (now empty) default target list like normal\&. .sp 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 The current list of targets added using \fBDefault\fR is available in the \fIDEFAULT_TARGETS\fR list (see below)\&. .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 .\} .RE .PP \fBDefaultEnvironment\fR(\fI[key=value, \&.\&.\&.]\fR) .RS 4 Instantiates and returns the global construction environment object\&. The Default Environment is used internally by SCons when executing a global function or the global form of a Builder method that requires access to a construction environment\&. .sp On the first call, arguments are interpreted as for the \fBEnvironment\fR function\&. The Default Environment is a singleton; subsequent calls to \fBDefaultEnvironment\fR return the already\-constructed object, and any keyword arguments are silently ignored\&. .sp The Default Environment can be modified after instantiation, similar to other construction environments, although some construction environment methods may be unavailable\&. Modifying the Default Environment has no effect on any other construction environment, either existing or newly constructed\&. .sp It is not necessary to explicitly call \fBDefaultEnvironment\fR\&. SCons instantiates the default environment automatically when the build phase begins, if has not already been done\&. However, calling it explicitly provides the opportunity to affect and examine its contents\&. Instantiation occurs even if nothing in the build system appears to use it, due to internal uses\&. .sp If the project SConscript files do not use global functions or Builders, a small performance gain may be achieved by calling \fBDefaultEnvironment\fR with an empty tools list (\fBDefaultEnvironment(tools=[])\fR)\&. This avoids the tool initialization cost for the Default Environment, which is mainly of interest in the test suite where \fBscons\fR is launched repeatedly in a short time period\&. .RE .PP \fBDepends\fR(\fItarget, dependency\fR), \fIenv\fR\&.Depends(\fItarget, dependency\fR) .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 \fIenv\fR\&.Detect(\fIprogs\fR) .RS 4 Find an executable from one or more choices: \fIprogs\fR may be a string or a list of strings\&. Returns the first value from \fIprogs\fR that was found, or \fBNone\fR\&. Executable is searched by checking the paths in the execution environment (\fIenv\fR[\*(AqENV\*(Aq][\*(AqPATH\*(Aq])\&. On Windows systems, additionally applies the filename suffixes found in the execution environment (\fIenv\fR[\*(AqENV\*(Aq][\*(AqPATHEXT\*(Aq]) but will not include any such extension in the return value\&. \fBenv\&.Detect\fR is a wrapper around \fBenv\&.WhereIs\fR\&. .RE .PP \fIenv\fR\&.Dictionary(\fI[var, \&.\&.\&.], [as_dict=]\fR) .RS 4 Return an object containing construction variables from \fIenv\fR\&. If \fIvar\fR is omitted, all the construction variables with their values are returned in a \fBdict\fR\&. If \fIvar\fR is specified, and \fIas_dict\fR is true, the specified construction variables are returned in a \fBdict\fR; otherwise (the default, for backwards compatibility), values only are returned, as a scalar if one \fIvar\fR is given, or as a list if multiples\&. .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 .\} .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 The object returned by \fBenv\&.Dictionary\fR should be treated as a read\-only view into the construction variables\&. Some construction variables require special internal handling, and modifying them through the \fBenv\&.Dictionary\fR object can bypass that handling and cause data inconsistencies\&. The primary use of \fBenv\&.Dictionary\fR is for diagnostic purposes \- it is used widely by test cases specifically because it bypasses the special handling so that behavior can be verified\&. .sp .5v .RE \fIChanged in 4\&.9\&.0\fR: \fIas_dict\fR added\&. .RE .PP \fBDir\fR(\fIname, [directory]\fR), \fIenv\fR\&.Dir(\fIname, [directory]\fR) .RS 4 Returns Directory Node(s)\&. A Directory Node is an object that represents a directory\&. \fIname\fR can be a relative or absolute path or a list of such paths\&. \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 single pathname, the corresponding node is returned\&. If \fIname\fR is a list, SCons returns a list of 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 "Filesystem Nodes" for more information\&. .RE .PP \fIenv\fR\&.Dump(\fI[var, \&.\&.\&.], [format=TYPE]\fR) .RS 4 Serialize construction variables from \fIenv\fR to a string\&. If \fIvar\fR is omitted, all the construction variables are serialized\&. If one or more \fIvar\fR values are supplied, only those variables and their values are serialized\&. .sp The optional \fIformat\fR string selects the serialization format: .PP pretty .RS 4 Returns a pretty\-printed representation of the construction variables \- the result will look like a Python \fBdict\fR (this is the default)\&. .RE .PP json .RS 4 Returns a JSON\-formatted representation of the variables\&. The variables will be presented as a JSON object literal, the JSON equivalent of a Python \fBdict\fR\&.\&. .RE .sp \fIChanged in 4\&.9\&.0\fR: More than one \fIkey\fR can be specified\&. The returned string always looks like a \fBdict\fR (or equivalent in other formats); previously a single key serialized only the value, not the key with the value\&. .sp Examples: this SConstruct .sp .if n \{\ .RS 4 .\} .nf env = Environment() print(env\&.Dump(\*(AqCCCOM\*(Aq)) print(env\&.Dump(\*(AqCC\*(Aq, \*(AqCCFLAGS\*(Aq, format=\*(Aqjson\*(Aq)) .fi .if n \{\ .RE .\} .sp will print something like: .sp .if n \{\ .RS 4 .\} .nf {\*(AqCCCOM\*(Aq: \*(Aq$CC \-o $TARGET \-c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES\*(Aq} { "CC": "gcc", "CCFLAGS": [] } .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 something like: .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 \fBEnsurePythonVersion\fR(\fImajor, minor\fR) .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 \fBEnsureSConsVersion\fR(\fImajor, minor, [revision]\fR) .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 \fBEnvironment\fR(\fI[key=value, \&.\&.\&.]\fR), \fIenv\fR\&.Environment(\fI[key=value, \&.\&.\&.]\fR) .RS 4 Return a new construction environment initialized with the specified \fIkey\fR=\fIvalue\fR pairs\&. The keyword arguments \fIparse_flags\fR, \fIplatform\fR, \fItoolpath\fR, \fItools\fR and \fIvariables\fR are specially recognized and do not lead to construction variable creation\&. See the manpage section "Construction Environments" for more details\&. .RE .PP \fBExecute\fR(\fIaction, [actionargs \&.\&.\&.]\fR), \fIenv\fR\&.Execute(\fIaction, [actionargs \&.\&.\&.]\fR) .RS 4 Executes an Action\&. \fIaction\fR may be an Action object or it may be a command\-line string, list of commands, or executable Python function, each of which will first be converted into an Action object and then executed\&. Any additional arguments to \fBExecute\fR are passed on to the \fBAction\fR factory function which actually creates the Action object (see the manpage section Action Objects for a description)\&. Example: .sp .if n \{\ .RS 4 .\} .nf Execute(Copy(\*(Aqfile\&.out\*(Aq, \*(Aqfile\&.in\*(Aq)) .fi .if n \{\ .RE .\} .sp \fBExecute\fR performs its action immediately, as part of the SConscript\-reading phase\&. There are no sources or targets declared in an \fBExecute\fR call, so any objects it manipulates will not be tracked as part of the SCons dependency graph\&. In the example above, neither file\&.out nor file\&.in will be tracked objects\&. .sp \fBExecute\fR returns the exit value of the command or return value of the Python function\&. \fBscons\fR prints an error message if the executed \fIaction\fR fails (exits with or returns a non\-zero value), however it does \fInot\fR, automatically terminate the build for such a failure\&. 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 if Execute("mkdir sub/dir/ectory"): # The mkdir failed, don\*(Aqt try to build\&. Exit(1) .fi .if n \{\ .RE .\} .RE .PP \fBExit\fR(\fI[value]\fR) .RS 4 This tells \fBscons\fR to exit immediately with the specified \fIvalue\fR\&. A default exit value of 0 (zero) is used if no value is specified\&. .RE .PP \fBExport\fR(\fI[vars\&.\&.\&.], [key=value\&.\&.\&.]\fR), \fIenv\fR\&.Export(\fI[vars\&.\&.\&.], [key=value\&.\&.\&.]\fR) .RS 4 Exports variables for sharing with other SConscript files\&. The variables are added to a global collection where they can be imported by other SConscript files\&. \fIvars\fR may be one or more strings, or a list of strings\&. If any string contains whitespace, it is split automatically into individual strings\&. Each string must match the name of a variable that is in scope during evaluation of the current SConscript file, or an exception is raised\&. .sp A \fIvars\fR argument may also be a dictionary or individual keyword arguments; in accordance with Python syntax rules, keyword arguments must come after any non\-keyword arguments\&. The dictionary/keyword form can be used to map the local name of a variable to a different name to be used for imports\&. See the Examples for an illustration of the syntax\&. .sp \fBExport\fR calls are cumulative\&. Specifying a previously exported variable will replace the previous value in the collection\&. Both local variables and global variables can be exported\&. .sp To use an exported variable, an SConscript must call \fBImport\fR to bring it into its own scope\&. Importing creates an additional reference to the object that was originally exported, so if that object is mutable, changes made will be visible to other users of that object\&. .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 also supports an \fIexports\fR argument that allows exporting one or more variables to the SConscript files invoked by that call (only)\&. See the description of that function for details\&. .RE .PP \fBFile\fR(\fIname, [directory]\fR), \fIenv\fR\&.File(\fIname, [directory]\fR) .RS 4 Returns File Node(s)\&. A File Node is an object that represents a file\&. \fIname\fR can be a relative or absolute path or a list of such paths\&. \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 single pathname, the corresponding node is returned\&. If \fIname\fR is a list, SCons returns a list of 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 "Filesystem Nodes" for more information\&. .RE .PP \fBFindFile\fR(\fIfile, dirs\fR), \fIenv\fR\&.FindFile(\fIfile, dirs\fR) .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 # Searches for \*(Aqfoo\*(Aq in \*(Aqdir1\*(Aq and \*(Aqdir2\*(Aq, returning the node if found foo = env\&.FindFile(\*(Aqfoo\*(Aq, [\*(Aqdir1\*(Aq, \*(Aqdir2\*(Aq]) .fi .if n \{\ .RE .\} .RE .PP \fBFindInstalledFiles\fR(), \fIenv\fR\&.FindInstalledFiles() .RS 4 Return the list of targets set up by the \fBInstall\fR and \fBInstallAs\fR builders\&. This function serves as a convenient method to select the contents of a binary package\&. The list is populated as \fBInstall\fR and \fBInstallAs\fR are executed \- that is, the return reflects builder calls already seen but not any calls that may occur later\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf Install(\*(Aq/bin\*(Aq, [\*(Aqexecutable_a\*(Aq, \*(Aqexecutable_b\*(Aq]) # Returns the file node list # [\*(Aq/bin/executable_a\*(Aq, \*(Aq/bin/executable_b\*(Aq] FindInstalledFiles() Install(\*(Aq/lib\*(Aq, [\*(Aqsome_library\*(Aq]) # Returns 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 \fBFindPathDirs\fR(\fIvariable\fR) .RS 4 Return a callable object for use as the \fIpath_function\fR of a Scanner object\&. When called, it looks up the specified \fIvariable\fR in the construction environment and treats its value as a list of directory paths to search (like \fB$CPPPATH\fR or \fB$LIBPATH\fR)\&. .sp Using \fBFindPathDirs\fR is generally preferable to writing your own \fIpath_function\fR because it handles common SCons scanning cases correctly and efficiently: (1) it returns all appropriate directories from source trees when a variant directory is used, and from repositories when \fBRepository\fR or the \fB\-Y/\-\-repository\fR option is in effect\&. (2) it detects when different values of \fIvariable\fR resolve to the same directory list and reuses that result instead of rescanning the same directories, avoiding redundant work\&. .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 \fBFindSourceFiles\fR(\fI[node]\fR), \fIenv\fR\&.FindSourceFiles(\fI[node]\fR) .RS 4 Return the list of nodes which represent the sources of the built files\&. It does so by recursively inspecting the dependency tree starting at the optional argument \fInode\fR, which defaults to the current directory ("\&.")\&. It returns all leaf nodes (files with no further dependencies) from the tree\&. This function serves as 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 Notice that build support files in the tree (SConstruct in the above example) are also returned\&. .RE .PP \fBFlatten\fR(\fIsequence\fR), \fIenv\fR\&.Flatten(\fIsequence\fR) .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 \fBGetBuildFailures\fR() .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 \fBGetBuildPath\fR(\fIfile, [\&.\&.\&.]\fR), \fIenv\fR\&.GetBuildPath(\fIfile, [\&.\&.\&.]\fR) .RS 4 Returns the \fBscons\fR path name (or names) for the specified \fIfile\fR (or files)\&. The specified \fIfile\fR or files may be \fBscons\fR Nodes or strings representing path names\&. .RE .PP \fBGetLaunchDir\fR() .RS 4 Returns the absolute path name of the directory from which \fBscons\fR 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 \fBGetOption\fR(\fIname\fR), \fIenv\fR\&.GetOption(\fIname\fR) .RS 4 Query the value of settable option \fIname\fR, which may have been set on the command line, via option defaults, or using the \fBSetOption\fR function\&. The table shows the corresponding command line arguments that could affect the value\&. Options are stored using the indicated type\&. \fIname\fR can be also be the destination variable name from a project\-specific option added using the \fBAddOption\fR function, as long as that addition has been processed prior to the \fBGetOption\fR call in the SConscript files\&. .TS allbox tab(:); lB lB lB. T{ Query name T}:T{ Command\-line argument T}:T{ Notes T} .T& l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l. T{ \fIcache_debug\fR T}:T{ \fB\-\-cache\-debug\fR T}:T{ String (filename) T} T{ \fIcache_disable\fR T}:T{ \fB\-\-cache\-disable\fR, \fB\-\-no\-cache\fR T}:T{ Boolean T} T{ \fIcache_force\fR T}:T{ \fB\-\-cache\-force\fR, \fB\-\-cache\-populate\fR T}:T{ Boolean T} T{ \fIcache_readonly\fR T}:T{ \fB\-\-cache\-readonly\fR T}:T{ Boolean T} T{ \fIcache_show\fR T}:T{ \fB\-\-cache\-show\fR T}:T{ Boolean T} T{ \fIclean\fR T}:T{ \fB\-c\fR, \fB\-\-clean\fR, \fB\-\-remove\fR T}:T{ Boolean T} T{ \fIclimb_up\fR T}:T{ \fB\-D\fR, \fB\-U\fR, \fB\-u\fR, \fB\-\-up\fR, \fB\-\-search_up\fR T}:T{ Integer\&. 1 means \fB\-u\fR was given, 2 is \fB\-D\fR, 3 is \fB\-U\fR\&. T} T{ \fIconfig\fR T}:T{ \fB\-\-config\fR T}:T{ String T} T{ \fIdebug\fR T}:T{ \fB\-\-debug\fR T}:T{ List T} T{ \fIdirectory\fR T}:T{ \fB\-C\fR, \fB\-\-directory\fR T}:T{ List (paths) T} T{ \fIdiskcheck\fR T}:T{ \fB\-\-diskcheck\fR T}:T{ List T} T{ \fIduplicate\fR T}:T{ \fB\-\-duplicate\fR T}:T{ String T} T{ \fIenable_virtualenv\fR T}:T{ \fB\-\-enable\-virtualenv\fR T}:T{ Boolean T} T{ \fIexperimental\fR T}:T{ \fB\-\-experimental\fR T}:T{ Set\&. \fISince 4\&.2\fR\&. T} T{ \fIfile\fR T}:T{ \fB\-f\fR, \fB\-\-file\fR, \fB\-\-makefile\fR, \fB\-\-sconstruct\fR T}:T{ List (filenames) T} T{ \fIhash_chunksize\fR T}:T{ \fB\-\-hash\-chunksize\fR T}:T{ Integer\&. Supersedes \fBmd5_chunksize\fR\&. \fISince 4\&.2\fR T} T{ \fIhash_format\fR T}:T{ \fB\-\-hash\-format\fR T}:T{ String\&. \fISince 4\&.2\fR T} T{ \fIhelp\fR T}:T{ \fB\-h\fR, \fB\-\-help\fR T}:T{ Boolean T} T{ \fIignore_errors\fR T}:T{ \fB\-i\fR, \fB\-\-ignore\-errors\fR T}:T{ Boolean T} T{ \fIignore_virtualenv\fR T}:T{ \fB\-\-ignore\-virtualenv\fR T}:T{ Boolean T} T{ \fIimplicit_cache\fR T}:T{ \fB\-\-implicit\-cache\fR T}:T{ Boolean T} T{ \fIimplicit_deps_changed\fR T}:T{ \fB\-\-implicit\-deps\-changed\fR T}:T{ Boolean T} T{ \fIimplicit_deps_unchanged\fR T}:T{ \fB\-\-implicit\-deps\-unchanged\fR T}:T{ Boolean T} T{ \fIinclude_dir\fR T}:T{ \fB\-I\fR, \fB\-\-include\-dir\fR T}:T{ List (paths) T} T{ \fIinstall_sandbox\fR T}:T{ \fB\-\-install\-sandbox\fR T}:T{ String (filename)\&. Available only if the install tool has been called T} T{ \fIkeep_going\fR T}:T{ \fB\-k\fR, \fB\-\-keep\-going\fR T}:T{ Boolean T} T{ \fImax_drift\fR T}:T{ \fB\-\-max\-drift\fR T}:T{ Integer T} T{ \fImd5_chunksize\fR T}:T{ \fB\-\-hash\-chunksize\fR T}:T{ Integer\&. Superseded by \fBhash_chunksize\fR\&. \fIDeprecated since 4\&.2\fR T} T{ \fIno_exec\fR T}:T{ \fB\-n\fR, \fB\-\-no\-exec\fR, \fB\-\-just\-print\fR, \fB\-\-dry\-run\fR, \fB\-\-recon\fR T}:T{ Boolean T} T{ \fIno_progress\fR T}:T{ \fB\-Q\fR T}:T{ Boolean T} T{ \fInum_jobs\fR T}:T{ \fB\-j\fR, \fB\-\-jobs\fR T}:T{ Integer T} T{ \fIpackage_type\fR T}:T{ \fB\-\-package\-type\fR T}:T{ String\&. Available only if the packaging tool has been called T} T{ \fIprofile_file\fR T}:T{ \fB\-\-profile\fR T}:T{ String (filename) T} T{ \fIquestion\fR T}:T{ \fB\-q\fR, \fB\-\-question\fR T}:T{ Boolean T} T{ \fIrandom\fR T}:T{ \fB\-\-random\fR T}:T{ Boolean T} T{ \fIrepository\fR T}:T{ \fB\-Y\fR, \fB\-\-repository\fR, \fB\-\-srcdir\fR T}:T{ List (paths) T} T{ \fIsilent\fR T}:T{ \fB\-s\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR T}:T{ Boolean T} T{ \fIsite_dir\fR T}:T{ \fB\-\-site\-dir\fR, \fB\-\-no\-site\-dir\fR T}:T{ String (path), False or None T} T{ \fIstack_size\fR T}:T{ \fB\-\-stack\-size\fR T}:T{ Integer T} T{ \fItaskmastertrace_file\fR T}:T{ \fB\-\-taskmastertrace\fR T}:T{ String (filename) T} T{ \fItree_printers\fR T}:T{ \fB\-\-tree\fR T}:T{ List T} T{ \fIwarn\fR T}:T{ \fB\-\-warn\fR, \fB\-\-warning\fR T}:T{ List T} .TE .sp 1 .RE .PP \fBGetSConsVersion\fR() .RS 4 Returns the current SCons version in the form of a Tuple[int, int, int], representing the major, minor, and revision values respectively\&. \fIAdded in 4\&.8\&.0\fR\&. .RE .PP \fBGlob\fR(\fIpattern, [ondisk=True, source=False, strings=False, exclude=None]\fR), \fIenv\fR\&.Glob(\fIpattern, [ondisk=True, source=False, strings=False, exclude=None]\fR) .RS 4 Returns a possibly empty list of Nodes (or strings) that match pathname specification \fIpattern\fR\&. \fIpattern\fR can be absolute, top\-relative, or (most commonly) relative to the directory of the current SConscript file\&. \fBGlob\fR matches both files stored on disk and Nodes which SCons already knows about, even if any corresponding file is not currently stored on disk\&. The environment method form (\fBenv\&.Glob\fR) performs string substitution on \fIpattern\fR and returns whatever matches the resulting expanded pattern\&. The results are sorted, unlike for the similar Python glob\&.glob function, to ensure build order will be stable\&. .sp \fIpattern\fR can contain POSIX\-style shell metacharacters for matching: .TS allbox tab(:); lB lB. T{ Pattern T}:T{ Meaning T} .T& l l l l l l l l. T{ * T}:T{ matches everything T} T{ ? T}:T{ matches any single character T} T{ [seq] T}:T{ matches any character in \fIseq\fR (can be a list or a range)\&. T} T{ [!seq] T}:T{ matches any character not in \fIseq\fR T} .TE .sp 1 For a literal match, wrap the metacharacter in brackets to escape the normal behavior\&. For example, \*(Aq[?]\*(Aq matches the character \*(Aq?\*(Aq\&. .sp Filenames starting with a dot are specially handled \- they can only be matched by patterns that start with a dot (or have a dot immediately following a pathname separator character, or slash), they are not not matched by the metacharacters\&. Metacharacter matches also do not span directory separators\&. .sp \fBGlob\fR understands repositories (see the \fBRepository\fR function) and source directories (see the \fBVariantDir\fR function) and returns a Node (or string, if so configured) match in the local (SConscript) directory if a matching Node is found anywhere in a corresponding repository or source directory\&. .sp If the optional \fIondisk\fR argument evaluates false, the search for matches on disk is disabled, and only matches from already\-configured File or Dir Nodes are returned\&. The default is to return Nodes for matches on disk as well\&. .sp If the optional \fIsource\fR argument evaluates true, and the local directory is a variant directory, then \fBGlob\fR returns Nodes from the corresponding source directory, rather than the local directory\&. .sp If the optional \fIstrings\fR argument evaluates true, \fBGlob\fR returns matches as strings, rather than Nodes\&. The returned strings will be relative to the local (SConscript) directory\&. (Note that while this may make it easier to perform arbitrary manipulation of file names, it loses the context SCons would have in the Node, so if the returned strings are passed to a different SConscript file, any Node translation there will be relative to that SConscript directory, not to the original SConscript directory\&.) .sp The optional \fIexclude\fR argument may be set to a pattern or a list of patterns describing files or directories to filter out of the match list\&. Elements matching a least one specified pattern will be excluded\&. These patterns use the same syntax as for \fIpattern\fR\&. .sp Examples: .sp .if n \{\ .RS 4 .\} .nf Program("foo", Glob("*\&.c")) Zip("/tmp/everything", Glob("\&.??*") + Glob("*")) sources = Glob("*\&.cpp", exclude=["os_*_specific_*\&.cpp"]) \e + Glob("os_%s_specific_*\&.cpp" % currentOS) .fi .if n \{\ .RE .\} .RE .PP \fBHelp\fR(\fItext, append=False, local_only=False\fR), \fIenv\fR\&.Help(\fItext, append=False, local_only=False\fR) .RS 4 Adds \fItext\fR to the help message shown when \fBscons\fR is called with the \fB\-h\fR or \fB\-\-help\fR argument\&. .sp On the first call to \fBHelp\fR, if \fIappend\fR is \fBFalse\fR (the default), any existing help text is discarded\&. The default help text is the help for the \fBscons\fR command itself plus help collected from any project\-local \fBAddOption\fR calls\&. This is the help printed if \fBHelp\fR has never been called\&. If \fIappend\fR is \fBTrue\fR, \fItext\fR is appended to the existing help text\&. If \fIlocal_only\fR is also \fBTrue\fR (the default is \fBFalse\fR), the project\-local help from \fBAddOption\fR calls is preserved in the help message but the \fBscons\fR command help is not\&. .sp Subsequent calls to \fBHelp\fR ignore the keyword arguments \fIappend\fR and \fIlocal_only\fR and always append to the existing help text\&. .sp \fIChanged in 4\&.6\&.0\fR: added \fIlocal_only\fR\&. .RE .PP \fBIgnore\fR(\fItarget, dependency\fR), \fIenv\fR\&.Ignore(\fItarget, dependency\fR) .RS 4 Ignores \fIdependency\fR when deciding if \fItarget\fR needs to be rebuilt\&. \fItarget\fR and \fIdependency\fR can each be a single filename or Node or a list of filenames or Nodes\&. .sp \fBIgnore\fR can also be used to remove a target from the default build by specifying the directory the target will be built in as \fItarget\fR and the file you want to skip selecting for building as \fIdependency\fR\&. Note that this only removes the target from the default target selection algorithm: if it is a dependency of another object being built SCons still builds it normally\&. 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 \fBImport\fR(\fIvars\&.\&.\&.\fR), \fIenv\fR\&.Import(\fIvars\&.\&.\&.\fR) .RS 4 Imports variables into the scope of the current SConscript file\&. \fIvars\fR must be strings representing names of variables which have been previously exported either by the \fBExport\fR function or by the \fIexports\fR argument to the \fBSConscript\fR function\&. Variables exported by the \fBSConscript\fR call take precedence\&. Multiple variable names can be passed to \fBImport\fR as separate arguments, as a list of strings, or as words in a space\-separated string\&. The wildcard "*" can be used to import all available variables\&. .sp If the imported variable is mutable, changes made locally will be reflected in the object the variable is bound to\&. This allows subsidiary SConscript files to contribute to building up, for example, a construction environment\&. .sp Examples: .sp .if n \{\ .RS 4 .\} .nf Import("env") Import("env", "variable") Import(["env", "variable"]) Import("*") .fi .if n \{\ .RE .\} .RE .PP \fBLiteral\fR(\fIstring\fR), \fIenv\fR\&.Literal(\fIstring\fR) .RS 4 The specified \fIstring\fR will be preserved as\-is and not have construction variables expanded\&. .RE .PP \fBLocal\fR(\fItargets\fR), \fIenv\fR\&.Local(\fItargets\fR) .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 \fIenv\fR\&.MergeFlags(\fIarg, [unique]\fR) .RS 4 Merges values from \fIarg\fR into construction variables in \fIenv\fR\&. If \fIarg\fR is a dictionary, each key\-value pair represents a construction variable name and the corresponding flags to merge\&. If \fIarg\fR is not a dictionary, \fBMergeFlags\fR attempts to convert it to one before the values are merged\&. \fBenv\&.ParseFlags\fR is used for this, so values to be converted are subject to the same limitations: \fBParseFlags\fR has knowledge of which construction variables certain flags should go to, but not all; and only for GCC and compatible compiler chains\&. \fIarg\fR must be a single object, so to pass multiple strings, enclose them in a list\&. .sp If unique is true (the default), duplicate values are not retained\&. In case of duplication, any construction variable names that end in PATH keep the left\-most value so the path search order is not altered\&. All other construction variables keep the right\-most value\&. If unique is false, values are appended even if they are duplicates\&. .sp Examples: .sp .if n \{\ .RS 4 .\} .nf # Add an optimization flag to $CCFLAGS\&. env\&.MergeFlags({\*(AqCCFLAGS\*(Aq: \*(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 # for two distinct packages and merge 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 \fBNoCache\fR(\fItarget, \&.\&.\&.\fR), \fIenv\fR\&.NoCache(\fItarget, \&.\&.\&.\fR) .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 \fBNoClean\fR(\fItargets, \&.\&.\&.\fR), \fIenv\fR\&.NoClean(\fItargets, \&.\&.\&.\fR) .RS 4 Specifies files or directories which should not be removed whenever a specified \fItarget\fR (or its dependencies) is selected and clean mode is active (\fB\-c\fR command line option)\&. \fItargets\fR may be one or more file or directory names or nodes, and/or lists of names or nodes\&. \fBNoClean\fR can be called multiple times\&. .sp Calling \fBNoClean\fR for a target overrides calling \fBClean\fR for the same target, so any targets passed to both functions will \fInot\fR be removed in clean mode\&. .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 \fIenv\fR\&.ParseConfig(\fIcommand, [function, unique]\fR) .RS 4 Updates the current construction environment with the values extracted from the output of running external \fIcommand\fR, by passing it to a helper \fIfunction\fR\&. \fIcommand\fR may be a string or a list of strings representing the command and its arguments\&. If \fIfunction\fR is omitted or \fBNone\fR, \fBenv\&.MergeFlags\fR is used\&. By default, duplicate values are not added to any construction variables; you can specify \fIunique=False\fR to allow duplicate values to be added\&. .sp \fIcommand\fR is executed using the SCons execution environment (that is, the construction variable \fB$ENV\fR in the current construction environment)\&. If \fIcommand\fR needs additional information to operate properly, that needs to be set in the execution environment\&. For example, \fBpkg\-config\fR may need a custom value set in the \fBPKG_CONFIG_PATH\fR environment variable\&. .sp \fBenv\&.MergeFlags\fR needs to understand the output produced by \fIcommand\fR in order to distribute it to appropriate construction variables\&. \fBenv\&.MergeFlags\fR uses a separate function to do that processing \- see \fBenv\&.ParseFlags\fR for the details, including a table of options and corresponding construction variables\&. To provide alternative processing of the output of \fIcommand\fR, you can supply a custom \fIfunction\fR, which must accept three arguments: the construction environment to modify, a string argument containing the output from running \fIcommand\fR, and the optional \fIunique\fR flag\&. .RE .PP \fBParseDepends\fR(\fIfilename, [must_exist, only_one]\fR), \fIenv\fR\&.ParseDepends(\fIfilename, [must_exist, only_one]\fR) .RS 4 Parses the contents of \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 \fIfilename\fR does not exist\&. The optional \fImust_exist\fR argument may be set to \fBTrue\fR to have SCons raise an exception if the file does not exist, or is otherwise inaccessible\&. .sp The optional \fIonly_one\fR argument may be set to \fBTrue\fR to have SCons raise an exception 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 \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 \fIenv\fR\&.ParseFlags(\fIflags, \&.\&.\&.\fR) .RS 4 Parses one or more strings containing typical command\-line flags for GCC\-style tool chains and returns a dictionary with the flag values separated into the appropriate SCons construction variables\&. 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\&. This can be used to call a *\-config command typical of the POSIX programming environment (for example, \fBpkg\-config\fR)\&. Note that such a command is executed using the SCons execution environment; if the command needs additional information, that information needs to be explicitly provided\&. See \fBParseConfig\fR for more details\&. .sp Flag values are translated according 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 \-fsanitize 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 \-stdlib= CXXFLAGS \-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 \fBPlatform\fR(\fIplat\fR), \fIenv\fR\&.Platform(\fIplat\fR) .RS 4 When called as a global function, returns a callable platform object selected by \fIplat\fR (defaults to the detected platform for the current system) that can be used to initialize a construction environment by passing it as the \fIplatform\fR keyword argument to the \fBEnvironment\fR function\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf env = Environment(platform=Platform(\*(Aqwin32\*(Aq)) .fi .if n \{\ .RE .\} .sp When called as a method of an environment, calls the platform object indicated by \fIplat\fR to update that environment\&. .sp .if n \{\ .RS 4 .\} .nf env\&.Platform(\*(Aqposix\*(Aq) .fi .if n \{\ .RE .\} .sp See the manpage section "Construction Environments" for more details\&. .RE .PP \fBPrecious\fR(\fItarget, \&.\&.\&.\fR), \fIenv\fR\&.Precious(\fItarget, \&.\&.\&.\fR) .RS 4 Marks \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 a single call, and may be strings and/or nodes\&. Returns a list of the affected target nodes\&. .RE .PP \fIenv\fR\&.Prepend(\fIkey=val, [\&.\&.\&.]\fR) .RS 4 Prepend values to construction variables in the current construction environment, works like \fBenv\&.Append\fR (see for details), except that values are added to the front, rather than the end, of any existing value of the construction variable .sp Example: .sp .if n \{\ .RS 4 .\} .nf env\&.Prepend(CCFLAGS=\*(Aq\-g \*(Aq, FOO=[\*(Aqfoo\&.yyy\*(Aq]) .fi .if n \{\ .RE .\} .sp See also \fBenv\&.Append\fR, \fBenv\&.AppendUnique\fR and \fBenv\&.PrependUnique\fR\&. .RE .PP \fIenv\fR\&.PrependENVPath(\fIname, newpath, [envname, sep, delete_existing=True]\fR) .RS 4 Prepend directory paths from \fInewpath\fR to a search\-path entry \fIname\fR in construction variable \fIenvname\fR in the current enviromment (\fIenv\fR)\&. If \fIenvname\fR is not given, the default is "ENV" (see \fB$ENV\fR)\&. \fIenvname\fR is expected to refer to a dictionary\-like object; if it does not exist in \fIenv\fR it will be created as an initially empty dict\&. \fInewpath\fR may be specified as a string, a directory node, or a list of strings\&. If a string, it may contain multiple paths separated by the system path separator (os\&.pathsep), or, if specified, by the value of \fIsep\fR\&. Top\-relative path strings (starting with #) are recognized\&. The type of the existing value of \fIname\fR is preserved\&. .sp Paths will only appear once\&. Duplicate paths in \fInewpath\fR are removed, preserving the first occurrence to maintain path order\&. If \fIdelete_existing\fR is true (the default), existing duplicates are removed before prepending, otherwise, new duplicates are skipped\&. During comparisons, paths are normalized, to avoid issues with case differences (on case\-insensitive filesystems) and with relative paths that may refer back to the same directory\&. The stored values are not modified by this process\&. .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 Yields: .sp .if n \{\ .RS 4 .\} .nf before: /biz:/foo after: /foo/bar:/foo:/biz .fi .if n \{\ .RE .\} .sp See also \fBenv\&.AppendENVPath\fR\&. .RE .PP \fIenv\fR\&.PrependUnique(\fIkey=val, [\&.\&.\&.], [delete_existing=False]\fR) .RS 4 Prepend values to construction variables in the current construction environment, maintaining uniqueness\&. Works like \fBenv\&.Append\fR, except that values are added to the front, rather than the end, of the construction variable, and values that would become duplicates are not added\&. If \fIdelete_existing\fR is set to a true value, then for any duplicate, the existing instance of \fIval\fR is first removed, then \fIval\fR is inserted, having the effect of moving it to the front\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf env\&.PrependUnique(CCFLAGS=\*(Aq\-g\*(Aq, FOO=[\*(Aqfoo\&.yyy\*(Aq]) .fi .if n \{\ .RE .\} .sp See also \fBenv\&.Append\fR, \fBenv\&.AppendUnique\fR and \fBenv\&.Prepend\fR\&. .RE .PP \fBProgress\fR(\fIcallable, [interval]\fR), \fBProgress\fR(\fIstring, [interval, file, overwrite]\fR), \fBProgress\fR(\fIlist_of_strings, [interval, file, overwrite]\fR) .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 __call__ method), the function will be called once every \fIinterval\fR times a Node is evaluated (default \fB1\fR)\&. The callable will be passed the evaluated Node as its only argument\&. (For future compatibility, it\*(Aqs a good idea to also add \fI*args\fR and \fI**kwargs\fR as arguments to your function or method signatures\&. 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, **kwargs): 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 to \fBProgress\fR is a string or list of strings, it is taken as text to be displayed every \fIinterval\fR evaluated Nodes\&. If the first argument is a list of strings, then each string in the list will be displayed in rotating fashion every \fIinterval\fR evaluated Nodes\&. .sp The default is to print the string on standard output\&. An alternate output stream may be specified with the \fIfile\fR keyword argument, which the caller must pass already opened\&. .sp 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 $TARGET;, it will be replaced with the Node\&. Note that, for performance reasons, this is \fInot\fR a regular SCons variable substitution, so you can not use other variables or use curly braces\&. The following example will print the name of every evaluated Node, using a carriage return) (\er) to cause each line to overwritten by the next line, and the \fIoverwrite\fR keyword argument (default False) 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 A list of strings can be used to implement a "spinner" on the user\*(Aqs screen as follows, changing every five evaluated Nodes: .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 \fBPseudo\fR(\fItarget, \&.\&.\&.\fR), \fIenv\fR\&.Pseudo(\fItarget, \&.\&.\&.\fR) .RS 4 Marks \fItarget\fR as a pseudo target, not representing the production of any physical target file\&. If any pseudo \fItarget\fR does exist, SCons will abort the build with an error\&. Multiple targets can be passed in a single call, and may be strings and/or Nodes\&. Returns a list of the affected target nodes\&. .sp \fBPseudo\fR may be useful in conjuction with a builder call (such as \fBCommand\fR) which does not create a physical target, and the behavior if the target accidentally existed would be incorrect\&. This is similar in concept to the GNU make \&.PHONY target\&. SCons also provides a powerful target alias capability (see \fBAlias\fR) which may provide more flexibility in many situations when defining target names that are not directly built\&. .RE .PP \fBPyPackageDir\fR(\fImodulename\fR), \fIenv\fR\&.PyPackageDir(\fImodulename\fR) .RS 4 Finds the location of \fImodulename\fR, which can be a string or a sequence of strings, each representing the name of a Python module\&. Construction variables are expanded in \fImodulename\fR\&. Returns a Directory Node (see \fBDir\fR), or a list of Directory Nodes if \fImodulename\fR is a sequence\&. None is returned for any module not found\&. .sp When a Tool module which is installed as a Python module is used, you need to specify a \fItoolpath\fR argument to \fBTool\fR, \fBEnvironment\fR or \fBClone\fR, as tools outside the standard project locations (site_scons/site_tools) will not be found otherwise\&. Using \fBPyPackageDir\fR allows this path to be discovered at runtime instead of hardcoding the path\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf env = Environment( tools=["default", "ExampleTool"], toolpath=[PyPackageDir("example_tool")] ) .fi .if n \{\ .RE .\} .RE .PP \fIenv\fR\&.Replace(\fIkey=val, [\&.\&.\&.]\fR) .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 \fBRepository\fR(\fIdirectory\fR), \fIenv\fR\&.Repository(\fIdirectory\fR) .RS 4 Sets \fIdirectory\fR as a repository to be searched for files contributing to the build\&. Multiple calls to \fBRepository\fR are allowed, with repositories searched in the given order\&. Repositories specified via command\-line option have higher priority\&. .sp In \fBscons\fR, a repository is partial or complete copy of the source tree, from the top\-level directory down, containing source files that can be used to build targets in the current worktree\&. Repositories can also contain derived files\&. An example might be an official source tree maintained by an integrator\&. If a repository contains derived files, they should be the result of building with SCons, so a signature database (sconsign) is present in the repository, allowing better decisions on whether they are up\-to\-date or not\&. .sp Note that if an up\-to\-date derived file already exists in a repository, \fBscons\fR will \fInot\fR make a copy in the local directory tree\&. If you need a local copy to be made, use the \fBLocal\fR method\&. .RE .PP \fBRequires\fR(\fItarget, prerequisite\fR), \fIenv\fR\&.Requires(\fItarget, prerequisite\fR) .RS 4 Specifies an order\-only relationship between \fItarget\fR and \fIprerequisite\fR\&. The prerequisites 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\&. \fItarget\fR and \fIprerequisite\fR may each be a string or Node, or a list of strings or Nodes\&. If there are multiple \fItarget\fR values, the prerequisite(s) are added to each one\&. Returns a list of the affected target nodes\&. .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 \fBReturn\fR(\fI[vars\&.\&.\&., stop=True]\fR) .RS 4 Return to the calling SConscript, optionally returning the values of variables named in \fIvars\fR\&. Multiple strings containing variable names may be passed to \fBReturn\fR\&. A string containing white space is split into individual variable names\&. Returns the value if one variable is specified, else returns a tuple of values\&. Returns an empty tuple if \fIvars\fR is omitted\&. .sp By default \fBReturn\fR stops processing the current SConscript and returns immediately\&. 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 was called\&. .sp Examples: .sp .if n \{\ .RS 4 .\} .nf # Returns no values (evaluates False) 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 \fBScanner\fR(\fIfunction, [name, argument, skeys, path_function, node_class, node_factory, scan_check, recursive]\fR), \fIenv\fR\&.Scanner(\fIfunction, [name, argument, skeys, path_function, node_class, node_factory, scan_check, recursive]\fR) .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 \fBSConscript\fR(\fIscriptnames, [exports, variant_dir, duplicate, must_exist]\fR), \fIenv\fR\&.SConscript(\fIscriptnames, [exports, variant_dir, duplicate, must_exist]\fR), \fBSConscript\fR(\fIdirs=subdirs, [name=scriptname, exports, variant_dir, duplicate, must_exist]\fR), \fIenv\fR\&.SConscript(\fIdirs=subdirs, [name=scriptname, exports, variant_dir, duplicate, must_exist]\fR) .RS 4 Executes subsidiary SConscript (build configuration) file(s)\&. There are two ways to call the \fBSConscript\fR function\&. .sp The first calling style is to supply one or more SConscript file names as the first positional argument, which can be a string or a list of strings\&. If there is a second positional argument, it is treated as if the \fIexports\fR keyword argument had been given (see below)\&. 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]) SConscript(Split(\*(Aqsrc/SConscript doc/SConscript\*(Aq)) config = SConscript(\*(AqMyConfig\&.py\*(Aq) .fi .if n \{\ .RE .\} .sp The second calling style is to omit the positional argument naming the script and instead specify directory names using the \fIdirs\fR keyword argument\&. The value can be a string or list of strings\&. In this case, \fBscons\fR will execute a subsidiary configuration file named SConscript (by default) in each of the specified directories\&. You may specify a name other than SConscript by supplying an optional \fIname\fR=\fIscriptname\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 keyword argument specifies variables to make available for use by the called SConscripts, which are evaluated in an isolated context and otherwise do not have access to local variables from the calling SConscript\&. The value may be a string or list of strings representing variable names, or a dictionary mapping local names to the names they can be imported by\&. For the first (scriptnames) calling style, a second positional argument will also be interpreted as \fIexports\fR; the second (directory) calling style accepts no positional arguments and must use the keyword form\&. These variables are locally exported only to the called SConscript file(s), and take precedence over any same\-named variables in the global pool managed by the \fBExport\fR function\&. The subsidiary SConscript files must use the \fBImport\fR function to import the variables into their local scope\&. 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 function, but in effect only within the scope of the \fBSConscript\fR call\&. The \fIvariant_dir\fR argument is interpreted relative to the directory of the \fIcalling\fR SConscript file\&. The source directory is the directory in which the \fIcalled\fR SConscript file resides and the SConscript file is evaluated as if it were in the \fIvariant_dir\fR directory\&. Thus: .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 If 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 The optional \fIduplicate\fR argument is interpreted as for \fBVariantDir\fR\&. If the \fIvariant_dir\fR argument is omitted, the \fIduplicate\fR argument is ignored\&. See the description of \fBVariantDir\fR for additional details and restrictions\&. .sp .sp If the optional \fImust_exist\fR is \fBTrue\fR (the default), an exception is raised if a requested SConscript file is not found\&. To allow missing scripts to be silently ignored (the default behavior prior to SCons version 3\&.1), pass must_exist=False in the \fBSConscript\fR call\&. .sp \fIChanged in 4\&.6\&.0\fR: \fImust_exist\fR now defaults to \fBTrue\fR\&. .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 .\} .sp \fBSConscript\fR returns the values of any variables named by the executed SConscript file(s) in arguments to the \fBReturn\fR function\&. If a single \fBSConscript\fR call causes multiple scripts to be executed, the return value is a tuple containing the returns of each of the scripts\&. If an executed script does not explicitly call \fBReturn\fR, it returns \fBNone\fR\&. .RE .PP \fBSConscriptChdir\fR(\fIvalue\fR) .RS 4 By default, \fBscons\fR changes its working directory to the directory in which each subsidiary SConscript file lives while reading and processing that script\&. This behavior may be disabled by specifying an argument which evaluates false, in which case \fBscons\fR 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 \fBSConscriptChdir\fR multiple times\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf SConscriptChdir(False) SConscript(\*(Aqfoo/SConscript\*(Aq) # will not chdir to foo SConscriptChdir(True) SConscript(\*(Aqbar/SConscript\*(Aq) # will chdir to bar .fi .if n \{\ .RE .\} .RE .PP \fBSConsignFile\fR(\fI[name, dbm_module]\fR), \fIenv\fR\&.SConsignFile(\fI[name, dbm_module]\fR) .RS 4 Specify where to store the SCons signature database, and which database format to use\&. This may be useful to specify alternate database files and/or file locations for different types of builds\&. .sp The optional \fIname\fR argument is the base name of the database file(s)\&. The database is placed relative to the directory containing the top\-level SConstruct file, unless \fIname\fR is an absolute path name\&. The default is \&.sconsign\&. The actual database file(s) stored on disk may have an appropriate suffix appended by the chosen \fIdbm_module\fR, and may also include the name of the hash format (see \fB\-\-hash\-format\fR)\&. .sp The optional \fIdbm_module\fR argument specifies which Python database module to use for reading/writing the file\&. The module must be imported first; then the imported module name is passed as the argument\&. The default is a custom SCons\&.dblite module that uses pickled Python data structures, which works on all Python versions\&. See documentation of the Python dbm module for other available types\&. .sp If called with no arguments, the database will default to \&.sconsign\&.dblite in the top directory of the project, which is also the default if if \fBSConsignFile\fR is not called\&. .sp The setting is global, so the only difference between the global function and the environment method form is variable expansion on \fIname\fR\&. There should only be one active call to this function/method in a given build setup\&. .sp If \fIname\fR is set to \fBNone\fR, \fBscons\fR will store file signatures in a separate \&.sconsign file in each directory, not in a single combined database file\&. This is a backwards\-compatibility measure to support the behavior that was the default prior to SCons 0\&.97 (i\&.e\&. before 2008)\&. Use of this mode is deprecated and should not be used in new projects\&. .sp \fIDeprecated since version 4\&.11\&.0\fR: the signature\-file\-per\-directory mode is deprecated and will be removed in a future release\&. .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\&. # SCons will add a database suffix to this name\&. SConsignFile("etc/scons\-signatures") # Stores signatures in the specified absolute file name\&. # SCons will add a database suffix to this name\&. SConsignFile("/home/me/SCons/signatures") # Stores signatures in a separate \&.sconsign file # in each directory\&. SConsignFile(None) # Stores signatures in a GNU dbm format \&.sconsign file import dbm\&.gnu SConsignFile(dbm_module=dbm\&.gnu) .fi .if n \{\ .RE .\} .RE .PP \fIenv\fR\&.SetDefault(\fIkey=val, [\&.\&.\&.]\fR) .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 \fBSetOption\fR(\fIname, value\fR), \fIenv\fR\&.SetOption(\fIname, value\fR) .RS 4 Set option variable \fIname\fR to \fIvalue\fR\&. Settable options have corresponding command\-line options, as shown in the table, which can be used for one\-time overrides \- a value set via the command line will take precedence over one set with \fBSetOption\fR\&. In addition to SConscript files, \fBSetOption\fR calls can also be placed in a site_init\&.py file\&. The current value can be queried with \fBGetOption\fR\&. .sp The behavior of the options is described in the manpage entry for the associated command\-line option\&. The \fIvalue\fR parameter is mandatory; for boolean option values (where the command\-line option does not take an option\-argument) use a \fIvalue\fR which evaluates to true (e\&.g\&. \fBTrue\fR, \fB1\fR) or false (e\&.g\&. \fBFalse\fR, \fB0\fR)\&. .sp Options which affect the reading and processing of SConscript files are not settable using \fBSetOption\fR since those files must be read in order to find the \fBSetOption\fR call in the first place\&. .sp For project\-specific options (sometimes called local options) added via an \fBAddOption\fR call, \fBSetOption\fR is allowed only after the \fBAddOption\fR call has completed successfully, and only if that call included the \fIsettable=True\fR keyword argument\&. .sp The settable variables with their associated command\-line options are: .TS allbox tab(:); lB lB lB. T{ Settable name T}:T{ Command\-line argument T}:T{ Notes T} .T& l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l s s. T{ \fIclean\fR T}:T{ \fB\-c\fR, \fB\-\-clean\fR, \fB\-\-remove\fR T}:T{ Boolean T} T{ \fIdiskcheck\fR T}:T{ \fB\-\-diskcheck\fR T}:T{ List T} T{ \fIduplicate\fR T}:T{ \fB\-\-duplicate\fR T}:T{ String T} T{ \fIexperimental\fR T}:T{ \fB\-\-experimental\fR T}:T{ Set\&. \fISince 4\&.2\fR\&. T} T{ \fIhash_chunksize\fR T}:T{ \fB\-\-hash\-chunksize\fR T}:T{ Integer\&. Supersedes \fBmd5_chunksize\fR\&. \fISince 4\&.2\fR T} T{ \fIhash_format\fR T}:T{ \fB\-\-hash\-format\fR T}:T{ String\&. \fISince 4\&.2\fR T} T{ \fIhelp\fR T}:T{ \fB\-h\fR, \fB\-\-help\fR T}:T{ Boolean T} T{ \fIimplicit_cache\fR T}:T{ \fB\-\-implicit\-cache\fR T}:T{ Boolean T} T{ \fIimplicit_deps_changed\fR T}:T{ \fB\-\-implicit\-deps\-changed\fR T}:T{ Boolean\&. Also sets \fIimplicit_cache\fR\&. \fISettable since 4\&.2\fR T} T{ \fIimplicit_deps_unchanged\fR T}:T{ \fB\-\-implicit\-deps\-unchanged\fR T}:T{ Boolean\&. Also sets \fIimplicit_cache\fR\&. \fISettable since 4\&.2\fR T} T{ \fImax_drift\fR T}:T{ \fB\-\-max\-drift\fR T}:T{ Integer T} T{ \fImd5_chunksize\fR T}:T{ \fB\-\-hash\-chunksize\fR T}:T{ Integer\&. Superseded by \fBhash_chunksize\fR\&. \fIDeprecated since 4\&.2\fR T} T{ \fIno_exec\fR T}:T{ \fB\-n\fR, \fB\-\-no\-exec\fR, \fB\-\-just\-print\fR, \fB\-\-dry\-run\fR, \fB\-\-recon\fR T}:T{ Boolean T} T{ \fIno_progress\fR T}:T{ \fB\-Q\fR T}:T{ Boolean\&. See \&\s-2\u[6]\d\s+2 T} T{ \fInum_jobs\fR T}:T{ \fB\-j\fR, \fB\-\-jobs\fR T}:T{ Integer T} T{ \fIrandom\fR T}:T{ \fB\-\-random\fR T}:T{ Boolean T} T{ \fIsilent\fR T}:T{ \fB\-s\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR T}:T{ Boolean T} T{ \fIstack_size\fR T}:T{ \fB\-\-stack\-size\fR T}:T{ Integer T} T{ \fIwarn\fR T}:T{ \fB\-\-warn\fR T}:T{ List T} T{ ---- .br [a] If \fIno_progress\fR is set via \fBSetOption\fR in an SConscript file (but not if set in a site_init\&.py file) there will still be an initial status message about reading SConscript files since SCons has to start reading them before it can see the \fBSetOption\fR\&. T} .TE .sp 1 Example: .sp .if n \{\ .RS 4 .\} .nf SetOption(\*(Aqmax_drift\*(Aq, 0) .fi .if n \{\ .RE .\} .RE .PP \fBSideEffect\fR(\fIside_effect, target\fR), \fIenv\fR\&.SideEffect(\fIside_effect, target\fR) .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, \fBscons\fR 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\&. .sp This function returns the list of side effect Node objects that were successfully added\&. If the list of side effects contained any side effects that had already been added, they are not added and included in the returned list\&. .RE .PP \fBSplit\fR(\fIarg\fR), \fIenv\fR\&.Split(\fIarg\fR) .RS 4 If \fIarg\fR is a string, splits on whitespace and returns a list of strings without whitespace\&. This mode is the most common case, and can be used to split a list of filenames (for example) rather than having to type them as a list of individually quoted words\&. If \fIarg\fR is a list or tuple returns the list or tuple unchanged\&. If \fIarg\fR is any other type of object, returns a list containing just the object\&. These non\-string cases do not actually do any spliting, but allow an argument variable to be passed to \fBSplit\fR without having to first check its type\&. .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 \fIenv\fR\&.subst(\fIinput, [raw, target, source, conv]\fR) .RS 4 Performs construction variable interpolation (substitution) on \fIinput\fR, which can be a string or a sequence\&. Substitutable elements take the form ${\fIexpression\fR}, although if there is no ambiguity in recognizing the element, the braces can be omitted\&. A literal \fB$\fR can be entered by using \fB$$\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 additionally discard all characters between any $( and $) pairs (as is done for signature calculation)\&. .sp If \fIinput\fR 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 a Python lambda expression 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 \fBTag\fR(\fInode, tags\fR) .RS 4 Annotates file or directory Nodes with information about how the \fBPackage\fR Builder should package those files or directories\&. All Node\-level tags are optional\&. .sp Examples: .sp .if n \{\ .RS 4 .\} .nf # makes sure the built library will be installed with 644 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 \fBTool\fR(\fIname, [toolpath, key=value, \&.\&.\&.]\fR), \fIenv\fR\&.Tool(\fIname, [toolpath, key=value, \&.\&.\&.]\fR) .RS 4 Locates the tool specification module \fIname\fR and returns a callable tool object for that tool\&. When the environment method (\fBenv\&.Tool\fR) form is used, the tool object is automatically called before the method returns to update \fIenv\fR, and \fIname\fR is appended to the \fB$TOOLS\fR construction variable in that environment\&. When the global function \fBTool\fR form is used, the tool object is constructed but not called, as it lacks the context of an environment to update, and the returned object needs to be used to arrange for the call\&. .sp The tool module is searched for in the tool search paths (see the \fBTools\fR section in the manual page for details) and in any paths specified by the optional \fItoolpath\fR parameter, which must be a list of strings\&. If \fItoolpath\fR is omitted, the \fItoolpath\fR supplied when the environment was created, if any, is used\&. .sp Any remaining keyword arguments are saved in the tool object, and will be passed to the tool module\*(Aqs \fBgenerate\fR function when the tool object is actually called\&. The \fBgenerate\fR function can update the construction environment with construction variables and arrange any other initialization needed to use the mechanisms that tool describes, and can use these extra arguments to help guide its actions\&. .sp \fIChanged in version 4\&.2:\fR \fBenv\&.Tool\fR now returns the tool object, previously it did not return (i\&.e\&. returned \fBNone\fR)\&. .sp Examples: .sp .if n \{\ .RS 4 .\} .nf env\&.Tool(\*(Aqgcc\*(Aq) env\&.Tool(\*(Aqopengl\*(Aq, toolpath=[\*(Aqbuild/tools\*(Aq]) .fi .if n \{\ .RE .\} .sp The returned tool object can be passed to an \fBEnvironment\fR or \fBClone\fR call as part of the \fItools\fR keyword argument, in which case the tool is applied to the environment being constructed, or it can be called directly, in which case a construction environment to update must be passed as the argument\&. Either approach will also update the \fB$TOOLS\fR construction variable\&. .sp Examples: .sp .if n \{\ .RS 4 .\} .nf env = Environment(tools=[Tool(\*(Aqmsvc\*(Aq)]) env = Environment() msvctool = Tool(\*(Aqmsvc\*(Aq) msvctool(env) # adds \*(Aqmsvc\*(Aq to the TOOLS variable gltool = Tool(\*(Aqopengl\*(Aq, toolpath = [\*(Aqtools\*(Aq]) gltool(env) # adds \*(Aqopengl\*(Aq to the TOOLS variable .fi .if n \{\ .RE .\} .RE .PP \fBValidateOptions\fR(\fI[throw_exception=False]\fR) .RS 4 Check that all the options specified on the command line are either SCons built\-in options or defined via calls to \fBAddOption\fR\&. SCons will eventually fail on unknown options anyway, but calling this function allows the build to "fail fast" before executing expensive logic later in the build\&. .sp This function should only be called after the last \fBAddOption\fR call in your SConscript logic\&. Be aware that some tools call \fBAddOption\fR, if you are getting error messages for arguments that they add, you will need to ensure that those tools are loaded before calling \fBValidateOptions\fR\&. .sp If there are any unknown command line options, \fBValidateOptions\fR prints an error message and exits with an error exit status\&. If the optional \fIthrow_exception\fR argument is True (default is False), a SConsBadOptionError is raised, giving an opportunity for the SConscript logic to catch that exception and handle invalid options appropriately\&. Note that this exception name needs to be imported (see the example below)\&. .sp A common build problem is typos (or thinkos) \- a user enters an option that is just a little off the expected value, or perhaps a different word with a similar meaning\&. It may be useful to abort the build before going too far down the wrong path\&. For example: .sp .if n \{\ .RS 4 .\} .nf $ \fBscons \-\-complier=mingw\fR # the correct flag is \-\-compiler .fi .if n \{\ .RE .\} .sp Here SCons could go off and run a bunch of configure steps using the default value of \fB\-\-compiler\fR, since the misspelled option causes it not to be supplied the intended value, costing developer time to track down why the configure logic made the "wrong" choices\&. This example shows catching this: .sp .if n \{\ .RS 4 .\} .nf from SCons\&.Script\&.SConsOptions import SConsBadOptionError AddOption( \*(Aq\-\-compiler\*(Aq, dest=\*(Aqcompiler\*(Aq, action=\*(Aqstore\*(Aq, default=\*(Aqgcc\*(Aq, type=\*(Aqstring\*(Aq, ) # \&.\&.\&. other SConscript logic \&.\&.\&. try: ValidateOptions(throw_exception=True) except SConsBadOptionError as e: print(f"ValidateOptions detects a fail: ", e\&.opt_str) Exit(3) .fi .if n \{\ .RE .\} .sp \fINew in version 4\&.5\&.0\fR .RE .PP \fBValue\fR(\fIvalue, [built_value], [name]\fR), \fIenv\fR\&.Value(\fIvalue, [built_value], [name]\fR) .RS 4 Returns a Node object representing the specified Python \fIvalue\fR\&. Value Nodes can be used as dependencies of targets\&. If the string representation of the Value Node changes between SCons runs, it is considered out\-of\-date and any targets depending on it will be rebuilt\&. Since Value Nodes have no filesystem representation, timestamps are not used; the timestamp deciders perform the same content\-based up to date check\&. .sp The optional \fIbuilt_value\fR argument can be specified when the Value Node is created to indicate the Node should already be considered "built\&." .sp The optional \fIname\fR parameter can be provided as an alternative name for the resulting Value node; this is advised if the \fIvalue\fR parameter cannot be converted to a string\&. .sp Value Nodes have a write method that can be used to "build" a Value Node by setting a new value\&. The corresponding read method returns the built value of the Node\&. .sp \fIChanged in version 4\&.0:\fR the \fIname\fR parameter was added\&. .sp Examples: .sp .if n \{\ .RS 4 .\} .nf env = Environment() def create(target, source, env): """Action function to create a file from a Value\&. Writes \*(Aqprefix=$SOURCE\*(Aq into the file name given as $TARGET\&. """ with open(target[0], \*(Aqwb\*(Aq) as f: f\&.write(b\*(Aqprefix=\*(Aq + source[0]\&.get_contents() + b\*(Aq\en\*(Aq) # Fetch the prefix= argument, if any, from the command line\&. # Use /usr/local as the default\&. prefix = ARGUMENTS\&.get(\*(Aqprefix\*(Aq, \*(Aq/usr/local\*(Aq) # Attach builder named Config to the construction environment # using the \*(Aqcreate\*(Aq action function above\&. env[\*(AqBUILDERS\*(Aq][\*(AqConfig\*(Aq] = Builder(action=create) env\&.Config(target=\*(Aqpackage\-config\*(Aq, source=Value(prefix)) def build_value(target, source, env): """Action function to "build" a Value\&. Writes contents of $SOURCE into $TARGET, thus updating if it existed\&. """ target[0]\&.write(source[0]\&.get_contents()) output = env\&.Value(\*(Aqbefore\*(Aq) input = env\&.Value(\*(Aqafter\*(Aq) # Attach a builder named UpdateValue to the construction environment # using the \*(Aqbuild_value\*(Aq action function above\&. env[\*(AqBUILDERS\*(Aq][\*(AqUpdateValue\*(Aq] = Builder(action=build_value) env\&.UpdateValue(target=Value(output), source=Value(input)) .fi .if n \{\ .RE .\} .RE .PP \fBVariantDir\fR(\fIvariant_dir, src_dir, [duplicate]\fR), \fIenv\fR\&.VariantDir(\fIvariant_dir, src_dir, [duplicate]\fR) .RS 4 Set up a mapping to define a variant build directory in \fIvariant_dir\fR\&. \fIsrc_dir\fR must not be underneath \fIvariant_dir\fR\&. A \fBVariantDir\fR mapping is global, even when called as \fBenv\&.VariantDir\fR\&. \fBVariantDir\fR can be called multiple times with the same \fIsrc_dir\fR to set up multiple variant builds with different options\&. .sp Note that while \fIvariant_dir\fR can be any convenient location, if it is not under the project top directory, normal target selection rules will not pick targets in the variant directory unless they are explicitly specified\&. .sp When files under \fIvariant_dir\fR are referenced, SCons backfills missing files from \fIsrc_dir\fR as needed to create a complete build tree\&. By default, SCons physically duplicates source files, subsidiary SConscript files, and any needed directory structure into the variant directory\&. This makes a build in the variant directory equivalent to a build in the source tree, even when intermediate source files are generated, scanners search for included files using source\-relative paths, or tools are hard\-coded to emit derived files beside their sources\&. Only the files SCons determines are needed for the build are duplicated into \fIvariant_dir\fR\&. Where possible, duplication is performed by linking rather than copying\&. The duplication strategy can be adjusted using the \fB\-\-duplicate\fR command\-line option or \fBSetOption\fR\&. .sp If the \fIduplicate\fR argument is set to \fBFalse\fR, SCons does not duplicate source files\&. Instead, it automatically invokes builders using the original source paths from \fIsrc_dir\fR and derived file paths in \fIvariant_dir\fR\&. This is more efficient than duplicating and is safe for most builds; if it causes problems, use duplicate=True (the 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 When switching an existing variant directory from duplicating to non\-duplicating, previously duplicated source files are not automatically removed\&. SCons will continue to prefer these stale copies over the original sources, possibly preventing detection of changes to the originals\&. To avoid this issue, clean the build tree before switching\&. After the switch, SCons no longer tracks duplicated files in the variant directory and will not remove them during cleaning\&. .sp .5v .RE Variant directories can also be established using the \fBSConscript\fR function 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=False) Program(\*(Aqbuild/prog\*(Aq, \*(Aqbuild/source\&.c\*(Aq) # this builds both the source and docs in a separate subtree VariantDir(\*(Aqbuild\*(Aq, \*(Aq\&.\*(Aq, duplicate=False) SConscript(dirs=[\*(Aqbuild/src\*(Aq, \*(Aqbuild/doc\*(Aq]) # same as previous example, but only uses SConscript SConscript(dirs=\*(Aqsrc\*(Aq, variant_dir=\*(Aqbuild/src\*(Aq, duplicate=False) SConscript(dirs=\*(Aqdoc\*(Aq, variant_dir=\*(Aqbuild/doc\*(Aq, duplicate=False) .fi .if n \{\ .RE .\} .sp \fBVariantDir\fR works most naturally when used with a subsidiary SConscript file\&. The subsidiary SConscript must be called as if it were in \fIvariant_dir\fR, regardless of the value of \fIduplicate\fR\&. Use the \fIexports\fR keyword argument to pass parameters or an appropriately configured environment object so the subsidiary SConscript can pick up the right settings for that variant build\&. The SConscript must \fBImport\fR these exported values before using them\&. .sp .if n \{\ .RS 4 .\} .nf env1 = Environment(\&.\&.\&.settings for variant1\&.\&.\&.) env2 = Environment(\&.\&.\&.settings for variant2\&.\&.\&.) # run src/SConscript by using the variant dir paths VariantDir(\*(Aqbuild/variant1\*(Aq, \*(Aqsrc\*(Aq) SConscript(\*(Aqbuild/variant1/SConscript\*(Aq, exports={"env": env1}) VariantDir(\*(Aqbuild/variant2\*(Aq, \*(Aqsrc\*(Aq) SConscript(\*(Aqbuild/variant2/SConscript\*(Aq, exports={"env": env2}) .fi .if n \{\ .RE .\} .RE .PP \fBVirtualenv\fR() .RS 4 If the SCons process is running inside a Python virtual environment, return the path to the directory where that environment is stored, else an empty string\&. The result can be treated as a boolean value if the path is unneeded\&. .RE .PP \fBWhereIs\fR(\fIprogram, [path, pathext, reject]\fR), \fIenv\fR\&.WhereIs(\fIprogram, [path, pathext, reject]\fR) .RS 4 Searches for the specified executable \fIprogram\fR, returning the full path to the program or \fBNone\fR\&. .sp When called as a construction environment method, searches the paths in the \fIpath\fR keyword argument, or if \fBNone\fR (the default) the paths listed in the construction environment (\fIenv\fR[\*(AqENV\*(Aq][\*(AqPATH\*(Aq])\&. The external environment\*(Aqs path list (os\&.environ[\*(AqPATH\*(Aq]) is used as a fallback if the key \fIenv\fR[\*(AqENV\*(Aq][\*(AqPATH\*(Aq] does not exist\&. .sp On Windows systems, searches for executable programs with any of the file extensions listed in the \fIpathext\fR keyword argument, or if \fBNone\fR (the default) the pathname extensions listed in the construction environment (\fIenv\fR[\*(AqENV\*(Aq][\*(AqPATHEXT\*(Aq])\&. The external environment\*(Aqs pathname extensions list (os\&.environ[\*(AqPATHEXT\*(Aq]) is used as a fallback if the key \fIenv\fR[\*(AqENV\*(Aq][\*(AqPATHEXT\*(Aq] does not exist\&. .sp When called as a global function, uses the external environment\*(Aqs path os\&.environ[\*(AqPATH\*(Aq] and path extensions os\&.environ[\*(AqPATHEXT\*(Aq], respectively, if \fIpath\fR and \fIpathext\fR are \fBNone\fR\&. .sp Will not select any path name or names in the optional \fIreject\fR list\&. .RE .SS "SConscript Variables" .PP In addition to the global functions and methods, \fBscons\fR supports a number of variables that can be used for run\-time queries in SConscript files to affect how you want the build to be performed\&. .PP \fIARGLIST\fR .RS 4 A list of the \fIvariable\fR=\fIvalue\fR build variable arguments specified on the command line\&. Each element in the list is a tuple consisting of the variable and its value\&. The separate \fIvariable\fR and \fIvalue\fR elements of the tuple can be accessed by subscripting for elements \fB[0]\fR and \fB[1]\fR of the tuple, or, more readably, by using tuple unpacking\&. Examples: .sp .if n \{\ .RS 4 .\} .nf print("first variable, value =", ARGLIST[0][0], ARGLIST[0][1]) print("second variable, value =", ARGLIST[1][0], ARGLIST[1][1]) var, value = ARGLIST[2] print("third variable, value =", var, value) for var, value in ARGLIST: # process variable and value .fi .if n \{\ .RE .\} .sp The values obtained from \fIARGLIST\fR (or from \fIARGUMENTS\fR) are always strings since they originate from outside the SCons process\&. As "untrusted data", they should be validated before usage, and may need conversion to an appropriate type\&. .RE .PP \fIARGUMENTS\fR .RS 4 A dictionary of all the \fIvariable\fR=\fIvalue\fR build variable arguments specified on the command line\&. The dictionary is in command\-line order, so if a given variable has more than one value assigned to it on the command line, the last (right\-most) value is the one saved in the \fIARGUMENTS\fR dictionary\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf if ARGUMENTS\&.get("debug", ""): env = Environment(CCFLAGS="\-g") else: env = Environment() .fi .if n \{\ .RE .\} .sp See also \fIARGLIST\fR\&. .RE .PP \fIBUILD_TARGETS\fR .RS 4 A list of the targets which \fBscons\fR has been asked to build\&. The contents will be either those targets listed on the command line, or, if none, those targets set via calls to the \fBDefault\fR function\&. It does \fInot\fR contain any dependent targets that \fBscons\fR selects for building as a result of making the sure the specified targets are up to date, if those targets did not appear on the command line\&. The list is empty if neither command line targets nor \fBDefault\fR calls are present\&. .sp 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, the contents of the list may change on each successive call to \fBDefault\fR\&. See \fIDEFAULT_TARGETS\fR 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 \fICOMMAND_LINE_TARGETS\fR .RS 4 A list of the targets explicitly specified on the command line\&. If there are command line targets, this list has the same contents as \fIBUILD_TARGETS\fR\&. If there are no targets specified on the command line, this list is empty\&. The elements of this list are strings\&. This can be used, for example, to take specific actions only when a certain target(s) are explicitly requested for building\&. .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 \fIDEFAULT_TARGETS\fR .RS 4 A list of the target \fInodes\fR that have been specified using the \fBDefault\fR function\&. If there are no command line targets, this list will have the same contents as \fIBUILD_TARGETS\fR\&. Since the elements of the list are nodes, you need to call the Python \fBstr\fR function on them to get 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 .\} .sp The contents of the \fIDEFAULT_TARGETS\fR list changes 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 .\} .sp Consequently, be sure to use \fIDEFAULT_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\&. .RE .PP 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 .\} .SS "Construction Variables" .PP Construction Variables are key\-value pairs used to store information in a construction environment that is needed needed for builds using that environment\&. Construction variable naming must follow the same rules as Python identifier naming: the initial character must be an underscore or letter, followed by any number of underscores, letters, or digits\&. The convention is to use uppercase for all letters for easier visual identification\&. .PP Construction variables are used to hold many different types of information\&. For example, the \fB$CPPDEFINES\fR variable is how to tell a C/C++ compiler about preprocessor macros you need for your build\&. The tool discovery that SCons performs will cause the \fB$CXX\fR variable to hold the name of the C++ compiler, if one was detected on the system, but you can give it a different value to force a compiler command of a different name to be used\&. Some variables contain lists of filename suffixes that are recognized by a particular compiler chain\&. \fB$BUILDERS\fR contains a mapping of configured Builder names (e\&.g\&. \fBTextfile\fR) to the actual Builder instance to call when that Builder is used\&. Construction variables may include references to other construction variables: the same tool which set up the C/C++ compiler will also set up an "action string", describing how to invoke that compiler, in \fB$CXXCOM\fR, which contains other construction variables using $VARIABLE syntax\&. These references will be expanded and replaced on use (see Variable Substitution)\&. .PP Construction variables are referenced as if they were keys and values in a Python dictionary: .sp .if n \{\ .RS 4 .\} .nf env["CC"] = "cc" flags = env\&.get("CPPDEFINES", []) .fi .if n \{\ .RE .\} .PP Construction variables can also be retrieved and set by using the \fBDictionary\fR method of the construction environment to create an actual dictionary: .sp .if n \{\ .RS 4 .\} .nf cvars = env\&.Dictionary() cvars["CC"] = "cc" .fi .if n \{\ .RE .\} .PP in the previous example, since \fIcvars\fR is an external copy, the value of \fB$CC\fR in the construction environment itself is not changed by the assignment\&. .PP Construction variables can set by passing them as keyword arguments when creating a new construction environment: .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 .\} .PP Construction variables can also be supplied as keyword arguments to a builder, in which case those settings affect only the work done by that builder call, and not the construction environment as a whole\&. This concept is called an override: .sp .if n \{\ .RS 4 .\} .nf env\&.Program(\*(Aqhello\*(Aq, \*(Aqhello\&.c\*(Aq, LIBS=[\*(Aqgl\*(Aq, \*(Aqglut\*(Aq]) .fi .if n \{\ .RE .\} .PP Many useful construction variables are automatically defined by SCons, tuned to the specific platform in use, and you can modify these or define any additional construction variables for use in your own Builders, Scanners and other tools\&. Take care not to overwrite ones which SCons is using\&. The following is a list of predefined construction variables\&. Pay attention to whether the values are ones you may be expected to set vs\&. ones that are set to expected values by internal tools and other initializations and probably should not be modified\&. .PP Note the actual list available at execution time will never include all of these, as the ones detected as not being applicable (wrong platform, necessary external command or files not installed, etc\&.) will not be set up\&. Correct build setups should be resilient to the possible absence of certain construction variables before using them, for example by using a Python dictionary \fBget\fR method to retrieve the value and taking alternative action if the return indicates the variable is unset\&. The \fBenv\&.Dump\fR method can be called to examine the construction variables set in a particular environment\&. .PP \fB__LDMODULEVERSIONFLAGS\fR .RS 4 This construction variable automatically introduces \fB$_LDMODULEVERSIONFLAGS\fR if \fB$LDMODULEVERSION\fR is set\&. Otherwise, it evaluates to an empty string\&. .RE .PP \fB__SHLIBVERSIONFLAGS\fR .RS 4 This construction variable automatically introduces \fB$_SHLIBVERSIONFLAGS\fR if \fB$SHLIBVERSION\fR is set\&. Otherwise, it evaluates to an empty string\&. .RE .PP \fBAPPLELINK_COMPATIBILITY_VERSION\fR .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 \fB_APPLELINK_COMPATIBILITY_VERSION\fR .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 \fBAPPLELINK_CURRENT_VERSION\fR .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 \fB_APPLELINK_CURRENT_VERSION\fR .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 \fBAPPLELINK_NO_COMPATIBILITY_VERSION\fR .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 \fBAPPLELINK_NO_CURRENT_VERSION\fR .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 \fBAR\fR .RS 4 The static library archiver\&. .RE .PP \fBARCHITECTURE\fR .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\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBARCOM\fR .RS 4 The command line used to generate a static library from object files\&. .RE .PP \fBARCOMSTR\fR .RS 4 The string displayed when a static library is generated from object files\&. 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 \fBARFLAGS\fR .RS 4 General options passed to the static library archiver\&. .RE .PP \fBAS\fR .RS 4 The assembler\&. .RE .PP \fBASCOM\fR .RS 4 The command line used to generate an object file from an assembly\-language source file\&. .RE .PP \fBASCOMSTR\fR .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 \fBASFLAGS\fR .RS 4 General options passed to the assembler\&. .RE .PP \fBASPPCOM\fR .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 \fBASPPCOMSTR\fR .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 \fBASPPFLAGS\fR .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 \fBBIBTEX\fR .RS 4 The bibliography generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&. .RE .PP \fBBIBTEXCOM\fR .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 \fBBIBTEXCOMSTR\fR .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 \fBBIBTEXFLAGS\fR .RS 4 General options passed to the bibliography generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&. .RE .PP \fBBUILDERS\fR .RS 4 A dictionary mapping the names of the builders available through the construction environment to underlying Builder objects\&. Custom builders need to be added to this to make them available\&. .sp A platform\-dependent default list of builders such as \fBProgram\fR, \fBLibrary\fR etc\&. is used to populate this construction variable when the construction environment is initialized via the presence/absence of the tools those builders depend on\&. \fB$BUILDERS\fR can be examined to learn which builders will actually be available at run\-time\&. .sp Note that if you initialize this construction variable through assignment when the construction environment is created, that value for \fB$BUILDERS\fR will override any defaults: .sp .if n \{\ .RS 4 .\} .nf bld = Builder(action=\*(Aqfoobuild < $SOURCE > $TARGET\*(Aq) env = Environment(BUILDERS={\*(AqNewBuilder\*(Aq: bld}) .fi .if n \{\ .RE .\} .sp To instead 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: bld}) .fi .if n \{\ .RE .\} .sp or this: .sp .if n \{\ .RS 4 .\} .nf env = Environment() env[\*(AqBUILDERS\*(Aq][\*(AqNewBuilder\*(Aq] = bld .fi .if n \{\ .RE .\} .RE .PP \fBCACHEDIR_CLASS\fR .RS 4 The class type that SCons should use when instantiating a new \fBCacheDir\fR in this construction environment\&. Must be a subclass of the SCons\&.CacheDir\&.CacheDir class\&. .RE .PP \fBCC\fR .RS 4 The C compiler\&. .RE .PP \fBCCCOM\fR .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\&. See also \fB$SHCCCOM\fR for compiling to shared objects\&. .RE .PP \fBCCCOMSTR\fR .RS 4 If set, the string displayed when a C source file is compiled to a (static) object file\&. If not set, then \fB$CCCOM\fR (the command line) is displayed\&. See also \fB$SHCCCOMSTR\fR for compiling to shared objects\&. .sp .if n \{\ .RS 4 .\} .nf env = Environment(CCCOMSTR = "Compiling static object $TARGET") .fi .if n \{\ .RE .\} .RE .PP \fBCCDEPFLAGS\fR .RS 4 Options to pass to C or C++ compiler to generate list of dependency files\&. .sp This is set only by compilers which support this functionality\&. (gcc, clang, and msvc currently) .RE .PP \fBCCFLAGS\fR .RS 4 General options that are passed to the C and C++ compilers\&. See also \fB$SHCCFLAGS\fR for compiling to shared objects\&. .RE .PP \fBCCPCHFLAGS\fR .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 \fBCCPDBFLAGS\fR .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 Microsoft 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 \fBCCVERSION\fR .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 \fBCFILESUFFIX\fR .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 \fBCFLAGS\fR .RS 4 General options that are passed to the C compiler (C only; not C++)\&. See also \fB$SHCFLAGS\fR for compiling to shared objects\&. .RE .PP \fBCHANGE_SPECFILE\fR .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\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBCHANGED_SOURCES\fR .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 \fBCHANGED_TARGETS\fR .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 \fBCHANGELOG\fR .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\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBCOMPILATIONDB_COMSTR\fR .RS 4 The string displayed when the \fBCompilationDatabase\fR builder\*(Aqs action is run\&. .RE .PP \fBCOMPILATIONDB_PATH_FILTER\fR .RS 4 A string which instructs \fBCompilationDatabase\fR to only include entries where the output member matches the pattern in the filter string using fnmatch, which uses glob style wildcards\&. .sp The default value is an empty string \*(Aq\*(Aq, which disables filtering\&. .RE .PP \fBCOMPILATIONDB_USE_ABSPATH\fR .RS 4 A boolean flag to instruct \fBCompilationDatabase\fR whether to write the file and output members in the compilation database using absolute or relative paths\&. .sp The default value is False (use relative paths) .RE .PP \fB_concat\fR .RS 4 A function used to produce variables like \fB$_CPPINCFLAGS\fR\&. It takes four mandatory arguments, and up to 4 additional optional arguments: 1) a prefix to concatenate onto each element, 2) a list of elements, 3) a suffix to concatenate onto each element, 4) an environment for variable interpolation, 5) an optional function that will be called to transform the list before concatenation, 6) an optionally specified target (Can use TARGET), 7) an optionally specified source (Can use SOURCE), 8) optional \fIaffect_signature\fR flag which will wrap non\-empty returned value with $( and $) to indicate the contents should not affect the signature of the generated command line\&. .sp .if n \{\ .RS 4 .\} .nf env[\*(Aq_CPPINCFLAGS\*(Aq] = \*(Aq${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}\*(Aq .fi .if n \{\ .RE .\} .RE .PP \fBCONFIGUREDIR\fR .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\&. .sp If variant directories are in use, and the configure check results should not be shared between variants, you can set \fB$CONFIGUREDIR\fR and \fB$CONFIGURELOG\fR so they are unique per variant directory\&. .RE .PP \fBCONFIGURELOG\fR .RS 4 The name of the \fBConfigure\fR context log file\&. The default is config\&.log in the top\-level directory containing the SConstruct file\&. .sp If variant directories are in use, and the configure check results should not be shared between variants, you can set \fB$CONFIGUREDIR\fR and \fB$CONFIGURELOG\fR so they are unique per variant directory\&. .RE .PP \fB_CPPDEFFLAGS\fR .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 each definition in \fB$CPPDEFINES\fR\&. .RE .PP \fBCPPDEFINES\fR .RS 4 A platform independent specification of C preprocessor macro definitions\&. The definitions are added to command lines through the automatically\-generated \fB$_CPPDEFFLAGS\fR construction variable, which is constructed according to the contents of \fB$CPPDEFINES\fR: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If \fB$CPPDEFINES\fR is a string, the values of the \fB$CPPDEFPREFIX\fR and \fB$CPPDEFSUFFIX\fR construction variables are respectively prepended and appended to each definition in \fB$CPPDEFINES\fR, split on whitespace\&. .sp .if n \{\ .RS 4 .\} .nf # Adds \-Dxyz to POSIX compiler command lines, # and /Dxyz to Microsoft Visual C++ command lines\&. env = Environment(CPPDEFINES=\*(Aqxyz\*(Aq) .fi .if n \{\ .RE .\} .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If \fB$CPPDEFINES\fR is a list, the values of the \fB$CPPDEFPREFIX\fR and \fB$CPPDEFSUFFIX\fR construction variables are respectively prepended and appended to each element in the list\&. If any element is a tuple (or list) then the first item of the tuple is the macro name and the second is the macro definition\&. If the definition is not omitted or None, the name and definition are combined into a single name=definition item before the prepending/appending\&. .sp .if n \{\ .RS 4 .\} .nf # Adds \-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 .\} .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If \fB$CPPDEFINES\fR is a dictionary, the values of the \fB$CPPDEFPREFIX\fR and \fB$CPPDEFSUFFIX\fR construction variables are respectively prepended and appended to each key from the dictionary\&. If the value for a key is not None, then the key (macro name) and the value (macros definition) are combined into a single name=definition item before the prepending/appending\&. .sp .if n \{\ .RS 4 .\} .nf # Adds \-DA \-DB=2 to POSIX compiler command lines, # or /DA /DB=2 to Microsoft Visual C++ command lines\&. env = Environment(CPPDEFINES={\*(AqB\*(Aq:2, \*(AqA\*(Aq:None}) .fi .if n \{\ .RE .\} .RE .sp Depending on how contents are added to \fB$CPPDEFINES\fR, it may be transformed into a compound type, for example a list containing strings, tuples and/or dictionaries\&. SCons can correctly expand such a compound type\&. .sp Note that SCons may call the compiler via a shell\&. If a macro definition contains characters such as spaces that have meaning to the shell, or is intended to be a string value, you may need to use the shell\*(Aqs quoting syntax to avoid interpretation by the shell before the preprocessor sees it\&. Function\-like macros are not supported via this mechanism (and some compilers do not even implement that functionality via the command lines)\&. When quoting, note that one set of quote characters are used to define a Python string, then quotes embedded inside that would be consumed by the shell unless escaped\&. These examples may help illustrate: .sp .if n \{\ .RS 4 .\} .nf env = Environment(CPPDEFINES=[\*(AqUSE_ALT_HEADER=\e\e"foo_alt\&.h\e\e"\*(Aq]) env = Environment(CPPDEFINES=[(\*(AqUSE_ALT_HEADER\*(Aq, \*(Aq\e\e"foo_alt\&.h\e\e"\*(Aq)]) .fi .if n \{\ .RE .\} .sp :\fIChanged in version 4\&.5\fR: SCons no longer sorts \fB$CPPDEFINES\fR values entered in dictionary form\&. Python now preserves dictionary keys in the order they are entered, so it is no longer necessary to sort them to ensure a stable command line\&. .RE .PP \fBCPPDEFPREFIX\fR .RS 4 The prefix used to specify preprocessor macro definitions on the C compiler command line\&. This will be prepended to each definition in the \fB$CPPDEFINES\fR construction variable when the \fB$_CPPDEFFLAGS\fR variable is automatically generated\&. .RE .PP \fBCPPDEFSUFFIX\fR .RS 4 The suffix used to specify preprocessor macro definitions on the C compiler command line\&. This will be appended to each definition in the \fB$CPPDEFINES\fR construction variable when the \fB$_CPPDEFFLAGS\fR variable is automatically generated\&. .RE .PP \fBCPPFLAGS\fR .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 \fB_CPPINCFLAGS\fR .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 each directory in \fB$CPPPATH\fR\&. .RE .PP \fBCPPPATH\fR .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\&. In general, it\*(Aqs not advised to put include directory directives directly into \fB$CCFLAGS\fR or \fB$CXXFLAGS\fR as the result will be non\-portable and the directories will not be searched by the dependency scanner\&. \fB$CPPPATH\fR should be a list of path strings, or a single string, not a pathname list joined by the Python os\&.pathsep character\&. .sp Note: directory names in \fB$CPPPATH\fR will be looked\-up relative to the directory of the SConscript file when they are used in a command\&. To force \fBscons\fR to lookup a directory relative to the root of the source tree, use the # prefix: .sp .if n \{\ .RS 4 .\} .nf env = Environment(CPPPATH=\*(Aq#/include\*(Aq) .fi .if n \{\ .RE .\} .sp The directory lookup 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 values of the \fB$INCPREFIX\fR and \fB$INCSUFFIX\fR construction variables to each directory in \fB$CPPPATH\fR\&. Any command lines you define that need the \fB$CPPPATH\fR 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 \fBCPPSUFFIXES\fR .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 \fBCXX\fR .RS 4 The C++ compiler\&. See also \fB$SHCXX\fR for compiling to shared objects\&. .RE .PP \fBCXXCOM\fR .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\&. See also \fB$SHCXXCOM\fR for compiling to shared objects\&. .RE .PP \fBCXXCOMSTR\fR .RS 4 If set, the string displayed when a C++ source file is compiled to a (static) object file\&. If not set, then \fB$CXXCOM\fR (the command line) is displayed\&. See also \fB$SHCXXCOMSTR\fR for compiling to shared objects\&. .sp .if n \{\ .RS 4 .\} .nf env = Environment(CXXCOMSTR = "Compiling static object $TARGET") .fi .if n \{\ .RE .\} .RE .PP \fBCXXFILESUFFIX\fR .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 \fBCXXFLAGS\fR .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\&. See also \fB$SHCXXFLAGS\fR for compiling to shared objects\&. .RE .PP \fBCXXVERSION\fR .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 \fBDC\fR .RS 4 The D compiler to use\&. SCons provides tool modules for three D compilation systems: DMD (dmd), the reference compiler; LDC (ldc), the LLVM\-based D compiler; and GDC (gdc), from the GNU Compiler Collection, searched in that order\&. Use a tool specifier if you need to prefer a specific compiler\&. See also \fB$SHDC\fR for compiling to shared objects\&. .RE .PP \fBDCOM\fR .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 are included on this command line\&. See also \fB$SHDCOM\fR for compiling to shared objects\&. See also the \fBProgramAllAtOnce\fR builder for how to compile directly to an executable without making intermediate object files\&. .RE .PP \fBDCOMSTR\fR .RS 4 If set, the string displayed when a D source file is compiled to an object file\&. If not set, then \fB$DCOM\fR (the command line) is displayed\&. See also \fB$SHDCOMSTR\fR for compiling to shared objects\&. .RE .PP \fBDDEBUG\fR .RS 4 Debug tags to enable when compiling\&. .RE .PP \fBDDEBUGPREFIX\fR .RS 4 Prefix used for debug tags from \fB$DDEBUG\fR\&. Defaults vary by D compiler\&. .RE .PP \fBDDEBUGSUFFIX\fR .RS 4 Suffix used for debug tags from \fB$DDEBUG\fR\&. .RE .PP \fBDESCRIPTION\fR .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\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBDESCRIPTION_lang\fR .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\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBDFILESUFFIX\fR .RS 4 File suffix for D source files\&. The default is \&.d\&. .RE .PP \fBDFLAGPREFIX\fR .RS 4 Prefix added to each element of \fB$DFLAGS\fR\&. .RE .PP \fBDFLAGS\fR .RS 4 General options that are passed to the D compiler\&. .RE .PP \fBDFLAGSUFFIX\fR .RS 4 Suffix added to each element of \fB$DFLAGS\fR\&. .RE .PP \fBDI_FILE_DIR\fR .RS 4 Path to search for D interface files, which are translations of C header files\&. .RE .PP \fBDI_FILE_DIR_PREFIX\fR .RS 4 Prefix added to the name of the D interface file directory from \fB$DI_FILE_DIR\fR\&. .RE .PP \fBDI_FILE_DIR_SUFFFIX\fR .RS 4 Suffix added to the name of the D interface file directory from \fB$DI_FILE_DIR\fR\&. .RE .PP \fBDI_FILE_SUFFIX\fR .RS 4 Suffix for D interface files, which are translations of C header files\&. The default is \&.di\&. .RE .PP \fBDINCPREFIX\fR .RS 4 Prefix added to each path in \fB$DPATH\fR\&. .RE .PP \fBDINCSUFFIX\fR .RS 4 Suffix added to each path in \fB$DPATH\fR\&. .RE .PP \fBDir\fR .RS 4 A function that converts a string into a Dir instance relative to the target being built\&. .RE .PP \fBDirs\fR .RS 4 A function that converts a list of strings into a list of Dir instances relative to the target being built\&. .RE .PP \fBDLIB\fR .RS 4 Name of the static library tool for D code\&. .RE .PP \fBDLIBCOM\fR .RS 4 The command line to use when linking a static library\&. .RE .PP \fBDLIBDIRPREFIX\fR .RS 4 The command\-line prefix for library search directories from \fB$LIBPATH\fR when linking D code\&. .RE .PP \fBDLIBDIRSUFFIX\fR .RS 4 The command\-line suffix for library search directories from \fB$LIBPATH\fR when linking D code\&. .RE .PP \fBDLIBFLAGPREFIX\fR .RS 4 Prefix added to each element of \fB$DLIBFLAGS\fR\&. .RE .PP \fBDLIBFLAGS\fR .RS 4 The flags to pass to the library tool\&. .RE .PP \fBDLIBFLAGSUFFIX\fR .RS 4 Suffix added to each element of \fB$DLIBFLAGS\fR\&. .RE .PP \fBDLIBLINKPREFIX\fR .RS 4 Prefix added to each library name from \fB$LIBS\fR\&. .RE .PP \fBDLIBLINKSUFFIX\fR .RS 4 Suffix added to each library name from \fB$LIBS\fR\&. .RE .PP \fBDLINK\fR .RS 4 Name of the linker to use for linking systems including D sources\&. See also \fB$SHDLINK\fR for linking shared objects\&. .RE .PP \fBDLINKCOM\fR .RS 4 The command line to use when linking systems including D sources\&. See also \fB$SHDLINKCOM\fR for linking shared objects\&. .RE .PP \fBDLINKFLAGPREFIX\fR .RS 4 Prefix added to each element of \fB$DLINKFLAGS\fR\&. .RE .PP \fBDLINKFLAGS\fR .RS 4 Linker flags\&. See also \fB$SHDLINKFLAGS\fR for linking shared objects\&. .RE .PP \fBDLINKFLAGSUFFIX\fR .RS 4 Suffix added to each element of \fB$DLINKFLAGS\fR\&. .RE .PP \fBDOCBOOK_DEFAULT_XSL_EPUB\fR .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 \fBDOCBOOK_DEFAULT_XSL_HTML\fR .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 \fBDOCBOOK_DEFAULT_XSL_HTMLCHUNKED\fR .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 \fBDOCBOOK_DEFAULT_XSL_HTMLHELP\fR .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 \fBDOCBOOK_DEFAULT_XSL_MAN\fR .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 \fBDOCBOOK_DEFAULT_XSL_PDF\fR .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 \fBDOCBOOK_DEFAULT_XSL_SLIDESHTML\fR .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 \fBDOCBOOK_DEFAULT_XSL_SLIDESPDF\fR .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 \fBDOCBOOK_FOP\fR .RS 4 The path to the PDF renderer fop or xep, if one of them is installed (fop gets checked first)\&. .RE .PP \fBDOCBOOK_FOPCOM\fR .RS 4 The full command\-line for the PDF renderer fop or xep\&. .RE .PP \fBDOCBOOK_FOPCOMSTR\fR .RS 4 The string displayed when a renderer like fop or xep is used to create PDF output from an XML file\&. .RE .PP \fBDOCBOOK_FOPFLAGS\fR .RS 4 Additional command\-line flags for the PDF renderer fop or xep\&. .RE .PP \fBDOCBOOK_XMLLINT\fR .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 lxml Python binding can be imported in the current system\&. .RE .PP \fBDOCBOOK_XMLLINTCOM\fR .RS 4 The full command\-line for the external executable xmllint\&. .RE .PP \fBDOCBOOK_XMLLINTCOMSTR\fR .RS 4 The string displayed when xmllint is used to resolve XIncludes for a given XML file\&. .RE .PP \fBDOCBOOK_XMLLINTFLAGS\fR .RS 4 Additional command\-line flags for the external executable xmllint\&. .RE .PP \fBDOCBOOK_XSLTPROC\fR .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 lxml Python binding can be imported in the current system\&. .RE .PP \fBDOCBOOK_XSLTPROCCOM\fR .RS 4 The full command\-line for the external executable xsltproc (or saxon, xalan)\&. .RE .PP \fBDOCBOOK_XSLTPROCCOMSTR\fR .RS 4 The string displayed when xsltproc is used to transform an XML file via a given XSLT stylesheet\&. .RE .PP \fBDOCBOOK_XSLTPROCFLAGS\fR .RS 4 Additional command\-line flags for the external executable xsltproc (or saxon, xalan)\&. .RE .PP \fBDOCBOOK_XSLTPROCPARAMS\fR .RS 4 Additional 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 \fBDPATH\fR .RS 4 List of paths to search for import modules\&. .RE .PP \fBDRPATHPREFIX\fR .RS 4 Prefix added to rpath entries when generating shared objects\&. .RE .PP \fBDRPATHSUFFIX\fR .RS 4 Suffix added to rpath entries when generating shared objects\&. .RE .PP \fBDSUFFIXES\fR .RS 4 The list of suffixes of files that will be scanned for imported D package files\&. The default list is [\*(Aq\&.d\*(Aq]\&. .RE .PP \fBDVERPREFIX\fR .RS 4 Prefix added to each element of \fB$DVERSIONS\fR\&. .RE .PP \fBDVERSIONS\fR .RS 4 List of version tags to enable when compiling\&. .RE .PP \fBDVERSUFFIX\fR .RS 4 Suffix added to each element of \fB$DVERSIONS\fR\&. .RE .PP \fBDVIPDF\fR .RS 4 The TeX DVI file to PDF file converter\&. .RE .PP \fBDVIPDFCOM\fR .RS 4 The command line used to convert TeX DVI files into a PDF file\&. .RE .PP \fBDVIPDFCOMSTR\fR .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 \fBDVIPDFFLAGS\fR .RS 4 General options passed to the TeX DVI file to PDF file converter\&. .RE .PP \fBDVIPS\fR .RS 4 The TeX DVI file to PostScript converter\&. .RE .PP \fBDVIPSFLAGS\fR .RS 4 General options passed to the TeX DVI file to PostScript converter\&. .RE .PP \fBENV\fR .RS 4 The execution environment \- a dictionary of environment variables used when SCons invokes external commands to build targets defined in this construction environment\&. When \fB$ENV\fR is passed to a command, all list values are assumed to be path lists and are joined using the search path separator\&. Any other non\-string values are coerced to a string\&. .sp Note that by default SCons does \fInot\fR propagate the environment in effect when you execute \fBscons\fR (the "shell environment") to the execution environment\&. This is so that builds will be guaranteed repeatable regardless of the environment variables set at the time \fBscons\fR is invoked\&. If you want to propagate a shell environment variable to the commands executed to build target files, you must do so explicitly\&. A common example is the system \fBPATH\fR environment variable, so that \fBscons\fR will find utilities the same way 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 .\} .sp Although it is usually not recommended, you can propagate the entire shell environment in one go: .sp .if n \{\ .RS 4 .\} .nf import os env = Environment(ENV=os\&.environ\&.copy()) .fi .if n \{\ .RE .\} .RE .PP \fBESCAPE\fR .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 \fBF03\fR .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 \fBF03COM\fR .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 \fBF03COMSTR\fR .RS 4 If set, the string displayed when a Fortran 03 source file is compiled to an object file\&. If not set, then \fB$F03COM\fR or \fB$FORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBF03FILESUFFIXES\fR .RS 4 The list of file extensions for which the F03 dialect will be used\&. By default, this is [\*(Aq\&.f03\*(Aq] .RE .PP \fBF03FLAGS\fR .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 \fB_F03INCFLAGS\fR .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 \fBF03PATH\fR .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 \fBscons\fR to lookup 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 lookup 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 \fBF03PPCOM\fR .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 \fBF03PPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$F03PPCOM\fR or \fB$FORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBF03PPFILESUFFIXES\fR .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 \fBF08\fR .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 \fBF08COM\fR .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 \fBF08COMSTR\fR .RS 4 If set, the string displayed when a Fortran 08 source file is compiled to an object file\&. If not set, then \fB$F08COM\fR or \fB$FORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBF08FILESUFFIXES\fR .RS 4 The list of file extensions for which the F08 dialect will be used\&. By default, this is [\*(Aq\&.f08\*(Aq] .RE .PP \fBF08FLAGS\fR .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 \fB_F08INCFLAGS\fR .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 \fBF08PATH\fR .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 \fBscons\fR to lookup 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 lookup 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 \fBF08PPCOM\fR .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 \fBF08PPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$F08PPCOM\fR or \fB$FORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBF08PPFILESUFFIXES\fR .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 \fBF77\fR .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 \fBF77COM\fR .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 \fBF77COMSTR\fR .RS 4 If set, the string displayed when a Fortran 77 source file is compiled to an object file\&. If not set, then \fB$F77COM\fR or \fB$FORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBF77FILESUFFIXES\fR .RS 4 The list of file extensions for which the F77 dialect will be used\&. By default, this is [\*(Aq\&.f77\*(Aq] .RE .PP \fBF77FLAGS\fR .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 \fB_F77INCFLAGS\fR .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 \fBF77PATH\fR .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 \fBscons\fR to lookup 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 lookup 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 \fBF77PPCOM\fR .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 \fBF77PPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$F77PPCOM\fR or \fB$FORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBF77PPFILESUFFIXES\fR .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 \fBF90\fR .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 \fBF90COM\fR .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 \fBF90COMSTR\fR .RS 4 If set, the string displayed when a Fortran 90 source file is compiled to an object file\&. If not set, then \fB$F90COM\fR or \fB$FORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBF90FILESUFFIXES\fR .RS 4 The list of file extensions for which the F90 dialect will be used\&. By default, this is [\*(Aq\&.f90\*(Aq] .RE .PP \fBF90FLAGS\fR .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 \fB_F90INCFLAGS\fR .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 \fBF90PATH\fR .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 \fBscons\fR to lookup 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 lookup 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 \fBF90PPCOM\fR .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 \fBF90PPCOMSTR\fR .RS 4 If set, the string displayed when a Fortran 90 source file is compiled after first running the file through the C preprocessor\&. If not set, then \fB$F90PPCOM\fR or \fB$FORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBF90PPFILESUFFIXES\fR .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 \fBF95\fR .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 \fBF95COM\fR .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 \fBF95COMSTR\fR .RS 4 If set, the string displayed when a Fortran 95 source file is compiled to an object file\&. If not set, then \fB$F95COM\fR or \fB$FORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBF95FILESUFFIXES\fR .RS 4 The list of file extensions for which the F95 dialect will be used\&. By default, this is [\*(Aq\&.f95\*(Aq] .RE .PP \fBF95FLAGS\fR .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 \fB_F95INCFLAGS\fR .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 \fBF95PATH\fR .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 \fBscons\fR to lookup 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 lookup 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 \fBF95PPCOM\fR .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 \fBF95PPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$F95PPCOM\fR or \fB$FORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBF95PPFILESUFFIXES\fR .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 \fBFile\fR .RS 4 A function that converts a string into a File instance relative to the target being built\&. .RE .PP \fBFILE_ENCODING\fR .RS 4 File encoding used for files written by \fBTextfile\fR and \fBSubstfile\fR\&. Set to "utf\-8" by default\&. .sp \fINew in version 4\&.5\&.0\&.\fR .RE .PP \fBFORTRAN\fR .RS 4 The default Fortran compiler for all versions of Fortran\&. .RE .PP \fBFORTRANCOM\fR .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$_FORTRANMODFLAG\fR, and \fB$_FORTRANINCFLAGS\fR construction variables are included on this command line\&. .RE .PP \fBFORTRANCOMMONFLAGS\fR .RS 4 General user\-specified options that are passed to the Fortran compiler\&. Similar to \fB$FORTRANFLAGS\fR, but this construction variable is applied to all dialects\&. .sp \fINew in version 4\&.4\&.\fR .RE .PP \fBFORTRANCOMSTR\fR .RS 4 If set, the string displayed when a Fortran source file is compiled to an object file\&. If not set, then \fB$FORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBFORTRANFILESUFFIXES\fR .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 \fBFORTRANFLAGS\fR .RS 4 General user\-specified options for the FORTRAN dialect 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 for the construction variables that expand those options\&. .RE .PP \fB_FORTRANINCFLAGS\fR .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 \fBFORTRANMODDIR\fR .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 \fBFORTRANMODDIRPREFIX\fR .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 \fBFORTRANMODDIRSUFFIX\fR .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 \fB_FORTRANMODFLAG\fR .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 \fBFORTRANMODPREFIX\fR .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 \fBFORTRANMODSUFFIX\fR .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 \fBFORTRANPATH\fR .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 \fBscons\fR to lookup 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 \fBFORTRANPPCOM\fR .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 \fBFORTRANPPCOMSTR\fR .RS 4 If set, the string displayed when a Fortran source file is compiled to an object file after first running the file through the C preprocessor\&. If not set, then \fB$FORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBFORTRANPPFILESUFFIXES\fR .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 \fBFORTRANSUFFIXES\fR .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 \fBFRAMEWORKPATH\fR .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 \&. 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 \fB_FRAMEWORKPATH\fR .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 \fBFRAMEWORKPATHPREFIX\fR .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 \fBFRAMEWORKPREFIX\fR .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 \fBFRAMEWORKS\fR .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 \fB_FRAMEWORKS\fR .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 \fBFRAMEWORKSFLAGS\fR .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 \fBGS\fR .RS 4 The Ghostscript program used to, for example, convert PostScript to PDF files\&. .RE .PP \fBGSCOM\fR .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 \fBGSCOMSTR\fR .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 \fBGSFLAGS\fR .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 \fBHOST_ARCH\fR .RS 4 The name of the host hardware architecture used to create this construction environment\&. The platform code sets this when initializing (see \fB$PLATFORM\fR and the \fIplatform\fR argument to \fBEnvironment\fR)\&. Note the detected name of the architecture may not be identical to that returned by the Python platform\&.machine method\&. .sp On the win32 platform, if the Microsoft Visual C++ compiler is available, msvc tool setup is done using \fB$HOST_ARCH\fR and \fB$TARGET_ARCH\fR\&. Changing the values at any later time will not cause the tool to be reinitialized\&. Valid host arch values are x86 and arm for 32\-bit hosts and amd64, arm64, and x86_64 for 64\-bit hosts\&. .sp Should be considered immutable\&. \fB$HOST_ARCH\fR is not currently used by other platforms, but the option is reserved to do so in future .RE .PP \fBHOST_OS\fR .RS 4 The name of the host operating system for the platform used to create this construction environment\&. The platform code sets this when initializing (see \fB$PLATFORM\fR and the \fIplatform\fR argument to \fBEnvironment\fR)\&. .sp Should be considered immutable\&. \fB$HOST_OS\fR is not currently used by SCons, but the option is reserved to do so in future .RE .PP \fBIDLSUFFIXES\fR .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 \fBIMPLIBNOVERSIONSYMLINKS\fR .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 \fBIMPLIBPREFIX\fR .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 \fBIMPLIBSUFFIX\fR .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 \fBIMPLIBVERSION\fR .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 \fBIMPLICIT_COMMAND_DEPENDENCIES\fR .RS 4 Controls how SCons adds implicit dependencies from action strings (the commands executed to build targets)\&. These implicit dependencies allow SCons to trigger target rebuilds when the compilers, tools, or scripts that affect build outcomes change (for example, when a new version of a compiler is installed)\&. By default, SCons adds an implicit dependency on the executable represented by the first argument of the command line\&. This executable is first checked as a path; if not found, it is searched for in the execution environment\*(Aqs search path (env[\*(AqENV\*(Aq][\*(AqPATH\*(Aq])\&. .sp If \fB$IMPLICIT_COMMAND_DEPENDENCIES\fR is set to a falsy value ("none", "false", "no", "off", "0" or integer 0), no implicit dependencies from action strings are added\&. If set to an integer value greater than 1, or to "all", additional command\-line arguments are checked\&. A numeric value \fIN\fR checks the first \fIN\fR arguments, while "all" checks every argument\&. A checked argument beyond the first is added as a dependency if it is an absolute path or it refers to an existing file in the filesystem; unlike the first argument, these additional arguments are not searched using the execution environment\*(Aqs search path\&. All other values of \fB$IMPLICIT_COMMAND_DEPENDENCIES\fR are treated the same as the default\&. The value of \fB$IMPLICIT_COMMAND_DEPENDENCIES\fR is subject to substitution before it is used, so it can contain a construction variable reference\&. .sp Action strings may be segmented with a logical AND operator (&&), indicating each segment is executed sequentially, but only if the previous segment succeeded\&. If \fB$IMPLICIT_COMMAND_DEPENDENCIES\fR is set to "all" or an integer greater than 1, each segment is treated as a separate command line for computing dependencies; otherwise, only the first segment is checked\&. .RE .PP \fBINCPREFIX\fR .RS 4 The prefix used to specify an include directory on the C compiler command line\&. This will be prepended to 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 \fBINCSUFFIX\fR .RS 4 The suffix used to specify an include directory on the C compiler command line\&. This will be appended to 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 \fBINSTALL\fR .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 \fBINSTALLSTR\fR .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 \fBINTEL_C_COMPILER_VERSION\fR .RS 4 Set by the intelc Tool to the major version number of the Intel C compiler selected for use\&. .RE .PP \fBJAR\fR .RS 4 The Java archive tool\&. .RE .PP \fBJARCHDIR\fR .RS 4 The directory to which the Java archive tool should change (using the \fB\-C\fR option)\&. .RE .PP \fBJARCOM\fR .RS 4 The command line used to call the Java archive tool\&. .RE .PP \fBJARCOMSTR\fR .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 .\} .RE .PP \fBJARFLAGS\fR .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\&. .RE .PP \fBJARSUFFIX\fR .RS 4 The suffix for Java archives: \&.jar by default\&. .RE .PP \fBJAVABOOTCLASSPATH\fR .RS 4 Specifies the location of the bootstrap class files\&. Can be specified as a string or Node object, or as a list of strings or Node objects\&. .sp The value will be added to the JDK command lines via the \fB\-bootclasspath\fR option, which requires a system\-specific search path separator\&. This will be supplied by SCons as needed when it constructs the command line if \fB$JAVABOOTCLASSPATH\fR is provided in list form\&. If \fB$JAVABOOTCLASSPATH\fR is a single string containing search path separator characters (: for POSIX systems or ; for Windows), it will not be modified; and so is inherently system\-specific; to supply the path in a system\-independent manner, give \fB$JAVABOOTCLASSPATH\fR as a list of paths instead\&. .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 Can only be used when compiling for releases prior to JDK 9\&. .sp .5v .RE .RE .PP \fBJAVAC\fR .RS 4 The Java compiler\&. .RE .PP \fBJAVACCOM\fR .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 \fBJAVACCOMSTR\fR .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 \fBJAVACFLAGS\fR .RS 4 General options that are passed to the Java compiler\&. .RE .PP \fBJAVACLASSDIR\fR .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 \fBJavaH\fR builder\&. .RE .PP \fBJAVACLASSPATH\fR .RS 4 Specifies the class search path for the JDK tools\&. Can be specified as a string or Node object, or as a list of strings or Node objects\&. Class path entries may be directory names to search for class files or packages, pathnames to archives (\&.jar or \&.zip) containing classes, or paths ending in a "base name wildcard" character (*), which matches files in that directory with a \&.jar suffix\&. See the Java documentation for more details\&. .sp The value will be added to the JDK command lines via the \fB\-classpath\fR option, which requires a system\-specific search path separator\&. This will be supplied by SCons as needed when it constructs the command line if \fB$JAVACLASSPATH\fR is provided in list form\&. If \fB$JAVACLASSPATH\fR is a single string containing search path separator characters (: for POSIX systems or ; for Windows), it will be split on the separator into a list of individual paths for dependency scanning purposes\&. It will not be modified for JDK command\-line usage, so such a string is inherently system\-specific; to supply the path in a system\-independent manner, give \fB$JAVACLASSPATH\fR as a list of paths instead\&. .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 SCons \fBalways\fR supplies a \fB\-sourcepath\fR when invoking the Java compiler javac, regardless of the setting of \fB$JAVASOURCEPATH\fR, as it passes the path(s) to the source(s) supplied in the call to the \fBJava\fR builder via \fB\-sourcepath\fR \&. From the documentation of the standard Java toolkit for javac: \(lqIf not compiling code for modules, if the \fB\-\-source\-path\fR or \fB\-sourcepath\fR option is not specified, then the user class path is also searched for source files\&.\(rq Since \fB\-sourcepath\fR is always supplied, javac will not use the contents of the value of \fB$JAVACLASSPATH\fR when searching for sources\&. .sp .5v .RE .RE .PP \fBJAVACLASSSUFFIX\fR .RS 4 The suffix for Java class files; \&.class by default\&. .RE .PP \fBJAVAH\fR .RS 4 The Java generator for C header and stub files\&. .RE .PP \fBJAVAHCOM\fR .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 \fBJAVAHCOMSTR\fR .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 \fBJAVAHFLAGS\fR .RS 4 General options passed to the C header and stub file generator for Java classes\&. .RE .PP \fBJAVAINCLUDES\fR .RS 4 Include path for Java header files (such as jni\&.h)\&. .RE .PP \fBJAVAPROCESSORPATH\fR .RS 4 Specifies the location of the annotation processor class files\&. Can be specified as a string or Node object, or as a list of strings or Node objects\&. .sp The value will be added to the JDK command lines via the \fB\-processorpath\fR option, which requires a system\-specific search path separator\&. This will be supplied by SCons as needed when it constructs the command line if \fB$JAVAPROCESSORPATH\fR is provided in list form\&. If \fB$JAVAPROCESSORPATH\fR is a single string containing search path separator characters (: for POSIX systems or ; for Windows), it will not be modified; and so is inherently system\-specific; to supply the path in a system\-independent manner, give \fB$JAVAPROCESSORPATH\fR as a list of paths instead\&. .sp \fINew in version 4\&.5\&.0\fR .RE .PP \fBJAVASOURCEPATH\fR .RS 4 Specifies the list of directories that will be searched for input (source) \&.java files\&. Can be specified as a string or Node object, or as a list of strings or Node objects\&. .sp The value will be added to the JDK command lines via the \fB\-sourcepath\fR option, which requires a system\-specific search path separator, This will be supplied by SCons as needed when it constructs the command line if \fB$JAVASOURCEPATH\fR is provided in list form\&. If \fB$JAVASOURCEPATH\fR is a single string containing search path separator characters (: for POSIX systems or ; for Windows), it will not be modified, and so is inherently system\-specific; to supply the path in a system\-independent manner, give \fB$JAVASOURCEPATH\fR as a list of paths instead\&. .sp Note that the specified directories are only added to the command line via the \fB\-sourcepath\fR option\&. SCons does not currently search the \fB$JAVASOURCEPATH\fR directories for dependent \&.java files\&. .RE .PP \fBJAVASUFFIX\fR .RS 4 The suffix for Java files; \&.java by default\&. .RE .PP \fBJAVAVERSION\fR .RS 4 Specifies the Java version being used by the \fBJava\fR builder\&. Set this to specify the version of Java targeted by the javac compiler\&. 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 a version greater than 1\&.4 makes SCons realize that a build with such a compiler is actually up\-to\-date\&. The default is 1\&.4\&. .sp While this is \fInot\fR primarily intended for selecting one version of the Java compiler vs\&. another, it does have that effect on the Windows platform\&. A more precise approach is to set \fB$JAVAC\fR (and related construction variables for related utilities) to the path to the specific Java compiler you want, if that is not the default compiler\&. On non\-Windows platforms, the alternatives system may provide a way to adjust the default Java compiler without having to specify explicit paths\&. .RE .PP \fBLATEX\fR .RS 4 The LaTeX structured formatter and typesetter\&. .RE .PP \fBLATEXCOM\fR .RS 4 The command line used to call the LaTeX structured formatter and typesetter\&. .RE .PP \fBLATEXCOMSTR\fR .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 \fBLATEXFLAGS\fR .RS 4 General options passed to the LaTeX structured formatter and typesetter\&. .RE .PP \fBLATEXRETRIES\fR .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 \fBLATEXSUFFIXES\fR .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 \fBLDMODULE\fR .RS 4 The linker for building loadable modules\&. By default, this is the same as \fB$SHLINK\fR\&. .RE .PP \fBLDMODULECOM\fR .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 \fBLDMODULECOMSTR\fR .RS 4 If set, the string displayed when building loadable modules\&. If not set, then \fB$LDMODULECOM\fR (the command line) is displayed\&. .RE .PP \fBLDMODULEEMITTER\fR .RS 4 Contains the emitter specification for the \fBLoadableModule\fR builder\&. The manpage section "Builder Objects" contains general information on specifying emitters\&. .RE .PP \fBLDMODULEFLAGS\fR .RS 4 General user options passed to the linker for building loadable modules\&. .RE .PP \fBLDMODULENOVERSIONSYMLINKS\fR .RS 4 Instructs the \fBLoadableModule\fR builder not to automatically create symlinks for versioned modules\&. Defaults to \fB$SHLIBNOVERSIONSYMLINKS\fR\&. .RE .PP \fBLDMODULEPREFIX\fR .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 \fB_LDMODULESONAME\fR .RS 4 A macro that automatically generates a loadable module\*(Aqs \fB$SONAME\fR based on $TARGET, \fB$LDMODULEVERSION\fR and \fB$LDMODULESUFFIX\fR\&. Used by the \fBLoadableModule\fR builder when the linker tool supports SONAME (e\&.g\&. gnulink)\&. .RE .PP \fBLDMODULESUFFIX\fR .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 \fBLDMODULEVERSION\fR .RS 4 When this construction variable is defined, a versioned loadable module is created by the \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 be specified in the same format as \fB$SHLIBVERSION\fR\&. .RE .PP \fB_LDMODULEVERSIONFLAGS\fR .RS 4 This macro automatically introduces extra flags to \fB$LDMODULECOM\fR when building a versioned \fBLoadableModule\fR (that is, when \fB$LDMODULEVERSION\fR is set)\&. \fB$_LDMODULEVERSIONFLAGS\fR 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 \fBLDMODULEVERSIONFLAGS\fR .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 \fBLEX\fR .RS 4 The lexical analyzer generator\&. .RE .PP \fBLEX_HEADER_FILE\fR .RS 4 If supplied, generate a C header file with the name taken from this variable\&. Will be emitted as a \fB\-\-header\-file=\fR command\-line option\&. Use this in preference to including \fB\-\-header\-file=\fR in \fB$LEXFLAGS\fR directly\&. .RE .PP \fBLEX_TABLES_FILE\fR .RS 4 If supplied, write the lex tables to a file with the name taken from this variable\&. Will be emitted as a \fB\-\-tables\-file=\fR command\-line option\&. Use this in preference to including \fB\-\-tables\-file=\fR in \fB$LEXFLAGS\fR directly\&. .RE .PP \fBLEXCOM\fR .RS 4 The command line used to call the lexical analyzer generator to generate a source file\&. .RE .PP \fBLEXCOMSTR\fR .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 \fBLEXFLAGS\fR .RS 4 General options passed to the lexical analyzer generator\&. In addition to passing the value on during invocation, the lex tool also examines this construction variable for options which cause additional output files to be generated, and adds those to the target list\&. Recognized for this purpose are GNU flex options \fB\-\-header\-file=\fR and \fB\-\-tables\-file=\fR; the output file is named by the option argument\&. .sp Note that files specified by \fB\-\-header\-file=\fR and \fB\-\-tables\-file=\fR may not be properly handled by SCons in all situations\&. Consider using \fB$LEX_HEADER_FILE\fR and \fB$LEX_TABLES_FILE\fR instead\&. .RE .PP \fBLEXUNISTD\fR .RS 4 Used only in Windows environments to set a lex flag to prevent unistd\&.h from being included\&. The default value is \fB\-\-nounistd\fR\&. .RE .PP \fB_LIBDIRFLAGS\fR .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 each directory in \fB$LIBPATH\fR\&. .RE .PP \fBLIBDIRPREFIX\fR .RS 4 The prefix used to specify a library directory on the linker command line\&. This will be prepended to each directory in the \fB$LIBPATH\fR construction variable when the \fB$_LIBDIRFLAGS\fR variable is automatically generated\&. .RE .PP \fBLIBDIRSUFFIX\fR .RS 4 The suffix used to specify a library directory on the linker command line\&. This will be appended to each directory in the \fB$LIBPATH\fR construction variable when the \fB$_LIBDIRFLAGS\fR variable is automatically generated\&. .RE .PP \fBLIBEMITTER\fR .RS 4 Contains the emitter specification for the \fBStaticLibrary\fR builder\&. The manpage section "Builder Objects" contains general information on specifying emitters\&. .RE .PP \fB_LIBFLAGS\fR .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 each filename in \fB$LIBS\fR\&. .RE .PP \fBLIBLINKPREFIX\fR .RS 4 The prefix used to specify a library to link on the linker command line\&. This will be prepended to each library in the \fB$LIBS\fR construction variable when the \fB$_LIBFLAGS\fR variable is automatically generated\&. .RE .PP \fBLIBLINKSUFFIX\fR .RS 4 The suffix used to specify a library to link on the linker command line\&. This will be appended to each library in the \fB$LIBS\fR construction variable when the \fB$_LIBFLAGS\fR variable is automatically generated\&. .RE .PP \fBLIBLITERALPREFIX\fR .RS 4 If the linker supports command line syntax directing that the argument specifying a library should be searched for literally (without modification), \fB$LIBLITERALPREFIX\fR can be set to that indicator\&. For example, the GNU linker follows this rule: \(lq \-l:foo searches the library path for a filename called foo, without converting it to libfoo\&.so or libfoo\&.a\&. \(rq If \fB$LIBLITERALPREFIX\fR is set, SCons will not transform a string\-valued entry in \fB$LIBS\fR that starts with that string\&. The entry will still be surrounded with \fB$LIBLINKPREFIX\fR and \fB$LIBLINKSUFFIX\fR on the command line\&. This is useful, for example, in directing that a static library be used when both a static and dynamic library are available and linker policy is to prefer dynamic libraries\&. Compared to the example in \fB$LIBS\fR, .sp .if n \{\ .RS 4 .\} .nf env\&.Append(LIBS=":libmylib\&.a") .fi .if n \{\ .RE .\} .sp will let the linker select that specific (static) library name if found in the library search path\&. This differs from using a File object to specify the static library, as the latter bypasses the library search path entirely\&. .RE .PP \fBLIBPATH\fR .RS 4 The list of directories that will be searched for libraries specified by the \fB$LIBS\fR construction variable\&. \fB$LIBPATH\fR should be a list of path strings, or a single string, not a pathname list joined by the Python os\&.pathsep character\&. Do not put library search directives directly into \fB$LINKFLAGS\fR or \fB$SHLINKFLAGS\fR as the result will be non\-portable\&. .sp Note: directory names in \fB$LIBPATH\fR will be looked\-up relative to the directory of the SConscript file when they are used in a command\&. To force \fBscons\fR to lookup a directory relative to the root of the source tree, use the # prefix: .sp .if n \{\ .RS 4 .\} .nf env = Environment(LIBPATH=\*(Aq#/libs\*(Aq) .fi .if n \{\ .RE .\} .sp The directory lookup 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 each directory in \fB$LIBPATH\fR\&. Any command lines you define that need the \fB$LIBPATH\fR 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 \fBLIBPREFIX\fR .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 \fBLIBPREFIXES\fR .RS 4 A list of all legal prefixes for library file names on the current platform\&. When searching for library dependencies, SCons will look for files with these prefixes, the base library name, and suffixes from the \fB$LIBSUFFIXES\fR list\&. .RE .PP \fBLIBS\fR .RS 4 The list of libraries that will be added to the link line for linking with any executable program, shared library, or loadable module created by the construction environment or override\&. .sp For portability, a string\-valued library name should include only the base library name, without prefixes such as lib or suffixes such as \&.so or \&.dll\&. SCons \fIwill\fR attempt to strip prefixes from the \fB$LIBPREFIXES\fR list and suffixes from the \fB$LIBSUFFIXES\fR list, but depending on that behavior will make the build less portable: for example, on a POSIX system, no attempt will be made to strip a suffix like \&.dll\&. Library name strings in \fB$LIBS\fR should not include a path component: instead use \fB$LIBPATH\fR to direct the compiler to look for libraries in those paths, plus any default paths the linker searches in\&. If \fB$LIBLITERALPREFIX\fR is set to a non\-empty string, then a string\-valued \fB$LIBS\fR entry that starts with \fB$LIBLITERALPREFIX\fR will cause the rest of the entry to be searched for unmodified, but respecting normal library search paths (this is an exception to the guideline above about leaving off the prefix/suffix from the library name)\&. .sp If a \fB$LIBS\fR entry is a Node object (either as returned by a previous Builder call, or as the result of an explicit call to \fBFile\fR), the pathname from that Node will be added to \fB$_LIBFLAGS\fR, and thus to the link line, unmodified \- without adding \fB$LIBLINKPREFIX\fR or \fB$LIBLINKSUFFIX\fR\&. Such entries are searched for literally (including any path component); the library search paths are not used\&. For example: .sp .if n \{\ .RS 4 .\} .nf env\&.Append(LIBS=File(\*(Aq/tmp/mylib\&.so\*(Aq)) .fi .if n \{\ .RE .\} .sp For each Builder call that causes linking with libraries, SCons will add the libraries in the setting of \fB$LIBS\fR in effect at that moment to the dependency graph as dependencies of the target being generated\&. .sp The library list will be transformed to command\-line arguments 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 each library name\&. .sp Any command lines you define yourself that need the libraries from \fB$LIBS\fR should include \fB$_LIBFLAGS\fR (as well as \fB$_LIBDIRFLAGS\fR) rather than \fB$LIBS\fR\&. For example: .sp .if n \{\ .RS 4 .\} .nf env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS \-o $TARGET $SOURCE") .fi .if n \{\ .RE .\} .RE .PP \fBLIBSUFFIX\fR .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 \fBLIBSUFFIXES\fR .RS 4 A list of all legal suffixes for library file names\&. on the current platform\&. When searching for library dependencies, SCons will look for files with prefixes from the \fB$LIBPREFIXES\fR list, the base library name, and these suffixes\&. .RE .PP \fBLICENSE\fR .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 \m[blue]\fBhttp://www\&.opensource\&.org/licenses/alphabetical\fR\m[]\&\s-2\u[7]\d\s+2 for a list of license names and SPDX codes\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBLINESEPARATOR\fR .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 \fBLINGUAS_FILE\fR .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 the 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 a non\-string truthy value, the list will be read from the file named LINGUAS\&. .RE .PP \fBLINK\fR .RS 4 The linker\&. See also \fB$SHLINK\fR for linking shared objects\&. .sp On POSIX systems (those using the link tool), you should normally not change this value as it defaults to a "smart" linker tool which selects a compiler driver matching the type of source files in use\&. So for example, if you set \fB$CXX\fR to a specific compiler name, and are compiling C++ sources, the smartlink function will automatically select the same compiler for linking\&. .RE .PP \fBLINKCOM\fR .RS 4 The command line used to link object files into an executable\&. See also \fB$SHLINKCOM\fR for linking shared objects\&. .RE .PP \fBLINKCOMSTR\fR .RS 4 If set, the string displayed when object files are linked into an executable\&. If not set, then \fB$LINKCOM\fR (the command line) is displayed\&. See also \fB$SHLINKCOMSTR\fR\&. for linking shared objects\&. .sp .if n \{\ .RS 4 .\} .nf env = Environment(LINKCOMSTR = "Linking $TARGET") .fi .if n \{\ .RE .\} .RE .PP \fBLINKFLAGS\fR .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\&. See also \fB$SHLINKFLAGS\fR\&. for linking shared objects\&. .RE .PP \fBM4\fR .RS 4 The M4 macro preprocessor\&. .RE .PP \fBM4COM\fR .RS 4 The command line used to pass files through the M4 macro preprocessor\&. .RE .PP \fBM4COMSTR\fR .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 \fBM4FLAGS\fR .RS 4 General options passed to the M4 macro preprocessor\&. .RE .PP \fBMAKEINDEX\fR .RS 4 The makeindex generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&. .RE .PP \fBMAKEINDEXCOM\fR .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 \fBMAKEINDEXCOMSTR\fR .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 \fBMAKEINDEXFLAGS\fR .RS 4 General options passed to the makeindex generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter\&. .RE .PP \fBMAXLINELENGTH\fR .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 \fBMIDL\fR .RS 4 The Microsoft IDL compiler\&. .RE .PP \fBMIDLCOM\fR .RS 4 The command line used to pass files to the Microsoft IDL compiler\&. .RE .PP \fBMIDLCOMSTR\fR .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 \fBMIDLFLAGS\fR .RS 4 General options passed to the Microsoft IDL compiler\&. .RE .PP \fBMOSUFFIX\fR .RS 4 Suffix used for MO files (default: \*(Aq\&.mo\*(Aq)\&. See msgfmt tool and \fBMOFiles\fR builder\&. .RE .PP \fBMSGFMT\fR .RS 4 Absolute path to \fBmsgfmt(1)\fR binary, found by \fBDetect()\fR\&. See msgfmt tool and \fBMOFiles\fR builder\&. .RE .PP \fBMSGFMTCOM\fR .RS 4 Complete command line to run \fBmsgfmt(1)\fR program\&. See msgfmt tool and \fBMOFiles\fR builder\&. .RE .PP \fBMSGFMTCOMSTR\fR .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 \fBMSGFMTFLAGS\fR .RS 4 Additional flags to \fBmsgfmt(1)\fR\&. See msgfmt tool and \fBMOFiles\fR builder\&. .RE .PP \fBMSGINIT\fR .RS 4 Path to \fBmsginit(1)\fR program (found via \fBDetect\fR)\&. See msginit tool and \fBPOInit\fR builder\&. .RE .PP \fBMSGINITCOM\fR .RS 4 Complete command line to run \fBmsginit(1)\fR program\&. See msginit tool and \fBPOInit\fR builder\&. .RE .PP \fBMSGINITCOMSTR\fR .RS 4 String to display when \fBmsginit(1)\fR is invoked\&. The default is an empty string, which will print the command line (\fB$MSGINITCOM\fR)\&. See msginit tool and \fBPOInit\fR builder\&. .RE .PP \fBMSGINITFLAGS\fR .RS 4 List of additional flags to \fBmsginit(1)\fR (default: [])\&. See msginit tool and \fBPOInit\fR builder\&. .RE .PP \fB_MSGINITLOCALE\fR .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 \fBMSGMERGE\fR .RS 4 Absolute path to \fBmsgmerge(1)\fR binary as found by \fBDetect()\fR\&. See msgmerge tool and \fBPOUpdate\fR builder\&. .RE .PP \fBMSGMERGECOM\fR .RS 4 Complete command line to run \fBmsgmerge(1)\fR command\&. See msgmerge tool and \fBPOUpdate\fR builder\&. .RE .PP \fBMSGMERGECOMSTR\fR .RS 4 String to be displayed when \fBmsgmerge(1)\fR is invoked\&. The default is an empty string, which will print the command line (\fB$MSGMERGECOM\fR)\&. See msgmerge tool and \fBPOUpdate\fR builder\&. .RE .PP \fBMSGMERGEFLAGS\fR .RS 4 Additional flags to \fBmsgmerge(1)\fR command\&. See msgmerge tool and \fBPOUpdate\fR builder\&. .RE .PP \fBMSSDK_DIR\fR .RS 4 The directory containing the Microsoft SDK (either Platform SDK or Windows SDK) to be used for compilation\&. .RE .PP \fBMSSDK_VERSION\fR .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 \fBMSVC_BATCH\fR .RS 4 When set to any true value, specifies that SCons should batch compilation of object files when calling the Microsoft Visual 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 \fBMSVC_NOTFOUND_POLICY\fR .RS 4 Specify the \fBscons\fR behavior when the Microsoft Visual C++ compiler is not detected\&. .sp The \fB$MSVC_NOTFOUND_POLICY\fR specifies the \fBscons\fR behavior when no msvc versions are detected or when the requested msvc version is not detected\&. .sp The valid values for \fB$MSVC_NOTFOUND_POLICY\fR and the corresponding \fBscons\fR behavior are: .PP \fI\*(AqError\*(Aq or \*(AqException\*(Aq\fR .RS 4 Raise an exception when no msvc versions are detected or when the requested msvc version is not detected\&. .RE .PP \fI\*(AqWarning\*(Aq or \*(AqWarn\*(Aq\fR .RS 4 Issue a warning and continue when no msvc versions are detected or when the requested msvc version is not detected\&. Depending on usage, this could result in build failure(s)\&. .RE .PP \fI\*(AqIgnore\*(Aq or \*(AqSuppress\*(Aq\fR .RS 4 Take no action and continue when no msvc versions are detected or when the requested msvc version is not detected\&. Depending on usage, this could result in build failure(s)\&. .RE .sp Note: in addition to the camel case values shown above, lower case and upper case values are accepted as well\&. .sp The \fB$MSVC_NOTFOUND_POLICY\fR is applied when any of the following conditions are satisfied: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_VERSION\fR is specified, the default tools list is implicitly defined (i\&.e\&., the tools list is not specified), and the default tools list contains one or more of the msvc tools\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_VERSION\fR is specified, the default tools list is explicitly specified (e\&.g\&., tools=[\*(Aqdefault\*(Aq]), and the default tools list contains one or more of the msvc tools\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A non\-default tools list is specified that contains one or more of the msvc tools (e\&.g\&., tools=[\*(Aqmsvc\*(Aq, \*(Aqmslink\*(Aq])\&. .RE .sp The \fB$MSVC_NOTFOUND_POLICY\fR is ignored when any of the following conditions are satisfied: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_VERSION\fR is not specified and the default tools list is implicitly defined (i\&.e\&., the tools list is not specified)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_VERSION\fR is not specified and the default tools list is explicitly specified (e\&.g\&., tools=[\*(Aqdefault\*(Aq])\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A non\-default tool list is specified that does not contain any of the msvc tools (e\&.g\&., tools=[\*(Aqmingw\*(Aq])\&. .RE .sp Important usage details: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_NOTFOUND_POLICY\fR must be passed as an argument to the \fBEnvironment\fR constructor when an msvc tool (e\&.g\&., msvc, msvs, etc\&.) is loaded via the default tools list or via a tools list passed to the \fBEnvironment\fR constructor\&. Otherwise, \fB$MSVC_NOTFOUND_POLICY\fR must be set before the first msvc tool is loaded into the environment\&. .RE .sp When \fB$MSVC_NOTFOUND_POLICY\fR is not specified, the default \fBscons\fR behavior is to issue a warning and continue subject to the conditions listed above\&. The default \fBscons\fR behavior may change in the future\&. .sp \fINew in version 4\&.4\fR .RE .PP \fBMSVC_SCRIPT_ARGS\fR .RS 4 Pass user\-defined arguments to the Microsoft Visual C++ batch file determined via autodetection\&. .sp \fB$MSVC_SCRIPT_ARGS\fR is available for msvc batch file arguments that do not have first\-class support via construction variables or when there is an issue with the appropriate construction variable validation\&. When available, it is recommended to use the appropriate construction variables (e\&.g\&., \fB$MSVC_TOOLSET_VERSION\fR) rather than \fB$MSVC_SCRIPT_ARGS\fR arguments\&. .sp The valid values for \fB$MSVC_SCRIPT_ARGS\fR are: None, a string, or a list of strings\&. .sp The \fB$MSVC_SCRIPT_ARGS\fR value is converted to a scalar string (i\&.e\&., "flattened")\&. The resulting scalar string, if not empty, is passed as an argument to the msvc batch file determined via autodetection subject to the validation conditions listed below\&. .sp \fB$MSVC_SCRIPT_ARGS\fR is ignored when the value is None and when the result from argument conversion is an empty string\&. The validation conditions below do not apply\&. .sp An exception is raised when any of the following conditions are satisfied: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SCRIPT_ARGS\fR is specified for Visual Studio 2013 and earlier\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Multiple SDK version arguments (e\&.g\&., \*(Aq10\&.0\&.20348\&.0\*(Aq) are specified in \fB$MSVC_SCRIPT_ARGS\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SDK_VERSION\fR is specified and an SDK version argument (e\&.g\&., \*(Aq10\&.0\&.20348\&.0\*(Aq) is specified in \fB$MSVC_SCRIPT_ARGS\fR\&. Multiple SDK version declarations via \fB$MSVC_SDK_VERSION\fR and \fB$MSVC_SCRIPT_ARGS\fR are not allowed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Multiple toolset version arguments (e\&.g\&., \*(Aq\-vcvars_ver=14\&.29\*(Aq) are specified in \fB$MSVC_SCRIPT_ARGS\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_TOOLSET_VERSION\fR is specified and a toolset version argument (e\&.g\&., \*(Aq\-vcvars_ver=14\&.29\*(Aq) is specified in \fB$MSVC_SCRIPT_ARGS\fR\&. Multiple toolset version declarations via \fB$MSVC_TOOLSET_VERSION\fR and \fB$MSVC_SCRIPT_ARGS\fR are not allowed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Multiple spectre library arguments (e\&.g\&., \*(Aq\-vcvars_spectre_libs=spectre\*(Aq) are specified in \fB$MSVC_SCRIPT_ARGS\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SPECTRE_LIBS\fR is enabled and a spectre library argument (e\&.g\&., \*(Aq\-vcvars_spectre_libs=spectre\*(Aq) is specified in \fB$MSVC_SCRIPT_ARGS\fR\&. Multiple spectre library declarations via \fB$MSVC_SPECTRE_LIBS\fR and \fB$MSVC_SCRIPT_ARGS\fR are not allowed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Multiple UWP arguments (e\&.g\&., uwp or store) are specified in \fB$MSVC_SCRIPT_ARGS\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_UWP_APP\fR is enabled and a UWP argument (e\&.g\&., uwp or store) is specified in \fB$MSVC_SCRIPT_ARGS\fR\&. Multiple UWP declarations via \fB$MSVC_UWP_APP\fR and \fB$MSVC_SCRIPT_ARGS\fR are not allowed\&. .RE .sp Example 1 \- A Visual Studio 2022 build with an SDK version and a toolset version specified with a string argument: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_SCRIPT_ARGS=\*(Aq10\&.0\&.20348\&.0 \-vcvars_ver=14\&.29\&.30133\*(Aq) .fi .if n \{\ .RE .\} .sp Example 2 \- A Visual Studio 2022 build with an SDK version and a toolset version specified with a list argument: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_SCRIPT_ARGS=[\*(Aq10\&.0\&.20348\&.0\*(Aq, \*(Aq\-vcvars_ver=14\&.29\&.30133\*(Aq]) .fi .if n \{\ .RE .\} .sp Important usage details: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SCRIPT_ARGS\fR must be passed as an argument to the \fBEnvironment\fR constructor when an msvc tool (e\&.g\&., msvc, msvs, etc\&.) is loaded via the default tools list or via a tools list passed to the \fBEnvironment\fR constructor\&. Otherwise, \fB$MSVC_SCRIPT_ARGS\fR must be set before the first msvc tool is loaded into the environment\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Other than checking for multiple declarations as described above, \fB$MSVC_SCRIPT_ARGS\fR arguments are not validated\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI Erroneous, inconsistent, and/or version incompatible \fR\fI\fB$MSVC_SCRIPT_ARGS\fR\fR\fI arguments are likely to result in build failures for reasons that are not readily apparent and may be difficult to diagnose\&. \fR The burden is on the user to ensure that the arguments provided to the msvc batch file are valid, consistent and compatible with the version of msvc selected\&. .RE .sp \fINew in version 4\&.4\fR .RE .PP \fBMSVC_SCRIPTERROR_POLICY\fR .RS 4 Specify the \fBscons\fR behavior when Microsoft Visual C++ batch file errors are detected\&. .sp The \fB$MSVC_SCRIPTERROR_POLICY\fR specifies the \fBscons\fR behavior when msvc batch file errors are detected\&. When \fB$MSVC_SCRIPTERROR_POLICY\fR is not specified, the default \fBscons\fR behavior is to suppress msvc batch file error messages\&. .sp The root cause of msvc build failures may be difficult to diagnose\&. In these situations, setting the \fBscons\fR behavior to issue a warning when msvc batch file errors are detected \fImay\fR produce additional diagnostic information\&. .sp The valid values for \fB$MSVC_SCRIPTERROR_POLICY\fR and the corresponding \fBscons\fR behavior are: .PP \fI\*(AqError\*(Aq or \*(AqException\*(Aq\fR .RS 4 Raise an exception when msvc batch file errors are detected\&. .RE .PP \fI\*(AqWarning\*(Aq or \*(AqWarn\*(Aq\fR .RS 4 Issue a warning when msvc batch file errors are detected\&. .RE .PP \fI\*(AqIgnore\*(Aq or \*(AqSuppress\*(Aq\fR .RS 4 Suppress msvc batch file error messages\&. .sp \fINew in version 4\&.4\fR .RE .sp Note: in addition to the camel case values shown above, lower case and upper case values are accepted as well\&. .sp Example 1 \- A Visual Studio 2022 build with user\-defined script arguments: .sp .if n \{\ .RS 4 .\} .nf env = environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_SCRIPT_ARGS=[\*(Aq8\&.1\*(Aq, \*(Aqstore\*(Aq, \*(Aq\-vcvars_ver=14\&.1\*(Aq]) env\&.Program(\*(Aqhello\*(Aq, [\*(Aqhello\&.c\*(Aq], CCFLAGS=\*(Aq/MD\*(Aq, LIBS=[\*(Aqkernel32\*(Aq, \*(Aquser32\*(Aq, \*(Aqruntimeobject\*(Aq]) .fi .if n \{\ .RE .\} .sp Example 1 \- Output fragment: .sp .if n \{\ .RS 4 .\} .nf \&.\&.\&. link /nologo /OUT:_build001\ehello\&.exe kernel32\&.lib user32\&.lib runtimeobject\&.lib _build001\ehello\&.obj LINK : fatal error LNK1104: cannot open file \*(AqMSVCRT\&.lib\*(Aq \&.\&.\&. .fi .if n \{\ .RE .\} .sp Example 2 \- A Visual Studio 2022 build with user\-defined script arguments and the script error policy set to issue a warning when msvc batch file errors are detected: .sp .if n \{\ .RS 4 .\} .nf env = environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_SCRIPT_ARGS=[\*(Aq8\&.1\*(Aq, \*(Aqstore\*(Aq, \*(Aq\-vcvars_ver=14\&.1\*(Aq], MSVC_SCRIPTERROR_POLICY=\*(Aqwarn\*(Aq) env\&.Program(\*(Aqhello\*(Aq, [\*(Aqhello\&.c\*(Aq], CCFLAGS=\*(Aq/MD\*(Aq, LIBS=[\*(Aqkernel32\*(Aq, \*(Aquser32\*(Aq, \*(Aqruntimeobject\*(Aq]) .fi .if n \{\ .RE .\} .sp Example 2 \- Output fragment: .sp .if n \{\ .RS 4 .\} .nf \&.\&.\&. scons: warning: vc script errors detected: [ERROR:vcvars\&.bat] The UWP Application Platform requires a Windows 10 SDK\&. [ERROR:vcvars\&.bat] WindowsSdkDir = "C:\eProgram Files (x86)\eWindows Kits\e8\&.1\e" [ERROR:vcvars\&.bat] host/target architecture is not supported : { x64 , x64 } \&.\&.\&. link /nologo /OUT:_build001\ehello\&.exe kernel32\&.lib user32\&.lib runtimeobject\&.lib _build001\ehello\&.obj LINK : fatal error LNK1104: cannot open file \*(AqMSVCRT\&.lib\*(Aq .fi .if n \{\ .RE .\} .sp Important usage details: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SCRIPTERROR_POLICY\fR must be passed as an argument to the \fBEnvironment\fR constructor when an msvc tool (e\&.g\&., msvc, msvs, etc\&.) is loaded via the default tools list or via a tools list passed to the \fBEnvironment\fR constructor\&. Otherwise, \fB$MSVC_SCRIPTERROR_POLICY\fR must be set before the first msvc tool is loaded into the environment\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Due to \fBscons\fR implementation details, not all Windows system environment variables are propagated to the environment in which the msvc batch file is executed\&. Depending on Visual Studio version and installation options, non\-fatal msvc batch file error messages may be generated for ancillary tools which may not affect builds with the msvc compiler\&. For this reason, caution is recommended when setting the script error policy to raise an exception (e\&.g\&., \*(AqError\*(Aq)\&. .RE .sp \fINew in version 4\&.4\fR .RE .PP \fBMSVC_SDK_VERSION\fR .RS 4 Build with a specific version of the Microsoft Software Development Kit (SDK)\&. .sp The valid values for \fB$MSVC_SDK_VERSION\fR are: None or a string containing the requested SDK version (e\&.g\&., \*(Aq10\&.0\&.20348\&.0\*(Aq)\&. .sp \fB$MSVC_SDK_VERSION\fR is ignored when the value is None and when the value is an empty string\&. The validation conditions below do not apply\&. .sp An exception is raised when any of the following conditions are satisfied: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SDK_VERSION\fR is specified for Visual Studio 2013 and earlier\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SDK_VERSION\fR is specified and an SDK version argument is specified in \fB$MSVC_SCRIPT_ARGS\fR\&. Multiple SDK version declarations via \fB$MSVC_SDK_VERSION\fR and \fB$MSVC_SCRIPT_ARGS\fR are not allowed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The \fB$MSVC_SDK_VERSION\fR specified does not match any of the supported formats: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(Aq10\&.0\&.XXXXX\&.Y\*(Aq [SDK 10\&.0] .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(Aq8\&.1\*(Aq [SDK 8\&.1] .RE .sp .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The system folder for the corresponding \fB$MSVC_SDK_VERSION\fR version is not found\&. The requested SDK version does not appear to be installed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The \fB$MSVC_SDK_VERSION\fR version does not appear to support the requested platform type (i\&.e\&., UWP or Desktop)\&. The requested SDK version platform type components do not appear to be installed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The \fB$MSVC_SDK_VERSION\fR version is 8\&.1, the platform type is UWP, and the build tools selected are from Visual Studio 2017 and later (i\&.e\&., \fB$MSVC_VERSION\fR must be \*(Aq14\&.0\*(Aq or \fB$MSVC_TOOLSET_VERSION\fR must be \*(Aq14\&.0\*(Aq)\&. .RE .sp Example 1 \- A Visual Studio 2022 build with a specific Windows SDK version: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_SDK_VERSION=\*(Aq10\&.0\&.20348\&.0\*(Aq) .fi .if n \{\ .RE .\} .sp Example 2 \- A Visual Studio 2022 build with a specific SDK version for the Universal Windows Platform: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_SDK_VERSION=\*(Aq10\&.0\&.20348\&.0\*(Aq, MSVC_UWP_APP=True) .fi .if n \{\ .RE .\} .sp Important usage details: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SDK_VERSION\fR must be passed as an argument to the \fBEnvironment\fR constructor when an msvc tool (e\&.g\&., msvc, msvs, etc\&.) is loaded via the default tools list or via a tools list passed to the \fBEnvironment\fR constructor\&. Otherwise, \fB$MSVC_SDK_VERSION\fR must be set before the first msvc tool is loaded into the environment\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI Should a SDK 10\&.0 version be installed that does not follow the naming scheme above, the SDK version will need to be specified via \fR\fI\fB$MSVC_SCRIPT_ARGS\fR\fR\fI until the version number validation format can be extended\&. \fR .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Should an exception be raised indicating that the SDK version is not found, verify that the requested SDK version is installed with the necessary platform type components\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} There is a known issue with the Microsoft libraries when the target architecture is ARM64 and a Windows 11 SDK (version \*(Aq10\&.0\&.22000\&.0\*(Aq and later) is used with the v141 build tools and older v142 toolsets (versions \*(Aq14\&.28\&.29333\*(Aq and earlier)\&. Should build failures arise with these combinations of settings due to unresolved symbols in the Microsoft libraries, \fB$MSVC_SDK_VERSION\fR may be employed to specify a Windows 10 SDK (e\&.g\&., \*(Aq10\&.0\&.20348\&.0\*(Aq) for the build\&. .RE .sp \fINew in version 4\&.4\fR .RE .PP \fBMSVC_SPECTRE_LIBS\fR .RS 4 Build with the spectre\-mitigated Microsoft Visual C++ libraries\&. .sp The valid values for \fB$MSVC_SPECTRE_LIBS\fR are: True, False, or None\&. .sp When \fB$MSVC_SPECTRE_LIBS\fR is enabled (i\&.e\&., True), the Microsoft Visual C++ environment will include the paths to the spectre\-mitigated implementations of the Microsoft Visual C++ libraries\&. .sp An exception is raised when any of the following conditions are satisfied: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SPECTRE_LIBS\fR is enabled for Visual Studio 2015 and earlier\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SPECTRE_LIBS\fR is enabled and a spectre library argument is specified in \fB$MSVC_SCRIPT_ARGS\fR\&. Multiple spectre library declarations via \fB$MSVC_SPECTRE_LIBS\fR and \fB$MSVC_SCRIPT_ARGS\fR are not allowed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SPECTRE_LIBS\fR is enabled and the platform type is UWP\&. There are no spectre\-mitigated libraries for Universal Windows Platform (UWP) applications or components\&. .RE .sp Example \- A Visual Studio 2022 build with spectre mitigated Microsoft Visual C++ libraries: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_SPECTRE_LIBS=True) .fi .if n \{\ .RE .\} .sp Important usage details: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_SPECTRE_LIBS\fR must be passed as an argument to the \fBEnvironment\fR constructor when an msvc tool (e\&.g\&., msvc, msvs, etc\&.) is loaded via the default tools list or via a tools list passed to the \fBEnvironment\fR constructor\&. Otherwise, \fB$MSVC_SPECTRE_LIBS\fR must be set before the first msvc tool is loaded into the environment\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Additional compiler switches (e\&.g\&., /Qspectre) are necessary for including spectre mitigations when building user artifacts\&. Refer to the Visual Studio documentation for details\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI The existence of the spectre libraries host architecture and target architecture folders are not verified when \fR\fI\fB$MSVC_SPECTRE_LIBS\fR\fR\fI is enabled which could result in build failures\&. \fR The burden is on the user to ensure the requisite libraries with spectre mitigations are installed\&. .RE .sp \fINew in version 4\&.4\fR .RE .PP \fBMSVC_TOOLSET_VERSION\fR .RS 4 Build with a specific Microsoft Visual C++ toolset version\&. .sp \fI Specifying \fR\fI\fB$MSVC_TOOLSET_VERSION\fR\fR\fI does not affect the autodetection and selection of msvc instances\&. The \fR\fI\fB$MSVC_TOOLSET_VERSION\fR\fR\fI is applied \fR\fI\fIafter\fR\fR\fI an msvc instance is selected\&. This could be the default version of msvc if \fR\fI\fB$MSVC_VERSION\fR\fR\fI is not specified\&. \fR .sp The valid values for \fB$MSVC_TOOLSET_VERSION\fR are: None or a string containing the requested toolset version (e\&.g\&., \*(Aq14\&.29\*(Aq)\&. .sp \fB$MSVC_TOOLSET_VERSION\fR is ignored when the value is None and when the value is an empty string\&. The validation conditions below do not apply\&. .sp An exception is raised when any of the following conditions are satisfied: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_TOOLSET_VERSION\fR is specified for Visual Studio 2015 and earlier\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_TOOLSET_VERSION\fR is specified and a toolset version argument is specified in \fB$MSVC_SCRIPT_ARGS\fR\&. Multiple toolset version declarations via \fB$MSVC_TOOLSET_VERSION\fR and \fB$MSVC_SCRIPT_ARGS\fR are not allowed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The \fB$MSVC_TOOLSET_VERSION\fR specified does not match any of the supported formats: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(AqXX\&.Y\*(Aq .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(AqXX\&.YY\*(Aq .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(AqXX\&.YY\&.ZZZZZ\*(Aq .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(AqXX\&.YY\&.Z\*(Aq to \*(AqXX\&.YY\&.ZZZZ\*(Aq \fI [\fR\fI\fBscons\fR\fR\fI extension not directly supported by the msvc batch files and may be removed in the future] \fR .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(AqXX\&.YY\&.ZZ\&.N\*(Aq [SxS format] .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(AqXX\&.YY\&.ZZ\&.NN\*(Aq [SxS format] .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The major msvc version prefix (i\&.e\&., \*(AqXX\&.Y\*(Aq) of the \fB$MSVC_TOOLSET_VERSION\fR specified is for Visual Studio 2013 and earlier (e\&.g\&., \*(Aq12\&.0\*(Aq)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The major msvc version prefix (i\&.e\&., \*(AqXX\&.Y\*(Aq) of the \fB$MSVC_TOOLSET_VERSION\fR specified is greater than the msvc version selected (e\&.g\&., \*(Aq99\&.0\*(Aq)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A system folder for the corresponding \fB$MSVC_TOOLSET_VERSION\fR version is not found\&. The requested toolset version does not appear to be installed\&. .RE .sp Toolset selection details: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} When \fB$MSVC_TOOLSET_VERSION\fR is not an SxS version number or a full toolset version number: the first toolset version, ranked in descending order, that matches the \fB$MSVC_TOOLSET_VERSION\fR prefix is selected\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} When \fB$MSVC_TOOLSET_VERSION\fR is specified using the major msvc version prefix (i\&.e\&., \*(AqXX\&.Y\*(Aq) and the major msvc version is that of the latest release of Visual Studio, the selected toolset version may not be the same as the default Microsoft Visual C++ toolset version\&. .sp In the latest release of Visual Studio, the default Microsoft Visual C++ toolset version is not necessarily the toolset with the largest version number\&. .RE .sp Example 1 \- A default Visual Studio build with a partial toolset version specified: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_TOOLSET_VERSION=\*(Aq14\&.2\*(Aq) .fi .if n \{\ .RE .\} .sp Example 2 \- A default Visual Studio build with a partial toolset version specified: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_TOOLSET_VERSION=\*(Aq14\&.29\*(Aq) .fi .if n \{\ .RE .\} .sp Example 3 \- A Visual Studio 2022 build with a full toolset version specified: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_TOOLSET_VERSION=\*(Aq14\&.29\&.30133\*(Aq) .fi .if n \{\ .RE .\} .sp Example 4 \- A Visual Studio 2022 build with an SxS toolset version specified: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_TOOLSET_VERSION=\*(Aq14\&.29\&.16\&.11\*(Aq) .fi .if n \{\ .RE .\} .sp Important usage details: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_TOOLSET_VERSION\fR must be passed as an argument to the \fBEnvironment\fR constructor when an msvc tool (e\&.g\&., msvc, msvs, etc\&.) is loaded via the default tools list or via a tools list passed to the \fBEnvironment\fR constructor\&. Otherwise, \fB$MSVC_TOOLSET_VERSION\fR must be set before the first msvc tool is loaded into the environment\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI The existence of the toolset host architecture and target architecture folders are not verified when \fR\fI\fB$MSVC_TOOLSET_VERSION\fR\fR\fI is specified which could result in build failures\&. \fR The burden is on the user to ensure the requisite toolset target architecture build tools are installed\&. .RE .sp \fINew in version 4\&.4\fR .RE .PP \fBMSVC_USE_SCRIPT\fR .RS 4 Use a batch script to set up the Microsoft Visual C++ compiler\&. .sp If set to the name of a Visual Studio \&.bat file (e\&.g\&. vcvars\&.bat), SCons will run that batch file instead of the auto\-detected one, and extract the relevant variables from the result (typically \fB%INCLUDE%\fR, \fB%LIB%\fR, and \fB%PATH%\fR) for supplying to the build\&. This can be useful to force the use of a compiler version that SCons does not detect\&. \fB$MSVC_USE_SCRIPT_ARGS\fR provides arguments passed to this script\&. .sp Setting \fB$MSVC_USE_SCRIPT\fR to \fBNone\fR bypasses the Visual Studio autodetection entirely; use this if you are running SCons in a Visual Studio \fBcmd\fR window and importing the shell\*(Aqs environment variables \- that is, if you are sure everything is set correctly already and you don\*(Aqt want SCons to change anything\&. .sp \fB$MSVC_USE_SCRIPT\fR ignores \fB$MSVC_VERSION\fR and \fB$TARGET_ARCH\fR\&. .sp \fIChanged in version 4\&.4:\fR new \fB$MSVC_USE_SCRIPT_ARGS\fR provides a way to pass arguments\&. .RE .PP \fBMSVC_USE_SCRIPT_ARGS\fR .RS 4 Provides arguments passed to the script \fB$MSVC_USE_SCRIPT\fR\&. .sp \fINew in version 4\&.4\fR .RE .PP \fBMSVC_USE_SETTINGS\fR .RS 4 Use a dictionary to set up the Microsoft Visual C++ compiler\&. .sp \fB$MSVC_USE_SETTINGS\fR is ignored when \fB$MSVC_USE_SCRIPT\fR is defined and/or when \fB$MSVC_USE_SETTINGS\fR is set to \fBNone\fR\&. .sp The dictionary is used to populate the environment with the relevant variables (typically \fB%INCLUDE%\fR, \fB%LIB%\fR, and \fB%PATH%\fR) for supplying to the build\&. This can be useful to force the use of a compiler environment that SCons does not configure correctly\&. This is an alternative to manually configuring the environment when bypassing Visual Studio autodetection entirely by setting \fB$MSVC_USE_SCRIPT\fR to \fBNone\fR\&. .sp Here is an example of configuring a build environment using the Microsoft Visual C++ compiler included in the Microsoft SDK on a 64\-bit host and building for a 64\-bit architecture: .sp .if n \{\ .RS 4 .\} .nf # Microsoft SDK 6\&.0 (MSVC 8\&.0): 64\-bit host and 64\-bit target msvc_use_settings = { "PATH": [ "C:\e\eProgram Files\e\eMicrosoft SDKs\e\eWindows\e\ev6\&.0\e\eVC\e\eBin\e\ex64", "C:\e\eProgram Files\e\eMicrosoft SDKs\e\eWindows\e\ev6\&.0\e\eBin\e\ex64", "C:\e\eProgram Files\e\eMicrosoft SDKs\e\eWindows\e\ev6\&.0\e\eBin", "C:\e\eWindows\e\eMicrosoft\&.NET\e\eFramework\e\ev2\&.0\&.50727", "C:\e\eWindows\e\esystem32", "C:\e\eWindows", "C:\e\eWindows\e\eSystem32\e\eWbem", "C:\e\eWindows\e\eSystem32\e\eWindowsPowerShell\e\ev1\&.0\e\e" ], "INCLUDE": [ "C:\e\eProgram Files\e\eMicrosoft SDKs\e\eWindows\e\ev6\&.0\e\eVC\e\eInclude", "C:\e\eProgram Files\e\eMicrosoft SDKs\e\eWindows\e\ev6\&.0\e\eVC\e\eInclude\e\eSys", "C:\e\eProgram Files\e\eMicrosoft SDKs\e\eWindows\e\ev6\&.0\e\eInclude", "C:\e\eProgram Files\e\eMicrosoft SDKs\e\eWindows\e\ev6\&.0\e\eInclude\e\egl", ], "LIB": [ "C:\e\eProgram Files\e\eMicrosoft SDKs\e\eWindows\e\ev6\&.0\e\eVC\e\eLib\e\ex64", "C:\e\eProgram Files\e\eMicrosoft SDKs\e\eWindows\e\ev6\&.0\e\eLib\e\ex64", ], "LIBPATH": [], "VSCMD_ARG_app_plat": [], "VCINSTALLDIR": [], "VCToolsInstallDir": [] } # Specifying MSVC_VERSION is recommended env = Environment(MSVC_VERSION=\*(Aq8\&.0\*(Aq, MSVC_USE_SETTINGS=msvc_use_settings) .fi .if n \{\ .RE .\} .sp Important usage details: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_USE_SETTINGS\fR must be passed as an argument to the \fBEnvironment\fR constructor when an msvc tool (e\&.g\&., msvc, msvs, etc\&.) is loaded via the default tools list or via a tools list passed to the \fBEnvironment\fR constructor\&. Otherwise, \fB$MSVC_USE_SETTINGS\fR must be set before the first msvc tool is loaded into the environment\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI The dictionary content requirements are based on the internal msvc implementation and therefore may change at any time\&. \fR The burden is on the user to ensure the dictionary contents are minimally sufficient to ensure successful builds\&. .RE .sp \fINew in version 4\&.4\fR .RE .PP \fBMSVC_UWP_APP\fR .RS 4 Build with the Universal Windows Platform (UWP) application Microsoft Visual C++ libraries\&. .sp The valid values for \fB$MSVC_UWP_APP\fR are: True, \*(Aq1\*(Aq, False, \*(Aq0\*(Aq, or None\&. .sp When \fB$MSVC_UWP_APP\fR is enabled (i\&.e\&., True or \*(Aq1\*(Aq), the Microsoft Visual C++ environment will be set up to point to the Windows Store compatible libraries and Microsoft Visual C++ 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\&. .sp An exception is raised when any of the following conditions are satisfied: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_UWP_APP\fR is enabled for Visual Studio 2013 and earlier\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_UWP_APP\fR is enabled and a UWP argument is specified in \fB$MSVC_SCRIPT_ARGS\fR\&. Multiple UWP declarations via \fB$MSVC_UWP_APP\fR and \fB$MSVC_SCRIPT_ARGS\fR are not allowed\&. .RE .sp Example \- A Visual Studio 2022 build for the Universal Windows Platform: .sp .if n \{\ .RS 4 .\} .nf env = Environment(MSVC_VERSION=\*(Aq14\&.3\*(Aq, MSVC_UWP_APP=True) .fi .if n \{\ .RE .\} .sp Important usage details: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$MSVC_UWP_APP\fR must be passed as an argument to the \fBEnvironment\fR constructor when an msvc tool (e\&.g\&., msvc, msvs, etc\&.) is loaded via the default tools list or via a tools list passed to the \fBEnvironment\fR constructor\&. Otherwise, \fB$MSVC_UWP_APP\fR must be set before the first msvc tool is loaded into the environment\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI The existence of the UWP libraries is not verified when \fR\fI\fB$MSVC_UWP_APP\fR\fR\fI is enabled which could result in build failures\&. \fR The burden is on the user to ensure the requisite UWP libraries are installed\&. .RE .sp .RE .PP \fBMSVC_VERSION\fR .RS 4 A string to select the preferred version of Microsoft Visual C++\&. If the specified version is unavailable and/or unknown to SCons, a warning is issued showing the versions actually discovered, and the build will eventually fail indicating a missing compiler binary\&. If \fB$MSVC_VERSION\fR is not set, SCons will (by default) select the latest version of Microsoft Visual C++ installed on your system (excluding any preview versions)\&. .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 order to take effect, \fB$MSVC_VERSION\fR must be set before the initial Microsoft Visual C++ compiler discovery takes place\&. Discovery happens, at the latest, during the first call to the \fBEnvironment\fR function, unless a \fItools\fR list is specified which excludes the entire Microsoft Visual C++ toolchain \- that is, omits "defaults" and any specific tool module that refers to parts of the toolchain (msvc, mslink, masm, midl and msvs)\&. In this case, detection is deferred until any one of those tool modules is invoked manually\&. The following two examples illustrate this: .sp .if n \{\ .RS 4 .\} .nf # MSVC_VERSION set as Environment is created env = Environment(MSVC_VERSION=\*(Aq14\&.2\*(Aq) # Initialization deferred with empty tools, triggered manually env = Environment(tools=[]) env[\*(AqMSVC_VERSION\*(Aq] = \*(Aq14\&.2 env\&.Tool(\*(Aqmsvc\*(Aq) env\&.Tool(\*(Aqmslink\*(Aq) env\&.Tool(\*(Aqmsvs\*(Aq) .fi .if n \{\ .RE .\} .sp .5v .RE The valid values for \fB$MSVC_VERSION\fR represent major versions of the compiler, except that versions ending in Exp refer to "Express" or "Express for Desktop" Visual Studio editions\&. Values that do not look like a valid compiler version \fIstring\fR are not supported\&. .sp The following table shows the correspondence of \fB$MSVC_VERSION\fR values to various version indicators (\*(Aqx\*(Aq is used as a placeholder for a single digit that can vary)\&. .TS allbox tab(:); lB cB cB lB cB. T{ SCons Key T}:T{ .if n \{\ .RS 4 .\} .nf Visual C++ Version .fi .if n \{\ .RE .\} T}:T{ _MSVC_VER T}:T{ Visual Studio Product T}:T{ .if n \{\ .RS 4 .\} .nf MSBuild / Visual Studio .fi .if n \{\ .RE .\} T} .T& l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c l c c l c. T{ "14\&.5" T}:T{ 14\&.5x T}:T{ 195x T}:T{ Visual Studio 2026 T}:T{ 18\&.x T} T{ "14\&.3" T}:T{ 14\&.3x T}:T{ 193x T}:T{ Visual Studio 2022 T}:T{ 17\&.x, 17\&.1x T} T{ "14\&.2" T}:T{ 14\&.2x T}:T{ 192x T}:T{ Visual Studio 2019 T}:T{ 16\&.x, 16\&.1x T} T{ "14\&.1" T}:T{ 14\&.1 or 14\&.1x T}:T{ 191x T}:T{ Visual Studio 2017 T}:T{ 15\&.x T} T{ "14\&.1Exp" T}:T{ 14\&.1 or 14\&.1x T}:T{ 191x T}:T{ Visual Studio 2017 Express T}:T{ 15\&.x T} T{ "14\&.0" T}:T{ 14\&.0 T}:T{ 1900 T}:T{ Visual Studio 2015 T}:T{ 14\&.0 T} T{ "14\&.0Exp" T}:T{ 14\&.0 T}:T{ 1900 T}:T{ Visual Studio 2015 Express T}:T{ 14\&.0 T} T{ "12\&.0" T}:T{ 12\&.0 T}:T{ 1800 T}:T{ Visual Studio 2013 T}:T{ 12\&.0 T} T{ "12\&.0Exp" T}:T{ 12\&.0 T}:T{ 1800 T}:T{ Visual Studio 2013 Express T}:T{ 12\&.0 T} T{ "11\&.0" T}:T{ 11\&.0 T}:T{ 1700 T}:T{ Visual Studio 2012 T}:T{ 11\&.0 T} T{ "11\&.0Exp" T}:T{ 11\&.0 T}:T{ 1700 T}:T{ Visual Studio 2012 Express T}:T{ 11\&.0 T} T{ "10\&.0" T}:T{ 10\&.0 T}:T{ 1600 T}:T{ Visual Studio 2010 T}:T{ 10\&.0 T} T{ "10\&.0Exp" T}:T{ 10\&.0 T}:T{ 1600 T}:T{ Visual C++ Express 2010 T}:T{ 10\&.0 T} T{ "9\&.0" T}:T{ 9\&.0 T}:T{ 1500 T}:T{ Visual Studio 2008 T}:T{ 9\&.0 T} T{ "9\&.0Exp" T}:T{ 9\&.0 T}:T{ 1500 T}:T{ Visual C++ Express 2008 T}:T{ 9\&.0 T} T{ "8\&.0" T}:T{ 8\&.0 T}:T{ 1400 T}:T{ Visual Studio 2005 T}:T{ 8\&.0 T} T{ "8\&.0Exp" T}:T{ 8\&.0 T}:T{ 1400 T}:T{ Visual C++ Express 2005 T}:T{ 8\&.0 T} T{ "7\&.1" T}:T{ 7\&.1 T}:T{ 1300 T}:T{ Visual Studio \&.NET 2003 T}:T{ 7\&.1 T} T{ "7\&.0" T}:T{ 7\&.0 T}:T{ 1200 T}:T{ Visual Studio \&.NET 2002 T}:T{ 7\&.0 T} T{ "6\&.0" T}:T{ 6\&.0 T}:T{ 1100 T}:T{ Visual Studio 6\&.0 T}:T{ 6\&.0 T} .TE .sp 1 .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 .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} It is not necessary to install a Visual Studio IDE to build with SCons (for example, you can install only Build Tools), but when a Visual Studio IDE is installed, additional builders such as \fBMSVSSolution\fR and \fBMSVSProject\fR become available and correspond to the specified versions\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Versions ending in Exp refer to historical "Express" or "Express for Desktop" Visual Studio editions, which had feature limitations compared to the full editions\&. It is only necessary to specify the Exp suffix to select the express edition when both express and non\-express editions of the same product are installed simultaneously\&. The Exp suffix is unnecessary, but accepted, when only the express edition is installed\&. .RE .sp .5v .RE The compilation environment can be further or more precisely specified through the use of several other construction variables: see the descriptions of \fB$MSVC_TOOLSET_VERSION\fR, \fB$MSVC_SDK_VERSION\fR, \fB$MSVC_USE_SCRIPT\fR, \fB$MSVC_USE_SCRIPT_ARGS\fR, and \fB$MSVC_USE_SETTINGS\fR\&. .RE .PP \fBMSVS\fR .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$MSVC_VERSION\fR) .RE .PP VERSIONS .RS 4 the available versions of MSVS installed .RE .PP VCINSTALLDIR .RS 4 installed directory of Microsoft 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\&. Visual Studio 2017 and later do not use the registry for primary storage of this information, so typically for these versions only PROJECTSUFFIX and SOLUTIONSUFFIX will be set\&. .RE .PP \fBMSVS_ARCH\fR .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 \fBMSVS_PROJECT_GUID\fR .RS 4 The string placed in a generated Microsoft Visual C++ project file as the value of the ProjectGUID attribute\&. There is no default value\&. If not defined, a new GUID is generated\&. .RE .PP \fBMSVS_SCC_AUX_PATH\fR .RS 4 The path name placed in a generated Microsoft Visual C++ 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 \fBMSVS_SCC_CONNECTION_ROOT\fR .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 C++ 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 \fBMSVS_SCC_PROJECT_NAME\fR .RS 4 The project name placed in a generated Microsoft Visual C++ 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 \fBMSVS_SCC_PROVIDER\fR .RS 4 The string placed in a generated Microsoft Visual C++ 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 \fBMSVS_VERSION\fR .RS 4 Set 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 \fB$MSVS_VERSION\fR variable when initializing the Environment, 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 \fIDeprecated since 1\&.3\&.0:\fR \fB$MSVS_VERSION\fR is deprecated in favor of \fB$MSVC_VERSION\fR\&. As a transitional aid, if \fB$MSVS_VERSION\fR is set and \fB$MSVC_VERSION\fR is not, \fB$MSVC_VERSION\fR will be initialized to the value of \fB$MSVS_VERSION\fR\&. An error is raised if both are set and have different values\&. .RE .PP \fBMSVSBUILDCOM\fR .RS 4 The build command line placed in a generated Microsoft Visual C++ project file\&. The default is to have Visual Studio invoke SCons with any specified build targets\&. .RE .PP \fBMSVSCLEANCOM\fR .RS 4 The clean command line placed in a generated Microsoft Visual C++ project file\&. The default is to have Visual Studio invoke SCons with the \fB\-c\fR option to remove any specified targets\&. .RE .PP \fBMSVSENCODING\fR .RS 4 The encoding string placed in a generated Microsoft Visual C++ project file\&. The default is encoding Windows\-1252\&. .RE .PP \fBMSVSPROJECTCOM\fR .RS 4 The action used to generate Microsoft Visual C++ project files\&. .RE .PP \fBMSVSPROJECTSUFFIX\fR .RS 4 The suffix used for Microsoft Visual C++ project (DSP) files\&. The default value is \&.vcxproj when using Visual Studio 2010 and later, \&.vcproj when using Visual Studio versions between 2002 and 2008, and \&.dsp when using Visual Studio 6\&.0\&. .RE .PP \fBMSVSREBUILDCOM\fR .RS 4 The rebuild command line placed in a generated Microsoft Visual C++ project file\&. The default is to have Visual Studio invoke SCons with any specified rebuild targets\&. .RE .PP \fBMSVSSCONS\fR .RS 4 The SCons used in generated Microsoft Visual C++ project files\&. The default is the version of SCons being used to generate the project file\&. .RE .PP \fBMSVSSCONSCOM\fR .RS 4 The default SCons command used in generated Microsoft Visual C++ project files\&. .RE .PP \fBMSVSSCONSCRIPT\fR .RS 4 The sconscript file (that is, SConstruct or SConscript file) that will be invoked by Microsoft Visual C++ 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 \fBMSVSSCONSFLAGS\fR .RS 4 The SCons flags used in generated Microsoft Visual C++ project files\&. .RE .PP \fBMSVSSOLUTIONCOM\fR .RS 4 The action used to generate Microsoft Visual Studio solution files\&. .RE .PP \fBMSVSSOLUTIONSUFFIX\fR .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 2002) and later, and \&.dsw when using Visual Studio 6\&.0\&. .RE .PP \fBMT\fR .RS 4 The program used on Windows systems to embed manifests into DLLs and EXEs\&. See also \fB$WINDOWS_EMBED_MANIFEST\fR\&. .RE .PP \fBMTEXECOM\fR .RS 4 The Windows command line used to embed manifests into executables\&. See also \fB$MTSHLIBCOM\fR\&. .RE .PP \fBMTFLAGS\fR .RS 4 Flags passed to the \fB$MT\fR manifest embedding program (Windows only)\&. .RE .PP \fBMTSHLIBCOM\fR .RS 4 The Windows command line used to embed manifests into shared libraries (DLLs)\&. See also \fB$MTEXECOM\fR\&. .RE .PP \fBMWCW_VERSION\fR .RS 4 The version number of the MetroWerks CodeWarrior C compiler to be used\&. .RE .PP \fBMWCW_VERSIONS\fR .RS 4 A list of installed versions of the MetroWerks CodeWarrior C compiler on this system\&. .RE .PP \fBNAME\fR .RS 4 Specfies the name of the project to package\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBNINJA_ALIAS_NAME\fR .RS 4 The name of the alias target which will cause SCons to create the ninja build file, and then (optionally) run ninja\&. The default value is generate\-ninja\&. .RE .PP \fBNINJA_CMD_ARGS\fR .RS 4 A string which will pass arguments through SCons to the ninja command when scons executes ninja\&. Has no effect if \fB$NINJA_DISABLE_AUTO_RUN\fR is set\&. .sp This value can also be passed on the command line: .sp .if n \{\ .RS 4 .\} .nf scons NINJA_CMD_ARGS=\-v or scons NINJA_CMD_ARGS="\-v \-j 3" .fi .if n \{\ .RE .\} .RE .PP \fBNINJA_COMPDB_EXPAND\fR .RS 4 Boolean value to instruct ninja to expand the command line arguments normally put into response files\&. If true, prevents unexpanded lines in the compilation database like \(lqgcc @rsp_file\(rq and instead yields expanded lines like \(lqgcc \-c \-o myfile\&.o myfile\&.c \-Ia \-DXYZ\(rq\&. .sp Ninja\*(Aqs compdb tool added the \fB\-x\fR flag in Ninja V1\&.9\&.0 .RE .PP \fBNINJA_DEPFILE_PARSE_FORMAT\fR .RS 4 Determines the type of format ninja should expect when parsing header include depfiles\&. Can be \fBmsvc\fR, \fBgcc\fR, or \fBclang\fR\&. The \fBmsvc\fR option corresponds to \fB/showIncludes\fR format, and \fBgcc\fR or \fBclang\fR correspond to \fB\-MMD \-MF\fR\&. .RE .PP \fBNINJA_DIR\fR .RS 4 The \fIbuilddir\fR value\&. Propagates directly into the generated ninja build file\&. From Ninja\*(Aqs docs: \(lq A directory for some Ninja output files\&. \&.\&.\&. (You can also store other build output in this directory\&.) \(rq The default value is \&.ninja\&. .RE .PP \fBNINJA_DISABLE_AUTO_RUN\fR .RS 4 Boolean\&. Default: \fBFalse\fR\&. If true, SCons will not run ninja automatically after creating the ninja build file\&. .sp If not explicitly set, this will be set to \fBTrue\fR if \fB\-\-disable_execute_ninja\fR or SetOption(\*(Aqdisable_execute_ninja\*(Aq, True) is seen\&. .RE .PP \fBNINJA_ENV_VAR_CACHE\fR .RS 4 A string that sets the environment for any environment variables that differ between the OS environment and the SCons execution environment\&. .sp It will be compatible with the default shell of the operating system\&. .sp If not explicitly set, SCons will generate this dynamically from the execution environment stored in the current construction environment (e\&.g\&. env[\*(AqENV\*(Aq]) where those values differ from the existing shell\&.\&. .RE .PP \fBNINJA_FILE_NAME\fR .RS 4 The filename for the generated Ninja build file\&. The default is ninja\&.build\&. .RE .PP \fBNINJA_FORCE_SCONS_BUILD\fR .RS 4 If true, causes the build nodes to call back to scons instead of using ninja to build them\&. This is intended to be passed to the environment on the builder invocation\&. It is useful if you have a build node which does something which is not easily translated into ninja\&. .RE .PP \fBNINJA_GENERATED_SOURCE_ALIAS_NAME\fR .RS 4 A string matching the name of a user defined alias which represents a list of all generated sources\&. This will prevent the auto\-detection of generated sources from \fB$NINJA_GENERATED_SOURCE_SUFFIXES\fR\&. Then all other source files will be made to depend on this in the ninja build file, forcing the generated sources to be built first\&. .RE .PP \fBNINJA_GENERATED_SOURCE_SUFFIXES\fR .RS 4 The list of source file suffixes which are generated by SCons build steps\&. All source files which match these suffixes will be added to the _generated_sources alias in the output ninja build file\&. Then all other source files will be made to depend on this in the ninja build file, forcing the generated sources to be built first\&. .RE .PP \fBNINJA_MSVC_DEPS_PREFIX\fR .RS 4 The \fImsvc_deps_prefix\fR string\&. Propagates directly into the generated ninja build file\&. From Ninja\*(Aqs docs: \(lqdefines the string which should be stripped from msvc\*(Aqs \fB/showIncludes\fR output\(rq .RE .PP \fBNINJA_POOL\fR .RS 4 Set the \fIninja_pool\fR for this or all targets in scope for this env var\&. .RE .PP \fBNINJA_REGENERATE_DEPS\fR .RS 4 A generator function used to create a ninja depfile which includes all the files which would require SCons to be invoked if they change\&. Or a list of said files\&. .RE .PP \fB_NINJA_REGENERATE_DEPS_FUNC\fR .RS 4 Internal value used to specify the function to call with argument env to generate the list of files which, if changed, would require the ninja build file to be regenerated\&. .RE .PP \fBNINJA_SCONS_DAEMON_KEEP_ALIVE\fR .RS 4 The number of seconds for the SCons daemon launched by ninja to stay alive\&. (Default: 180000) .RE .PP \fBNINJA_SCONS_DAEMON_PORT\fR .RS 4 The TCP/IP port for the SCons daemon to listen on\&. \fINOTE: You cannot use a port already being listened to on your build machine\&.\fR (Default: random number between 10000,60000) .RE .PP \fBNINJA_SYNTAX\fR .RS 4 The path to a custom ninja_syntax\&.py file which is used in generation\&. The tool currently assumes you have ninja installed as a Python module and grabs the syntax file from that installation if \fB$NINJA_SYNTAX\fR is not explicitly set\&. .RE .PP \fBno_import_lib\fR .RS 4 When set to non\-zero, suppresses creation of a corresponding Windows static import lib by the \fBSharedLibrary\fR 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 \fBOBJPREFIX\fR .RS 4 The prefix used for (static) object file names\&. .RE .PP \fBOBJSUFFIX\fR .RS 4 The suffix used for (static) object file names\&. .RE .PP \fBPACKAGEROOT\fR .RS 4 Specifies the directory where all files in resulting archive will be placed if applicable\&. The default value is \(lq\fB$NAME\fR\-\fB$VERSION\fR\(rq\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBPACKAGETYPE\fR .RS 4 Selects the package type to build when using the \fBPackage\fR builder\&. It may be a string or list of strings\&. See the documentation for the builder for the currently supported types\&. .sp \fB$PACKAGETYPE\fR may be overridden with the \fB\-\-package\-type\fR command line option\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBPACKAGEVERSION\fR .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\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBPCH\fR .RS 4 A node for 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\&. Examples: .sp .if n \{\ .RS 4 .\} .nf env[\*(AqPCH\*(Aq] = File(\*(AqStdAfx\&.pch\*(Aq) env[\*(AqPCH\*(Aq] = env\&.PCH(\*(Aqpch\&.cc\*(Aq)[0] .fi .if n \{\ .RE .\} .RE .PP \fBPCHCOM\fR .RS 4 The command line used by the \fBPCH\fR builder to generated a precompiled header\&. .RE .PP \fBPCHCOMSTR\fR .RS 4 The string displayed when generating a precompiled header\&. If not set, then \fB$PCHCOM\fR (the command line) is displayed\&. .RE .PP \fBPCHPDBFLAGS\fR .RS 4 A construction variable that, when expanded, adds the \fB/yD\fR flag to the command line only if the \fB$PDB\fR construction variable is set\&. .RE .PP \fBPCHSTOP\fR .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 defined, 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 \fBPDB\fR .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 Microsoft 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 \fBPDFLATEX\fR .RS 4 The pdflatex utility\&. .RE .PP \fBPDFLATEXCOM\fR .RS 4 The command line used to call the pdflatex utility\&. .RE .PP \fBPDFLATEXCOMSTR\fR .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 \fBPDFLATEXFLAGS\fR .RS 4 General options passed to the pdflatex utility\&. .RE .PP \fBPDFPREFIX\fR .RS 4 The prefix used for PDF file names\&. .RE .PP \fBPDFSUFFIX\fR .RS 4 The suffix used for PDF file names\&. .RE .PP \fBPDFTEX\fR .RS 4 The pdftex utility\&. .RE .PP \fBPDFTEXCOM\fR .RS 4 The command line used to call the pdftex utility\&. .RE .PP \fBPDFTEXCOMSTR\fR .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 \fBPDFTEXFLAGS\fR .RS 4 General options passed to the pdftex utility\&. .RE .PP \fBPKGCHK\fR .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 \fBPKGINFO\fR .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 \fBPLATFORM\fR .RS 4 The name of the platform used to create this construction environment\&. SCons sets this when initializing the platform, which by default is auto\-detected (see the \fIplatform\fR argument to \fBEnvironment\fR)\&. .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 \fBPOAUTOINIT\fR .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 \fBPOCREATE_ALIAS\fR .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 \fBPOSUFFIX\fR .RS 4 Suffix used for PO files (default: \*(Aq\&.po\*(Aq) See msginit tool and \fBPOInit\fR builder\&. .RE .PP \fBPOTDOMAIN\fR .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 \fBPOTSUFFIX\fR .RS 4 Suffix used for PO Template files (default: \*(Aq\&.pot\*(Aq)\&. See xgettext tool and \fBPOTUpdate\fR builder\&. .RE .PP \fBPOTUPDATE_ALIAS\fR .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 \fBPOUPDATE_ALIAS\fR .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 \fBPRINT_CMD_LINE_FUNC\fR .RS 4 The function to print command lines as they are executed\&. Called unless command printing is disabled by the \fB\-q\fR/\fB\-\-question\fR or \fB\-s\fR/\fB\-\-silent\fR options\&. The function will be called with four arguments: \fIs\fR, \fItarget\fR, \fIsource\fR and \fIenv\fR\&. \fIs\fR is the command line string to be executed, \fItarget\fR, is the target(s) being built \fIsource\fR, is the source(s) used and \fIenv\fR is the environment being used\&. .sp Any or all of the arguments can be used in composing the message\&. \fIsource\fR and \fItarget\fR will be lists of nodes, and need to be suitably converted for printing (see example)\&. The default, used if the variable is not set or set to \fBNone\fR, is to print only the string \fIs\fR, equivalent to: .sp .if n \{\ .RS 4 .\} .nf def print_cmd_line(s, target, source, env): sys\&.stdout\&.write(s + "\en") .fi .if n \{\ .RE .\} .sp This example uses the source and target parameters to format a custom message: .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, \*(Aqbar\&.c\*(Aq]) .fi .if n \{\ .RE .\} .sp This prints: .sp .if n \{\ .RS 4 .\} .nf \&.\&.\&. scons: Building targets \&.\&.\&. Building bar\&.c \-> bar\&.o\&.\&.\&. Building foo\&.c \-> foo\&.o\&.\&.\&. Building foo\&.o and bar\&.o \-> foo\&.\&.\&. scons: done building targets\&. .fi .if n \{\ .RE .\} .sp Another possible use for a print function is to show a very brief message on the console while logging the full command line to a file\&. .RE .PP \fBPROGEMITTER\fR .RS 4 Contains the emitter specification for the \fBProgram\fR builder\&. The manpage section "Builder Objects" contains general information on specifying emitters\&. .RE .PP \fBPROGPREFIX\fR .RS 4 The prefix used for executable file names\&. .RE .PP \fBPROGSUFFIX\fR .RS 4 The suffix used for executable file names\&. .RE .PP \fBPSCOM\fR .RS 4 The command line used to convert TeX DVI files into a PostScript file\&. .RE .PP \fBPSCOMSTR\fR .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 \fBPSPREFIX\fR .RS 4 The prefix used for PostScript file names\&. .RE .PP \fBPSSUFFIX\fR .RS 4 The prefix used for PostScript file names\&. .RE .PP \fBRANLIB\fR .RS 4 The archive indexer\&. .RE .PP \fBRANLIBCOM\fR .RS 4 The command line used to index a static library archive\&. .RE .PP \fBRANLIBCOMSTR\fR .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 \fBRANLIBFLAGS\fR .RS 4 General options passed to the archive indexer\&. .RE .PP \fBRC\fR .RS 4 The resource compiler used to build a Microsoft Visual C++ resource file\&. .RE .PP \fBRCCOM\fR .RS 4 The command line used to build a Microsoft Visual C++ resource file\&. .RE .PP \fBRCCOMSTR\fR .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 \fBRCFLAGS\fR .RS 4 The flags passed to the resource compiler by the \fBRES\fR builder\&. .RE .PP \fBRCINCFLAGS\fR .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 \fBRCINCPREFIX\fR .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 \fBRCINCSUFFIX\fR .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 \fBRDirs\fR .RS 4 A function that converts a string into a list of Dir instances by searching the repositories\&. .RE .PP \fBREGSVR\fR .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=True\&. .RE .PP \fBREGSVRCOM\fR .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=True\&. .RE .PP \fBREGSVRCOMSTR\fR .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 \fBREGSVRFLAGS\fR .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 \fBRMIC\fR .RS 4 The Java RMI stub compiler\&. .RE .PP \fBRMICCOM\fR .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 \fBRMICCOMSTR\fR .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 \fBRMICFLAGS\fR .RS 4 General options passed to the Java RMI stub compiler\&. .RE .PP \fBRPATH\fR .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 \fBscons\fR in any way: if you want an absolute path, you must make it absolute yourself\&. .RE .PP \fB_RPATH\fR .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 \fBRPATHPREFIX\fR .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 \fBRPATHSUFFIX\fR .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 \fBRPCGEN\fR .RS 4 The RPC protocol compiler\&. .RE .PP \fBRPCGENCLIENTFLAGS\fR .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 \fBRPCGENFLAGS\fR .RS 4 General options passed to the RPC protocol compiler\&. .RE .PP \fBRPCGENHEADERFLAGS\fR .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 \fBRPCGENSERVICEFLAGS\fR .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 \fBRPCGENXDRFLAGS\fR .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 \fBSCANNERS\fR .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 \fBSCONS_HOME\fR .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 C++ project files\&. .RE .PP \fBSHCC\fR .RS 4 The C compiler used for generating shared\-library objects\&. See also \fB$CC\fR for compiling to static objects\&. .RE .PP \fBSHCCCOM\fR .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\&. See also \fB$CCCOM\fR for compiling to static objects\&. .RE .PP \fBSHCCCOMSTR\fR .RS 4 If set, the string displayed when a C source file is compiled to a shared object file\&. If not set, then \fB$SHCCCOM\fR (the command line) is displayed\&. See also \fB$CCCOMSTR\fR for compiling to static objects\&. .sp .if n \{\ .RS 4 .\} .nf env = Environment(SHCCCOMSTR = "Compiling shared object $TARGET") .fi .if n \{\ .RE .\} .RE .PP \fBSHCCFLAGS\fR .RS 4 Options that are passed to the C and C++ compilers to generate shared\-library objects\&. See also \fB$CCFLAGS\fR for compiling to static objects\&. .RE .PP \fBSHCFLAGS\fR .RS 4 Options that are passed to the C compiler (only; not C++) to generate shared\-library objects\&. See also \fB$CFLAGS\fR for compiling to static objects\&. .RE .PP \fBSHCXX\fR .RS 4 The C++ compiler used for generating shared\-library objects\&. See also \fB$CXX\fR for compiling to static objects\&. .RE .PP \fBSHCXXCOM\fR .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\&. See also \fB$CXXCOM\fR for compiling to static objects\&. .RE .PP \fBSHCXXCOMSTR\fR .RS 4 If set, the string displayed when a C++ source file is compiled to a shared object file\&. If not set, then \fB$SHCXXCOM\fR (the command line) is displayed\&. See also \fB$CXXCOMSTR\fR for compiling to static objects\&. .sp .if n \{\ .RS 4 .\} .nf env = Environment(SHCXXCOMSTR = "Compiling shared object $TARGET") .fi .if n \{\ .RE .\} .RE .PP \fBSHCXXFLAGS\fR .RS 4 Options that are passed to the C++ compiler to generate shared\-library objects\&. See also \fB$CXXFLAGS\fR for compiling to static objects\&. .RE .PP \fBSHDC\fR .RS 4 The name of the compiler to use when compiling D source destined to be in a shared object\&. See also \fB$DC\fR for compiling to static objects\&. .RE .PP \fBSHDCOM\fR .RS 4 The command line to use when compiling code to be part of shared objects\&. See also \fB$DCOM\fR for compiling to static objects\&. .RE .PP \fBSHDCOMSTR\fR .RS 4 If set, the string displayed when a D source file is compiled to a (shared) object file\&. If not set, then \fB$SHDCOM\fR (the command line) is displayed\&. See also \fB$DCOMSTR\fR for compiling to static objects\&. .RE .PP \fBSHDLIBVERSIONFLAGS\fR .RS 4 Extra flags added to \fB$SHDLINKCOM\fR when building versioned \fBSharedLibrary\fR\&. These flags are only used when \fB$SHLIBVERSION\fR is set\&. .RE .PP \fBSHDLINK\fR .RS 4 The linker to use when creating shared objects from dlang code\&. See also \fB$DLINK\fR for linking static objects\&. .RE .PP \fBSHDLINKCOM\fR .RS 4 The command line to use when generating shared objects\&. See also \fB$DLINKCOM\fR for linking static objects\&. .RE .PP \fBSHDLINKFLAGS\fR .RS 4 The flags to use when generating a shared object for the D language\&. See also \fB$DLINKFLAGS\fR for linking static objects\&. .RE .PP \fBSHELL\fR .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 \fBSHELL_ENV_GENERATORS\fR .RS 4 A hook allowing the execution environment to be modified prior to the actual execution of a command line from an action via the spawner function defined by \fB$SPAWN\fR\&. Allows substitution based on targets and sources, as well as values from the construction environment, adding extra environment variables, etc\&. .sp The value must be a list (or other iterable) of functions which each generate or alter the execution environment dictionary\&. The first function will be passed a copy of the initial execution environment (\fB$ENV\fR in the current construction environment); the dictionary returned by that function is passed to the next, until the iterable is exhausted and the result returned for use by the command spawner\&. The original execution environment is not modified\&. .sp Each function provided in \fB$SHELL_ENV_GENERATORS\fR must accept four arguments and return a dictionary: \fIenv\fR is the construction environment for this action; \fItarget\fR is the list of targets associated with this action; \fIsource\fR is the list of sources associated with this action; and \fIshell_env\fR is the current dictionary after iterating any previous \fB$SHELL_ENV_GENERATORS\fR functions (this can be compared to the original execution environment, which is available as env[\*(AqENV\*(Aq], to detect any changes)\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf def custom_shell_env(env, target, source, shell_env): """customize shell_env if desired""" if str(target[0]) == \*(Aqspecial_target\*(Aq: shell_env[\*(AqSPECIAL_VAR\*(Aq] = env\&.subst(\*(AqSOME_VAR\*(Aq, target=target, source=source) return shell_env env["SHELL_ENV_GENERATORS"] = [custom_shell_env] .fi .if n \{\ .RE .\} .sp \fIAvailable since 4\&.4\fR .RE .PP \fBSHF03\fR .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 \fBSHF03COM\fR .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 \fBSHF03COMSTR\fR .RS 4 If set, the string displayed when a Fortran 03 source file is compiled to a shared\-library object file\&. If not set, then \fB$SHF03COM\fR or \fB$SHFORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBSHF03FLAGS\fR .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$FORTRANCOMMONFLAGS\fR variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&. .RE .PP \fBSHF03PPCOM\fR .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 \fBSHF03PPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$SHF03PPCOM\fR or \fB$SHFORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBSHF08\fR .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 \fBSHF08COM\fR .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 \fBSHF08COMSTR\fR .RS 4 If set, the string displayed when a Fortran 08 source file is compiled to a shared\-library object file\&. If not set, then \fB$SHF08COM\fR or \fB$SHFORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBSHF08FLAGS\fR .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$FORTRANCOMMONFLAGS\fR variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&. .RE .PP \fBSHF08PPCOM\fR .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 \fBSHF08PPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$SHF08PPCOM\fR or \fB$SHFORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBSHF77\fR .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 \fBSHF77COM\fR .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 \fBSHF77COMSTR\fR .RS 4 If set, the string displayed when a Fortran 77 source file is compiled to a shared\-library object file\&. If not set, then \fB$SHF77COM\fR or \fB$SHFORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBSHF77FLAGS\fR .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$FORTRANCOMMONFLAGS\fR variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&. .RE .PP \fBSHF77PPCOM\fR .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 \fBSHF77PPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$SHF77PPCOM\fR or \fB$SHFORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBSHF90\fR .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 \fBSHF90COM\fR .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 \fBSHF90COMSTR\fR .RS 4 If set, the string displayed when a Fortran 90 source file is compiled to a shared\-library object file\&. If not set, then \fB$SHF90COM\fR or \fB$SHFORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBSHF90FLAGS\fR .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$FORTRANCOMMONFLAGS\fR variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&. .RE .PP \fBSHF90PPCOM\fR .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 \fBSHF90PPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$SHF90PPCOM\fR or \fB$SHFORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBSHF95\fR .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 \fBSHF95COM\fR .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 \fBSHF95COMSTR\fR .RS 4 If set, the string displayed when a Fortran 95 source file is compiled to a shared\-library object file\&. If not set, then \fB$SHF95COM\fR or \fB$SHFORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBSHF95FLAGS\fR .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$FORTRANCOMMONFLAGS\fR variable, which specifies the user\-specified options passed to the default Fortran compiler for all Fortran versions\&. .RE .PP \fBSHF95PPCOM\fR .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 \fBSHF95PPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$SHF95PPCOM\fR or \fB$SHFORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBSHFORTRAN\fR .RS 4 The default Fortran compiler used for generating shared\-library objects\&. .RE .PP \fBSHFORTRANCOM\fR .RS 4 The command line used to compile a Fortran source file to a shared\-library object file\&. By default, any options specified in the \fB$SHFORTRANFLAGS\fR, \fB$_FORTRANMODFLAG\fR, and \fB$_FORTRANINCFLAGS\fR construction variables are included on this command line\&. See also \fB$FORTRANCOM\fR\&. .RE .PP \fBSHFORTRANCOMSTR\fR .RS 4 If set, the string displayed when a Fortran source file is compiled to a shared\-library object file\&. If not set, then \fB$SHFORTRANCOM\fR (the command line) is displayed\&. .RE .PP \fBSHFORTRANFLAGS\fR .RS 4 Options that are passed to the Fortran compiler to generate shared\-library objects\&. .RE .PP \fBSHFORTRANPPCOM\fR .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\&. By default, any options specified in the \fB$SHFORTRANFLAGS\fR, \fB$CPPFLAGS\fR, \fB$_CPPDEFFLAGS\fR, \fB$_FORTRANMODFLAG\fR, and \fB$_FORTRANINCFLAGS\fR construction variables are included on this command line\&. See also \fB$SHFORTRANCOM\fR\&. .RE .PP \fBSHFORTRANPPCOMSTR\fR .RS 4 If set, 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 not set, then \fB$SHFORTRANPPCOM\fR (the command line) is displayed\&. .RE .PP \fBSHLIBEMITTER\fR .RS 4 Contains the emitter specification for the \fBSharedLibrary\fR builder\&. The manpage section "Builder Objects" contains general information on specifying emitters\&. .RE .PP \fBSHLIBNOVERSIONSYMLINKS\fR .RS 4 Instructs the \fBSharedLibrary\fR builder to not create symlinks for versioned shared libraries\&. .RE .PP \fBSHLIBPREFIX\fR .RS 4 The prefix used for shared library file names\&. .RE .PP \fB_SHLIBSONAME\fR .RS 4 A macro that automatically generates a shared library\*(Aqs \fB$SONAME\fR based on $TARGET, \fB$SHLIBVERSION\fR and \fB$SHLIBSUFFIX\fR\&. Used by the \fBSharedLibrary\fR builder when the linker tool supports SONAME (e\&.g\&. gnulink)\&. .RE .PP \fBSHLIBSUFFIX\fR .RS 4 The suffix used for shared library file names\&. .RE .PP \fBSHLIBVERSION\fR .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 are specified as alphanumeric, decimal\-delimited values which can be recognized by the regular expression "\ew+[\e\&.\ew+]*" Example valid \fB$SHLIBVERSION\fR values include \*(Aq1\*(Aq, \*(Aq1\&.2\&.3\*(Aq, and \*(Aq1\&.2\&.gitaa412c8b\*(Aq\&. .RE .PP \fB_SHLIBVERSIONFLAGS\fR .RS 4 This macro automatically introduces extra flags to \fB$SHLINKCOM\fR when building a versioned \fBSharedLibrary\fR (that is, when \fB$SHLIBVERSION\fR is set)\&. \fB$_SHLIBVERSIONFLAGS\fR 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 \fBSHLIBVERSIONFLAGS\fR .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 \fBSHLINK\fR .RS 4 The linker for programs that use shared libraries\&. See also \fB$LINK\fR for linking static objects\&. .sp On POSIX systems (those using the link tool), you should normally not change this value as it defaults to a "smart" linker tool which selects a compiler driver matching the type of source files in use\&. So for example, if you set \fB$SHCXX\fR to a specific compiler name, and are compiling C++ sources, the smartlink function will automatically select the same compiler for linking\&. .RE .PP \fBSHLINKCOM\fR .RS 4 The command line used to link programs using shared libraries\&. See also \fB$LINKCOM\fR for linking static objects\&. .RE .PP \fBSHLINKCOMSTR\fR .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\&. See also \fB$LINKCOMSTR\fR for linking static objects\&. .sp .if n \{\ .RS 4 .\} .nf env = Environment(SHLINKCOMSTR = "Linking shared $TARGET") .fi .if n \{\ .RE .\} .RE .PP \fBSHLINKFLAGS\fR .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\&. See also \fB$LINKFLAGS\fR for linking static objects\&. .RE .PP \fBSHOBJPREFIX\fR .RS 4 The prefix used for shared object file names\&. .RE .PP \fBSHOBJSUFFIX\fR .RS 4 The suffix used for shared object file names\&. .RE .PP \fBSONAME\fR .RS 4 The name of a versioned shared library/loadable module\&. If specified, it is an explicit statement of the name; if unspecified, the value is generated\&. \fB$SONAME\fR and \fB$SOVERSION\fR may not both be specified in the same construction environment or override\&. .sp .if n \{\ .RS 4 .\} .nf # Will cause libtest\&.so\&.2 to exist and be a symlink to libtest\&.so\&.0\&.1\&.2 env\&.SharedLibrary(\*(Aqtest\*(Aq, \*(Aqtest\&.c\*(Aq, SHLIBVERSION=\*(Aq0\&.1\&.2\*(Aq, SONAME=\*(Aqlibtest\&.so\&.2\*(Aq) .fi .if n \{\ .RE .\} .sp This variable is used by toolchains that support versioned shared objects\&. .RE .PP \fBSOURCE\fR .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 \fBSOURCE_URL\fR .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\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBSOURCES\fR .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 \fBSOVERSION\fR .RS 4 Version string used in construction of \fB$SONAME\fR\&. The version is added to the base library name (\fItest\fR in the example below)\&. \fB$SONAME\fR and \fB$SOVERSION\fR may not both be specified in the same construction environment or override\&. .sp .if n \{\ .RS 4 .\} .nf # SONAME will be libtest\&.so\&.2, and will be a symlink to libtest\&.so\&.0\&.1\&.2 env\&.SharedLibrary(\*(Aqtest\*(Aq, \*(Aqtest\&.c\*(Aq, SHLIBVERSION=\*(Aq0\&.1\&.2\*(Aq, SOVERSION=\*(Aq2\*(Aq) .fi .if n \{\ .RE .\} .sp This variable is used by toolchains that support versioned shared objects\&. .RE .PP \fBSPAWN\fR .RS 4 A command interpreter function that will be called to execute command line strings\&. The function must accept five arguments: .sp .if n \{\ .RS 4 .\} .nf def spawn(shell, escape, cmd, args, env): .fi .if n \{\ .RE .\} .sp \fIshell\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 holds the arguments to the command and \fIenv\fR is a dictionary of environment variables defining the execution environment in which the command should be executed\&. .RE .PP \fBSTATIC_AND_SHARED_OBJECTS_ARE_THE_SAME\fR .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 \fBSUBST_DICT\fR .RS 4 The dictionary used by the \fBSubstfile\fR or \fBTextfile\fR builders for substitution values\&. It can be anything acceptable to the \fBdict()\fR constructor, so in addition to a dictionary, lists of tuples are also acceptable\&. .RE .PP \fBSUBSTFILEPREFIX\fR .RS 4 The prefix used for \fBSubstfile\fR file names, an empty string by default\&. .RE .PP \fBSUBSTFILESUFFIX\fR .RS 4 The suffix used for \fBSubstfile\fR file names, an empty string by default\&. .RE .PP \fBSUMMARY\fR .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\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBSWIG\fR .RS 4 The name of the SWIG compiler to use\&. .RE .PP \fBSWIGCFILESUFFIX\fR .RS 4 The suffix that will be used for intermediate C source files generated by SWIG\&. The default value is \*(Aq_wrap$CFILESUFFIX\*(Aq \- that is, the concatenation of the string _wrap and the current C suffix \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 \fBSWIGCOM\fR .RS 4 The command line used to call SWIG\&. .RE .PP \fBSWIGCOMSTR\fR .RS 4 The string displayed when calling SWIG\&. If this is not set, then \fB$SWIGCOM\fR (the command line) is displayed\&. .RE .PP \fBSWIGCXXFILESUFFIX\fR .RS 4 The suffix that will be used for intermediate C++ source files generated by SWIG\&. The default value is \*(Aq_wrap$CXXFILESUFFIX\*(Aq \- that is, the concatenation of the string _wrap and the current C++ suffix \fB$CXXFILESUFFIX\fR\&. By default, this value is used whenever the \fB\-c++\fR option is specified as part of the \fB$SWIGFLAGS\fR construction variable\&. .RE .PP \fBSWIGDIRECTORSUFFIX\fR .RS 4 The suffix that will be used for intermediate C++ header files generated by SWIG\&. These are only generated for C++ code when the SWIG \*(Aqdirectors\*(Aq feature is turned on\&. The default value is _wrap\&.h\&. .RE .PP \fBSWIGFLAGS\fR .RS 4 General options passed to SWIG\&. This is where you should set the target language (\fB\-python\fR, \fB\-perl5\fR, \fB\-tcl\fR, etc\&.) and whatever other options you want to specify to SWIG, such as the \fB\-c++\fR to generate C++ code instead of C Code\&. .RE .PP \fB_SWIGINCFLAGS\fR .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 \fBSWIGINCPREFIX\fR .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 \fBSWIGINCSUFFIX\fR .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 \fBSWIGOUTDIR\fR .RS 4 Specifies the output directory in which SWIG 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 \fBSWIGPATH\fR .RS 4 The list of directories that SWIG will search for included files\&. SCons\*(Aq 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 \fB$SWIGFLAGS\fR the result will be non\-portable and the directories will not be searched by the dependency scanner\&. Note: directory names in \fB$SWIGPATH\fR will be looked\-up relative to the SConscript directory when they are used in a command\&. To force \fBscons\fR to lookup a directory relative to the root of the source tree, use a top\-relative path (#): .sp .if n \{\ .RS 4 .\} .nf env = Environment(SWIGPATH=\*(Aq#/include\*(Aq) .fi .if n \{\ .RE .\} .sp The directory lookup 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 \fBSWIGVERSION\fR .RS 4 The detected version string of the SWIG tool\&. .RE .PP \fBTAR\fR .RS 4 The tar archiver\&. .RE .PP \fBTARCOM\fR .RS 4 The command line used to call the tar archiver\&. .RE .PP \fBTARCOMSTR\fR .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 \fBTARFLAGS\fR .RS 4 General options passed to the tar archiver\&. .RE .PP \fBTARGET\fR .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 \fBTARGET_ARCH\fR .RS 4 The name of the hardware architecture that objects created using this construction environment should target\&. Can be set when creating a construction environment by passing as a keyword argument in the \fBEnvironment\fR call\&. .sp On the win32 platform, if the Microsoft Visual C++ compiler is available, msvc tool setup is done using \fB$HOST_ARCH\fR and \fB$TARGET_ARCH\fR\&. If a value is not specified, will be set to the same value as \fB$HOST_ARCH\fR\&. Changing the value after the environment is initialized will not cause the tool to be reinitialized\&. Compiled objects will be in the target architecture if the compilation system supports generating for that target\&. The latest compiler which can fulfill the requirement will be selected, unless a different version is directed by the value of the \fB$MSVC_VERSION\fR construction variable\&. .sp On the win32/msvc combination, valid target arch values are x86, arm, i386 for 32\-bit targets and amd64, arm64, x86_64 and ia64 (Itanium) for 64\-bit targets\&. For example, if you want to compile 64\-bit binaries, you would set TARGET_ARCH=\*(Aqx86_64\*(Aq when creating the construction environment\&. Note that not all target architectures are supported for all Visual Studio / MSVC versions\&. Check the relevant Microsoft documentation\&. .sp \fB$TARGET_ARCH\fR is not currently used by other compilation tools, but the option is reserved to do so in future .RE .PP \fBTARGET_OS\fR .RS 4 The name of the operating system that objects created using this construction environment should target\&. Can be set when creating a construction environment by passing as a keyword argument in the \fBEnvironment\fR call;\&. .sp \fB$TARGET_OS\fR is not currently used by SCons but the option is reserved to do so in future .RE .PP \fBTARGETS\fR .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 \fBTARSUFFIX\fR .RS 4 The suffix used for tar file names\&. .RE .PP \fBTEMPFILE\fR .RS 4 Holds a callable object which will be invoked to transform long command lines (string or list) into an alternate form\&. Length limits on various operating systems may cause long command lines to fail when calling out to a shell to run the command\&. Most often affects linking, when there are many object files and/or libraries to be linked, but may also affect other compilation steps which have many arguments\&. \fB$TEMPFILE\fR is not called directly, but rather is typically embedded in another construction variable, to be expanded when used\&. Example: .sp .if n \{\ .RS 4 .\} .nf env["TEMPFILE"] = TempFileMunge env["LINKCOM"] = "${TEMPFILE(\*(Aq$LINK $TARGET $SOURCES\*(Aq, \*(Aq$LINKCOMSTR\*(Aq)}" .fi .if n \{\ .RE .\} .sp The SCons default value for \fB$TEMPFILE\fR, TempFileMunge, performs command substitution on the passed command line, calculates whether modification is needed, then puts all but the first word (assumed to be the command name) of the resulting list into a temporary file (sometimes called a response file or command file), and returns a new command line consisting of the the command name and an appropriately formatted reference to the temporary file\&. .sp A replacement for the default tempfile object would need to do fundamentally the same thing, including taking into account the values of \fB$MAXLINELENGTH\fR, \fB$TEMPFILEPREFIX\fR, \fB$TEMPFILESUFFIX\fR, \fB$TEMPFILEARGJOIN\fR, \fB$TEMPFILEDIR\fR and \fB$TEMPFILEARGESCFUNC\fR\&. If a particular use case requires a different transformation than the default, it is recommended to copy the mechanism and define a new construction variable and rewrite the relevant *COM variable(s) to use it, to avoid possibly disrupting existing uses of \fB$TEMPFILE\fR\&. .RE .PP \fBTEMPFILEARGESCFUNC\fR .RS 4 The default argument escape function is \fBSCons\&.Subst\&.quote_spaces\fR\&. If you need to apply extra operations on a command argument (to fix Windows slashes, normalize paths, etc\&.) before writing to the temporary file, you can set the \fB$TEMPFILEARGESCFUNC\fR variable to a custom function\&. The function must accept a single string argument and and return a new string with any modifications applied\&. Example: .sp .if n \{\ .RS 4 .\} .nf import sys import re from SCons\&.Subst import quote_spaces WINPATHSEP_RE = re\&.compile(r"\e\e([^\e"\*(Aq\e\e]|$)") def tempfile_arg_esc_func(arg): arg = quote_spaces(arg) if sys\&.platform != "win32": return arg # GCC requires double Windows slashes, let\*(Aqs use UNIX separator return WINPATHSEP_RE\&.sub(r"/\e1", arg) env["TEMPFILEARGESCFUNC"] = tempfile_arg_esc_func .fi .if n \{\ .RE .\} .RE .PP \fBTEMPFILEARGJOIN\fR .RS 4 The string to use to join the arguments passed to \fB$TEMPFILE\fR when the 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 separator as defined by os\&.linesep\&. Note this value is used literally and not expanded by the subst logic\&. .RE .PP \fBTEMPFILEDIR\fR .RS 4 The directory to create the long\-lines temporary file in\&. If unset, the Python tempfile module chooses the directory based on the \fBTMPDIR\fR, \fBTEMP\fR or \fBTMP\fR environment variables\&. If the default path causes processing errors, set \fB$TEMPFILEDIR\fR to a safer alternative\&. For example, on Windows, the default temporary file path contains the username\&. If the username contains non\-7\-bit\-ASCII characters, there may decoding errors opening the path to the temporary file\&. See also \fB$TEMPFILEENCODING\fR\&. .RE .PP \fBTEMPFILEENCODING\fR .RS 4 By default, the long\-lines temporary file (aka "response file") created by the \fB$TEMPFILE\fR function will be encoded in the Python default encoding, UTF\-8\&. If the external command which reads the response file encounters decoding errors (usually, if that command depends on Windows legacy code pages, and a pathname in the response file or the response file path itself cannot be represented in the 7\-bit ASCII characer set), set this variable to the appropriate codec\&. See also \fB$TEMPFILEDIR\fR\&. .sp \fINew in version 4\&.10\&.0\fR .RE .PP \fBTEMPFILEPREFIX\fR .RS 4 The prefix for the name of the temporary file used to store command lines exceeding \fB$MAXLINELENGTH\fR\&. The prefix must include the compiler syntax to actually include and process the file\&. The default prefix is \*(Aq@\*(Aq, which works for the Microsoft Visual C++ 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 \fBTEMPFILESUFFIX\fR .RS 4 The suffix for the name of the temporary file used to store command lines exceeding \fB$MAXLINELENGTH\fR\&. The suffix should include the dot (\*(Aq\&.\*(Aq) if one is needed as it will not be added automatically\&. The default is \&.lnk\&. .RE .PP \fBTEX\fR .RS 4 The TeX formatter and typesetter\&. .RE .PP \fBTEXCOM\fR .RS 4 The command line used to call the TeX formatter and typesetter\&. .RE .PP \fBTEXCOMSTR\fR .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 \fBTEXFLAGS\fR .RS 4 General options passed to the TeX formatter and typesetter\&. .RE .PP \fBTEXINPUTS\fR .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 \fBTEXTFILEPREFIX\fR .RS 4 The prefix used for \fBTextfile\fR file names, an empty string by default\&. .RE .PP \fBTEXTFILESUFFIX\fR .RS 4 The suffix used for \fBTextfile\fR file names; \&.txt by default\&. .RE .PP \fBTOOLS\fR .RS 4 A list of the names of the Tool specification modules that were actually initialized in the current construction environment\&. This may be useful as a diagnostic aid to see if a tool did (or did not) run\&. The value is informative and is not guaranteed to be complete\&. .RE .PP \fBUNCHANGED_SOURCES\fR .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 \fBUNCHANGED_TARGETS\fR .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 \fBVENDOR\fR .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\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBVERSION\fR .RS 4 The version of the project, specified as a string\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBVSWHERE\fR .RS 4 Specify the location of \fBvswhere\&.exe\fR\&. .sp The \fBvswhere\&.exe\fR executable is distributed with Microsoft Visual Studio and Build Tools since the 2017 edition, but is also available as a standalone installation\&. It allows queries to obtain detailed information about installations of 2017 and later editions\&. SCons makes use of this information to determine the state of compiler support for those editions\&. .sp Setting the \fB$VSWHERE\fR variable to the path to a specific \fBvswhere\&.exe\fR binary causes SCons to use that binary\&. If not set, SCons will search for one, looking in the following locations in order, using the first found (\fB$VSWHERE\fR is updated with the location): .RS 4 %ProgramFiles(x86)%\eMicrosoft Visual Studio\eInstaller .RE .RS 4 %ProgramFiles%\eMicrosoft Visual Studio\eInstaller .RE .RS 4 %ChocolateyInstall%\ebin .RE .RS 4 %LOCALAPPDATA%\eMicrosoft\eWinGet\eLinks .RE .RS 4 %USERPROFILE%\escoop\eshims .RE .RS 4 %SCOOP%\eshims .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 In order to take effect, \fB$VSWHERE\fR must be set before the initial Microsoft Visual C++ compiler discovery takes place\&. Discovery happens, at the latest, during the first call to the \fBEnvironment\fR function, unless a \fItools\fR list is specified which excludes the entire Microsoft Visual C++ toolchain \- that is, omits "defaults" and any specific tool module that refers to parts of the toolchain (msvc, mslink, masm, midl and msvs)\&. In this case, detection is deferred until any one of those tool modules is invoked manually\&. The following two examples illustrate this: .sp .if n \{\ .RS 4 .\} .nf # VSWHERE set as Environment is created env = Environment(VSWHERE=\*(Aqc:/my/path/to/vswhere\*(Aq) # Initialization deferred with empty tools, triggered manually env = Environment(tools=[]) env[\*(AqVSWHERE\*(Aq] = r\*(Aqc:/my/vswhere/install/location/vswhere\&.exe\*(Aq env\&.Tool(\*(Aqmsvc\*(Aq) env\&.Tool(\*(Aqmslink\*(Aq) env\&.Tool(\*(Aqmsvs\*(Aq) .fi .if n \{\ .RE .\} .sp .5v .RE .RE .PP \fBWINDOWS_EMBED_MANIFEST\fR .RS 4 Set to \fBTrue\fR to embed the compiler\-generated manifest (normally ${TARGET}\&.manifest) into all Windows executables 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\&. See also \fB$WINDOWS_INSERT_MANIFEST\fR\&. .RE .PP \fBWINDOWS_INSERT_DEF\fR .RS 4 If set to true, a library build of a Windows shared library (\&.dll file) will include a reference to the corresponding module\-definition file at the same time, if a module\-definition file is not already listed as a build target\&. The name of the module\-definition file will be constructed from the base name of the library and the construction variables \fB$WINDOWSDEFSUFFIX\fR and \fB$WINDOWSDEFPREFIX\fR\&. The default is to not add a module\-definition file\&. The module\-definition file is not created by this directive, and must be supplied by the developer\&. .RE .PP \fBWINDOWS_INSERT_MANIFEST\fR .RS 4 If set to true, \fBscons\fR will add the manifest file generated by Microsoft Visual C++ 8\&.0 and later to the target list so SCons will be aware they were generated\&. In the case of an executable, the manifest file name is constructed using \fB$WINDOWSPROGMANIFESTSUFFIX\fR and \fB$WINDOWSPROGMANIFESTPREFIX\fR\&. In the case of a shared library, the manifest file name is constructed using \fB$WINDOWSSHLIBMANIFESTSUFFIX\fR and \fB$WINDOWSSHLIBMANIFESTPREFIX\fR\&. See also \fB$WINDOWS_EMBED_MANIFEST\fR\&. .RE .PP \fBWINDOWSDEFPREFIX\fR .RS 4 The prefix used for a Windows linker module\-definition file name\&. Defaults to empty\&. .RE .PP \fBWINDOWSDEFSUFFIX\fR .RS 4 The suffix used for a Windows linker module\-definition file name\&. Defaults to \&.def\&. .RE .PP \fBWINDOWSEXPPREFIX\fR .RS 4 The prefix used for Windows linker exports file names\&. Defaults to empty\&. .RE .PP \fBWINDOWSEXPSUFFIX\fR .RS 4 The suffix used for Windows linker exports file names\&. Defaults to \&.exp\&. .RE .PP \fBWINDOWSPROGMANIFESTPREFIX\fR .RS 4 The prefix used for executable program manifest files generated by Microsoft Visual C++\&. Defaults to empty\&. .RE .PP \fBWINDOWSPROGMANIFESTSUFFIX\fR .RS 4 The suffix used for executable program manifest files generated by Microsoft Visual C++\&. Defaults to \&.manifest\&. .RE .PP \fBWINDOWSSHLIBMANIFESTPREFIX\fR .RS 4 The prefix used for shared library manifest files generated by Microsoft Visual C++\&. Defaults to empty\&. .RE .PP \fBWINDOWSSHLIBMANIFESTSUFFIX\fR .RS 4 The suffix used for shared library manifest files generated by Microsoft Visual C++\&. Defaults to \&.manifest\&. .RE .PP \fBX_IPK_DEPENDS\fR .RS 4 This is used to fill in the Depends: field in the controlling information for Ipkg packages\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBX_IPK_DESCRIPTION\fR .RS 4 This is used to fill in the Description: field in the controlling information for Ipkg packages\&. The default value is \(lq\fB$SUMMARY\fR\en\fB$DESCRIPTION\fR\(rq .RE .PP \fBX_IPK_MAINTAINER\fR .RS 4 This is used to fill in the Maintainer: field in the controlling information for Ipkg packages\&. .RE .PP \fBX_IPK_PRIORITY\fR .RS 4 This is used to fill in the Priority: field in the controlling information for Ipkg packages\&. .RE .PP \fBX_IPK_SECTION\fR .RS 4 This is used to fill in the Section: field in the controlling information for Ipkg packages\&. .RE .PP \fBX_MSI_LANGUAGE\fR .RS 4 This is used to fill in the Language: attribute in the controlling information for MSI packages\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBX_MSI_LICENSE_TEXT\fR .RS 4 The text of the software license in RTF format\&. Carriage return characters will be replaced with the RTF equivalent \e\epar\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBX_MSI_UPGRADE_CODE\fR .RS 4 TODO .RE .PP \fBX_RPM_AUTOREQPROV\fR .RS 4 This is used to fill in the AutoReqProv: field in the RPM \&.spec file\&. .sp See the \fBPackage\fR builder\&. .RE .PP \fBX_RPM_BUILD\fR .RS 4 internal, but overridable .RE .PP \fBX_RPM_BUILDREQUIRES\fR .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 \fBX_RPM_BUILDROOT\fR .RS 4 internal, but overridable .RE .PP \fBX_RPM_CLEAN\fR .RS 4 internal, but overridable .RE .PP \fBX_RPM_CONFLICTS\fR .RS 4 This is used to fill in the Conflicts: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_DEFATTR\fR .RS 4 This value is used as the default attributes for the files in the RPM package\&. The default value is \(lq(\-,root,root)\(rq\&. .RE .PP \fBX_RPM_DISTRIBUTION\fR .RS 4 This is used to fill in the Distribution: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_EPOCH\fR .RS 4 This is used to fill in the Epoch: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_EXCLUDEARCH\fR .RS 4 This is used to fill in the ExcludeArch: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_EXLUSIVEARCH\fR .RS 4 This is used to fill in the ExclusiveArch: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_EXTRADEFS\fR .RS 4 A list used to supply extra definitions 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\&. .sp \fINew in version 3\&.1\&.\fR .sp .if n \{\ .RS 4 .\} .nf env\&.Package( NAME="foo", \&.\&.\&. X_RPM_EXTRADEFS=[ "%define _unpackaged_files_terminate_build 0" "%define _missing_doc_files_terminate_build 0" ], \&.\&.\&. ) .fi .if n \{\ .RE .\} .RE .PP \fBX_RPM_GROUP\fR .RS 4 This is used to fill in the Group: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_GROUP_lang\fR .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 \fBX_RPM_ICON\fR .RS 4 This is used to fill in the Icon: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_INSTALL\fR .RS 4 internal, but overridable .RE .PP \fBX_RPM_PACKAGER\fR .RS 4 This is used to fill in the Packager: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_POSTINSTALL\fR .RS 4 This is used to fill in the %post: section in the RPM \&.spec file\&. .RE .PP \fBX_RPM_POSTUNINSTALL\fR .RS 4 This is used to fill in the %postun: section in the RPM \&.spec file\&. .RE .PP \fBX_RPM_PREFIX\fR .RS 4 This is used to fill in the Prefix: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_PREINSTALL\fR .RS 4 This is used to fill in the %pre: section in the RPM \&.spec file\&. .RE .PP \fBX_RPM_PREP\fR .RS 4 internal, but overridable .RE .PP \fBX_RPM_PREUNINSTALL\fR .RS 4 This is used to fill in the %preun: section in the RPM \&.spec file\&. .RE .PP \fBX_RPM_PROVIDES\fR .RS 4 This is used to fill in the Provides: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_REQUIRES\fR .RS 4 This is used to fill in the Requires: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_SERIAL\fR .RS 4 This is used to fill in the Serial: field in the RPM \&.spec file\&. .RE .PP \fBX_RPM_URL\fR .RS 4 This is used to fill in the Url: field in the RPM \&.spec file\&. .RE .PP \fBXGETTEXT\fR .RS 4 Path to \fBxgettext(1)\fR program (found via \fBDetect()\fR)\&. See xgettext tool and \fBPOTUpdate\fR builder\&. .RE .PP \fBXGETTEXTCOM\fR .RS 4 Complete xgettext command line\&. See xgettext tool and \fBPOTUpdate\fR builder\&. .RE .PP \fBXGETTEXTCOMSTR\fR .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 \fB_XGETTEXTDOMAIN\fR .RS 4 Internal "macro"\&. Generates \fBxgettext\fR domain name form source and target (default: \*(Aq${TARGET\&.filebase}\*(Aq)\&. .RE .PP \fBXGETTEXTFLAGS\fR .RS 4 Additional flags to \fBxgettext(1)\fR\&. See xgettext tool and \fBPOTUpdate\fR builder\&. .RE .PP \fBXGETTEXTFROM\fR .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 \fB_XGETTEXTFROMFLAGS\fR .RS 4 Internal "macro"\&. Generates list of \-D flags from the \fB$XGETTEXTPATH\fR list\&. .RE .PP \fBXGETTEXTFROMPREFIX\fR .RS 4 This flag is used to add single \fB$XGETTEXTFROM\fR file to \fBxgettext(1)\fR\*(Aqs command line (default: \*(Aq\-f\*(Aq)\&. .RE .PP \fBXGETTEXTFROMSUFFIX\fR .RS 4 (default: \*(Aq\*(Aq) .RE .PP \fBXGETTEXTPATH\fR .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 \fB_XGETTEXTPATHFLAGS\fR .RS 4 Internal "macro"\&. Generates list of \-f flags from \fB$XGETTEXTFROM\fR\&. .RE .PP \fBXGETTEXTPATHPREFIX\fR .RS 4 This flag is used to add single search path to \fBxgettext(1)\fR\*(Aqs command line (default: \*(Aq\-D\*(Aq)\&. .RE .PP \fBXGETTEXTPATHSUFFIX\fR .RS 4 (default: \*(Aq\*(Aq) .RE .PP \fBYACC\fR .RS 4 The parser generator\&. .RE .PP \fBYACC_GRAPH_FILE\fR .RS 4 If supplied, write a graph of the automaton to a file with the name taken from this variable\&. Will be emitted as a \fB\-\-graph=\fR command\-line option\&. Use this in preference to including \fB\-\-graph=\fR in \fB$YACCFLAGS\fR directly\&. .sp \fINew in version 4\&.4\&.0\&.\fR .RE .PP \fBYACC_GRAPH_FILE_SUFFIX\fR .RS 4 Previously specified by \fB$YACCVCGFILESUFFIX\fR\&. .sp The suffix of the file containing a graph of the grammar automaton when the \fB\-g\fR option (or \fB\-\-graph=\fR without an option\-argument) is used in \fB$YACCFLAGS\fR\&. Note that setting this variable informs SCons how to construct the graph filename for tracking purposes, it does not affect the actual generated filename\&. Various yacc tools have emitted various formats at different times\&. Set this to match what your parser generator produces\&. .sp \fINew in version 4\&.6\&.0\fR\&. .RE .PP \fBYACC_HEADER_FILE\fR .RS 4 If supplied, generate a header file with the name taken from this variable\&. Will be emitted as a \fB\-\-header=\fR command\-line option\&. Use this in preference to including \fB\-\-header=\fR in \fB$YACCFLAGS\fR directly\&. .sp \fINew in version 4\&.4\&.0\&.\fR .RE .PP \fBYACCCOM\fR .RS 4 The command line used to call the parser generator to generate a source file\&. .RE .PP \fBYACCCOMSTR\fR .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 \fBYACCFLAGS\fR .RS 4 General options passed to the parser generator\&. In addition to passing the value on during invocation, the yacc tool also examines this construction variable for options which cause additional output files to be generated, and adds those to the target list\&. .sp If the \fB\-d\fR option is present in \fB$YACCFLAGS\fR \fBscons\fR assumes that the call will also create a header file with the suffix defined by \fB$YACCHFILESUFFIX\fR if the yacc source file ends in a \&.y suffix, or a file with the suffix defined by \fB$YACCHXXFILESUFFIX\fR if the yacc source file ends in a \&.yy suffix\&. The header will have the same base name as the requested target\&. This is only correct if the executable is \fBbison\fR (or \fBwin_bison\fR)\&. If using Berkeley yacc (\fBbyacc\fR), y\&.tab\&.h is always written \- avoid the \fB\-d\fR in this case and use \fB$YACC_HEADER_FILE\fR instead\&. .sp If a \fB\-g\fR option is present, \fBscons\fR assumes that the call will also create a graph file with the suffix defined by \fB$YACCVCGFILESUFFIX\fR\&. .sp If a \fB\-v\fR option is present, \fBscons\fR assumes that the call will also create an output debug file with the suffix \&.output\&. .sp Also recognized are GNU bison options \fB\-\-header\fR (and its deprecated synonym \fB\-\-defines\fR), which is similar to \fB\-d\fR but gives the option to explicitly name the output header file through an option argument; and \fB\-\-graph\fR, which is similar to \fB\-g\fR but gives the option to explicitly name the output graph file through an option argument\&. The file suffixes described for \fB\-d\fR and \fB\-g\fR above are not applied if these are used in the option=argument form\&. .sp Note that files specified by \fB\-\-header=\fR and \fB\-\-graph=\fR may not be properly handled by SCons in all situations, and using those in \fB$YACCFLAGS\fR should be considered legacy support only\&. Consider using \fB$YACC_HEADER_FILE\fR and \fB$YACC_GRAPH_FILE\fR instead if the files need to be explicitly named (\fInew in version 4\&.4\&.0\fR)\&. .RE .PP \fBYACCHFILESUFFIX\fR .RS 4 The suffix of the C header file generated by the parser generator when the \fB\-d\fR option (or \fB\-\-header\fR without an option\-argument) is used in \fB$YACCFLAGS\fR\&. Note that setting this variable informs SCons how to construct the header filename for tracking purposes, it does not affect the actual generated filename\&. Set this to match what your parser generator produces\&. The default value is \&.h\&. .RE .PP \fBYACCHXXFILESUFFIX\fR .RS 4 The suffix of the C++ header file generated by the parser generator when the \fB\-d\fR option (or \fB\-\-header\fR without an option\-argument) is used in \fB$YACCFLAGS\fR\&. Note that setting this variable informs SCons how to construct the header filename for tracking purposes, it does not affect the actual generated filename\&. Set this to match what your parser generator produces\&. The default value is \&.hpp\&. .RE .PP \fBYACCVCGFILESUFFIX\fR .RS 4 Obsoleted\&. Use \fB$YACC_GRAPH_FILE_SUFFIX\fR instead\&. The value is used only if \fB$YACC_GRAPH_FILE_SUFFIX\fR is not set\&. The default value is \&.gv\&. .sp \fIChanged in version 4\&.6\&.0\fR: deprecated\&. The default value changed from \&.vcg (bison stopped generating \&.vcg output with version 2\&.4, in 2006)\&. .RE .PP \fBZIP\fR .RS 4 The zip compression and file packaging utility\&. .RE .PP \fBZIP_OVERRIDE_TIMESTAMP\fR .RS 4 An optional timestamp which overrides the last modification time of the file when stored inside the Zip archive\&. This is a tuple of six values: Year (>= 1980) Month (one\-based) Day of month (one\-based) Hours (zero\-based) Minutes (zero\-based) Seconds (zero\-based) .RE .PP \fBZIPCOM\fR .RS 4 The command line used to call the zip utility, or the internal Python function used to create a zip archive\&. .RE .PP \fBZIPCOMPRESSION\fR .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 \fBZIPCOMSTR\fR .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 \fBZIPFLAGS\fR .RS 4 General options passed to the zip utility\&. .RE .PP \fBZIPROOT\fR .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 \fBZIPSUFFIX\fR .RS 4 The suffix used for zip file names\&. .RE .SS "Configure Contexts" .PP SCons provides an integrated autoconfiguration mechanism (inspired by GNU Autoconf but intrinsic to SCons), for checking the existence of external items needed for the build, such as C header files, libraries, etc\&. This can be used to build optional features only if support for them is available, abort the build quickly if required elements are missing, or just tune the build to the specific build platform\&. The mechanism is portable across platforms\&. .PP You activate the configuration sysem by creating a configure context, which holds accumulated information while the checks are being performed, request the desired checks, and then transfer the information to the regular build environment\&. Optionally, a configure header that C or C++ code can include can also be generated\&. SCons does not maintain an explicit cache of the tested values (unlike Autoconf), but uses its normal dependency tracking to keep the checked values up to date\&. You may override this behavior with the \fB\-\-config\fR command line option\&. .PP \fBConfigure\fR(\fIenv, [custom_tests, conf_dir, log_file, config_h, clean, help]\fR), \fIenv\fR\&.Configure(\fI[custom_tests, conf_dir, log_file, config_h, clean, help]\fR) .RS 4 Create a configure context, which tracks information discovered while running checks\&. The context includes a local construction environment (available as \fIcontext\fR\&.\fIenv\fR) which is used when running the checks and which can be updated with the check results\&. Only one context may be active at a time, but a new context can be created after the active one is completed\&. For the global function form, the required \fIenv\fR describes the initial values for the context\*(Aqs local construction environment; for the construction environment method form the instance provides the values\&. .sp \fIcustom_tests\fR specifies a dictionary containing custom checks (see details below)\&. The default value is \fBNone\fR, to indicate there are no custom checks in the configure context\&. .sp \fIconf_dir\fR specifies a directory where the test cases are built\&. This directory is not used for building normal targets\&. The default value is \(lq#/\&.sconf_temp\(rq\&. .sp \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 \(lq#/config\&.log\(rq\&. If you are using variant directories, you may want to place the log file for a given build under that build\*(Aqs variant directory\&. .sp \fIconfig_h\fR specifies a C header file where the results of tests will be written, so the build can have access to this information by including it\&. The results will consist of lines like #define HAVE_GETADDRINFO 1, #define HAVE_INTTYPES_H 1, etc\&. The default is None, which creates no configure header\&. The convention has been to call the configure header config\&.h\&. You can specify the same \fIconfig_h\fR file in multiple calls to \fBConfigure\fR, in which case SCons will concatenate all results in the specified file\&. Note that SCons uses its normal dependency tracking to decide if it\*(Aqs necessary to rebuild the configure hearer\&. This means that the file is not necessarily rebuilt each time scons is run, but is only rebuilt if its contents will have changed and some target that depends on the configure header is being built\&. .sp The \fIclean\fR and \fIhelp\fR arguments can be used to suppress execution of the configuration tests when the \fB\-c\fR/\fB\-\-clean\fR or \fB\-H\fR/\fB\-h\fR/\fB\-\-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\&. .sp \fIChanged in version 4\&.0\fR: raises an exception on an attempt to create a new context when there is an active context\&. .RE .PP \fIcontext\fR\&.Finish() .RS 4 Must be called after configuration is complete\&. Though required, this is not enforced except if \fBConfigure\fR is called again while there is still an active context, in which case an exception is raised\&. Returns the context\*(Aqs construction environment as modified during the course of running the configuration checks \- the original environment is unchanged; typically the returned environment is used to replace the original\&. 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\&. .RE .PP Example of a typical Configure usage: .sp .if n \{\ .RS 4 .\} .nf env = Environment() conf = Configure(env) if not conf\&.CheckCHeader("math\&.h"): print("We really need math\&.h!") Exit(1) if conf\&.CheckLibWithHeader("qt", "qapp\&.h", "c++", call="QApplication qapp(0,0);"): # do stuff for qt \- usage, e\&.g\&. conf\&.env\&.Append(CPPDEFINES="WITH_QT") env = conf\&.Finish() .fi .if n \{\ .RE .\} .PP A configure context has the following predefined methods which can be used to perform checks\&. Where \fIlanguage\fR is an optional parameter, it specifies the programming language of the check, currently a choice of C or C++\&. The spellings accepted for C are \(lqC\(rq or \(lqc\(rq; for C++ the value can be \(lqCXX\(rq, \(lqcxx\(rq, \(lqC++\(rq or \(lqc++\(rq\&. If \fIlanguage\fR is omitted, \(lqC\(rq is assumed\&. .PP \fIcontext\fR\&.CheckHeader(\fIheader, [include_quotes, language]\fR) .RS 4 Check if \fIheader\fR can be used when building this project\&. A generated stub program in the specified \fIlanguage\fR is built to check\&. \fIheader\fR may also 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 #include directives should precede the header line being checked for\&. The optional argument \fIinclude_quotes\fR specifies the characters wrapping the header name \- only the first two are considered\&. Essentially, this allows you to swap the default double\-quotes ("") for angle brackets (<>)\&. .sp Returns a boolean indicating success or failure\&. If a configure header was requested, the result is recorded in it in the form of a preprocessor macro in the case of success, or an informative comment in the case of failure\&. .RE .PP \fIcontext\fR\&.CheckCHeader(\fIheader, [include_quotes]\fR) .RS 4 Check if \fIheader\fR is usable when compiling a C language program\&. This is a wrapper around \fBCheckHeader\fR \- see its entry for details\&. .RE .PP \fIcontext\fR\&.CheckCXXHeader(\fIheader, [include_quotes]\fR) .RS 4 Check if \fIheader\fR is usable when compiling a C++ language program\&. This is a wrapper around \fBCheckHeader\fR \- see its entry for details\&. .RE .PP \fIcontext\fR\&.CheckFunc(\fIfunction_name, [header, language, funcargs]\fR) .RS 4 Check if \fIfunction_name\fR is usable in the context\*(Aqs local environment, using the compiler specified by \fIlanguage\fR \- that is, can a check referencing it be compiled using the current values of \fB$CFLAGS\fR, \fB$CPPFLAGS\fR, \fB$LIBS\fR or other relevant construction variables\&. .sp The optional \fIheader\fR argument is a string representing a code fragment to place at the top of the test program that will be compiled to check if the function exists\&. If omitted, the default stanza will be (with \fIfunction_name\fR appropriately substituted): .sp .if n \{\ .RS 4 .\} .nf #ifdef __cplusplus extern "C" #endif char function_name(void); .fi .if n \{\ .RE .\} .sp If \fIheader\fR is supplied, it should \fInot\fR include the standard header file that declares \fIfunction_name\fR and it \fIshould\fR include a dummy prototype similar to the default case\&. If this is not possible, the optional \fIfuncargs\fR argument can be used to specify a string containing an argument list with the same number and type of arguments as the prototype\&. The arguments can simply be constant values of the correct type\&. Modern C/C++ compilers reject implicit function declarations and may also reject function calls whose arguments are not type compatible with the prototype\&. .sp Returns a boolean indicating success or failure\&. If a configure header was requested, the result is recorded in it in the form of a preprocessor macro in the case of success, or an informative comment in the case of failure\&. .sp \fIChanged in version 4\&.7\&.0: added the \fR\fI\fIfuncargs\fR\fR\fI\&.\fR .RE .PP \fIcontext\fR\&.CheckLib(\fI[library, symbol, header, language, extra_libs=None, autoadd=True, append=True, unique=False]\fR) .RS 4 Check if \fIlibrary\fR can be used to build this project (see also \fBCheckLibWithHeader\fR)\&. A small stub program is generated and linked against \fIlibrary\fR by the compiler selected by \fIlanguage\fR\&. If \fIsymbol\fR is specified, the stub will contain a reference to that symbol, to check if it is actually provided by the library\&. If supplied, the text of \fIheader\fR is included at the top of the stub; it must be syntactically correct in \fIlanguage\fR\&. .sp Note that if \fIsymbol\fR is given, the stub will be generated with an old\-style prototype, as it has no knowledge of the actual prototype (e\&.g\&. char sin(); instead of double sin(double x);)\&. Such usage is no longer legal under C23 and later\&. .sp The remaining arguments should be specified in keyword style\&. If \fIextra_libs\fR is specified, it is a list off additional libraries to include when linking the stub program (usually, dependencies of the library being checked)\&. If \fIautoadd\fR is true (the default), and the link succeeds, the library is added to the \fB$LIBS\fR construction variable in the context\&. If \fIappend\fR is true (the default), an added library is appended, otherwise it is prepended\&. If \fIunique\fR is true, and the library would otherwise be added but is already present in \fB$LIBS\fR in the configure context, it will not be added again\&. The default is False\&. .sp \fIlibrary\fR can be a list of library names, or \fBNone\fR (the default if the argument is omitted)\&. If the former, \fIsymbol\fR is checked against each library name in order, returning (and reporting success) on the first successful test; if the latter, it is checked with the current value of \fB$LIBS\fR (in this case no library name would be added)\&. If \fIsymbol\fR is omitted or \fBNone\fR, then \fBCheckLib\fR just checks if you can link against the specified \fIlibrary\fR\&. Note though it is legal syntax, it would not be very useful to call this method with \fIlibrary\fR and \fIsymbol\fR both omitted or \fBNone\fR \- at least one should be supplied\&. .sp Returns a boolean indicating success or failure\&. .sp \fIChanged in version 4\&.5\&.0: added the \fR\fI\fIappend\fR\fR\fI and \fR\fI\fIunique\fR\fR\fI parameters\&.\fR .sp \fIChanged in version 4\&.9\&.0: added the \fR\fI\fIextra_libs\fR\fR\fI parameter\&.\fR .RE .PP \fIcontext\fR\&.CheckLibWithHeader(\fI[library, header, language, extra_libs=None, call=None, autoadd=True, append=True, unique=False]\fR) .RS 4 Check if \fIlibrary\fR can be used to build this project, when a header file must be included to use \fIlibrary\fR (see also \fBCheckLib\fR)\&. The first three arguments can be given as either positional or keyword arguments\&. \fIlibrary\fR specifies a library or list of libraries to check (the default is None), \fIheader\fR specifies a header file or list of header files to include in the test program\&. If \fIheader\fR is a list, the last item in the list is the header file to be checked, and the previous list items are header files whose #include lines should precede the header line being checked for\&. The default is to include no header text\&. .sp The remaining parameters should be specified in keyword style\&. If provided, \fIcall\fR is a code fragment to compile as the stub test, replacing the auto\-generated stub\&. The fragment must be a valid expression in \fIlanguage\fR\&. If not supplied, the default checks the ability to link against the specified \fIlibrary\fR\&. \fIextra_libs\fR can be used to add additional libraries to link against (usually, dependencies of the library under test)\&. If \fIautoadd\fR is true (the default), the first library that passes the check is added to the \fB$LIBS\fR construction variable in the configure context and the method returns\&. If \fIappend\fR is true (the default), an added library is appended, otherwise it is prepended\&. If \fIunique\fR is true, and the library would otherwise be added but is already present in \fB$LIBS\fR in the configure context, it will not be added again\&. The default is False\&. .sp Returns a boolean indicating success or failure\&. .sp \fIChanged in version 4\&.5\&.0: added the \fR\fI\fIappend\fR\fR\fI and \fR\fI\fIunique\fR\fR\fI parameters\&.\fR .sp \fIChanged in version 4\&.9\&.0: added the \fR\fI\fIextra_libs\fR\fR\fI parameter\&.\fR .RE .PP \fIcontext\fR\&.CheckType(\fItype_name, [includes, language]\fR) .RS 4 Check whether \fItype_name\fR is defined via a typedef\&. \fIincludes\fR is a string containing one or more #include lines that will be placed at the top of the stub program that will be compiled to perform the check\&. Returns a boolean indicating success or failure\&. If a configure header was requested, the result is recorded in it in the form of a preprocessor macro in the case of success, or an informative comment in the case of failure\&. .sp 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 \fIcontext\fR\&.CheckTypeSize(\fItype_name, [header, language, expect]\fR) .RS 4 Check for the size of a type \fItype_name\fR defined via a typedef (or built in)\&. The optional \fIheader\fR argument is a string that will be placed at the top of the stub program that will be compiled to perform the check \- the default is empty\&. The check succeeds and returns the size of the type if it is found, else zero\&. If the optional \fIexpect\fR (integer) parameter is given, the check succeeds only if the detected size matches it\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf CheckTypeSize(\*(Aqshort\*(Aq, expect=2) .fi .if n \{\ .RE .\} .sp will return the size 2 only if short is actually two bytes\&. .RE .PP \fIcontext\fR\&.CheckCC() .RS 4 Check whether the C compiler (as defined by the \fB$CC\fR construction variable) works, by trying to compile a small source file\&. This provides a more rigorous check: by default, SCons itself only detects if there is a program with the correct name, not if it is a functioning compiler\&. Returns a boolean indicating success or failure\&. .sp The test program will be built with the same command line as the one used by the \fBObject\fR builder for C source files, so by setting relevant construction variables it can be used to detect if particular compiler flags will be accepted or rejected by the compiler\&. .RE .PP \fIcontext\fR\&.CheckCXX() .RS 4 Check whether the C++ compiler (as defined by the \fB$CXX\fR construction variable) works, by trying to compile a small source file\&. This provides a more rigorous check: by default, SCons itself only detects if there is a program with the correct name, not if it is a functioning compiler\&. Returns a boolean indicating success or failure\&. .sp The test program will be built with the same command line as the one used by the \fBObject\fR builder for C++ source files, so by setting relevant construction variables it can be used to detect if particular compiler flags will be accepted or rejected by the compiler\&. .RE .PP \fIcontext\fR\&.CheckSHCC() .RS 4 Check whether the shared\-object C compiler (as defined by the \fB$SHCC\fR construction variable) works by trying to compile a small source file\&. This provides a more rigorous check: by default, SCons itself only detects if there is a program with the correct name, not if it is a functioning compiler\&. Returns a boolean indicating success or failure\&. .sp The test program will be built with the same command line as the one used by the \fBSharedObject\fR builder for C source files, so by setting relevant construction variables it can be used to detect if particular compiler flags will be accepted or rejected by the compiler\&. Note this does not check whether a shared library/dll can be created\&. .RE .PP \fIcontext\fR\&.CheckSHCXX() .RS 4 Check whether the shared\-object C++ compiler (as defined by the \fB$SHCXX\fR construction variable) works by trying to compile a small source file\&. This provides a more rigorous check: by default, SCons itself only detects if there is a program with the correct name, not if it is a functioning compiler\&. Returns a boolean indicating success or failure\&. .sp The test program will be built with the same command line as the one used by the \fBSharedObject\fR builder for C++ source files, so by setting relevant construction variables it can be used to detect if particular compiler flags will be accepted or rejected by the compiler\&. Note this does not check whether a shared library/dll can be created\&. .RE .PP \fIcontext\fR\&.CheckProg(\fIprog_name\fR) .RS 4 Check if \fIprog_name\fR exists in the path SCons will use at build time\&. (\fIcontext\fR\&.\fIenv[\*(AqENV\*(Aq][\*(AqPATH\*(Aq]\fR)\&. Returns a string containing the path to the program, or \fBNone\fR on failure\&. .RE .PP \fIcontext\fR\&.CheckDeclaration(\fIsymbol, [includes, language]\fR) .RS 4 Check if the specified \fIsymbol\fR is declared\&. \fIincludes\fR is a string containing one or more #include lines that will be inserted into the program that will be run to test for the existence of the symbol\&. .sp Returns a boolean indicating success or failure\&. .RE .PP \fIcontext\fR\&.CheckMember(\fIaggregate_member, [header, language]\fR) .RS 4 Check for the existence of a member of the C/C++ struct or class\&. \fIaggregate_member\fR specifies the struct/class and member to check for\&. \fIheader\fR is a string containing one or more #include lines that will be inserted into the program that will be run to test for the existence of the member\&. Example: .sp .if n \{\ .RS 4 .\} .nf sconf\&.CheckMember(\*(Aqstruct tm\&.tm_sec\*(Aq, \*(Aq#include \*(Aq) .fi .if n \{\ .RE .\} .sp Returns a boolean indicating success or failure\&. .sp \fIAdded in 4\&.4\&.0\fR\&. .RE .PP \fIcontext\fR\&.Define(\fIsymbol, [value, comment]\fR) .RS 4 This method does not check for anything, but rather forces the definition of a preprocessor macro that will be added to the configure header\&. \fIname\fR is the macro\*(Aqs identifier\&. If \fIvalue\fR is given, it will be be used as the macro replacement value\&. If \fIvalue\fR is a string and needs to display with quotes, the quotes need to be included, as in \*(Aq"string"\*(Aq If the optional \fIcomment\fR is given, it is inserted as a comment above the macro definition (suitable comment marks will be added automatically)\&. This is analogous to using \fBAC_DEFINE\fR in Autoconf\&. .sp 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("A_SYMBOL") # Puts the following line in the config header file: # #define A_SYMBOL 1 conf\&.Define("A_SYMBOL", 1) .fi .if n \{\ .RE .\} .sp Examples of quoting string values: .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("A_SYMBOL", "YA") # Puts the following line in the config header file: # #define A_SYMBOL "YA" conf\&.Define("A_SYMBOL", \*(Aq"YA"\*(Aq) .fi .if n \{\ .RE .\} .sp Example including 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("A_SYMBOL", 1, "Set to 1 if you have a symbol") .fi .if n \{\ .RE .\} .RE .PP You can define your own custom checks in addition to using the predefined checks\&. To enable custom checks, pass a dictionary to the \fBConfigure\fR function as the \fIcustom_tests\fR parameter\&. The dictionary maps the names of the checks to the custom check callables (either a Python function or an instance of a class implementing a __call__ method)\&. Each custom check will be called with a a CheckContext instance as the first parameter followed by the remaining arguments, which must be supplied by the user of the check\&. A CheckContext is not the same as a configure context; rather it is an instance of a class which contains a configure context (available as \fIchk_ctx\fR\&.\fIsconf\fR)\&. A CheckContext provides the following methods which custom checks can make use of:: .PP \fIchk_ctx\fR\&.Message(\fItext\fR) .RS 4 Displays \fItext\fR as an indicator of progress\&. For example: Checking for library X\&.\&.\&.\&. Usually called before the check is started\&. .RE .PP \fIchk_ctx\fR\&.Result(\fIres\fR) .RS 4 Displays a result message as an indicator of progress\&. If \fIres\fR is an integer, displays yes if \fIres\fR evaluates true or no if false\&. If \fIres\fR is a string, it is displayed as\-is\&. Usually called after the check has completed\&. .RE .PP \fIchk_ctx\fR\&.TryCompile(\fItext, extension=\*(Aq\*(Aq\fR) .RS 4 Check if a file containing \fItext\fR and given the specified \fIextension\fR (e\&.g\&. \*(Aq\&.c\*(Aq) can be compiled to an object file using the environment\*(Aqs \fBObject\fR builder\&. Returns a boolean indicating success or failure\&. .RE .PP \fIchk_ctx\fR\&.TryLink(\fItext, extension=\*(Aq\*(Aq\fR) .RS 4 Check if a file containing \fItext\fR and given the specified \fIextension\fR (e\&.g\&. \*(Aq\&.c\*(Aq) can be compiled to an executable program using the environment\*(Aqs \fBProgram\fR builder\&. Returns a boolean indicating success or failure\&. .RE .PP \fIchk_ctx\fR\&.TryRun(\fItext, extension=\*(Aq\*(Aq\fR) .RS 4 Check if a file containing \fItext\fR and given the specified \fIextension\fR (e\&.g\&. \*(Aq\&.c\*(Aq) can be compiled to an excutable program using the environment\*(Aqs \fBProgram\fR builder and subsequently executed\&. Execution is only attempted if the build succeeds\&. If the program executes successfully (that is, its return status is 0), a tuple (True, outputStr) is returned, where \fIoutputStr\fR is the standard output of the program\&. If the program fails execution (its return status is non\-zero), then (False, \*(Aq\*(Aq) is returned\&. .RE .PP \fIchk_ctx\fR\&.TryAction(\fIaction, [text, extension=\*(Aq\*(Aq]\fR) .RS 4 Check if the specified \fIaction\fR with an optional source file (contents \fItext\fR, given extension \fIextension\fR) can be executed\&. \fIaction\fR may be anything which can be converted to an Action Object\&. On success, a tuple (True, outputStr) is returned, where \fIoutputStr\fR is the content of the target file\&. On failure (False, \*(Aq\*(Aq) is returned\&. .RE .PP \fIchk_ctx\fR\&.TryBuild(\fIbuilder, [text, extension=\*(Aq\*(Aq]\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, returns a boolean indicating success or failure\&. In addition, \fIchk_ctx\fR\&.\fIlastTarget\fR is set to the build target node if the build was successful\&. .RE .PP Example of implementing and using custom checks: .sp .if n \{\ .RS 4 .\} .nf def CheckQt(chk_ctx, qtdir): chk_ctx\&.Message(\*(AqChecking for qt \&.\&.\&.\*(Aq) lastLIBS = chk_ctx\&.env[\*(AqLIBS\*(Aq] lastLIBPATH = chk_ctx\&.env[\*(AqLIBPATH\*(Aq] lastCPPPATH = chk_ctx\&.env[\*(AqCPPPATH\*(Aq] chk_ctx\&.env\&.Append(LIBS=\*(Aqqt\*(Aq, LIBPATH=qtdir + \*(Aq/lib\*(Aq, CPPPATH=qtdir + \*(Aq/include\*(Aq) ret = chk_ctx\&.TryLink( """\e #include int main(int argc, char **argv) { QApplication qapp(argc, argv); return 0; } """ ) if not ret: chkctx\&.env\&.Replace(LIBS=lastLIBS, LIBPATH=lastLIBPATH, CPPPATH=lastCPPPATH) chkctx\&.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 SCons depends on information stored in construction variables to control how targets are built\&. It is often necessary to pass specialized information at build time to override the variables in the build scripts\&. This can be done through variable\-assignment arguments on the command line and/or in stored variable files\&. .PP For the case where you want to specify new values for construction variables, SCons provides a \fBVariables\fR object to simplify collecting those and updating a construction environment with the values\&. This helps processing commands lines like this: .sp .if n \{\ .RS 4 .\} .nf \fBscons VARIABLE=foo OTHERVAR=bar\fR .fi .if n \{\ .RE .\} .PP Variables supplied on the command line can always be manually processed by iterating the \fIARGUMENTS\fR dictionary or the \fIARGLIST\fR list, However, using a \fBVariables\fR object allows you to describe anticipated variables, perform necessary type conversion, validate that values meet defined constraints, and specify default values, help messages and aliases\&. This provides a somewhat similar interface to option handling (see \fBAddOption\fR)\&. A \fBVariables\fR object also allows obtaining values from a saved variables file, or from a custom dictionary in an SConscript file\&. The processed variables can then be applied to the desired construction environment\&. .PP Conceptually, command\-line targets control what to build, command\-line variables (and variable files) control how to build, and command\-line options control how SCons operates (although SCons does not enforce that separation)\&. .PP To obtain an object for manipulating variables, call the \fBVariables\fR factory function: .PP \fBVariables\fR([\fIfiles, [args]]\fR) .RS 4 If \fIfiles\fR is a filename or list of filenames, they are executed as Python scripts to set saved variables when the \fBUpdate\fR method is called\&. This allows the use of Python syntax in the assignments\&. A variables file can be the result of an previous call to the \fBSave\fR method\&. If \fIfiles\fR is not specified, or the \fIfiles\fR argument is \fBNone\fR, then no files will be processed\&. Supplying \fBNone\fR is required if there are no files but you want to specify \fIargs\fR as a positional argument; or you can use keyword arguments to avoid that\&. If any of \fIfiles\fR is missing, it is silently skipped\&. .sp Either of the following example file contents could be used to set an alternative C compiler: .sp .if n \{\ .RS 4 .\} .nf CC = \*(Aqmy_cc\*(Aq CC = os\&.environ\&.get(\*(AqCC\*(Aq) .fi .if n \{\ .RE .\} .sp If \fIargs\fR is specified, it must be a dictionary\&. The key\-value pairs from \fIargs\fR will be added to those obtained from \fIfiles\fR, if any\&. Keys from \fIargs\fR take precedence over same\-named keys from \fIfiles\fR\&. If omitted, the default is the \fIARGUMENTS\fR dictionary that holds build variables specified on the command line\&. Using \fIARGUMENTS\fR allows you to indicate that if a setting appears on both the command line and in the file(s), the command line setting is preferred\&. However, any dictionary can be passed\&. Examples: .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}) vars = Variables(args={FOO:\*(Aqexpansion\*(Aq, BAR:7}) .fi .if n \{\ .RE .\} .sp Calling \fBVariables\fR with no arguments is equivalent to: .sp .if n \{\ .RS 4 .\} .nf vars = Variables(files=None, args=ARGUMENTS) .fi .if n \{\ .RE .\} .RE .PP A \fBVariables\fR object is a container for variable descriptions, added by calling the \fBAdd\fR or \fBAddVariables\fR methods\&. A variable description consists of a name, a list of aliases for the name, a help message, a default value, and functions to validate and convert values\&. Processing of input sources is deferred until the \fBUpdate\fR method is called, at which time the variables are added to the specified construction environment, using the name as the construction variable name; any aliases are not added\&. Variables from the input sources which do not match any names or aliases from the variable descriptions in this object are skipped, except that a dictionary of their names and values are made available in the \fIunknown\fR attribute of the \fBVariables\fR object\&. This list can also be obtained via the \fBUnknownVariables\fR method\&. If a variable description has a default value other than None and does not appear in the input sources, it is added to the construction environment with its default value\&. A list of variables set from their defaults and not from the input sources is available as the \fIdefaulted\fR attribute of the \fBVariables\fR object\&. The unknown variables and defaulted information is not available until the \fBUpdate\fR method has run\&. .PP Since the variables are eventually added as construction variables, you should choose variable names which do not unintentionally change pre\-defined construction variables that your project will make use of (see the section called \(lqConstruction Variables\(rq for a reference), since the specified values are assigned, not merged, to the respective construction variables\&. .PP The \fBVariables\fR subsystem does not directly support a way to define a variable the user \fImust\fR supply, but this can be simulated by using a validator function, and specifying a default value which the validator will reject, resulting in an invalid value error message (the convenience methods \fBEnumVariable\fR and \fBListVariable\fR make this relatively straightforward)\&. .PP A \fBVariables\fR object has the following methods: .PP \fIvars\fR\&.\fBAdd\fR(\fIkey, [help, default, validator, converter, subst]\fR) .RS 4 Add a customizable construction variable to the \fBVariables\fR object\&. \fIkey\fR is either the name of the variable, or a sequence of strings, in which case the first item in the sequence is taken as the variable name, and any remaining values are considered aliases for the variable\&. \fIkey\fR is mandatory, the other fields are optional\&. .sp \fIhelp\fR is the help text for the variable (default is an empty string)\&. .sp \fIdefault\fR is the value assigned to the variable in the construction environment if no value is provided in the input sources\&. If \fIdefault\fR is None (the default), the variable is not added to the construction environment unless explicitly set in the input sources\&. The default value can be of the intended type, or a string that the \fIconverter\fR can transform into that type\&. .sp If the \fIvalidator\fR argument is supplied, it is a callback function to validate the value of the variable\&. The validator is called when the \fBUpdate\fR method is called\&. A validator must accept three arguments: \fIkey\fR, \fIvalue\fR, and \fIenv\fR\&. It should raise an exception (with a helpful error message) if the value is invalid; no return value is expected\&. .sp If the \fIconverter\fR argument is supplied, it is a callback function to transform the value into the format desired for the construction environment\&. A converter is called before the validator\&. It must return a value, which is then passed to the \fIvalidator\fR (if any)\&. A converter must accept at least a \fIvalue\fR argument, and may optionally accept \fIenv\fR as a second argument if it needs access to the construction environment\&. In general, the converter should not fail, leaving validation checks to the validator, although if an operation is impossible to complete or there is no separate validator it can raise a ValueError\&. .sp If the \fIsubst\fR argument is supplied, it is a boolean that indicates whether to perform substitution on the value before passing it to the converter and validator functions\&. The default is True\&. Suppressing substitution may be useful if the variable value looks like a construction variable reference (e\&.g\&. $VAR) and the validator and/or converter should see it unexpanded\&. .sp As a special case, if \fIkey\fR is a sequence and is the \fIonly\fR argument to \fBAdd\fR, it is unpacked into the six parameters \fIkey\fR, \fIhelp\fR, \fIdefault\fR, \fIvalidator\fR, \fIconverter\fR, and \fIsubst\fR, with any missing members from the right filled in with the respective default values\&. This form allows it to consume a tuple emitted by the convenience functions \fBBoolVariable\fR, \fBEnumVariable\fR, \fBListVariable\fR, \fBPackageVariable\fR and \fBPathVariable\fR\&. .sp Examples: .sp .if n \{\ .RS 4 .\} .nf vars\&.Add(\*(AqCC\*(Aq, help=\*(AqThe C compiler\*(Aq) def valid_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 .\} .sp \fIChanged in version 4\&.8\&.0:\fR added the \fIsubst\fR parameter\&. .RE .PP \fIvars\fR\&.\fBAddVariables\fR(\fIargs\fR) .RS 4 A convenience method that adds one or more customizable construction variables to a \fBVariables\fR object in one call; equivalent to calling \fBAdd\fR multiple times\&. Each \fIargs\fR member must be a tuple that contains the arguments for an individual call to the \fBAdd\fR method using the "special case" form; the other calling styles (individual positional arguments and/or keyword arguments) are not supported\&. .sp .if n \{\ .RS 4 .\} .nf opt\&.AddVariables( ("debug", "", 0), ("CC", "The C compiler"), ("VALIDATE", "An option for testing validation", "notset", validator, None), ) .fi .if n \{\ .RE .\} .RE .PP \fIvars\fR\&.\fBFormatVariableHelpText\fR(\fIenv, opt, help, default, actual, aliases\fR) .RS 4 Returns a formatted string containing the printable help text for the single variable \fIopt\fR\&. All of the arguments must be supplied except \fIaliases\fR, which is optional\&. \fIenv\fR is the construction environment containing the variable values, (\fIenv\fR is not used by the standard implementation of \fBFormatVariableHelpText\fR); \fIvar\fR is the name of the variable; \fIhelp\fR is the text of the initial help message when the variable was added to the \fBVariables\fR object; \fIdefault\fR is the default value assigned when the variable was added to the \fBVariables\fR object; \fIactual\fR is the value as assigned in \fIenv\fR (which may be the same as \fIdefault\fR, if none of the input sources assign to the variable); and \fIaliases\fR are any alias names for the variable, if omitted defaults to an empty list\&. .sp \fBFormatVariableHelpText\fR is normally not called directly, but by \fBGenerateHelpText\fR, which does the work of obtaining the necessary values\&. You can patch in your own function that takes the same function signature in order to customize the appearance of variable help messages\&. Example: .sp .if n \{\ .RS 4 .\} .nf def my_format(env, var, help, default, actual): fmt = "\en%s: default=%s actual=%s (%s)\en" return fmt % (var, default, actual, help) vars\&.FormatVariableHelpText = my_format .fi .if n \{\ .RE .\} .sp Note that \fBGenerateHelpText\fR will not put any blank lines or extra characters between the entries, so you must add those characters to the returned string if you want the entries separated\&. .RE .PP \fIvars\fR\&.\fBGenerateHelpText\fR(\fIenv, [sort]\fR) .RS 4 Return a formatted string with the help text collected from all the variables configured in this \fBVariables\fR object\&. This string is suitable for passing in to the \fBHelp\fR function\&. The generated string include an indication of the actual value in the environment given by \fIenv\fR\&. .sp If the optional \fIsort\fR parameter is set to a callable value, it is used as a comparison function to determine how to sort the added variables\&. This function must accept two arguments, compare them, and return a negative integer if the first is less\-than the second, zero if equal, or a positive integer if greater\-than\&. If \fIsort\fR is not callable, but evaluates true, an alphabetical sort is performed\&. The default is \fBFalse\fR (unsorted)\&. .sp .if n \{\ .RS 4 .\} .nf Help(vars\&.GenerateHelpText(env)) def cmp(a, b): return (a > b) \- (a < b) Help(vars\&.GenerateHelpText(env, sort=cmp)) .fi .if n \{\ .RE .\} .RE .PP \fIvars\fR\&.\fBSave\fR(\fIfilename, env\fR) .RS 4 Saves the currently set variables into a script file named \fIfilename\fR\&. You can load these saved variables on a subsequent run by passing the file to the \fBVariables\fR function\&. This provides a way to cache particular variable settings for reuse\&. Only variables set to non\-default values are saved\&. Each selected variable is saved as a Python assignment statement\&. Previous contents of the save file are not preserved except if they were used to populate the Variables object\&. .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 \fIvars\fR\&.\fBUnknownVariables\fR() .RS 4 Returns a dictionary containing any variables that were specified in the \fIfiles\fR and/or \fIargs\fR parameters when \fBVariables\fR was called, but the object was not actually configured for\&. This information is not available until the \fBUpdate\fR method has run\&. .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 \fIvars\fR\&.\fBUpdate\fR(\fIenv, [args]\fR) .RS 4 Process the input sources recorded when the \fBVariables\fR object was initialized and update \fIenv\fR with the customized construction variables\&. The names of any variables in the input sources that are not configured in the \fBVariables\fR object are recorded and may be retrieved using the \fBUnknownVariables\fR method\&. .sp If the optional \fIargs\fR argument is provided, it must be a dictionary of variables, which will be used in place of the one saved when the \fBVariables\fR object was created\&. .sp Normally, \fBUpdate\fR is not called directly, but rather invoked indirectly by passing the \fBVariables\fR object to the \fBEnvironment\fR function: .sp .if n \{\ .RS 4 .\} .nf env = Environment(\&.\&.\&., variables=vars) .fi .if n \{\ .RE .\} .RE .PP A \fBVariables\fR object also makes available two data attributes that can be read for further information\&. These only have values if \fBUpdate\fR has previously run\&. .PP \fIvars\fR\&.\fIdefaulted\fR .RS 4 A list of variable names that were set in the construction environment from the default values in the variable descriptions \- that is, variables that have a default value and were not defined in the input sources\&. .RE .PP \fIvars\fR\&.\fIunknown\fR .RS 4 A dictionary of variables that were specified in the input sources, but do not have matching variable definitions\&. This is the same information that is returned by the \fBUnknownVariables\fR method\&. .RE .PP \fIAdded in 4\&.9\&.0\fR: the \fIdefaulted\fR attribute\&. .PP SCons provides five pre\-defined variable types, accessible through factory functions that generate a tuple appropriate for directly passing to the \fBAdd\fR or \fBAddVariables\fR methods\&. .PP \fBBoolVariable\fR(\fIkey, help, default\fR) .RS 4 Set up a Boolean variable named \fIkey\fR\&. The variable will have a default value of \fIdefault\fR, and \fIhelp\fR will form the descriptive part of the help text\&. The variable will interpret the command\-line values \fBy\fR, \fByes\fR, \fBt\fR, \fBtrue\fR, \fB1\fR, \fBon\fR and \fBall\fR as true, and the command\-line values \fBn\fR, \fBno\fR, \fBf\fR, \fBfalse\fR, \fB0\fR, \fBoff\fR and \fBnone\fR as false\&. .RE .PP \fBEnumVariable\fR(\fIkey, help, default, allowed_values, [map, ignorecase]\fR) .RS 4 Set up a variable named \fIkey\fR whose value may only be chosen from a specified list ("enumeration") of values\&. The variable will have a default value of \fIdefault\fR and \fIhelp\fR will form the descriptive part of the help text\&. Any value that is not in \fIallowed_values\fR will raise an error, except that the optional \fImap\fR argument is a dictionary that can be used to map additional names into a particular name in the \fIallowed_values\fR list\&. If the optional \fIignorecase\fR is 0 (the default), the values are considered case\-sensitive\&. If \fIignorecase\fR is 1, values will be matched case\-insensitively\&. If \fIignorecase\fR is 2, values will be matched case\-insensitively, and all input values will be converted to lower case\&. .RE .PP \fBListVariable\fR(\fIkey, help, default, names, [map, validator]\fR) .RS 4 Set up a variable named \fIkey\fR whose value may be one or more choices from a specified list of values\&. The variable will have a default value of \fIdefault\fR, and \fIhelp\fR will form the descriptive part of the help text\&. Any value that is not in \fInames\fR or the special values \fBall\fR or \fBnone\fR will raise an error\&. Use a comma separator to specify multiple values\&. \fIdefault\fR may be specified either as a string of comma\-separated values, or as a Python list of values\&. .sp 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\&. (Note that the additional values accepted through the use of a \fImap\fR are not reflected in the generated help message)\&. .sp The optional \fIvalidator\fR argument can be used to specify a custom validator callback function, as described for \fBAdd\fR\&. The default is to use an internal validator routine\&. .sp \fIAdded in 4\&.8\&.0\fR: the \fIvalidator\fR parameter\&. .RE .PP \fBPackageVariable\fR(\fIkey, help, default\fR) .RS 4 Set up a variable named \fIkey\fR to help control a build component, such as a software package\&. Similar to a \fBBoolVariable\fR, but can also specify a path string to provide additional information to the build, for example the path to a configuration file describing the package, or a directory containing the package headers and libraries\&. The variable will have a default value of \fIdefault\fR, and the \fIhelp\fR parameter will be used as the descriptive part of the help text\&. .sp Any of the (case\-insensitive) strings \fB1\fR, \fByes\fR, \fBtrue\fR, \fBon\fR, \fBenable\fR or \fBsearch\fR can be used to indicate the package is "enabled", and can also be used as the value of \fIdefault\fR\&. A value of boolean \fBTrue\fR is produced except for the special case described for a path string\&. .sp Any of the (case\-insensitive) strings \fB0\fR, \fBno\fR, \fBfalse\fR, \fBoff\fR or \fBdisable\fR can be used to indicate the package is "disabled", and can also be used as the value of \fIdefault\fR\&. A value of boolean \fBFalse\fR is produced\&. .sp A string which is neither an enabling or disabling string is considered a "path string"\&. A path string can be given when specifying the variable, and can also be used as the value of \fIdefault\fR\&. A path string must refer to an existing filesystem path, but any further meaning is left to the build system to decide\&. The path string is produced\&. As a special case, if \fIdefault\fR is a path string, and the variable is specified with an enabling string, the default path string is produced, rather than True\&. .RE .PP \fBPathVariable\fR(\fIkey, help, default, [validator]\fR) .RS 4 Set up a variable named \fIkey\fR to hold a path string\&. The variable will have a default value of \fIdefault\fR, and the \fIhelp\fR parameter will be used as the descriptive part of the help text\&. .sp The optional \fIvalidator\fR parameter describes a callback function which will be called to verify that the specified path is acceptable\&. SCons supplies the following ready\-made validators: .PP PathVariable\&.\fBPathExists\fR .RS 4 Verify that the specified path exists (this the default behavior if no \fIvalidator\fR is supplied)\&. .RE .PP PathVariable\&.\fBPathIsFile\fR .RS 4 Verify that the specified path exists and is a regular file\&. .RE .PP PathVariable\&.\fBPathIsDir\fR .RS 4 Verify that the specified path exists and is a directory\&. .RE .PP PathVariable\&.\fBPathIsDirCreate\fR .RS 4 Verify that the specified path exists and is a directory; if it does not exist, create the directory\&. .RE .PP PathVariable\&.\fBPathAccept\fR .RS 4 Accept the specific path name argument without validation, suitable for when you want your users to be able to specify a directory path that will be created as part of the build process, for example\&. .RE .sp You may supply your own \fIvalidator\fR function, which must accept 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( "warnings", help="compilation with \-Wall and similar", default=True, ), EnumVariable( "debug", help="debug output and symbols", default="no", allowed_values=("yes", "no", "full"), map={}, ignorecase=0, # case\-sensitive ), ListVariable( "shared", help="libraries to build as shared libraries", default="all", names=list_of_libs, ), PackageVariable( "x11", help="use X11 installed here (yes = search some places)", default="yes", ), PathVariable( "qtdir", help="where the root of Qt is installed", default=qtdir ), PathVariable( "foopath", help="where the foo library is installed", default=foopath, validator=PathVariable\&.PathIsDir, ), ) .fi .if n \{\ .RE .\} .SS "Node Objects" .PP SCons represents objects that are the sources or targets of build operations as Nodes, which are internal data structures\&. There are a number of user\-visible types of nodes: File Nodes, Directory Nodes, Value Nodes and Alias Nodes\&. Some of the node types have public attributes and methods, described below\&. Each of the node types has a global function and a matching environment method to create instances: \fBFile\fR, \fBDir\fR, \fBValue\fR and \fBAlias\fR\&. .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBFilesystem Nodes\fR .RS 4 .PP The \fBFile\fR and \fBDir\fR functions/methods return File Nodes and Directory Nodes, respectively\&. Such Filesystem Nodes represent build components that correspond to an entry in the computer\*(Aqs filesystem, whether or not such an entry exists at the time the Node is created\&. You do not usually need to explicitly create filesystem Nodes, since when you supply a string as a target or source of a Builder, SCons will create the Nodes as needed to populate the dependency graph\&. Builders return the target Node(s) in the form of a list, which you can then make use of\&. However, since filesystem Nodes have some useful public attributes and methods that you can use in SConscript files, it is sometimes appropriate to create them manually, outside the regular context of a Builder call\&. .PP The following attributes provide information about a Node: .PP \fInode\fR\&.\fIpath\fR .RS 4 The build path of the given file or directory\&. This path is relative to the project top directory\&. The build path is the same as the source path if \fIvariant_dir\fR is not being used\&. .RE .PP \fInode\fR\&.\fIabspath\fR .RS 4 The absolute build path of the given file or directory\&. .RE .PP \fInode\fR\&.\fIrelpath\fR .RS 4 The build path of the given file or directory relative to the project top directory\&. .RE .PP \fInode\fR\&.\fBsrcnode\fR() .RS 4 The \fBsrcnode\fR method returns another File or Directory Node representing the source path of the given File or Directory Node\&. .RE .PP Examples: .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 # Current dir\*(Aqs path relative to the project top directory Dir(\*(Aq\&.\*(Aq)\&.relpath # Next line is always \*(Aq\&.\*(Aq, because it is the top dir\*(Aqs path relative to itself\&. Dir(\*(Aq#\&.\*(Aq)\&.path # Source path of the given source file\&. File(\*(Aqfoo\&.c\*(Aq)\&.srcnode()\&.path # Builders return lists of File objects: foo = env\&.Program(\*(Aqfoo\&.c\*(Aq) print("foo will be built in", foo[0]\&.path) .fi .if n \{\ .RE .\} .PP Filesystem Node objects have methods to create new Filesystem Nodes relative to the original Node\&. There are also times when you may need to refer to an entry in a filesystem without knowing in advance whether it\*(Aqs a file or a directory\&. For those situations, there is an \fBEntry\fR method of filesystem node objects, which returns a Node that can represent either a file or a directory\&. .PP If the original Node is a Directory Node, these methods will place the new Node within the directory the original Node represents: .PP \fInode\fR\&.\fBDir\fR(\fIname\fR) .RS 4 Returns a directory Node \fIname\fR which is a subdirectory of the directory represented by \fInode\fR\&. .RE .PP \fInode\fR\&.\fBFile\fR(\fIname\fR) .RS 4 Returns a file Node \fIname\fR in the directory represented by \fInode\fR\&. .RE .PP \fInode\fR\&.\fBEntry\fR(\fIname\fR) .RS 4 Returns an unresolved Node \fIname\fR in the directory represented by \fInode\fR\&. .RE .PP If the original Node is a File Node, these methods will place the new Node in the same directory as the one the original Node represents: .PP \fInode\fR\&.\fBDir\fR(\fIname\fR) .RS 4 Returns a Node \fIname\fR for a directory in the parent directory of the file represented by \fInode\fR\&. .RE .PP \fInode\fR\&.\fBFile\fR(\fIname\fR) .RS 4 Returns a Node \fIname\fR for a file in the parent directory of the file represented by \fInode\fR\&. .RE .PP \fInode\fR\&.\fBEntry\fR(\fIname\fR) .RS 4 Returns an unresolved Node \fIname\fR in the parent directory of the file represented by \fInode\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 .\} .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBValue and Alias Nodes\fR .RS 4 .PP SCons provides two other Node types to represent object that will not have an equivalent filesystem entry\&. Such Nodes always need to be created explicitly\&. .PP The \fBAlias\fR method returns an Alias Node\&. Aliases are virtual objects \- they will not themselves result in physical objects being constructed, but are entered into the dependency graph related to their sources\&. An alias is checked for up to date by checking if its sources are up\-to\-date\&. An alias is built by making sure its sources have been built, and if any building took place, applying any Actions that are defined as part of the alias\&. .PP An \fBAlias\fR call creates an entry in the alias namespace, which is used for disambiguation\&. If an alias source has a string valued name, it will be resolved to a filesystem entry Node, unless it is found in the alias namespace, in which case it is resolved to the matching alias Node\&. As a result, the order of \fBAlias\fR calls is significant\&. An alias can refer to another alias, but only if the other alias has previously been created\&. .PP The \fBValue\fR method returns a Value Node\&. Value nodes are often used for generated data that will not have any corresponding filesystem entry, but will be used to determine whether a build target is out\-of\-date, or to include as part of a build Action\&. Common examples are timestamp strings, revision control version strings and other run\-time generated strings\&. .PP A Value Node can also be the target of a builder\&. .RE .SH "EXTENDING SCONS" .PP SCons is designed to be extensible through provided facilities, so changing the code of SCons itself is only rarely needed to customize its behavior\&. A number of the main operations use callable objects which can be supplemented by writing your own\&. Builders, Scanners and Tools each use a kind of plugin system, allowing you to easily drop in new ones\&. Information about creating Builder Objects and Scanner Objects appear in the following sections\&. The instructions SCons actually uses to construct things are called Actions, and it is easy to create Action Objects and hand them to the objects that need to know about those actions (besides Builders, see \fBAddPostAction\fR, \fBAddPreAction\fR and \fBAlias\fR for some examples of other places that take Actions)\&. Action Objects are also described below\&. Adding new Tool modules is described in Tool Modules .SS "Builder Objects" .PP \fBscons\fR can be extended to build additional 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\&. For output file types \fBscons\fR already knows about, you can usually modify the behavior of premade Builders such as \fBProgram\fR, \fBObject\fR or \fBLibrary\fR by changing the construction variables that control their behavior (\fB$CC\fR, \fB$LINK\fR, etc\&.)\&. In this manner you can, for example, change the compiler to use, which is simpler and less error\-prone than writing a new builder\&. The documentation for each Builder lists which construction variables it uses\&. .PP Builder objects are created using the \fBBuilder\fR factory function\&. Once created, a builder is added to a construction environment by registering it in the \fB$BUILDERS\fR dictionary in that environment (some of the examples in this section illustrate this)\&. Doing so automatically triggers SCons to add a method with the name of the builder to the environment\&. .PP The \fBBuilder\fR function accepts the following keyword arguments: .PP \fIaction\fR .RS 4 The command used to build the target from the source\&. \fIaction\fR may be a string representing a template command line to execute, a list of strings representing the command to execute with 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 Action Objects) or a list of any of the above\&. .sp An action function must accept three arguments: \fIsource\fR, \fItarget\fR and \fIenv\fR\&. \fIsource\fR is a list of source nodes; \fItarget\fR is a list of target nodes; \fIenv\fR is the construction environment to use for context\&. .sp The \fIaction\fR and \fIgenerator\fR arguments must not both be used for the same Builder\&. .RE .PP \fIprefix\fR .RS 4 The prefix to prepend to the target file name\&. \fIprefix\fR may be a string, a function (or other callable) that takes two arguments (a construction environment and a list of sources) and returns a prefix string, or a dictionary specifying a mapping from a specific source suffix (of the first source specified) to a corresponding target prefix string\&. For the dictionary form, both the source suffix (key) and target prefix (value) specifications may use environment variable substitution, and the target prefix may also be a callable object\&. The default target prefix may be indicated by a dictionary entry with a key of \fBNone\fR\&. .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 .\} .RE .PP \fIsuffix\fR .RS 4 The suffix to append to the target file name\&. Specified in the same manner as for \fIprefix\fR above\&. If the suffix is a string, then \fBscons\fR prepends a \*(Aq\&.\*(Aq to the suffix if it\*(Aqs not already there\&. The string returned by the callable object or obtained from the dictionary is untouched, and you need to manually prepend a \*(Aq\&.\*(Aq if one is required\&. .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 \fIensure_suffix\fR .RS 4 If set to a true value, ensures that targets will end in \fIsuffix\fR\&. Thus, the suffix will also be added to any target strings that have a suffix that is not already \fIsuffix\fR\&. The default behavior (also indicated by a false value) is to leave unchanged any target string that looks like it already has a 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=True ) 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 \fIsrc_suffix\fR .RS 4 The expected source file name suffix\&. \fIsrc_suffix\fR may be a string or a list of strings\&. .RE .PP \fItarget_scanner\fR .RS 4 A Scanner object that will be invoked to find implicit dependencies for this target file\&. Use only to specify Scanner objects that find implicit dependencies based on the target file and construction environment, \fInot\fR for implicit dependencies based on source files (use \fIsource_scanner\fR for those)\&. See the section called \(lqScanner Objects\(rq for information about creating your own Scanner objects\&. .RE .PP \fIsource_scanner\fR .RS 4 A Scanner object that will be invoked to find implicit dependencies in any source files used to build this target file\&. Use to specify a scanner to find things like #include lines in source files\&. The pre\-built DirScanner 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 called \(lqScanner Objects\(rq for information about creating your own Scanner objects\&. .RE .PP \fItarget_factory\fR .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 (that is, the default factory is \fBFile\fR)\&. Other useful \fItarget_factory\fR 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 def my_mkdir(target, source, env): # target[0] will be a Dir node for \*(Aqnew_directory\*(Aq 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 \fBMakeDirectory\fR Builder needs to specify an empty source list to make the filename string represent the builder\*(Aqs target\&. SCons assumes a single positional argument to a builder 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 \fIsource_factory\fR .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 (that is, the default factory is \fBFile\fR)\&. Other useful \fIsource_factory\fR 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 def collect(target, source, env): # target[0] will default to a File node for \*(Aqarchive\*(Aq (no target_factory) # source[0] will be a Dir node for \*(Aqdirectory_name\*(Aq CollectBuilder = Builder(action=collect, source_factory=Dir) env = Environment() env\&.Append(BUILDERS={\*(AqCollect\*(Aq: CollectBuilder}) env\&.Collect(\*(Aqarchive\*(Aq, \*(Aqdirectory_name\*(Aq) .fi .if n \{\ .RE .\} .RE .PP \fIemitter\fR .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\&. \fIemitter\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 A function passed as \fIemitter\fR must accept three arguments: \fIsource\fR, \fItarget\fR and \fIenv\fR\&. \fIsource\fR is a list of source nodes, \fItarget\fR is a list of target nodes, \fIenv\fR is the construction environment to use for context\&. .sp 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( action="my_build < $TARGET > $SOURCE", emitter={\*(Aq\&.suf1\*(Aq: e_suf1, \*(Aq\&.suf2\*(Aq: e_suf2} ) .fi .if n \{\ .RE .\} .RE .PP \fImulti\fR .RS 4 Specifies whether this builder is allowed to be called multiple times for the same target file(s)\&. The default is \fBFalse\fR, 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 \fIenv\fR .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 \fIgenerator\fR .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 A function passed as \fIgenerator\fR must accept four arguments: \fIsource\fR, \fItarget\fR, \fIenv\fR and \fIfor_signature\fR\&. \fIsource\fR is a list of source nodes, \fItarget\fR is a list of target nodes, \fIenv\fR is the construction environment to use for context, and \fIfor_signature\fR is a Boolean value that tells the function if it is being called for the purpose of generating a build signature (as opposed to actually executing the command)\&. Since the build signature is used for rebuild determination, the function should omit those elements that do not affect whether a rebuild should be triggered if \fIfor_signature\fR is true\&. .sp 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 \fIsrc_builder\fR .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 \fIsingle_source\fR .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 \fIsource_ext_match\fR .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 \fIsource_ext_match\fR to \fBFalse\fR or some other non\-true value\&. In this case, \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 \fIsource_ext_match\fR prevents \fBscons\fR from exiting with an error due to the mismatched suffixes of foo\&.in and foo\&.extra\&. .sp .if n \{\ .RS 4 .\} .nf b = Builder(action={\*(Aq\&.in\*(Aq: \*(Aqbuild $SOURCES > $TARGET\*(Aq}, source_ext_match=False) env = Environment(BUILDERS={\*(AqMyBuild\*(Aq: b}) env\&.MyBuild(\*(Aqfoo\&.out\*(Aq, [\*(Aqfoo\&.in\*(Aq, \*(Aqfoo\&.extra\*(Aq]) .fi .if n \{\ .RE .\} .RE .PP \fIenv\fR .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 \fIchdir\fR .RS 4 A directory from which scons will execute the action(s) specified for this Builder\&. If the \fIchdir\fR argument is a string or a directory Node, scons will change to the specified directory\&. If the \fIchdir\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 \fIchdir\fR keyword argument\-\-that is, the expanded file names will still be relative to the project top directory, and consequently incorrect relative to the chdir directory\&. Builders created using \fIchdir\fR keyword argument, will need to use construction variable expansions like ${TARGET\&.file} and ${SOURCE\&.file} 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=True) env = Environment(BUILDERS={\*(AqMyBuild\*(Aq : b}) env\&.MyBuild(\*(Aqsub/dir/foo\&.out\*(Aq, \*(Aqsub/dir/foo\&.in\*(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 \fBWarning\fR .ps -1 .br Python only tracks one current directory location, even if there are multiple executing threads\&. This means that use of the \fIchdir\fR argument will \fInot\fR work with SCons in multi\-threaded mode (the \fB\-j\fR option), because individual worker threads spawned by SCons interfere with each other when they start changing directory\&. .sp .5v .RE .RE .PP Any additional keyword arguments supplied when a Builder object is created (that is, when the \fBBuilder\fR 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 such keyword arguments supplied when a Builder object is called will only be associated with the target created by that particular \fBBuilder\fR call (and any other files built as a result of the call)\&. These extra keyword arguments are passed to the following functions: command generator functions, function Actions, and emitter functions\&. .PP When debugging errors in a custom builder method, remember that the builder\*(Aqs Action is executed asynchronously \- the builder call in the SConscript only instructs SCons what you want built, while the actual building is scheduled later (if necessary) by the taskmaster\&. As a result, wrapping a builder call in a try block is not useful, as success in the builder call is not the same as the build itself succeeding\&. If necessary, code a builder\*(Aqs Action to exit with a useful error message indicating the problem in the SConscript file\&. Attempting programmatic recovery from build errors is rarely useful\&. .SS "Action Objects" .PP The \fBBuilder\fR factory function will turn its \fIaction\fR keyword argument into an appropriate internal Action object, as will the \fBCommand\fR function\&. You can also explicitly create Action objects for passing to \fBBuilder\fR, or other functions that take actions as arguments, by calling the \fBAction\fR factory function\&. This may more efficient when multiple Builder objects need to do the same thing rather than letting each of those Builder objects create a separate Action object\&. It also allows more flexible configuration of an Action object\&. For example, to control the message printed when the action is taken you need to create the action object using \fBAction\fR\&. .PP The Action factory function returns an appropriate object for the action represented by the type of the \fIaction\fR argument (the first positional parameter): .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If \fIaction\fR is already an Action object, the object is simply returned\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If \fIaction\fR is a string, a command\-line Action is returned\&. If such a string begins with @, the command line is not printed\&. If the string begins with hyphen (\-), the exit status from the specified command is ignored, allowing execution to continue even if the command reports failure: .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 .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If \fIaction\fR 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 within the list is itself a list, the embedded list is taken as the command and arguments to be executed via the command line\&. This allows white space to be enclosed in an argument rather than taken as a separator 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 .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If \fIaction\fR is a callable object, a Function Action is returned\&. The callable must accept three keyword arguments: \fItarget\fR, \fIsource\fR and \fIenv\fR\&. \fItarget\fR is a Node object representing the target file, \fIsource\fR is a Node object representing the source file and \fIenv\fR is the construction environment used for building the target file\&. .sp The \fItarget\fR and \fIsource\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 .\} .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If \fIaction\fR is not one of the above types, no action object is generated and \fBAction\fR returns \fBNone\fR\&. .RE .PP The environment method form \fBenv\&.Action\fR will expand construction variables in any argument strings, including \fIaction\fR, at the time it is called, using the construction variables in the construction environment through which it was called\&. The global function form \fBAction\fR delays variable expansion until the Action object is actually used\&. .PP The optional second argument to \fBAction\fR is used to control the output which is printed when the Action is actually performed\&. If this parameter is omitted, or if the value is 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 following argument types are accepted: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If the second argument is a string, or if the \fIcmdstr\fR keyword argument is supplied, the string defines what is printed\&. Substitution is performed on the string before it is printed\&. The string typically contains substitutable 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\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If the second argument is a function, or if the \fIstrfunction\fR keyword argument is supplied, the function will be called to obtain the string to be printed when the action is performed\&. The function must accept three keyword arguments: \fItarget\fR, \fIsource\fR and \fIenv\fR, with the same interpretation as for a callable \fIaction\fR argument above\&. The function is responsible for handling any required substitutions\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If the second argument is \fBNone\fR, or if cmdstr=None is supplied, output is suppressed entirely\&. .RE .PP The \fIcmdstr\fR and \fIstrfunction\fR keyword arguments may not both be supplied in a single call to \fBAction\fR .PP Printing of action strings is affected by the setting of \fB$PRINT_CMD_LINE_FUNC\fR\&. .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 Any additional positional arguments, if present, may either be construction variables or lists of construction variables whose values will be included in the signature of the Action (the build signature) when deciding whether a target should be rebuilt because the action changed\&. Such variables may also be specified using the \fIvarlist\fR keyword parameter; both positional and keyword forms may be present, and will be 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 with open(target[0], \*(Aqw\*(Aq) as f: f\&.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 factory function can be passed the following optional keyword arguments to modify the Action object\*(Aqs behavior: .PP \fIchdir\fR .RS 4 If \fIchdir\fR is true (the default is \fBFalse\fR), SCons will change directories before executing the action\&. If the value of \fIchdir\fR is a string or a directory Node, SCons will change to the specified directory\&. Otherwise, if \fIchdir\fR evaluates true, 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 \fIchdir\fR parameter \- that is, the expanded file names will still be relative to the project top directory, and consequently incorrect relative to the chdir directory\&. Builders created using \fIchdir\fR keyword argument, will need to use construction variable expansions like ${TARGET\&.file} and ${SOURCE\&.file} to use just the filename portion of the targets and source\&. Example: .sp .if n \{\ .RS 4 .\} .nf a = Action("build < ${SOURCE\&.file} > ${TARGET\&.file}", chdir=True) .fi .if n \{\ .RE .\} .RE .PP \fIexitstatfunc\fR .RS 4 If provided, must be a callable which accepts a single parameter, the exit status (or return value) from the specified action, and which returns 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 succeeds\&. Example: .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 .\} .RE .PP \fIbatch_key\fR .RS 4 If provided, indicates 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 Visual C++\&. If the \fIbatch_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 \fB$CHANGED_SOURCES\fR construction variable (and possibly \fB$CHANGED_TARGETS\fR as well) to only pass to the command line those sources that have actually changed since their targets were built\&. Example: .sp .if n \{\ .RS 4 .\} .nf a = Action(\*(Aqbuild $CHANGED_SOURCES\*(Aq, batch_key=True) .fi .if n \{\ .RE .\} .sp The \fIbatch_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 \fIbatch_key\fR function must accept four parameters: \fIaction\fR, \fIenv\fR, \fItarget\fR and \fIsource\fR\&. The first parameter, \fIaction\fR, is the active action object\&. The second parameter, \fIenv\fR, is the construction environment configured for the target\&. The \fItarget\fR and \fIsource\fR parameters are the lists of targets and sources for the 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 \fIbatch_key\fR function may decide to return the value of a specific construction variable from \fIenv\fR which will cause \fBscons\fR to batch\-build targets with matching values of that construction variable, or perhaps return the Python \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 .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBMiscellaneous Action Functions\fR .RS 4 .PP SCons supplies Action 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 rather are factory functions which return an Action object that can be executed at the appropriate time\&. .PP 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: .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 \fBenv\&.Command\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( target=\*(Aqfoo\&.out\*(Aq, source=\*(Aqfoo\&.in\*(Aq, action=[ Mkdir(\*(Aq$TMPBUILD\*(Aq), Copy(\*(Aq$TMPBUILD\*(Aq, \*(Aq${SOURCE\&.dir}\*(Aq), "cd $TMPBUILD && make", Delete(\*(Aq$TMPBUILD\*(Aq), ], ) .fi .if n \{\ .RE .\} .PP \fBChmod\fR(\fIdest, mode\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 POSIX \fBchmod\fR 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 .\} .sp The behavior of \fBChmod\fR is limited on Windows and on WebAssembly platforms, see the notes in the Python documentation for \m[blue]\fBos\&.chmod\fR\m[]\&\s-2\u[8]\d\s+2, which is the underlying function\&. .RE .PP \fBCopy\fR(\fIdest, src\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\&. If \fIsrc\fR is a list, \fIdest\fR must be a directory if it already exists\&. 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 \fBDelete\fR(\fIentry, [must_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 to a true value, then a Python error will be raised if the specified entry does not exist; the default is false, 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, action=[ Delete(\*(Aq${TARGET\&.dir}\*(Aq), MyBuildAction, ], ) Execute(Delete(\*(Aqfile_that_must_exist\*(Aq, must_exist=True)) .fi .if n \{\ .RE .\} .RE .PP \fBMkdir\fR(\fIname\fR) .RS 4 Returns an Action that creates the directory \fIname\fR and all needed intermediate directories\&. \fIname\fR may also be a list of directories to create\&. Examples: .sp .if n \{\ .RS 4 .\} .nf Execute(Mkdir(\*(Aq/tmp/outputdir\*(Aq)) env\&.Command( \*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq, action=[ 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 \fBMove\fR(\fIdest, src\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, action=[MyBuildAction, Move(\*(Aq$TARGET\*(Aq, \*(Aqfile_created_by_MyBuildAction\*(Aq)], ) .fi .if n \{\ .RE .\} .RE .PP \fBTouch\fR(\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, action=[MyBuildAction, Touch(\*(Aq$TARGET\*(Aq)]) .fi .if n \{\ .RE .\} .RE .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBVariable Substitution\fR .RS 4 .PP Before executing a command, \fBscons\fR performs parameter expansion (substitution) on the string that makes up the action part of the builder\&. The format of a substitutable parameter is ${\fIexpression\fR}\&. If \fIexpression\fR refers to a variable, the braces in ${\fIexpression\fR} can be omitted \fIunless\fR the variable name is immediately followed by a character that could either be interpreted as part of the name, or is Python syntax such as \fB[\fR (for indexing/slicing) or \fB\&.\fR (for attribute access \- see Special Attributes below)\&. .PP If \fIexpression\fR refers to a construction variable, it (including the $ or ${ }) is replaced with the value of that variable in the construction environment at the time of execution\&. If \fIexpression\fR looks like a variable name but is not defined in the construction environment it is replaced with an empty string\&. If \fIexpression\fR refers to one of the Special Variables (see below) the corresponding value of the variable is substituted\&. \fIexpression\fR may also be a Python expression to be evaluated\&. See Python Code Substitution below for a description\&. .PP SCons uses the following rules when converting construction variables into command line strings: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If the value is a string it is interpreted as space delimited command line arguments\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} If 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 .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Anything that is not a list or string is converted to a string and interpreted as a single command line argument\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} 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\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} For a literal \fB$\fR use \fB$$\fR\&. For example, $$FOO will be left in the final string as $FOO\&. .RE .PP When a build action is executed, a hash of the command line is saved, together with other information about the target(s) built by the action, for future use in rebuild determination\&. This is called the build signature (or build action signature)\&. The escape sequence \fB$(\fR \fIsubexpression\fR \fB$)\fR may be used to indicate parts of a command line that may change without causing a rebuild\-\-that is, which are not to be included when calculating the build signature\&. All text from \fB$(\fR up to and including the matching \fB$)\fR will be removed from the command line before it is added to the build signature while only the \fB$(\fR and \fB$)\fR will be removed before the command is executed\&. For example, the command line string: .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 build signature added to any target files would be computed from: .sp .if n \{\ .RS 4 .\} .nf echo Last build occurred \&. > $TARGET .fi .if n \{\ .RE .\} .PP While construction variables are normally directly substituted, if a construction variable has a value which is a callable Python object (a function, or a class with a __call__ method), that object is called during substitution\&. The callable must accept four arguments: \fItarget\fR, \fIsource\fR, \fIenv\fR and \fIfor_signature\fR\&. \fIsource\fR is a list of source nodes, \fItarget\fR is a list of target nodes, \fIenv\fR is the construction environment to use for context, and \fIfor_signature\fR is a boolean value that tells the callable if it is being called for the purpose of generating a build signature\&. Since the build signature is used for rebuild determination, variable elements that do not affect whether a rebuild should be triggered should be omitted from the returned string if \fIfor_signature\fR is true\&. See \fB$(\fR and \fB$)\fR above for the syntax\&. .PP SCons will insert whatever the callable 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 As a reminder, substitution happens when $BAR is actually used in a builder action\&. The value of env[\*(AqBAR\*(Aq] will be exactly as it was set: "$FOO baz"\&. This can make debugging tricky, as the substituted result is not available at the time the SConscript files are being interpreted and thus not available to the print function\&. However, you can perform the substitution on demand by calling the \fBenv\&.subst\fR method for this purpose\&. .PP You can use this feature to pass arguments to a callable variable by creating a callable class that stores passed arguments in the instance, and then uses them (in the __call__ method) when the instance 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: 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 .\} .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBSubstitution: Special Variables\fR .RS 4 .PP Besides regular construction variables, scons provides the following Special Variables for use in expanding commands: .PP \fB$CHANGED_SOURCES\fR .RS 4 The file names of all sources of the build command that have changed since the target was last built\&. .RE .PP \fB$CHANGED_TARGETS\fR .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 \fB$SOURCE\fR .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 \fB$SOURCES\fR .RS 4 The file names of the sources of the build command\&. .RE .PP \fB$TARGET\fR .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 \fB$TARGETS\fR .RS 4 The file names of all targets being built\&. .RE .PP \fB$UNCHANGED_SOURCES\fR .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 \fB$UNCHANGED_TARGETS\fR .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 These names are reserved and may not be assigned to or used as construction variables\&. SCons computes them in a context\-dependent manner and they are not retrieved from a construction environment\&. .PP For example, the following builder call: .sp .if n \{\ .RS 4 .\} .nf env = Environment(CC=\*(Aqcc\*(Aq) env\&.Command( target=[\*(Aqfoo\*(Aq], source=[\*(Aqfoo\&.c\*(Aq, \*(Aqbar\&.c\*(Aq], action=\*(Aq@echo $CC \-c \-o $TARGET $SOURCES\*(Aq ) .fi .if n \{\ .RE .\} .PP would produce the following output: .sp .if n \{\ .RS 4 .\} .nf cc \-c \-o foo foo\&.c bar\&.c .fi .if n \{\ .RE .\} .PP In the previous example, a string ${SOURCES[1]} would expand to: bar\&.c\&. .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBSubstitution: Special Attributes\fR .RS 4 .PP A variable name may have the following modifiers appended within the enclosing curly braces to access properties of the interpolated string\&. These are known as special attributes\&. .RS 4 \fIbase\fR \- The base path of the file name, including the directory path but excluding any suffix\&. .RE .RS 4 \fIdir\fR \- The name of the directory in which the file exists\&. .RE .RS 4 \fIfile\fR \- The file name, minus any directory portion\&. .RE .RS 4 \fIfilebase\fR \- Like \fIfile\fR but minus its suffix\&. .RE .RS 4 \fIsuffix\fR \- Just the file suffix\&. .RE .RS 4 \fIabspath\fR \- The absolute path name of the file\&. .RE .RS 4 \fIrelpath\fR \- The path name of the file relative to the project top directory\&. .RE .RS 4 \fIposix\fR \- The path with directories separated by forward slashes (\fB/\fR)\&. Sometimes necessary on Windows systems when a path references a file on other (POSIX) systems\&. .RE .RS 4 \fIwindows\fR \- The path with directories separated by backslashes (\fB\e\e\fR)\&. Sometimes necessary on POSIX\-style systems when a path references a file on other (Windows) systems\&. \fIwin32\fR is a (deprecated) synonym for \fIwindows\fR\&. .RE .RS 4 \fIsrcpath\fR \- 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 .RS 4 \fIsrcdir\fR \- 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 .RS 4 \fIrsrcpath\fR \- 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 .RS 4 \fIrsrcdir\fR \- 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 ${TARGET\&.relpath} => sub/dir/file\&.x $TARGET => \&.\&./dir2/file\&.x ${TARGET\&.abspath} => /top/dir2/file\&.x ${TARGET\&.relpath} => \&.\&./dir2/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 Some modifiers can be combined, like ${TARGET\&.srcpath\&.base), ${TARGET\&.file\&.suffix}, etc\&. .RE .sp .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBPython Code Substitution\fR .RS 4 .PP If a substitutable expression using the notation ${\fIexpression\fR} does not appear to match one of the other substitution patterns, it is evaluated as a Python expression\&. This uses Python\*(Aqs \fBeval\fR function, with the \fIglobals\fR parameter set to the current environment\*(Aqs set of construction variables, and the result substituted in\&. So in the following case: .sp .if n \{\ .RS 4 .\} .nf env\&.Command( \*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq, "echo ${COND==1 and \*(AqFOO\*(Aq or \*(AqBAR\*(Aq} > $TARGET" ) .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 complete 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] = 1 env[\*(AqFOO\*(Aq] = [\*(Aqfoo1\*(Aq, \*(Aqfoo2\*(Aq] env[\*(AqBAR\*(Aq] = \*(Aqbarbar\*(Aq env\&.Command( \*(Aqfoo\&.out\*(Aq, \*(Aqfoo\&.in\*(Aq, "echo ${COND==1 and FOO or BAR} > $TARGET" ) .fi .if n \{\ .RE .\} .PP will execute: .sp .if n \{\ .RS 4 .\} .nf echo foo1 foo2 > foo\&.out .fi .if n \{\ .RE .\} .PP In point of fact, Python expression evaluation is how the special attributes are substituted: they are simply attributes of the Python objects that represent \fB$TARGET\fR, \fB$SOURCES\fR, etc\&., which SCons passes to \fBeval\fR which returns the value\&. .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBCaution\fR .ps -1 .br .PP Use of the Python \fBeval\fR function is considered to have security implications, since, depending on input sources, arbitrary unchecked strings of code can be executed by the Python interpreter\&. Although SCons makes use of it in a somewhat restricted context, you should be aware of this issue when using the ${python\-expression\-for\-subst} form\&. .sp .5v .RE .RE .SS "Scanner Objects" .PP Scanner objects are used to scan specific file types for implicit dependencies, for example embedded preprocessor/compiler directives that cause other files to be included during processing\&. SCons has a number of pre\-built Scanner objects, so it is usually only necessary to set up Scanners for new file types\&. You do this by calling the \fBScanner\fR factory function\&. \fBScanner\fR accepts the following arguments\&. Only \fIfunction\fR is required; the rest are optional: .PP \fIfunction\fR .RS 4 A function which can process ("scan") a given Node (usually a file) and return a list of Nodes representing any implicit dependencies (usually files) which will be tracked for the Node\&. The function must accept three required arguments, \fInode\fR, \fIenv\fR and \fIpath\fR, and an optional fourth, \fIarg\fR\&. \fInode\fR is the internal SCons node representing the file to scan, \fIenv\fR is the construction environment to use during the scan, and \fIpath\fR is a tuple of directories that can be searched for files, as generated by the optional scanner \fIpath_function\fR\&. If the \fIargument\fR parameter was supplied when the Scanner object was created, it is passed as the \fIarg\fR parameter to the scanner function when it is called\&. Since \fIargument\fR is optional, the scanner function \fImay\fR be called without an \fIarg\fR parameter\&. .sp The scanner function can make use of \fBstr\fR(\fInode\fR) to fetch the name of the file, \fInode\fR\&.dir to fetch the directory the file is in, \fInode\fR\&.get_contents() to fetch the contents of the file as bytes or \fInode\fR\&.get_text_contents() to fetch the contents of the file as text\&. .sp The scanner function should account for any directories listed in the \fIpath\fR parameter when determining the existence of possible dependencies\&. External tools such as the C/C++ preprocessor are given lists of directories to search for source file inclusion directives (e\&.g\&. #include "myheader\&.h")\&. That list is generated from the relevant path variable (e\&.g\&. \fB$CPPPATH\fR for C/C++)\&. The Scanner can be directed to pass the same list on to the scanner function via the \fIpath\fR parameter so it can search in the same places\&. The Scanner is enabled to pass this list via the \fIpath_function\fR argument at Scanner creation time\&. .sp Instead of a scanner function, you can supply a dictionary as the \fIfunction\fR parameter\&. The dictionary must map keys (such as file suffixes) to other Scanner objects\&. A Scanner created this way serves as a dispatcher: the Scanner\*(Aqs \fIskeys\fR parameter is automatically populated with the dictionary\*(Aqs keys, indicating that the Scanner handles Nodes which would be selected by those keys; the mapping is then used to pass the file on to a different Scanner that would not have been selected to handle that Node based on its own \fIskeys\fR\&. .sp Note that the file to scan is \fInot\fR guaranteed to exist at the time the scanner is called \- it could be a generated file which has not been generated yet \- so the scanner function must be tolerant of that\&. .sp While many scanner functions operate on source code files by looking for known patterns in the code, they can really do anything they need to\&. For example, the \fBProgram\fR Builder is assigned a \fItarget_scanner\fR which examines the list of libraries supplied for the build (\fB$LIBS\fR) and decides whether to add them as dependencies, it does not look \fIinside\fR the built binary\&. .sp It is up to the scanner function to decide whether or not to generate an SCons dependency for candidates identified by scanning\&. Dependencies are a key part of SCons operation, enabling both rebuild determination and correct ordering of builds\&. It is particularly important that generated files which are dependencies are added into the Node graph, or use\-before\-create failures are likely\&. However, not everything may need to be tracked as a dependency\&. In some cases, implementation\-provided header files change infrequently but are included very widely, so tracking them in the SCons node graph could become quite expensive for limited benefit \- consider for example the C standard header file string\&.h\&. The scanner function is not passed any special information to help make this choice, so the decision\-making encoded in the scanner function must be carefully considered\&. .RE .PP \fIname\fR .RS 4 The name to use for the Scanner\&. This is mainly used to identify the Scanner internally\&. The default value is "NONE"\&. .RE .PP \fIargument\fR .RS 4 If specified, will be passed to the scanner function \fIfunction\fR and the path function \fIpath_function\fR when called, as the optional parameter each of those functions takes\&. .RE .PP \fIskeys\fR .RS 4 Scanner key(s) indicating the file types this scanner is associated with\&. Used internally to select an appropriate scanner\&. 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 \fIskeys\fR is a string, it will be expanded into a list by the current environment\&. .RE .PP \fIpath_function\fR .RS 4 If specified, a function to generate paths to pass to the scanner function to search while generating dependencies\&. The function must take 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 the value of \fIargument\fR if it was supplied when the Scanner was created (since \fIargument\fR is optional, the function may be called without this argument, the \fIpath_function\fR should be prepared for this)\&. Must return a tuple of directories that can be searched for files to be returned by this Scanner object\&. .sp The \fBFindPathDirs\fR function can be called to return a ready\-made \fIpath_function\fR for a given construction variable name, which is often easier than writing your own function from scratch\&. For example, \fBpath_function=FindPathDirs(\*(AqCPPPATH\*(Aq)\fR means the scanner function will be called with the paths extracted from \fB$CPPPATH\fR in the construction environment \fIenv\fR, and passed as the \fIpath\fR parameter to the scanner function\&. .RE .PP \fInode_class\fR .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 function supplied by the \fInode_factory\fR argument\&. A value of \fBNone\fR can be supplied to indicate no conversion; the default is to return File nodes\&. .RE .PP \fInode_factory\fR .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, as indicated by \fInode_class\fR\&. .RE .PP \fIscan_check\fR .RS 4 A 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 \fIrecursive\fR .RS 4 Specifies whether this scanner should be re\-invoked on the dependency files returned by the scanner\&. If omitted, the Node subsystem will only invoke the scanner on the file being scanned and not recurse\&. Recursion is needed when the files returned by the scanner may themselves contain further file dependencies, as in the case of preprocessor #include lines\&. A value that evaluates true enables recursion; \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 Once created, a Scanner can be added to an environment by setting it in the \fB$SCANNERS\fR list, which automatically triggers SCons to also add it to the environment as a method\&. However, usually a scanner is not truly standalone, but needs to be plugged in to the existing selection mechanism for deciding how to scan source files based on filename extensions\&. For this, SCons has a global SourceFileScanner object that is used by the \fBObject\fR, \fBSharedObject\fR and \fBStaticObject\fR builders to decide which scanner should be used\&. You can use the SourceFileScanner\&.add_scanner() method to add your own Scanner object to the SCons 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 .\} .SS "Tool Modules" .PP Custom tools can be added to a project either by placing them in the site_tools subdirectory of a configured site directory, or in a location specified by the \fItoolpath\fR keyword argument to \fBEnvironment\fR\&. You have to arrange to call a tool to put it into effect, either as part of the list given to the \fItools\fR keyword argument at construction environment initialization, or by calling \fBenv\&.Tool\fR\&. .PP The \fItoolpath\fR parameter takes a list of path strings, and the \fItools\fR parameter takes a list of tools, which are often strings: .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 module foo in directory tools and in the standard locations, as well as using the ordinary default tools for the platform\&. .PP When looking up tool specification modules, directories specified via \fItoolpath\fR are considered before the existing tool path (site_tools subdirectories of the default or specified site directories), which are in turn considered before built\-in tools\&. For example, adding a tool specification module gcc\&.py to the toolpath directory would override the built\-in gcc tool\&. The \fItoolpath\fR is saved in the environment and will be used by subsequent calls to the \fBenv\&.Tool\fR method, as well as by \fBenv\&.Clone\fR\&. .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 A tool specification module is a form of Python module, looked up internally using the Python import mechanism, so a tool can consist either of a single Python file taking the name of the tool (e\&.g\&. mytool\&.py) or a directory taking the name of the tool (e\&.g\&. mytool/) which contains at least an __init__\&.py file\&. A tool specification module has two required entry points: .PP \fBgenerate\fR(\fIenv, **kwargs\fR) .RS 4 Modify the construction environment \fIenv\fR to set up necessary construction variables, Builders, Emitters, etc\&., so the facilities represented by the tool can be executed\&. Take care not to overwrite construction variables which may have been explicitly set by the user; retain and/or append instead\&. For example: .sp .if n \{\ .RS 4 .\} .nf def generate(env): \&.\&.\&. if \*(AqMYTOOL\*(Aq not in env: env[\*(AqMYTOOL\*(Aq] = env\&.Detect("mytool") flags = env\&.get(\*(AqMYTOOLFLAGS\*(Aq, SCons\&.Util\&.CLVar()) env\&.AppendUnique(MYTOOLFLAGS=\*(Aq\-\-myarg\*(Aq) \&.\&.\&. .fi .if n \{\ .RE .\} .sp The \fBgenerate\fR function may use any keyword arguments that the user supplies via \fIkwargs\fR to vary its initialization\&. .RE .PP \fBexists\fR(\fIenv\fR) .RS 4 Return a truthy value if the tool can be called in the context of \fIenv\fR, else return a falsy value\&. Usually this means looking up one or more known programs using the \fIPATH\fR from the supplied \fIenv\fR, but the tool can make the \fIexists\fR decision in any way it chooses\&. .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 .PP At the moment, user\-added tools do not automatically have their \fBexists\fR function called\&. As a result, it is recommended that the \fBgenerate\fR function be defensively coded \- that is, do not rely on any necessary existence checks already having been performed\&. This is expected to be a temporary limitation, and the \fBexists\fR function should still be provided\&. .sp .5v .RE .PP An element of the \fItools\fR list may also be a function or other callable object (including a Tool object returned by a previous call to \fBTool\fR) in which case the \fBEnvironment\fR function will directly call that object to update the new construction environment\&. No tool lookup is done in this case\&. .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 An element of the \fItools\fR list may also be a two\-element list or tuple of the form (toolname, kw_dict)\&. SCons searches for the tool specification module \fItoolname\fR 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 those 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, **kwargs): # Sets MY_TOOL to the value of keyword \*(Aqarg1\*(Aq or \*(Aq1\*(Aq if not supplied env[\*(AqMY_TOOL\*(Aq] = kwargs\&.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 specification (\fBmy_tool\fR in the example) can use the \fB$PLATFORM\fR variable from the construction environment it is passed to customize the tool for different platforms\&. .PP Tools can be "nested" \- that is, they can be located within a subdirectory in the toolpath\&. A nested tool name uses a dot to represent a directory separator .sp .if n \{\ .RS 4 .\} .nf # namespaced builder env = Environment(ENV=os\&.environ\&.copy(), 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 .\} .SH "SYSTEM-SPECIFIC BEHAVIOR" .PP \fBscons\fR 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 \fBscons\fR handles the upper\-case \&.C file suffix differently, depending on the capabilities of the underlying system\&. On a case\-sensitive system such as Linux or UNIX, \fBscons\fR treats a file with a \&.C suffix as a C++ source file\&. On a case\-insensitive system such as Windows, \fBscons\fR treats a file with a \&.C suffix as a C source file\&. .SS "Fortran File Suffixes" .PP There are several ways source file suffixes impact the behavior of SCons when working with Fortran language code (not all are system\-specific, but they are included here for completeness)\&. .PP As the Fortran language has evolved through multiple standards editions, projects might have a need to handle files from different language generations differently\&. To this end, SCons dispatches to a different compiler dialect setup (expressed as a set of construction variables) depending on the file suffix\&. By default, all of these setups start out the same, but individual construction variables can be modified as needed to tune a given dialect\&. Each of these dialects has a tool specification module whose documentation describes the construction variables associated with that dialect: \&.f (as well as \&.for and \&.ftn) in fortran; (construction variables start with FORTRAN) \&.f77 in f77; (construction variables start with F77) \&.f90 in f90; (construction variables start with F90) \&.f95 in f95; (construction variables start with F95) \&.f03 in f03; (construction variables start with F03) \&.f08 in f08 (construction variables start with F08)\&. .PP While SCons recognizes multiple internal dialects based on filename suffixes, the convention of various available Fortran compilers is to assign an actual meaning to only two of these suffixes: \&.f (as well as \&.for and \&.ftn) refers to the fixed\-format source code that was the only available option in FORTRAN 77 and earlier, and \&.f90 refers to free\-format source code which became available as of the Fortran 90 standard\&. Some compilers recognize suffixes which correspond to Fortran specifications later than F90 as equivalent to \&.f90 for this purpose, while some do not \- check the documentation for your compiler\&. An occasionally suggested policy suggestion is to use only \&.f and \&.f90 as Fortran filename suffixes\&. The fixed/free form determination can usually be controlled explicitly with compiler flags (e\&.g\&. \fB\-ffixed\-form\fR for gfortran), overriding any assumption that may be made based on the source file suffix\&. .PP The source file suffix does not imply conformance with the similarly\-named Fortran standard \- a suffix of \&.f08 does not mean you are compiling specifically for Fortran 2008\&. Normally, compilers provide command\-line options for making this selection (e\&.g\&. \fB\-std=f2008\fR for gfortran)\&. .PP For dialects from F90 on (including the generic FORTRAN dialect), a suffix of \&.mod is recognized for Fortran modules\&. These files are a side effect of compiling a Fortran source file containing module declarations, and must be available when other code which declares that it uses the module is processed\&. SCons does not currently have integrated support for submodules, introduced in the Fortran 2008 standard \- the invoked compiler will produce results, but SCons will not recognize \&.smod files as tracked objects\&. .PP On a case\-sensitive system such as Linux or UNIX, a file with a an upper\-cased suffix from the set \&.F, \&.FOR, \&.FTN, \&.F90, \&.F95, \&.F03 and \&.F08 is treated as a Fortran source file which shall first be run through the standard C preprocessor\&. The lower\-cased versions of these suffixes do not trigger this behavior\&. On systems which do not distinguish between upper and lower case in filenames, this behavior is not available, but files suffixed with either \&.FPP or \&.fpp are always passed to the preprocessor first\&. This matches the convention of \fBgfortran\fR from the GNU Compiler Collection, and also followed by certain other Fortran compilers\&. For these two suffixes, the generic \fIFORTRAN\fR dialect will be selected\&. .PP SCons itself does not invoke the preprocessor, that is handled by the compiler, but it adds construction variables which are applicable to the preprocessor run\&. You can see this difference by examining \fB$FORTRANPPCOM\fR and \fB$FORTRANPPCOMSTR\fR which are used instead of \fB$FORTRANCOM\fR and \fB$FORTRANCOMSTR\fR for that dialect\&. .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 POSIX\-like environment\&. The Cygwin tools, including Cygwin Python, do this, in part, by sharing an ability to interpret POSIX\-style 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 understand the Cygwin path name semantics\&. This means that using a native Windows version of Python to build compiled programs using Cygwin tools (such as gcc, bison and flex) 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 guidelines: When using Cygwin\*(Aqs gcc for compiling, use the Cygwin\-supplied Python interpreter to run \fBscons\fR; when using Microsoft Visual C++ (or some other "native" Windows compiler) use the python\&.org, Microsoft Store, ActiveState or other native version of Python to run \fBscons\fR\&. .PP This discussion largely applies to the msys2 environment as well (with the use of the mingw compiler toolchain), in particular the recommendation to use the msys2 version of Python if running \fBscons\fR from inside an msys2 shell\&. .SS "Windows: scons\&.bat file" .PP On Windows, if \fBscons\fR is executed via a wrapper scons\&.bat batch file, there are (at least) two ramifications\&. Note this is no longer the default \- \fBscons\fR installed via Python\*(Aqs \fBpip\fR installer will have a \fBscons\&.exe\fR which does not have these limitations: .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, otherwise the Windows command shell will consume those as arguments to itself, not to \fBscons\fR: .sp .if n \{\ .RS 4 .\} .nf \fBscons "FOO=BAR" "BAZ=BLEH"\fR .fi .if n \{\ .RE .\} .PP Second, the Cygwin shell does not recognize typing \fBscons\fR at the command line prompt as referring to this wrapper\&. You can work around this either by executing \fBscons\&.bat\fR (including the extension) from the Cygwin command line, or by creating a wrapper shell script named scons which invokes scons\&.bat\&. .SS "MinGW" .PP The MinGW bin directory must be in your \fBPATH\fR environment variable or the \fI[\*(AqENV\*(Aq][\*(AqPATH\*(Aq]\fR construction variable for \fBscons\fR to detect and use the MinGW tools\&. When running under the native Windows Python interpreter, \fBscons\fR will prefer the MinGW tools over the Cygwin tools, if they are both installed, regardless of the order of the bin directories in the \fBPATH\fR variable\&. If you have both MSVC and MinGW installed and you want to use MinGW instead of MSVC, then you must explicitly tell \fBscons\fR to use MinGW by passing tools=[\*(Aqmingw\*(Aq] to the \fBEnvironment\fR function, because \fBscons\fR will prefer the MSVC tools over the MinGW tools\&. .SH "ENVIRONMENT" .PP In general, \fBscons\fR 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 \fBscons\fR itself if set: .PP \fBSCONS_LIB_DIR\fR .RS 4 Specifies the directory that contains the \fBscons\fR Python module directory\&. Normally \fBscons\fR can deduce this, but in some circumstances, such as working with a source release, it may be necessary to specify (for example, /home/aroach/scons\-src\-0\&.01/src/engine)\&. .RE .PP \fBSCONSFLAGS\fR .RS 4 A string containing options that will be used by \fBscons\fR in addition to those passed on the command line\&. Can be used to reduce frequent retyping of common options\&. The contents of \fBSCONSFLAGS\fR are considered before any passed command line options, so the command line can be used to override \fBSCONSFLAGS\fR options if necessary\&. .RE .PP \fBSCONS_CACHE_MSVC_CONFIG\fR .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 cache file, to give these settings persistence across \fBscons\fR invocations\&. Generating this information is relatively expensive, so using this option may aid performance where \fBscons\fR is run often, such as Continuous Integration setups\&. .sp If set to a True\-like value ("1", "true" or "True") will cache to a file named scons_msvc_cache\&.json in the user\*(Aqs home directory\&. If set to a pathname, will use that pathname for the cache\&. .sp Note: this implementation may still be somewhat fragile\&. In case of problems, remove the cache file \- recreating with fresh info normally resolves any issues\&. SCons ignores failures reading or writing the cache file and will silently revert to non\-cached behavior in such cases\&. .sp \fINew in 3\&.1 (experimental)\&. The default cache file name was changed to its present value in 4\&.4, and contents were expanded\&.\fR .RE .SH "SEE ALSO" .RS 4 The SCons User Guide at \m[blue]\fB\%https://scons.org/doc/production/HTML/scons-user.html\fR\m[] .RE .RS 4 The SCons Design Document (old) .RE .RS 4 The SCons Cookbook at \m[blue]\fB\%https://scons-cookbook.readthedocs.io\fR\m[] for examples of how to solve various problems with SCons\&. .RE .RS 4 SCons source code \m[blue]\fBon GitHub\fR\m[]\&\s-2\u[9]\d\s+2 .RE .RS 4 The SCons API Reference \m[blue]\fB\%https://scons.org/doc/production/HTML/scons-api/index.html\fR\m[] (for internal details) .RE .SH "AUTHORS" .PP Originally: Steven Knight knight@baldmt\&.com and Anthony Roach aroach@electriceyeball\&.com\&. .PP Since 2010: The SCons Development Team scons\-dev@python\&.org\&. .SH "AUTHOR" .PP \fBThe SCons Development Team\fR .SH "COPYRIGHT" .br Copyright \(co 2001 - 2026 The SCons Foundation .br .SH "NOTES" .IP " 1." 4 LLVM specification .RS 4 \%https://clang.llvm.org/docs/JSONCompilationDatabase.html .RE .IP " 2." 4 JEP 313 .RS 4 \%https:openjdk.java.net/jeps/313 .RE .IP " 3." 4 https://learn.microsoft.com/en-us/cpp/build/reference/vcxproj-file-structure .RS 4 \%https://learn.microsoft.com/en-us/cpp/build/reference/vcxproj-file-structure .RE .IP " 4." 4 https://learn.microsoft.com/en-us/visualstudio/extensibility/internals/solution-dot-sln-file .RS 4 \%https://learn.microsoft.com/en-us/visualstudio/extensibility/internals/solution-dot-sln-file .RE .IP " 5." 4 optparse documentation .RS 4 \%https://docs.python.org/3/library/optparse.html .RE .IP " 6." 4 If \fIno_progress\fR is set via \fBSetOption\fR in an SConscript file (but not if set in a site_init.py file) there will still be an initial status message about reading SConscript files since SCons has to start reading them before it can see the \fBSetOption\fR. .IP " 7." 4 http://www.opensource.org/licenses/alphabetical .RS 4 \%http://www.opensource.org/licenses/alphabetical .RE .IP " 8." 4 os.chmod .RS 4 \%https://docs.python.org/3/library/os.html#os.chmod .RE .IP " 9." 4 on GitHub .RS 4 \%https://github.com/SCons/scons .RE