1SCONS(1) SCons 4.2.0 SCONS(1)
2
3
4
6 scons - a software construction tool
7
9 scons [options...] [name=val...] [targets...]
10
12 scons orchestrates the construction of software (and other tangible
13 products such as documentation files) by determining which component
14 pieces must be built or rebuilt and invoking the necessary commands to
15 build them. SCons offers many features to improve developer
16 productivity such as parallel builds, caching of build artifacts,
17 automatic dependency scanning, and a database of information about
18 previous builds so details do not have to be recalculated each run.
19
20 scons requires Python 3.5 or later to run; there should be no other
21 dependencies or requirements.
22 Support for Python 3.5 is deprecated since SCons 4.2 and will be
23 dropped in a future release. The CPython project has retired 3.5:
24 https://www.python.org/dev/peps/pep-0478.
25
26 You set up an SCons build system by writing a script that describes
27 things to build (targets), and, if necessary, the rules to build those
28 files (actions). SCons comes with a collection of Builder methods
29 which apply premade actions for building many common software
30 components such as executable programs, object files and libraries, so
31 that for many software projects, only the targets and input files
32 (sources) need be specified in a call to a builder. scons thus can
33 operate at a level of abstraction above that of pure files. For example
34 if you specify a library target named "foo", scons keeps track of the
35 actual operating system dependent filename (such as libfoo.so on a
36 GNU/Linux system), and how to refer to that library in later
37 construction steps that want to use it, so you don't have to specify
38 that precise information yourself. scons can also scan automatically
39 for dependency information, such as header files included by source
40 code files, so this does not have to be specified manually.
41
42 When invoked, scons looks for a file named SConstruct in the current
43 directory and reads the build configuration from that file (other names
44 are allowed, see the section called “SConscript Files” for more
45 information). The SConstruct file may specify subsidiary configuration
46 files by calling the SConscript function. By convention, these
47 subsidiary files are named SConscript, although any name may be used.
48 As a result of this naming convention, the term SConscript files is
49 used to refer generically to the complete set of configuration files
50 for a project (including the SConstruct file), regardless of the actual
51 file names or number of such files.
52
53 Before reading the SConscript files, scons looks for a directory named
54 site_scons in various system directories and in the directory
55 containing the SConstruct file or, if specified, the directory from the
56 --site-dir option instead, and prepends the ones it finds to the Python
57 module search path (sys.path), thus allowing modules in such
58 directories to be imported in the normal Python way in SConscript
59 files. For each found site directory, (1) if it contains a file
60 site_init.py that file is evaluated, and (2) if it contains a directory
61 site_tools the path to that directory is prepended to the default
62 toolpath. See the --site-dir and --no-site-dir options for details on
63 default paths and controlling the site directories.
64
65 SConscript files are written in the Python programming language,
66 although it is normally not necessary to be a Python programmer to use
67 scons effectively. SConscript files are invoked in a context that makes
68 the facilities described in this manual page available in their local
69 namespace without any special steps. Standard Python scripting
70 capabilities such as flow control, data manipulation, and imported
71 Python libraries are available to use to handle complicated build
72 situations. Other Python files can be made a part of the build system,
73 but they do not automatically have the SCons context and need to import
74 it if they need access (described later).
75
76 scons reads and executes all of the included SConscript files before it
77 begins building any targets. To make this clear, scons prints the
78 following messages about what it is doing:
79
80 $ scons foo.out
81 scons: Reading SConscript files ...
82 scons: done reading SConscript files.
83 scons: Building targets ...
84 cp foo.in foo.out
85 scons: done building targets.
86 $
87
88 The status messages (lines beginning with the scons: tag) may be
89 suppressed using the -Q option.
90
91 scons does not automatically propagate the external environment used to
92 execute scons to the commands used to build target files. This is so
93 that builds will be guaranteed repeatable regardless of the environment
94 variables set at the time scons is invoked. This also means that if the
95 compiler or other commands that you want to use to build your target
96 files are not in standard system locations, scons will not find them
97 unless you explicitly include the locations into the execution
98 environment by setting the path in the ENV construction variable in the
99 internal construction environment:
100
101 import os
102 env = Environment(ENV={'PATH': os.environ['PATH']})
103
104 Similarly, if the commands use specific external environment variables
105 that scons does not recognize, they can be propagated into the
106 execution environment:
107
108 import os
109
110 env = Environment(
111 ENV={
112 'PATH': os.environ['PATH'],
113 'ANDROID_HOME': os.environ['ANDROID_HOME'],
114 'ANDROID_NDK_HOME': os.environ['ANDROID_NDK_HOME'],
115 }
116 )
117
118 Or you may explicitly propagate the invoking user's complete external
119 environment:
120
121 import os
122 env = Environment(ENV=os.environ.copy())
123
124 This comes at the expense of making your build dependent on the user's
125 environment being set correctly, but it may be more convenient for many
126 configurations. It should not cause problems if done in a build setup
127 which tightly controls how the environment is set up before invoking
128 scons, as in many continuous integration setups.
129
130 scons can scan known input file types automatically for dependency
131 information (for example, #include preprocessor directives in C or C++
132 files) and will rebuild dependent files appropriately whenever any
133 "included" input file changes. scons supports the ability to define
134 new scanners to support additional input file types.
135
136 scons is normally executed in a top-level directory containing an
137 SConstruct file. When scons is invoked, the command line (including the
138 contents of the SCONSFLAGS environment variable, if set) is processed.
139 Command-line options (see the section called “OPTIONS”) are consumed.
140 Any variable argument assignments are collected, and remaining
141 arguments are taken as targets to build.
142
143 Values of variables to be passed to the SConscript files may be
144 specified on the command line:
145
146 scons debug=1
147
148 These variables are available through the ARGUMENTS dictionary, and can
149 be used in the SConscript files to modify the build in any way:
150
151 if ARGUMENTS.get('debug', 0):
152 env = Environment(CCFLAGS='-g')
153 else:
154 env = Environment()
155
156 The command-line variable arguments are also available in the ARGLIST
157 list, indexed by their order on the command line. This allows you to
158 process them in order rather than by name, if necessary. Each ARGLIST
159 entry is a tuple containing (argname, argvalue).
160
161 See the section called “Command-Line Construction Variables” for more
162 information.
163
164 scons can maintain a cache of target (derived) files that can be shared
165 between multiple builds. When derived-file caching is enabled in an
166 SConscript file, any target files built by scons will be copied to the
167 cache. If an up-to-date target file is found in the cache, it will be
168 retrieved from the cache instead of being rebuilt locally. Caching
169 behavior may be disabled and controlled in other ways by the
170 --cache-force, --cache-disable, --cache-readonly, and --cache-show
171 command-line options. The --random option is useful to prevent multiple
172 builds from trying to update the cache simultaneously.
173
174 By default, scons searches for known programming tools on various
175 systems and initializes itself based on what is found. On Windows
176 systems which identify as win32, scons searches in order for the
177 Microsoft Visual C++ tools, the MinGW tool chain, the Intel compiler
178 tools, and the PharLap ETS compiler. On Windows system which identify
179 as cygwin (that is, if scons is invoked from a cygwin shell), the order
180 changes to prefer the GCC toolchain over the MSVC tools. On OS/2
181 systems, scons searches in order for the OS/2 compiler, the GCC tool
182 chain, and the Microsoft Visual C++ tools, On SGI IRIX, IBM AIX,
183 Hewlett Packard HP-UX, and Oracle Solaris systems, scons searches for
184 the native compiler tools (MIPSpro, Visual Age, aCC, and Forte tools
185 respectively) and the GCC tool chain. On all other platforms, including
186 POSIX (Linux and UNIX) platforms, scons searches in order for the GCC
187 tool chain, and the Intel compiler tools. These default values may be
188 overridden by appropriate setting of construction variables.
189
190 Target Selection
191 SCons acts on the selected targets, whether the requested operation is
192 build, no-exec or clean. Targets are selected as follows:
193
194 1. Targets specified on the command line. These may be files,
195 directories, or phony targets defined using the Alias function.
196 Directory targets are scanned by scons for any targets that may be
197 found with a destination in or under that directory. The targets
198 listed on the command line are made available in the
199 COMMAND_LINE_TARGETS list.
200
201 2. If no targets are specified on the command line, scons will select
202 those targets specified in the SConscript files via calls to the
203 Default function. These are known as the default targets, and are
204 made available in the DEFAULT_TARGETS list.
205
206 3. If no targets are selected by the previous steps, scons selects the
207 current directory for scanning, unless command-line options which
208 affect the target scan are detected (-C, -D, -u, -U). Since targets
209 thus selected were not the result of user instructions, this target
210 list is not made available for direct inspection; use the
211 --debug=explain option if they need to be examined.
212
213 4. scons always adds to the selected targets any intermediate targets
214 which are necessary to build the specified ones. For example, if
215 constructing a shared library or dll from C source files, scons
216 will also build the object files which will make up the library.
217
218 To ignore the default targets specified through calls to Default and
219 instead build all target files in or below the current directory
220 specify the current directory (.) as a command-line target:
221
222 scons .
223
224 To build all target files, including any files outside of the current
225 directory, supply a command-line target of the root directory (on POSIX
226 systems):
227
228 scons /
229
230 or the path name(s) of the volume(s) in which all the targets should be
231 built (on Windows systems):
232
233 scons C:\ D:\
234
235 A subset of a hierarchical tree may be built by remaining at the
236 top-level directory (where the SConstruct file lives) and specifying
237 the subdirectory as the target to build:
238
239 scons src/subdir
240
241 or by changing directory and invoking scons with the -u option, which
242 traverses up the directory hierarchy until it finds the SConstruct
243 file, and then builds targets relatively to the current subdirectory
244 (see also the related -D and -U options):
245
246 cd src/subdir
247 scons -u .
248
249 In all cases, more files may be built than are requested, as scons
250 needs to make sure any dependent files are built.
251
252 Specifying "cleanup" targets in SConscript files is usually not
253 necessary. The -c flag removes all selected targets:
254
255 scons -c .
256
257 to remove all target files in or under the current directory, or:
258
259 scons -c build export
260
261 to remove target files under build and export.
262
263 Additional files or directories to remove can be specified using the
264 Clean function in the SConscript files. Conversely, targets that would
265 normally be removed by the -c invocation can be retained by calling the
266 NoClean function with those targets.
267
268 scons supports building multiple targets in parallel via a -j option
269 that takes, as its argument, the number of simultaneous tasks that may
270 be spawned:
271
272 scons -j 4
273
274 builds four targets in parallel, for example.
275
277 In general, scons supports the same command-line options as GNU Make
278 and many of those supported by cons.
279
280 -b
281 Ignored for compatibility with non-GNU versions of Make
282
283 -c, --clean, --remove
284 Set clean mode. Clean up by removing the selected targets, well as
285 any files or directories associated with a selected target through
286 calls to the Clean function. Will not remove any targets which are
287 marked for preservation through calls to the NoClean function.
288
289 While clean mode removes targets rather than building them, work
290 which is done directly in Python code in SConscript files will
291 still be carried out. If it is important to avoid some such work
292 from taking place in clean mode, it should be protected. An
293 SConscript file can determine which mode is active by querying
294 GetOption, as in the call if GetOption("clean"):
295
296 --cache-debug=file
297 Write debug information about derived-file caching to the specified
298 file. If file is a hyphen (-), the debug information is printed to
299 the standard output. The printed messages describe what
300 signature-file names are being looked for in, retrieved from, or
301 written to the derived-file cache specified by CacheDir.
302
303 --cache-disable, --no-cache
304 Disable derived-file caching. scons will neither retrieve files
305 from the cache nor copy files to the cache. This option can be used
306 to temporarily disable the cache without modifying the build
307 scripts.
308
309 --cache-force, --cache-populate
310 When using CacheDir, populate a derived-file cache by copying any
311 already-existing, up-to-date derived files to the cache, in
312 addition to files built by this invocation. This is useful to
313 populate a new cache with all the current derived files, or to add
314 to the cache any derived files recently built with caching disabled
315 via the --cache-disable option.
316
317 --cache-readonly
318 Use the derived-file cache, if enabled, to retrieve files, but do
319 not not update the cache with any files actually built during this
320 invocation.
321
322 --cache-show
323 When using a derived-file cache show the command that would have
324 been executed to build the file (or the corresponding *COMSTR
325 contents if set) even if the file is retrieved from cache. Without
326 this option, scons shows a cache retrieval message if the file is
327 fetched from cache. This allows producing consistent output for
328 build logs, regardless of whether a target file was rebuilt or
329 retrieved from the cache.
330
331 --config=mode
332 Control how the Configure call should use or generate the results
333 of configuration tests. mode should be one of the following
334 choices:
335
336 auto
337 SCons will use its normal dependency mechanisms to decide if a
338 test must be rebuilt or not. This saves time by not running the
339 same configuration tests every time you invoke scons, but will
340 overlook changes in system header files or external commands
341 (such as compilers) if you don't specify those dependecies
342 explicitly. This is the default behavior.
343
344 force
345 If this mode is specified, all configuration tests will be
346 re-run regardless of whether the cached results are out of
347 date. This can be used to explicitly force the configuration
348 tests to be updated in response to an otherwise unconfigured
349 change in a system header file or compiler.
350
351 cache
352 If this mode is specified, no configuration tests will be rerun
353 and all results will be taken from cache. scons will report an
354 error if --config=cache is specified and a necessary test does
355 not have any results in the cache.
356
357
358 -C directory, --directory=directory
359 Run as if scons was started in directory instead of the current
360 working directory. That is, change directory before searching for
361 the SConstruct, Sconstruct, sconstruct, SConstruct.py,
362 Sconstruct.py or sconstruct.py file or doing anything else. When
363 multiple -C options are given, each subsequent non-absolute -C
364 directory is interpreted relative to the preceding one. This option
365 is similar to using -f directory/SConstruct, but -f does not search
366 for any of the predefined SConstruct names in the specified
367 directory. See also options -u, -U and -D to change the SConstruct
368 search behavior when this option is used.
369
370 -D
371 Works exactly the same way as the -u option except for the way
372 default targets are handled. When this option is used and no
373 targets are specified on the command line, all default targets are
374 built, whether or not they are below the current directory.
375
376 --debug=type[,type...]
377 Debug the build process. type specifies the kind of debugging info
378 to emit. Multiple types may be specified, separated by commas. The
379 following types are recognized:
380
381 action-timestamps
382 Prints additional time profiling information. For each command,
383 shows the absolute start and end times. This may be useful in
384 debugging parallel builds. Implies the --debug=time option.
385
386 Available since scons 3.1.
387
388 count
389 Print how many objects are created of the various classes used
390 internally by SCons before and after reading the SConscript
391 files and before and after building targets. This is not
392 supported when SCons is executed with the Python -O (optimized)
393 option or when the SCons modules have been compiled with
394 optimization (that is, when executing from *.pyo files).
395
396 duplicate
397 Print a line for each unlink/relink (or copy) of a variant file
398 from its source file. Includes debugging info for unlinking
399 stale variant files, as well as unlinking old targets before
400 building them.
401
402 explain
403 Print an explanation of why scons is deciding to (re-)build the
404 targets it selects for building.
405
406 findlibs
407 Instruct the scanner that searches for libraries to print a
408 message about each potential library name it is searching for,
409 and about the actual libraries it finds.
410
411 includes
412 Print the include tree after each top-level target is built.
413 This is generally used to find out what files are included by
414 the sources of a given derived file:
415
416 $ scons --debug=includes foo.o
417
418 memoizer
419 Prints a summary of hits and misses using the Memoizer, an
420 internal subsystem that counts how often SCons uses cached
421 values in memory instead of recomputing them each time they're
422 needed.
423
424 memory
425 Prints how much memory SCons uses before and after reading the
426 SConscript files and before and after building targets.
427
428 objects
429 Prints a list of the various objects of the various classes
430 used internally by SCons.
431
432 pdb
433 Re-run scons under the control of the pdb Python debugger.
434
435 prepare
436 Print a line each time any target (internal or external) is
437 prepared for building. scons prints this for each target it
438 considers, even if that target is up to date (see also
439 --debug=explain). This can help debug problems with targets
440 that aren't being built; it shows whether scons is at least
441 considering them or not.
442
443 presub
444 Print the raw command line used to build each target before the
445 construction environment variables are substituted. Also shows
446 which targets are being built by this command. Output looks
447 something like this:
448
449 $ scons --debug=presub
450 Building myprog.o with action(s):
451 $SHCC $SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
452 ...
453
454 stacktrace
455 Prints an internal Python stack trace when encountering an
456 otherwise unexplained error.
457
458 time
459 Prints various time profiling information:
460
461 • The time spent executing each individual build command
462
463 • The total build time (time SCons ran from beginning to end)
464
465 • The total time spent reading and executing SConscript files
466
467 • The total time SCons itself spent running (that is, not
468 counting reading and executing SConscript files)
469
470 • The total time spent executing all build commands
471
472 • The elapsed wall-clock time spent executing those build
473 commands
474
475 • The time spent processing each file passed to the
476 SConscript function
477
478 (When scons is executed without the -j option, the elapsed
479 wall-clock time will typically be slightly longer than the
480 total time spent executing all the build commands, due to the
481 SCons processing that takes place in between executing each
482 command. When scons is executed with the -j option, and your
483 build configuration allows good parallelization, the elapsed
484 wall-clock time should be significantly smaller than the total
485 time spent executing all the build commands, since multiple
486 build commands and intervening SCons processing should take
487 place in parallel.)
488
489
490 --diskcheck=type
491 Enable specific checks for whether or not there is a file on disk
492 where the SCons configuration expects a directory (or vice versa)
493 when searching for source and include files. type can be an
494 available diskcheck type or the special tokens all or none. A
495 comma-separated string can be used to select multiple checks. The
496 default setting is all.
497
498 Current available checks are:
499
500 match
501 to check that files and directories on disk match SCons'
502 expected configuration.
503
504 Disabling some or all of these checks can provide a performance
505 boost for large configurations, or when the configuration will
506 check for files and/or directories across networked or shared file
507 systems, at the slight increased risk of an incorrect build or of
508 not handling errors gracefully.
509
510 --duplicate=ORDER
511 There are three ways to duplicate files in a build tree: hard
512 links, soft (symbolic) links and copies. The default policy is to
513 prefer hard links to soft links to copies. You can specify a
514 different policy with this option. ORDER must be one of
515 hard-soft-copy (the default), soft-hard-copy, hard-copy, soft-copy
516 or copy. SCons will attempt to duplicate files using the
517 mechanisms in the specified order.
518
519 --enable-virtualenv
520 Import virtualenv-related variables to SCons.
521
522 --experimental=feature
523 Enable experimental features and/or tools. feature can be an
524 available feature name or the special tokens all or none. A
525 comma-separated string can be used to select multiple features. The
526 default setting is none.
527
528 Current available features are: ninja.
529
530 Caution
531 No Support offered for any features or tools enabled by this
532 flag.
533 Available since scons 4.2.
534
535 -f file, --file=file, --makefile=file, --sconstruct=file
536 Use file as the initial SConscript file. Multiple -f options may be
537 specified, in which case scons will read all of the specified
538 files.
539
540 -h, --help
541 Print a local help message for this project, if one is defined in
542 the SConscript files (see the Help function), plus a line that
543 refers to the standard SCons help message. If no local help message
544 is defined, prints the standard SCons help message (as for the -H
545 option) plus help for any local options defined through AddOption.
546 Exits after displaying the appropriate message.
547
548 Note that use of this option requires SCons to process the
549 SConscript files, so syntax errors may cause the help message not
550 to be displayed.
551
552 --hash-chunksize=KILOBYTES
553 Set the block size used when computing content signatures to
554 KILOBYTES. This value determines the size of the chunks which are
555 read in at once when computing signature hashes. Files below that
556 size are fully stored in memory before performing the signature
557 computation while bigger files are read in block-by-block. A huge
558 block-size leads to high memory consumption while a very small
559 block-size slows down the build considerably.
560
561 The default value is to use a chunk size of 64 kilobytes, which
562 should be appropriate for most uses.
563
564 Available since scons 4.2.
565
566 --hash-format=ALGORITHM
567 Set the hashing algorithm used by SCons to ALGORITHM. This value
568 determines the hashing algorithm used in generating content
569 signatures or CacheDir keys.
570
571 The supported list of values are: md5, sha1, and sha256. However,
572 the Python interpreter used to run SCons must have the
573 corresponding support available in the hashlib module to use the
574 specified algorithm.
575
576 Specifying this value changes the name of the SConsign database.
577 For example, --hash-format=sha256 will create a SConsign database
578 with name .sconsign_sha256.dblite.
579
580 If this option is not specified, a hash format of md5 is used, and
581 the SConsign database is .sconsign.dblite.
582
583 Available since scons 4.2.
584
585 -H, --help-options
586 Print the standard help message about SCons command-line options
587 and exit.
588
589 -i, --ignore-errors
590 Ignore all errors from commands executed to rebuild files.
591
592 -I directory, --include-dir=directory
593 Specifies a directory to search for imported Python modules. If
594 several -I options are used, the directories are searched in the
595 order specified.
596
597 --ignore-virtualenv
598 Suppress importing virtualenv-related variables to SCons.
599
600 --implicit-cache
601 Cache implicit dependencies. This causes scons to use the implicit
602 (scanned) dependencies from the last time it was run instead of
603 scanning the files for implicit dependencies. This can
604 significantly speed up SCons, but with the following limitations:
605
606 scons will not detect changes to implicit dependency search paths
607 (e.g. CPPPATH, LIBPATH) that would ordinarily cause different
608 versions of same-named files to be used.
609
610 scons will miss changes in the implicit dependencies in cases where
611 a new implicit dependency is added earlier in the implicit
612 dependency search path (e.g. CPPPATH, LIBPATH) than a current
613 implicit dependency with the same name.
614
615 --implicit-deps-changed
616 Forces SCons to ignore the cached implicit dependencies. This
617 causes the implicit dependencies to be rescanned and recached. This
618 implies --implicit-cache.
619
620 --implicit-deps-unchanged
621 Force SCons to ignore changes in the implicit dependencies. This
622 causes cached implicit dependencies to always be used. This implies
623 --implicit-cache.
624
625 --install-sandbox=sandbox_path
626 When using the Install builders, prepend sandbox_path to the
627 installation paths such that all installed files will be placed
628 under that directory. This option is unavailable if one of Install,
629 InstallAs or InstallVersionedLib is not used in the SConscript
630 files.
631
632 --interactive
633 Starts SCons in interactive mode. The SConscript files are read
634 once and a scons>>> prompt is printed. Targets may now be rebuilt
635 by typing commands at interactive prompt without having to re-read
636 the SConscript files and re-initialize the dependency graph from
637 scratch.
638
639 SCons interactive mode supports the following commands:
640
641 build [OPTIONS] [TARGETS] ...
642 Builds the specified TARGETS (and their dependencies) with the
643 specified SCons command-line OPTIONS. b and scons are synonyms
644 for build.
645
646 The following SCons command-line options affect the build
647 command:
648
649 --cache-debug=FILE
650 --cache-disable, --no-cache
651 --cache-force, --cache-populate
652 --cache-readonly
653 --cache-show
654 --debug=TYPE
655 -i, --ignore-errors
656 -j N, --jobs=N
657 -k, --keep-going
658 -n, --no-exec, --just-print, --dry-run, --recon
659 -Q
660 -s, --silent, --quiet
661 --taskmastertrace=FILE
662 --tree=OPTIONS
663
664 Any other SCons command-line options that are specified do not
665 cause errors but have no effect on the build command (mainly
666 because they affect how the SConscript files are read, which
667 only happens once at the beginning of interactive mode).
668
669 clean [OPTIONS] [TARGETS] ...
670 Cleans the specified TARGETS (and their dependencies) with the
671 specified OPTIONS. c is a synonym. This command is itself a
672 synonym for build --clean
673
674 exit
675 Exits SCons interactive mode. You can also exit by terminating
676 input (Ctrl+D UNIX or Linux systems, (Ctrl+Z on Windows
677 systems).
678
679 help [COMMAND]
680 Provides a help message about the commands available in SCons
681 interactive mode. If COMMAND is specified, h and ? are
682 synonyms.
683
684 shell [COMMANDLINE]
685 Executes the specified COMMANDLINE in a subshell. If no
686 COMMANDLINE is specified, executes the interactive command
687 interpreter specified in the SHELL environment variable (on
688 UNIX and Linux systems) or the COMSPEC environment variable (on
689 Windows systems). sh and ! are synonyms.
690
691 version
692 Prints SCons version information.
693
694 An empty line repeats the last typed command. Command-line editing
695 can be used if the readline module is available.
696
697 $ scons --interactive
698 scons: Reading SConscript files ...
699 scons: done reading SConscript files.
700 scons>>> build -n prog
701 scons>>> exit
702
703 -j N, --jobs=N
704 Specifies the maximum number of comcurrent jobs (commands) to run.
705 If there is more than one -j option, the last one is effective.
706
707 -k, --keep-going
708 Continue as much as possible after an error. The target that failed
709 and those that depend on it will not be remade, but other targets
710 specified on the command line will still be processed.
711
712 -m
713 Ignored for compatibility with non-GNU versions of Make.
714
715 --max-drift=SECONDS
716 Set the maximum expected drift in the modification time of files to
717 SECONDS. This value determines how long a file must be unmodified
718 before its cached content signature will be used instead of
719 calculating a new content signature (MD5 checksum) of the file's
720 contents. The default value is 2 days, which means a file must have
721 a modification time of at least two days ago in order to have its
722 cached content signature used. A negative value means to never
723 cache the content signature and to ignore the cached value if there
724 already is one. A value of 0 means to always use the cached
725 signature, no matter how old the file is.
726
727 --md5-chunksize=KILOBYTES
728 A deprecated synonym for --hash-chunksize.
729
730 Deprecated since scons 4.2.
731
732 -n, --no-exec, --just-print, --dry-run, --recon
733 Set no execute mode. Print the commands that would be executed to
734 build any out-of-date target files, but do not execute the
735 commands.
736
737 The output is a best effort, as SCons cannot always precisely
738 determine what would be built. For example, if a file is generated
739 by a builder action that is later used in the build, that file is
740 not available to scan for dependencies on an unbuilt tree, or may
741 contain out of date information in a built tree.
742
743 Work which is done directly in Python code in SConscript files, as
744 opposed to work done by builder actions during the build phase,
745 will still be carried out. If it is important to avoid some such
746 work from taking place in no execute mode, it should be protected.
747 An SConscript file can determine which mode is active by querying
748 GetOption, as in the call if GetOption("no_exec"):
749
750 --no-site-dir
751 Prevents the automatic addition of the standard site_scons dirs to
752 sys.path. Also prevents loading the site_scons/site_init.py modules
753 if they exist, and prevents adding their site_scons/site_tools dirs
754 to the toolpath.
755
756 --package-type=type
757 The type or types of package to create when using the Package
758 builder. In the case of multiple types, type should be a
759 comma-separated string; SCons will try to build for all of those
760 packages. Note this option is only available if the packaging tool
761 has been enabled.
762
763 --profile=file
764 Run SCons under the Python profiler and save the results in the
765 specified file. The results may be analyzed using the Python pstats
766 module.
767
768 -q, --question
769 Do not run any commands, or print anything. Just return an exit
770 status that is zero if the specified targets are already up to
771 date, non-zero otherwise.
772
773 -Q
774 Quiets SCons status messages about reading SConscript files,
775 building targets and entering directories. Commands that are
776 executed to rebuild target files are still printed.
777
778 --random
779 Build dependencies in a random order. This is useful when building
780 multiple trees simultaneously with caching enabled, to prevent
781 multiple builds from simultaneously trying to build or retrieve the
782 same target files.
783
784 -s, --silent, --quiet
785 Silent. Do not print commands that are executed to rebuild target
786 files. Also suppresses SCons status messages.
787
788 -S, --no-keep-going, --stop
789 Ignored for compatibility with GNU Make
790
791 --site-dir=dir
792 Uses the named dir as the site directory rather than the default
793 site_scons directories. This directory will be prepended to
794 sys.path, the module dir/site_init.py will be loaded if it exists,
795 and dir/site_tools will be added to the default toolpath.
796
797 The default set of site_scons directories used when --site-dir is
798 not specified depends on the system platform, as follows.
799 Directories are examined in the order given, from most generic to
800 most specific, so the last-executed site_init.py file is the most
801 specific one (which gives it the chance to override everything
802 else), and the directories are prepended to the paths, again so the
803 last directory examined comes first in the resulting path.
804
805 Windows:
806
807 %ALLUSERSPROFILE/Application Data/scons/site_scons
808 %USERPROFILE%/Local Settings/Application Data/scons/site_scons
809 %APPDATA%/scons/site_scons
810 %HOME%/.scons/site_scons
811 ./site_scons
812
813 Mac OS X:
814
815 /Library/Application Support/SCons/site_scons
816 /opt/local/share/scons/site_scons (for MacPorts)
817 /sw/share/scons/site_scons (for Fink)
818 $HOME/Library/Application Support/SCons/site_scons
819 $HOME/.scons/site_scons
820 ./site_scons
821
822 Solaris:
823
824 /opt/sfw/scons/site_scons
825 /usr/share/scons/site_scons
826 $HOME/.scons/site_scons
827 ./site_scons
828
829 Linux, HPUX, and other Posix-like systems:
830
831 /usr/share/scons/site_scons
832 $HOME/.scons/site_scons
833 ./site_scons
834
835 --stack-size=KILOBYTES
836 Set the size stack used to run threads to KILOBYTES. This value
837 determines the stack size of the threads used to run jobs. These
838 threads execute the actions of the builders for the nodes that are
839 out-of-date. This option has no effect unless the number of
840 concurrent build jobs is larger than one (as set by -j N or
841 --jobs=N on the command line or SetOption in a script).
842
843 Using a stack size that is too small may cause stack overflow
844 errors. This usually shows up as segmentation faults that cause
845 scons to abort before building anything. Using a stack size that is
846 too large will cause scons to use more memory than required and may
847 slow down the entire build process. The default value is to use a
848 stack size of 256 kilobytes, which should be appropriate for most
849 uses. You should not need to increase this value unless you
850 encounter stack overflow errors.
851
852 -t, --touch
853 Ignored for compatibility with GNU Make. (Touching a file to make
854 it appear up-to-date is unnecessary when using scons.)
855
856 --taskmastertrace=file
857 Prints trace information to the specified file about how the
858 internal Taskmaster object evaluates and controls the order in
859 which Nodes are built. A file name of - may be used to specify the
860 standard output.
861
862 --tree=type[,type...]
863 Prints a tree of the dependencies after each top-level target is
864 built. This prints out some or all of the tree, in various formats,
865 depending on the type specified:
866
867 all
868 Print the entire dependency tree after each top-level target is
869 built. This prints out the complete dependency tree, including
870 implicit dependencies and ignored dependencies.
871
872 derived
873 Restricts the tree output to only derived (target) files, not
874 source files.
875
876 linedraw
877 Draw the tree output using Unicode line-drawing characters
878 instead of plain ASCII text. This option acts as a modifier to
879 the selected type(s). If specified alone, without any type, it
880 behaves as if all had been specified.
881
882 Available since scons 4.0.
883
884 status
885 Prints status information for each displayed node.
886
887 prune
888 Prunes the tree to avoid repeating dependency information for
889 nodes that have already been displayed. Any node that has
890 already been displayed will have its name printed in [square
891 brackets], as an indication that the dependencies for that node
892 can be found by searching for the relevant output higher up in
893 the tree.
894
895 Multiple type choices may be specified, separated by commas:
896
897 # Prints only derived files, with status information:
898 scons --tree=derived,status
899
900 # Prints all dependencies of target, with status information
901 # and pruning dependencies of already-visited Nodes:
902 scons --tree=all,prune,status target
903
904 -u, --up, --search-up
905 Walks up the directory structure until an SConstruct, Sconstruct,
906 sconstruct, SConstruct.py, Sconstruct.py or sconstruct.py file is
907 found, and uses that as the top of the directory tree. If no
908 targets are specified on the command line, only targets at or below
909 the current directory will be built.
910
911 -U
912 Works exactly the same way as the -u option except for the way
913 default targets are handled. When this option is used and no
914 targets are specified on the command line, all default targets that
915 are defined in the SConscript(s) in the current directory are
916 built, regardless of what directory the resultant targets end up
917 in.
918
919 -v, --version
920 Print the scons version, copyright information, list of authors,
921 and any other relevant information. Then exit.
922
923 -w, --print-directory
924 Print a message containing the working directory before and after
925 other processing.
926
927 --no-print-directory
928 Turn off -w, even if it was turned on implicitly.
929
930 --warn=type, --warn=no-type
931 Enable or disable (with the no- prefix) warnings. type specifies
932 the type of warnings to be enabled or disabled:
933
934 all
935 All warnings.
936
937 cache-version
938 Warnings about the derived-file cache directory specified by
939 CacheDir not using the latest configuration information. These
940 warnings are enabled by default.
941
942 cache-write-error
943 Warnings about errors trying to write a copy of a built file to
944 a specified derived-file cache specified by CacheDir. These
945 warnings are disabled by default.
946
947 corrupt-sconsign
948 Warnings about unfamiliar signature data in .sconsign files.
949 These warnings are enabled by default.
950
951 dependency
952 Warnings about dependencies. These warnings are disabled by
953 default.
954
955 deprecated
956 Warnings about use of currently deprecated features. These
957 warnings are enabled by default. Not all deprecation warnings
958 can be disabled with the --warn=no-deprecated option as some
959 deprecated features which are late in the deprecation cycle may
960 have been designated as mandatory warnings, and these will
961 still display. Warnings for certain deprecated features may
962 also be enabled or disabled individually; see below.
963
964 duplicate-environment
965 Warnings about attempts to specify a build of a target with two
966 different construction environments that use the same action.
967 These warnings are enabled by default.
968
969 fortran-cxx-mix
970 Warnings about linking Fortran and C++ object files in a single
971 executable, which can yield unpredictable behavior with some
972 compilers.
973
974 future-deprecated
975 Warnings about features that will be deprecated in the future.
976 Such warnings are disabled by default. Enabling future
977 deprecation warnings is recommended for projects that
978 redistribute SCons configurations for other users to build, so
979 that the project can be warned as soon as possible about
980 to-be-deprecated features that may require changes to the
981 configuration.
982
983 link
984 Warnings about link steps.
985
986 misleading-keywords
987 Warnings about the use of two commonly misspelled keywords
988 targets and sources to Builder calls. The correct spelling is
989 the singular form, even though target and source can themselves
990 refer to lists of names or nodes.
991
992 missing-sconscript
993 Warnings about missing SConscript files. These warnings are
994 enabled by default.
995
996 no-object-count
997 Warnings about the --debug=object feature not working when
998 scons is run with the Python -O option or from optimized Python
999 (.pyo) modules.
1000
1001 no-parallel-support
1002 Warnings about the version of Python not being able to support
1003 parallel builds when the -j option is used. These warnings are
1004 enabled by default.
1005
1006 python-version
1007 Warnings about running SCons with a deprecated version of
1008 Python. These warnings are enabled by default.
1009
1010 reserved-variable
1011 Warnings about attempts to set the reserved construction
1012 variable names $CHANGED_SOURCES, $CHANGED_TARGETS, $TARGET,
1013 $TARGETS, $SOURCE, $SOURCES, $UNCHANGED_SOURCES or
1014 $UNCHANGED_TARGETS. These warnings are disabled by default.
1015
1016 stack-size
1017 Warnings about requests to set the stack size that could not be
1018 honored. These warnings are enabled by default.
1019
1020 target_not_build
1021 Warnings about a build rule not building the expected targets.
1022 These warnings are disabled by default.
1023
1024
1025 -Y repository, --repository=repository, --srcdir=repository
1026 Search the specified repository for any input and target files not
1027 found in the local directory hierarchy. Multiple -Y options may be
1028 specified, in which case the repositories are searched in the order
1029 specified.
1030
1032 SConscript Files
1033 The build configuration is described by one or more files, known as
1034 SConscript files. There must be at least one file for a valid build
1035 (scons will quit if it does not find one). scons by default looks for
1036 this file by the name SConstruct in the directory from which you run
1037 scons, though if necessary, also looks for alternative file names
1038 Sconstruct, sconstruct, SConstruct.py, Sconstruct.py and sconstruct.py
1039 in that order. A different file name (which can include a pathname
1040 part) may be specified via the -f option. Except for the SConstruct
1041 file, these files are not searched for automatically; you add
1042 additional configuration files to the build by calling the SConscript
1043 function. This allows parts of the build to be conditionally included
1044 or excluded at run-time depending on how scons is invoked.
1045
1046 Each SConscript file in a build configuration is invoked independently
1047 in a separate context. This provides necessary isolation so that
1048 different parts of the build don't accidentally step on each other. You
1049 have to be explicit about sharing information, by using the Export
1050 function or the exports argument to the SConscript function, as well as
1051 the Return function in a called SConscript file, and comsume shared
1052 information by using the Import function.
1053
1054 The following sections describe the various SCons facilities that can
1055 be used in SConscript files. Quick links:
1056 Construction Environments
1057 Tools
1058 Builder Methods
1059 Methods and Functions to do Things
1060 SConscript Variables
1061 Construction Variables
1062 Configure Contexts
1063 Command-Line Construction Variables
1064 Node Objects
1065
1066 Construction Environments
1067 A Construction Environment is the basic means by which SConscript files
1068 communicate build information to scons. A new construction environment
1069 is created using the Environment function:
1070
1071 env = Environment()
1072
1073 Construction environment attributes called Construction Variables may
1074 be set either by specifying them as keyword arguments when the object
1075 is created or by assigning them a value after the object is created.
1076 These two are nominally equivalent:
1077
1078 env = Environment(FOO='foo')
1079 env['FOO'] = 'foo'
1080
1081 Note that certain settings which affect tool detection are referenced
1082 only during initialization, and so need to be supplied as part of the
1083 call to Environment. For example, setting $MSVC_VERSION selects the
1084 version of Microsoft Visual C++ you wish to use, but setting it after
1085 the construction environment is constructed has no effect.
1086
1087 As a convenience, construction variables may also be set or modified by
1088 the parse_flags keyword argument during object creation, which has the
1089 effect of the env.MergeFlags method being applied to the argument value
1090 after all other processing is completed. This is useful either if the
1091 exact content of the flags is unknown (for example, read from a control
1092 file) or if the flags need to be distributed to a number of
1093 construction variables. env.ParseFlags describes how these arguments
1094 are distributed to construction variables.
1095
1096 env = Environment(parse_flags='-Iinclude -DEBUG -lm')
1097
1098 This example adds 'include' to the CPPPATH construction variable,
1099 'EBUG' to CPPDEFINES, and 'm' to LIBS.
1100
1101 An existing construction environment can be duplicated by calling the
1102 env.Clone method. Without arguments, it will be a copy with the same
1103 settings. Otherwise, env.Clone takes the same arguments as Environment,
1104 and uses the arguments to create a modified copy.
1105
1106 SCons provides a special construction environment called the Default
1107 Environment. The default environment is used only for global functions,
1108 that is, construction activities called without the context of a
1109 regular construction environment. See DefaultEnvironment for more
1110 information.
1111
1112 By default, a new construction environment is initialized with a set of
1113 builder methods and construction variables that are appropriate for the
1114 current platform. The optional platform keyword argument may be used to
1115 specify that the construction environment should be initialized for a
1116 different platform:
1117
1118 env = Environment(platform='cygwin')
1119 env = Environment(platform='os2')
1120 env = Environment(platform='posix')
1121 env = Environment(platform='win32')
1122
1123 Specifying a platform initializes the appropriate construction
1124 variables in the environment to use and generate file names with
1125 prefixes and suffixes appropriate for that platform.
1126
1127 Note that the win32 platform adds the SystemDrive and SystemRoot
1128 variables from the user's external environment to the construction
1129 environment's ENV dictionary. This is so that any executed commands
1130 that use sockets to connect with other systems (such as fetching source
1131 files from external CVS repository specifications like
1132 :pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons) will work on
1133 Windows systems.
1134
1135 The platform argument may be a function or callable object, in which
1136 case the Environment method will call it to update the new construction
1137 environment:
1138
1139 def my_platform(env):
1140 env['VAR'] = 'xyzzy'
1141
1142 env = Environment(platform=my_platform)
1143
1144 The optional tools and toolpath keyword arguments affect the way tools
1145 available to the environment are initialized. See the section called
1146 “Tools” for details.
1147
1148 The optional variables keyword argument allows passing a Variables
1149 object which will be used in the initialization of the construction
1150 environment See the section called “Command-Line Construction
1151 Variables” for details.
1152
1153 Tools
1154 SCons has a large number of predefined tools (more properly, tool
1155 specifications) which are used to help initialize the construction
1156 environment. An scons tool is only responsible for setup. For example,
1157 if the SConscript file declares the need to construct an object file
1158 from a C-language source file by calling the Object builder, then a
1159 tool representing an available C compiler needs to have run first, to
1160 set up the builder and all the construction variables it needs in the
1161 associated construction environment; the tool itself is not called in
1162 the process of the build. Normally this happens invisibly: scons has
1163 per-platform lists of default tools, and it runs through those tools,
1164 calling the ones which are actually applicable, skipping those where
1165 necessary programs are not installed on the build system, or other
1166 preconditions are not met.
1167
1168 A specific set of tools with which to initialize an environment when
1169 creating it may be specified using the optional keyword argument tools,
1170 which takes a list of tool names. This is useful to override the
1171 defaults, to specify non-default built-in tools, and to supply added
1172 tools:
1173
1174 env = Environment(tools=['msvc', 'lex'])
1175
1176 Tools can also be directly called by using the Tool method (see below).
1177
1178 The tools argument overrides the default tool list, it does not add to
1179 it, so be sure to include all the tools you need. For example if you
1180 are building a c/c++ program you must specify a tool for at least a
1181 compiler and a linker, as in tools=['clang', 'link']. The tool name
1182 'default' can be used to retain the default list.
1183
1184 If no tools argument is specified, or if tools includes 'default', then
1185 scons will auto-detect usable tools, using the execution environment
1186 value of PATH (that is, env['ENV']['PATH'] - the external evironment
1187 PATH from os.environ is not used) for looking up any backing programs,
1188 and the platform name in effect to determine the default tools for that
1189 platform. Changing the PATH variable after the construction environment
1190 is constructed will not cause the tools to be re-detected.
1191
1192 Additional tools can be added to a project either by placing them in a
1193 site_tools subdirectory of a site directory, or in a custom location
1194 specified to scons by giving the toolpath keyword argument. toolpath
1195 also takes a list as its value:
1196
1197 env = Environment(tools=['default', 'foo'], toolpath=['tools'])
1198
1199 This looks for a tool specification module foo.py in directory tools
1200 and in the standard locations, as well as using the ordinary default
1201 tools for the platform.
1202
1203 Directories specified via toolpath are prepended to the existing tool
1204 path. The default tool path is any site_tools directories, so tools in
1205 a specified toolpath take priority, followed by tools in a site_tools
1206 directory, followed by built-in tools. For example, adding a tool
1207 specification module gcc.py to the toolpath directory would override
1208 the built-in gcc tool. The tool path is stored in the environment and
1209 will be used by subsequent calls to the Tool method, as well as by
1210 env.Clone.
1211
1212 base = Environment(toolpath=['custom_path'])
1213 derived = base.Clone(tools=['custom_tool'])
1214 derived.CustomBuilder()
1215
1216 A tool specification module must include two functions:
1217
1218 generate(env, **kwargs)
1219 Modifies the environment referenced by env to set up variables so
1220 that the facilities represented by the tool can be executed. It may
1221 use any keyword arguments that the user supplies in kwargs to vary
1222 its initialization.
1223
1224 exists(env)
1225 Return True if the tool can be called in the context of env.
1226 Usually this means looking up one or more known programs using the
1227 PATH from the supplied env, but the tool can make the "exists"
1228 decision in any way it chooses.
1229
1230 Note
1231 At the moment, user-added tools do not automatically have their
1232 exists function called. As a result, it is recommended that the
1233 generate function be defensively coded - that is, do not rely on
1234 any necessary existence checks already having been performed. This
1235 is expected to be a temporary limitation, and the exists function
1236 should still be provided.
1237
1238 The elements of the tools list may also be functions or callable
1239 objects, in which case the Environment method will call those objects
1240 to update the new construction environment (see Tool for more details):
1241
1242 def my_tool(env):
1243 env['XYZZY'] = 'xyzzy'
1244
1245 env = Environment(tools=[my_tool])
1246
1247 The individual elements of the tools list may also themselves be lists
1248 or tuples of the form (toolname, kw_dict). SCons searches for the
1249 toolname specification file as described above, and passes kw_dict,
1250 which must be a dictionary, as keyword arguments to the tool's generate
1251 function. The generate function can use the arguments to modify the
1252 tool's behavior by setting up the environment in different ways or
1253 otherwise changing its initialization.
1254
1255 # in tools/my_tool.py:
1256 def generate(env, **kwargs):
1257 # Sets MY_TOOL to the value of keyword 'arg1' '1' if not supplied
1258 env['MY_TOOL'] = kwargs.get('arg1', '1')
1259
1260 def exists(env):
1261 return True
1262
1263 # in SConstruct:
1264 env = Environment(tools=['default', ('my_tool', {'arg1': 'abc'})],
1265 toolpath=['tools'])
1266
1267 The tool specification (my_tool in the example) can use the PLATFORM
1268 variable from the construction environment it is passed to customize
1269 the tool for different platforms.
1270
1271 Tools can be "nested" - that is, they can be located within a
1272 subdirectory in the toolpath. A nested tool name uses a dot to
1273 represent a directory separator
1274
1275 # namespaced builder
1276 env = Environment(ENV=os.environ.copy(), tools=['SubDir1.SubDir2.SomeTool'])
1277 env.SomeTool(targets, sources)
1278
1279 # Search Paths
1280 # SCons\Tool\SubDir1\SubDir2\SomeTool.py
1281 # SCons\Tool\SubDir1\SubDir2\SomeTool\__init__.py
1282 # .\site_scons\site_tools\SubDir1\SubDir2\SomeTool.py
1283 # .\site_scons\site_tools\SubDir1\SubDir2\SomeTool\__init__.py
1284
1285 SCons supports the following tool specifications out of the box:
1286
1287 386asm
1288 Sets construction variables for the 386ASM assembler for the Phar
1289 Lap ETS embedded operating system.
1290
1291 Sets: $AS, $ASCOM, $ASFLAGS, $ASPPCOM, $ASPPFLAGS.
1292
1293 Uses: $CC, $CPPFLAGS, $_CPPDEFFLAGS, $_CPPINCFLAGS.
1294
1295 aixc++
1296 Sets construction variables for the IMB xlc / Visual Age C++
1297 compiler.
1298
1299 Sets: $CXX, $CXXVERSION, $SHCXX, $SHOBJSUFFIX.
1300
1301 aixcc
1302 Sets construction variables for the IBM xlc / Visual Age C
1303 compiler.
1304
1305 Sets: $CC, $CCVERSION, $SHCC.
1306
1307 aixf77
1308 Sets construction variables for the IBM Visual Age f77 Fortran
1309 compiler.
1310
1311 Sets: $F77, $SHF77.
1312
1313 aixlink
1314 Sets construction variables for the IBM Visual Age linker.
1315
1316 Sets: $LINKFLAGS, $SHLIBSUFFIX, $SHLINKFLAGS.
1317
1318 applelink
1319 Sets construction variables for the Apple linker (similar to the
1320 GNU linker).
1321
1322 Sets: $APPLELINK_COMPATIBILITY_VERSION, $APPLELINK_CURRENT_VERSION,
1323 $APPLELINK_NO_COMPATIBILITY_VERSION, $APPLELINK_NO_CURRENT_VERSION,
1324 $FRAMEWORKPATHPREFIX, $LDMODULECOM, $LDMODULEFLAGS,
1325 $LDMODULEPREFIX, $LDMODULESUFFIX, $LINKCOM, $SHLINKCOM,
1326 $SHLINKFLAGS, $_APPLELINK_COMPATIBILITY_VERSION,
1327 $_APPLELINK_CURRENT_VERSION, $_FRAMEWORKPATH, $_FRAMEWORKS.
1328
1329 Uses: $FRAMEWORKSFLAGS.
1330
1331 ar
1332 Sets construction variables for the ar library archiver.
1333
1334 Sets: $AR, $ARCOM, $ARFLAGS, $LIBPREFIX, $LIBSUFFIX, $RANLIB,
1335 $RANLIBCOM, $RANLIBFLAGS.
1336
1337 as
1338 Sets construction variables for the as assembler.
1339
1340 Sets: $AS, $ASCOM, $ASFLAGS, $ASPPCOM, $ASPPFLAGS.
1341
1342 Uses: $CC, $CPPFLAGS, $_CPPDEFFLAGS, $_CPPINCFLAGS.
1343
1344 bcc32
1345 Sets construction variables for the bcc32 compiler.
1346
1347 Sets: $CC, $CCCOM, $CCFLAGS, $CFILESUFFIX, $CFLAGS, $CPPDEFPREFIX,
1348 $CPPDEFSUFFIX, $INCPREFIX, $INCSUFFIX, $SHCC, $SHCCCOM, $SHCCFLAGS,
1349 $SHCFLAGS, $SHOBJSUFFIX.
1350
1351 Uses: $_CPPDEFFLAGS, $_CPPINCFLAGS.
1352
1353 cc
1354 Sets construction variables for generic POSIX C compilers.
1355
1356 Sets: $CC, $CCCOM, $CCFLAGS, $CFILESUFFIX, $CFLAGS, $CPPDEFPREFIX,
1357 $CPPDEFSUFFIX, $FRAMEWORKPATH, $FRAMEWORKS, $INCPREFIX, $INCSUFFIX,
1358 $SHCC, $SHCCCOM, $SHCCFLAGS, $SHCFLAGS, $SHOBJSUFFIX.
1359
1360 Uses: $CCCOMSTR, $PLATFORM, $SHCCCOMSTR.
1361
1362 clang
1363 Set construction variables for the Clang C compiler.
1364
1365 Sets: $CC, $CCVERSION, $SHCCFLAGS.
1366
1367 clangxx
1368 Set construction variables for the Clang C++ compiler.
1369
1370 Sets: $CXX, $CXXVERSION, $SHCXXFLAGS, $SHOBJSUFFIX,
1371 $STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME.
1372
1373 compilation_db
1374 Sets up CompilationDatabase builder which generates a clang tooling
1375 compatible compilation database.
1376
1377 Sets: $COMPILATIONDB_COMSTR, $COMPILATIONDB_PATH_FILTER,
1378 $COMPILATIONDB_USE_ABSPATH.
1379
1380 cvf
1381 Sets construction variables for the Compaq Visual Fortran compiler.
1382
1383 Sets: $FORTRAN, $FORTRANCOM, $FORTRANMODDIR, $FORTRANMODDIRPREFIX,
1384 $FORTRANMODDIRSUFFIX, $FORTRANPPCOM, $OBJSUFFIX, $SHFORTRANCOM,
1385 $SHFORTRANPPCOM.
1386
1387 Uses: $CPPFLAGS, $FORTRANFLAGS, $SHFORTRANFLAGS, $_CPPDEFFLAGS,
1388 $_FORTRANINCFLAGS, $_FORTRANMODFLAG.
1389
1390 cXX
1391 Sets construction variables for generic POSIX C++ compilers.
1392
1393 Sets: $CPPDEFPREFIX, $CPPDEFSUFFIX, $CXX, $CXXCOM, $CXXFILESUFFIX,
1394 $CXXFLAGS, $INCPREFIX, $INCSUFFIX, $OBJSUFFIX, $SHCXX, $SHCXXCOM,
1395 $SHCXXFLAGS, $SHOBJSUFFIX.
1396
1397 Uses: $CXXCOMSTR, $SHCXXCOMSTR.
1398
1399 cyglink
1400 Set construction variables for cygwin linker/loader.
1401
1402 Sets: $IMPLIBPREFIX, $IMPLIBSUFFIX, $LDMODULEVERSIONFLAGS,
1403 $LINKFLAGS, $RPATHPREFIX, $RPATHSUFFIX, $SHLIBPREFIX, $SHLIBSUFFIX,
1404 $SHLIBVERSIONFLAGS, $SHLINKCOM, $SHLINKFLAGS,
1405 $_LDMODULEVERSIONFLAGS, $_SHLIBVERSIONFLAGS.
1406
1407 default
1408 Sets construction variables for a default list of Tool modules. Use
1409 default in the tools list to retain the original defaults, since
1410 the tools parameter is treated as a literal statement of the tools
1411 to be made available in that construction environment, not an
1412 addition.
1413
1414 The list of tools selected by default is not static, but is
1415 dependent both on the platform and on the software installed on the
1416 platform. Some tools will not initialize if an underlying command
1417 is not found, and some tools are selected from a list of choices on
1418 a first-found basis. The finished tool list can be examined by
1419 inspecting the $TOOLS construction variable in the construction
1420 environment.
1421
1422 On all platforms, the tools from the following list are selected if
1423 their respective conditions are met: filesystem;, wix, lex, yacc,
1424 rpcgen, swig, jar, javac, javah, rmic, dvipdf, dvips, gs, tex,
1425 latex, pdflatex, pdftex, tar, zip, textfile.
1426
1427 On Linux systems, the default tools list selects (first-found): a C
1428 compiler from gcc, intelc, icc, cc; a C++ compiler from g++,
1429 intelc, icc, cXX; an assembler from gas, nasm, masm; a linker from
1430 gnulink, ilink; a Fortran compiler from gfortran, g77, ifort, ifl,
1431 f95, f90, f77; and a static archiver ar. It also selects all found
1432 from the list m4 rpm.
1433
1434 On Windows systems, the default tools list selects (first-found): a
1435 C compiler from msvc, mingw, gcc, intelc, icl, icc, cc, bcc32; a
1436 C++ compiler from msvc, intelc, icc, g++, cXX, bcc32; an assembler
1437 from masm, nasm, gas, 386asm; a linker from mslink, gnulink, ilink,
1438 linkloc, ilink32; a Fortran compiler from gfortran, g77, ifl, cvf,
1439 f95, f90, fortran; and a static archiver from mslib, ar, tlib; It
1440 also selects all found from the list msvs, midl.
1441
1442 On MacOS systems, the default tools list selects (first-found): a C
1443 compiler from gcc, cc; a C++ compiler from g++, cXX; an assembler
1444 as; a linker from applelink, gnulink; a Fortran compiler from
1445 gfortran, f95, f90, g77; and a static archiver ar. It also selects
1446 all found from the list m4, rpm.
1447
1448 Default lists for other platforms can be found by examining the
1449 scons source code (see SCons/Tool/__init__.py).
1450
1451 dmd
1452 Sets construction variables for D language compiler DMD.
1453
1454 Sets: $DC, $DCOM, $DDEBUG, $DDEBUGPREFIX, $DDEBUGSUFFIX,
1455 $DFILESUFFIX, $DFLAGPREFIX, $DFLAGS, $DFLAGSUFFIX, $DINCPREFIX,
1456 $DINCSUFFIX, $DLIB, $DLIBCOM, $DLIBDIRPREFIX, $DLIBDIRSUFFIX,
1457 $DLIBFLAGPREFIX, $DLIBFLAGSUFFIX, $DLIBLINKPREFIX, $DLIBLINKSUFFIX,
1458 $DLINK, $DLINKCOM, $DLINKFLAGPREFIX, $DLINKFLAGS, $DLINKFLAGSUFFIX,
1459 $DPATH, $DRPATHPREFIX, $DRPATHSUFFIX, $DVERPREFIX, $DVERSIONS,
1460 $DVERSUFFIX, $SHDC, $SHDCOM, $SHDLIBVERSIONFLAGS, $SHDLINK,
1461 $SHDLINKCOM, $SHDLINKFLAGS.
1462
1463 docbook
1464 This tool tries to make working with Docbook in SCons a little
1465 easier. It provides several toolchains for creating different
1466 output formats, like HTML or PDF. Contained in the package is a
1467 distribution of the Docbook XSL stylesheets as of version 1.76.1.
1468 As long as you don't specify your own stylesheets for
1469 customization, these official versions are picked as
1470 default...which should reduce the inevitable setup hassles for you.
1471
1472 Implicit dependencies to images and XIncludes are detected
1473 automatically if you meet the HTML requirements. The additional
1474 stylesheet utils/xmldepend.xsl by Paul DuBois is used for this
1475 purpose.
1476
1477 Note, that there is no support for XML catalog resolving offered!
1478 This tool calls the XSLT processors and PDF renderers with the
1479 stylesheets you specified, that's it. The rest lies in your hands
1480 and you still have to know what you're doing when resolving names
1481 via a catalog.
1482
1483 For activating the tool "docbook", you have to add its name to the
1484 Environment constructor, like this
1485
1486 env = Environment(tools=['docbook'])
1487
1488 On its startup, the docbook tool tries to find a required xsltproc
1489 processor, and a PDF renderer, e.g. fop. So make sure that these
1490 are added to your system's environment PATH and can be called
1491 directly without specifying their full path.
1492
1493 For the most basic processing of Docbook to HTML, you need to have
1494 installed
1495
1496 • the Python lxml binding to libxml2, or
1497
1498 • a standalone XSLT processor, currently detected are xsltproc,
1499 saxon, saxon-xslt and xalan.
1500
1501 Rendering to PDF requires you to have one of the applications fop
1502 or xep installed.
1503
1504 Creating a HTML or PDF document is very simple and straightforward.
1505 Say
1506
1507 env = Environment(tools=['docbook'])
1508 env.DocbookHtml('manual.html', 'manual.xml')
1509 env.DocbookPdf('manual.pdf', 'manual.xml')
1510
1511 to get both outputs from your XML source manual.xml. As a shortcut,
1512 you can give the stem of the filenames alone, like this:
1513
1514 env = Environment(tools=['docbook'])
1515 env.DocbookHtml('manual')
1516 env.DocbookPdf('manual')
1517
1518 and get the same result. Target and source lists are also
1519 supported:
1520
1521 env = Environment(tools=['docbook'])
1522 env.DocbookHtml(['manual.html','reference.html'], ['manual.xml','reference.xml'])
1523
1524 or even
1525
1526 env = Environment(tools=['docbook'])
1527 env.DocbookHtml(['manual','reference'])
1528
1529
1530 Important
1531 Whenever you leave out the list of sources, you may not specify
1532 a file extension! The Tool uses the given names as file stems,
1533 and adds the suffixes for target and source files accordingly.
1534 The rules given above are valid for the Builders DocbookHtml,
1535 DocbookPdf, DocbookEpub, DocbookSlidesPdf and DocbookXInclude. For
1536 the DocbookMan transformation you can specify a target name, but
1537 the actual output names are automatically set from the refname
1538 entries in your XML source.
1539
1540 The Builders DocbookHtmlChunked, DocbookHtmlhelp and
1541 DocbookSlidesHtml are special, in that:
1542
1543 1. they create a large set of files, where the exact names and
1544 their number depend on the content of the source file, and
1545
1546 2. the main target is always named index.html, i.e. the output
1547 name for the XSL transformation is not picked up by the
1548 stylesheets.
1549
1550 As a result, there is simply no use in specifying a target HTML
1551 name. So the basic syntax for these builders is always:
1552
1553 env = Environment(tools=['docbook'])
1554 env.DocbookHtmlhelp('manual')
1555
1556 If you want to use a specific XSL file, you can set the additional
1557 xsl parameter to your Builder call as follows:
1558
1559 env.DocbookHtml('other.html', 'manual.xml', xsl='html.xsl')
1560
1561 Since this may get tedious if you always use the same local naming
1562 for your customized XSL files, e.g. html.xsl for HTML and pdf.xsl
1563 for PDF output, a set of variables for setting the default XSL name
1564 is provided. These are:
1565
1566 DOCBOOK_DEFAULT_XSL_HTML
1567 DOCBOOK_DEFAULT_XSL_HTMLCHUNKED
1568 DOCBOOK_DEFAULT_XSL_HTMLHELP
1569 DOCBOOK_DEFAULT_XSL_PDF
1570 DOCBOOK_DEFAULT_XSL_EPUB
1571 DOCBOOK_DEFAULT_XSL_MAN
1572 DOCBOOK_DEFAULT_XSL_SLIDESPDF
1573 DOCBOOK_DEFAULT_XSL_SLIDESHTML
1574
1575 and you can set them when constructing your environment:
1576
1577 env = Environment(
1578 tools=['docbook'],
1579 DOCBOOK_DEFAULT_XSL_HTML='html.xsl',
1580 DOCBOOK_DEFAULT_XSL_PDF='pdf.xsl',
1581 )
1582 env.DocbookHtml('manual') # now uses html.xsl
1583
1584 Sets: $DOCBOOK_DEFAULT_XSL_EPUB, $DOCBOOK_DEFAULT_XSL_HTML,
1585 $DOCBOOK_DEFAULT_XSL_HTMLCHUNKED, $DOCBOOK_DEFAULT_XSL_HTMLHELP,
1586 $DOCBOOK_DEFAULT_XSL_MAN, $DOCBOOK_DEFAULT_XSL_PDF,
1587 $DOCBOOK_DEFAULT_XSL_SLIDESHTML, $DOCBOOK_DEFAULT_XSL_SLIDESPDF,
1588 $DOCBOOK_FOP, $DOCBOOK_FOPCOM, $DOCBOOK_FOPFLAGS, $DOCBOOK_XMLLINT,
1589 $DOCBOOK_XMLLINTCOM, $DOCBOOK_XMLLINTFLAGS, $DOCBOOK_XSLTPROC,
1590 $DOCBOOK_XSLTPROCCOM, $DOCBOOK_XSLTPROCFLAGS,
1591 $DOCBOOK_XSLTPROCPARAMS.
1592
1593 Uses: $DOCBOOK_FOPCOMSTR, $DOCBOOK_XMLLINTCOMSTR,
1594 $DOCBOOK_XSLTPROCCOMSTR.
1595
1596 dvi
1597 Attaches the DVI builder to the construction environment.
1598
1599 dvipdf
1600 Sets construction variables for the dvipdf utility.
1601
1602 Sets: $DVIPDF, $DVIPDFCOM, $DVIPDFFLAGS.
1603
1604 Uses: $DVIPDFCOMSTR.
1605
1606 dvips
1607 Sets construction variables for the dvips utility.
1608
1609 Sets: $DVIPS, $DVIPSFLAGS, $PSCOM, $PSPREFIX, $PSSUFFIX.
1610
1611 Uses: $PSCOMSTR.
1612
1613 f03
1614 Set construction variables for generic POSIX Fortran 03 compilers.
1615
1616 Sets: $F03, $F03COM, $F03FLAGS, $F03PPCOM, $SHF03, $SHF03COM,
1617 $SHF03FLAGS, $SHF03PPCOM, $_F03INCFLAGS.
1618
1619 Uses: $F03COMSTR, $F03PPCOMSTR, $SHF03COMSTR, $SHF03PPCOMSTR.
1620
1621 f08
1622 Set construction variables for generic POSIX Fortran 08 compilers.
1623
1624 Sets: $F08, $F08COM, $F08FLAGS, $F08PPCOM, $SHF08, $SHF08COM,
1625 $SHF08FLAGS, $SHF08PPCOM, $_F08INCFLAGS.
1626
1627 Uses: $F08COMSTR, $F08PPCOMSTR, $SHF08COMSTR, $SHF08PPCOMSTR.
1628
1629 f77
1630 Set construction variables for generic POSIX Fortran 77 compilers.
1631
1632 Sets: $F77, $F77COM, $F77FILESUFFIXES, $F77FLAGS, $F77PPCOM,
1633 $F77PPFILESUFFIXES, $FORTRAN, $FORTRANCOM, $FORTRANFLAGS, $SHF77,
1634 $SHF77COM, $SHF77FLAGS, $SHF77PPCOM, $SHFORTRAN, $SHFORTRANCOM,
1635 $SHFORTRANFLAGS, $SHFORTRANPPCOM, $_F77INCFLAGS.
1636
1637 Uses: $F77COMSTR, $F77PPCOMSTR, $FORTRANCOMSTR, $FORTRANPPCOMSTR,
1638 $SHF77COMSTR, $SHF77PPCOMSTR, $SHFORTRANCOMSTR, $SHFORTRANPPCOMSTR.
1639
1640 f90
1641 Set construction variables for generic POSIX Fortran 90 compilers.
1642
1643 Sets: $F90, $F90COM, $F90FLAGS, $F90PPCOM, $SHF90, $SHF90COM,
1644 $SHF90FLAGS, $SHF90PPCOM, $_F90INCFLAGS.
1645
1646 Uses: $F90COMSTR, $F90PPCOMSTR, $SHF90COMSTR, $SHF90PPCOMSTR.
1647
1648 f95
1649 Set construction variables for generic POSIX Fortran 95 compilers.
1650
1651 Sets: $F95, $F95COM, $F95FLAGS, $F95PPCOM, $SHF95, $SHF95COM,
1652 $SHF95FLAGS, $SHF95PPCOM, $_F95INCFLAGS.
1653
1654 Uses: $F95COMSTR, $F95PPCOMSTR, $SHF95COMSTR, $SHF95PPCOMSTR.
1655
1656 fortran
1657 Set construction variables for generic POSIX Fortran compilers.
1658
1659 Sets: $FORTRAN, $FORTRANCOM, $FORTRANFLAGS, $SHFORTRAN,
1660 $SHFORTRANCOM, $SHFORTRANFLAGS, $SHFORTRANPPCOM.
1661
1662 Uses: $FORTRANCOMSTR, $FORTRANPPCOMSTR, $SHFORTRANCOMSTR,
1663 $SHFORTRANPPCOMSTR.
1664
1665 g++
1666 Set construction variables for the g++ C++ compiler.
1667
1668 Sets: $CXX, $CXXVERSION, $SHCXXFLAGS, $SHOBJSUFFIX.
1669
1670 g77
1671 Set construction variables for the g77 Fortran compiler. Calls the
1672 f77 Tool module to set variables.
1673
1674 gas
1675 Sets construction variables for the gas assembler. Calls the as
1676 tool.
1677
1678 Sets: $AS.
1679
1680 gcc
1681 Set construction variables for the gcc C compiler.
1682
1683 Sets: $CC, $CCVERSION, $SHCCFLAGS.
1684
1685 gdc
1686 Sets construction variables for the D language compiler GDC.
1687
1688 Sets: $DC, $DCOM, $DDEBUG, $DDEBUGPREFIX, $DDEBUGSUFFIX,
1689 $DFILESUFFIX, $DFLAGPREFIX, $DFLAGS, $DFLAGSUFFIX, $DINCPREFIX,
1690 $DINCSUFFIX, $DLIB, $DLIBCOM, $DLIBDIRPREFIX, $DLIBDIRSUFFIX,
1691 $DLIBFLAGPREFIX, $DLIBFLAGSUFFIX, $DLIBLINKPREFIX, $DLIBLINKSUFFIX,
1692 $DLINK, $DLINKCOM, $DLINKFLAGPREFIX, $DLINKFLAGS, $DLINKFLAGSUFFIX,
1693 $DPATH, $DRPATHPREFIX, $DRPATHSUFFIX, $DVERPREFIX, $DVERSIONS,
1694 $DVERSUFFIX, $SHDC, $SHDCOM, $SHDLIBVERSIONFLAGS, $SHDLINK,
1695 $SHDLINKCOM, $SHDLINKFLAGS.
1696
1697 gettext
1698 This is actually a toolset, which supports internationalization and
1699 localization of software being constructed with SCons. The toolset
1700 loads following tools:
1701
1702
1703
1704 • xgettext - to extract internationalized messages from source
1705 code to POT file(s),
1706
1707 • msginit - may be optionally used to initialize PO files,
1708
1709 • msgmerge - to update PO files, that already contain translated
1710 messages,
1711
1712 • msgfmt - to compile textual PO file to binary installable MO
1713 file.
1714
1715 When you enable gettext, it internally loads all abovementioned
1716 tools, so you're encouraged to see their individual documentation.
1717
1718 Each of the above tools provides its own builder(s) which may be
1719 used to perform particular activities related to software
1720 internationalization. You may be however interested in top-level
1721 Translate builder.
1722
1723 To use gettext tools add 'gettext' tool to your environment:
1724
1725 env = Environment( tools = ['default', 'gettext'] )
1726
1727 gfortran
1728 Sets construction variables for the GNU F95/F2003 GNU compiler.
1729
1730 Sets: $F77, $F90, $F95, $FORTRAN, $SHF77, $SHF77FLAGS, $SHF90,
1731 $SHF90FLAGS, $SHF95, $SHF95FLAGS, $SHFORTRAN, $SHFORTRANFLAGS.
1732
1733 gnulink
1734 Set construction variables for GNU linker/loader.
1735
1736 Sets: $LDMODULEVERSIONFLAGS, $RPATHPREFIX, $RPATHSUFFIX,
1737 $SHLIBVERSIONFLAGS, $SHLINKFLAGS, $_LDMODULESONAME, $_SHLIBSONAME.
1738
1739 gs
1740 This Tool sets the required construction variables for working with
1741 the Ghostscript software. It also registers an appropriate Action
1742 with the PDF Builder, such that the conversion from PS/EPS to PDF
1743 happens automatically for the TeX/LaTeX toolchain. Finally, it adds
1744 an explicit Gs Builder for Ghostscript to the environment.
1745
1746 Sets: $GS, $GSCOM, $GSFLAGS.
1747
1748 Uses: $GSCOMSTR.
1749
1750 hpc++
1751 Set construction variables for the compilers aCC on HP/UX systems.
1752
1753 hpcc
1754 Set construction variables for aCC compilers on HP/UX systems.
1755 Calls the cXX tool for additional variables.
1756
1757 Sets: $CXX, $CXXVERSION, $SHCXXFLAGS.
1758
1759 hplink
1760 Sets construction variables for the linker on HP/UX systems.
1761
1762 Sets: $LINKFLAGS, $SHLIBSUFFIX, $SHLINKFLAGS.
1763
1764 icc
1765 Sets construction variables for the icc compiler on OS/2 systems.
1766
1767 Sets: $CC, $CCCOM, $CFILESUFFIX, $CPPDEFPREFIX, $CPPDEFSUFFIX,
1768 $CXXCOM, $CXXFILESUFFIX, $INCPREFIX, $INCSUFFIX.
1769
1770 Uses: $CCFLAGS, $CFLAGS, $CPPFLAGS, $_CPPDEFFLAGS, $_CPPINCFLAGS.
1771
1772 icl
1773 Sets construction variables for the Intel C/C++ compiler. Calls the
1774 intelc Tool module to set its variables.
1775
1776 ifl
1777 Sets construction variables for the Intel Fortran compiler.
1778
1779 Sets: $FORTRAN, $FORTRANCOM, $FORTRANPPCOM, $SHFORTRANCOM,
1780 $SHFORTRANPPCOM.
1781
1782 Uses: $CPPFLAGS, $FORTRANFLAGS, $_CPPDEFFLAGS, $_FORTRANINCFLAGS.
1783
1784 ifort
1785 Sets construction variables for newer versions of the Intel Fortran
1786 compiler for Linux.
1787
1788 Sets: $F77, $F90, $F95, $FORTRAN, $SHF77, $SHF77FLAGS, $SHF90,
1789 $SHF90FLAGS, $SHF95, $SHF95FLAGS, $SHFORTRAN, $SHFORTRANFLAGS.
1790
1791 ilink
1792 Sets construction variables for the ilink linker on OS/2 systems.
1793
1794 Sets: $LIBDIRPREFIX, $LIBDIRSUFFIX, $LIBLINKPREFIX, $LIBLINKSUFFIX,
1795 $LINK, $LINKCOM, $LINKFLAGS.
1796
1797 ilink32
1798 Sets construction variables for the Borland ilink32 linker.
1799
1800 Sets: $LIBDIRPREFIX, $LIBDIRSUFFIX, $LIBLINKPREFIX, $LIBLINKSUFFIX,
1801 $LINK, $LINKCOM, $LINKFLAGS.
1802
1803 install
1804 Sets construction variables for file and directory installation.
1805
1806 Sets: $INSTALL, $INSTALLSTR.
1807
1808 intelc
1809 Sets construction variables for the Intel C/C++ compiler (Linux and
1810 Windows, version 7 and later). Calls the gcc or msvc (on Linux and
1811 Windows, respectively) tool to set underlying variables.
1812
1813 Sets: $AR, $CC, $CXX, $INTEL_C_COMPILER_VERSION, $LINK.
1814
1815 jar
1816 Sets construction variables for the jar utility.
1817
1818 Sets: $JAR, $JARCOM, $JARFLAGS, $JARSUFFIX.
1819
1820 Uses: $JARCOMSTR.
1821
1822 javac
1823 Sets construction variables for the javac compiler.
1824
1825 Sets: $JAVABOOTCLASSPATH, $JAVAC, $JAVACCOM, $JAVACFLAGS,
1826 $JAVACLASSPATH, $JAVACLASSSUFFIX, $JAVAINCLUDES, $JAVASOURCEPATH,
1827 $JAVASUFFIX.
1828
1829 Uses: $JAVACCOMSTR.
1830
1831 javah
1832 Sets construction variables for the javah tool.
1833
1834 Sets: $JAVACLASSSUFFIX, $JAVAH, $JAVAHCOM, $JAVAHFLAGS.
1835
1836 Uses: $JAVACLASSPATH, $JAVAHCOMSTR.
1837
1838 latex
1839 Sets construction variables for the latex utility.
1840
1841 Sets: $LATEX, $LATEXCOM, $LATEXFLAGS.
1842
1843 Uses: $LATEXCOMSTR.
1844
1845 ldc
1846 Sets construction variables for the D language compiler LDC2.
1847
1848 Sets: $DC, $DCOM, $DDEBUG, $DDEBUGPREFIX, $DDEBUGSUFFIX,
1849 $DFILESUFFIX, $DFLAGPREFIX, $DFLAGS, $DFLAGSUFFIX, $DINCPREFIX,
1850 $DINCSUFFIX, $DLIB, $DLIBCOM, $DLIBDIRPREFIX, $DLIBDIRSUFFIX,
1851 $DLIBFLAGPREFIX, $DLIBFLAGSUFFIX, $DLIBLINKPREFIX, $DLIBLINKSUFFIX,
1852 $DLINK, $DLINKCOM, $DLINKFLAGPREFIX, $DLINKFLAGS, $DLINKFLAGSUFFIX,
1853 $DPATH, $DRPATHPREFIX, $DRPATHSUFFIX, $DVERPREFIX, $DVERSIONS,
1854 $DVERSUFFIX, $SHDC, $SHDCOM, $SHDLIBVERSIONFLAGS, $SHDLINK,
1855 $SHDLINKCOM, $SHDLINKFLAGS.
1856
1857 lex
1858 Sets construction variables for the lex lexical analyser.
1859
1860 Sets: $LEX, $LEXCOM, $LEXFLAGS, $LEXUNISTD.
1861
1862 Uses: $LEXCOMSTR.
1863
1864 link
1865 Sets construction variables for generic POSIX linkers. This is a
1866 "smart" linker tool which selects a compiler to complete the
1867 linking based on the types of source files.
1868
1869 Sets: $LDMODULE, $LDMODULECOM, $LDMODULEFLAGS,
1870 $LDMODULENOVERSIONSYMLINKS, $LDMODULEPREFIX, $LDMODULESUFFIX,
1871 $LDMODULEVERSION, $LDMODULEVERSIONFLAGS, $LIBDIRPREFIX,
1872 $LIBDIRSUFFIX, $LIBLINKPREFIX, $LIBLINKSUFFIX, $LINK, $LINKCOM,
1873 $LINKFLAGS, $SHLIBSUFFIX, $SHLINK, $SHLINKCOM, $SHLINKFLAGS,
1874 $__LDMODULEVERSIONFLAGS, $__SHLIBVERSIONFLAGS.
1875
1876 Uses: $LDMODULECOMSTR, $LINKCOMSTR, $SHLINKCOMSTR.
1877
1878 linkloc
1879 Sets construction variables for the LinkLoc linker for the Phar Lap
1880 ETS embedded operating system.
1881
1882 Sets: $LIBDIRPREFIX, $LIBDIRSUFFIX, $LIBLINKPREFIX, $LIBLINKSUFFIX,
1883 $LINK, $LINKCOM, $LINKFLAGS, $SHLINK, $SHLINKCOM, $SHLINKFLAGS.
1884
1885 Uses: $LINKCOMSTR, $SHLINKCOMSTR.
1886
1887 m4
1888 Sets construction variables for the m4 macro processor.
1889
1890 Sets: $M4, $M4COM, $M4FLAGS.
1891
1892 Uses: $M4COMSTR.
1893
1894 masm
1895 Sets construction variables for the Microsoft assembler.
1896
1897 Sets: $AS, $ASCOM, $ASFLAGS, $ASPPCOM, $ASPPFLAGS.
1898
1899 Uses: $ASCOMSTR, $ASPPCOMSTR, $CPPFLAGS, $_CPPDEFFLAGS,
1900 $_CPPINCFLAGS.
1901
1902 midl
1903 Sets construction variables for the Microsoft IDL compiler.
1904
1905 Sets: $MIDL, $MIDLCOM, $MIDLFLAGS.
1906
1907 Uses: $MIDLCOMSTR.
1908
1909 mingw
1910 Sets construction variables for MinGW (Minimal Gnu on Windows).
1911
1912 Sets: $AS, $CC, $CXX, $LDMODULECOM, $LIBPREFIX, $LIBSUFFIX,
1913 $OBJSUFFIX, $RC, $RCCOM, $RCFLAGS, $RCINCFLAGS, $RCINCPREFIX,
1914 $RCINCSUFFIX, $SHCCFLAGS, $SHCXXFLAGS, $SHLINKCOM, $SHLINKFLAGS,
1915 $SHOBJSUFFIX, $WINDOWSDEFPREFIX, $WINDOWSDEFSUFFIX.
1916
1917 Uses: $RCCOMSTR, $SHLINKCOMSTR.
1918
1919 msgfmt
1920 This scons tool is a part of scons gettext toolset. It provides
1921 scons interface to msgfmt(1) command, which generates binary
1922 message catalog (MO) from a textual translation description (PO).
1923
1924 Sets: $MOSUFFIX, $MSGFMT, $MSGFMTCOM, $MSGFMTCOMSTR, $MSGFMTFLAGS,
1925 $POSUFFIX.
1926
1927 Uses: $LINGUAS_FILE.
1928
1929 msginit
1930 This scons tool is a part of scons gettext toolset. It provides
1931 scons interface to msginit(1) program, which creates new PO file,
1932 initializing the meta information with values from user's
1933 environment (or options).
1934
1935 Sets: $MSGINIT, $MSGINITCOM, $MSGINITCOMSTR, $MSGINITFLAGS,
1936 $POAUTOINIT, $POCREATE_ALIAS, $POSUFFIX, $POTSUFFIX,
1937 $_MSGINITLOCALE.
1938
1939 Uses: $LINGUAS_FILE, $POAUTOINIT, $POTDOMAIN.
1940
1941 msgmerge
1942 This scons tool is a part of scons gettext toolset. It provides
1943 scons interface to msgmerge(1) command, which merges two Uniform
1944 style .po files together.
1945
1946 Sets: $MSGMERGE, $MSGMERGECOM, $MSGMERGECOMSTR, $MSGMERGEFLAGS,
1947 $POSUFFIX, $POTSUFFIX, $POUPDATE_ALIAS.
1948
1949 Uses: $LINGUAS_FILE, $POAUTOINIT, $POTDOMAIN.
1950
1951 mslib
1952 Sets construction variables for the Microsoft mslib library
1953 archiver.
1954
1955 Sets: $AR, $ARCOM, $ARFLAGS, $LIBPREFIX, $LIBSUFFIX.
1956
1957 Uses: $ARCOMSTR.
1958
1959 mslink
1960 Sets construction variables for the Microsoft linker.
1961
1962 Sets: $LDMODULE, $LDMODULECOM, $LDMODULEFLAGS, $LDMODULEPREFIX,
1963 $LDMODULESUFFIX, $LIBDIRPREFIX, $LIBDIRSUFFIX, $LIBLINKPREFIX,
1964 $LIBLINKSUFFIX, $LINK, $LINKCOM, $LINKFLAGS, $REGSVR, $REGSVRCOM,
1965 $REGSVRFLAGS, $SHLINK, $SHLINKCOM, $SHLINKFLAGS, $WINDOWSDEFPREFIX,
1966 $WINDOWSDEFSUFFIX, $WINDOWSEXPPREFIX, $WINDOWSEXPSUFFIX,
1967 $WINDOWSPROGMANIFESTPREFIX, $WINDOWSPROGMANIFESTSUFFIX,
1968 $WINDOWSSHLIBMANIFESTPREFIX, $WINDOWSSHLIBMANIFESTSUFFIX,
1969 $WINDOWS_INSERT_DEF.
1970
1971 Uses: $LDMODULECOMSTR, $LINKCOMSTR, $REGSVRCOMSTR, $SHLINKCOMSTR.
1972
1973 mssdk
1974 Sets variables for Microsoft Platform SDK and/or Windows SDK. Note
1975 that unlike most other Tool modules, mssdk does not set
1976 construction variables, but sets the environment variables in the
1977 environment SCons uses to execute the Microsoft toolchain:
1978 %INCLUDE%, %LIB%, %LIBPATH% and %PATH%.
1979
1980 Uses: $MSSDK_DIR, $MSSDK_VERSION, $MSVS_VERSION.
1981
1982 msvc
1983 Sets construction variables for the Microsoft Visual C/C++
1984 compiler.
1985
1986 Sets: $BUILDERS, $CC, $CCCOM, $CCFLAGS, $CCPCHFLAGS, $CCPDBFLAGS,
1987 $CFILESUFFIX, $CFLAGS, $CPPDEFPREFIX, $CPPDEFSUFFIX, $CXX, $CXXCOM,
1988 $CXXFILESUFFIX, $CXXFLAGS, $INCPREFIX, $INCSUFFIX, $OBJPREFIX,
1989 $OBJSUFFIX, $PCHCOM, $PCHPDBFLAGS, $RC, $RCCOM, $RCFLAGS, $SHCC,
1990 $SHCCCOM, $SHCCFLAGS, $SHCFLAGS, $SHCXX, $SHCXXCOM, $SHCXXFLAGS,
1991 $SHOBJPREFIX, $SHOBJSUFFIX.
1992
1993 Uses: $CCCOMSTR, $CXXCOMSTR, $PCH, $PCHSTOP, $PDB, $SHCCCOMSTR,
1994 $SHCXXCOMSTR.
1995
1996 msvs
1997 Sets construction variables for Microsoft Visual Studio.
1998
1999 Sets: $MSVSBUILDCOM, $MSVSCLEANCOM, $MSVSENCODING, $MSVSPROJECTCOM,
2000 $MSVSREBUILDCOM, $MSVSSCONS, $MSVSSCONSCOM, $MSVSSCONSCRIPT,
2001 $MSVSSCONSFLAGS, $MSVSSOLUTIONCOM.
2002
2003 mwcc
2004 Sets construction variables for the Metrowerks CodeWarrior
2005 compiler.
2006
2007 Sets: $CC, $CCCOM, $CFILESUFFIX, $CPPDEFPREFIX, $CPPDEFSUFFIX,
2008 $CXX, $CXXCOM, $CXXFILESUFFIX, $INCPREFIX, $INCSUFFIX,
2009 $MWCW_VERSION, $MWCW_VERSIONS, $SHCC, $SHCCCOM, $SHCCFLAGS,
2010 $SHCFLAGS, $SHCXX, $SHCXXCOM, $SHCXXFLAGS.
2011
2012 Uses: $CCCOMSTR, $CXXCOMSTR, $SHCCCOMSTR, $SHCXXCOMSTR.
2013
2014 mwld
2015 Sets construction variables for the Metrowerks CodeWarrior linker.
2016
2017 Sets: $AR, $ARCOM, $LIBDIRPREFIX, $LIBDIRSUFFIX, $LIBLINKPREFIX,
2018 $LIBLINKSUFFIX, $LINK, $LINKCOM, $SHLINK, $SHLINKCOM, $SHLINKFLAGS.
2019
2020 nasm
2021 Sets construction variables for the nasm Netwide Assembler.
2022
2023 Sets: $AS, $ASCOM, $ASFLAGS, $ASPPCOM, $ASPPFLAGS.
2024
2025 Uses: $ASCOMSTR, $ASPPCOMSTR.
2026
2027 ninja
2028 Sets up Ninja builder which generates a ninja build file, and then
2029 optionally runs ninja.
2030
2031 Note
2032 This is an experimental feature.
2033
2034 This functionality is subject to change and/or removal without
2035 deprecation cycle.
2036 Sets: $IMPLICIT_COMMAND_DEPENDENCIES, $NINJA_ALIAS_NAME,
2037 $NINJA_COMPDB_EXPAND, $NINJA_DIR, $NINJA_DISABLE_AUTO_RUN,
2038 $NINJA_ENV_VAR_CACHE, $NINJA_FILE_NAME,
2039 $NINJA_GENERATED_SOURCE_SUFFIXES, $NINJA_MSVC_DEPS_PREFIX,
2040 $NINJA_POOL, $NINJA_REGENERATE_DEPS, $NINJA_SYNTAX,
2041 $_NINJA_REGENERATE_DEPS_FUNC, $__NINJA_NO.
2042
2043 Uses: $AR, $ARCOM, $ARFLAGS, $CC, $CCCOM, $CCFLAGS, $CXX, $CXXCOM,
2044 $ESCAPE, $LINK, $LINKCOM, $PLATFORM, $PRINT_CMD_LINE_FUNC,
2045 $PROGSUFFIX, $RANLIB, $RANLIBCOM, $SHCCCOM, $SHCXXCOM, $SHLINK,
2046 $SHLINKCOM.
2047
2048 packaging
2049 Sets construction variables for the Package Builder. If this tool
2050 is enabled, the --package-type command-line option is also enabled.
2051
2052 pdf
2053 Sets construction variables for the Portable Document Format
2054 builder.
2055
2056 Sets: $PDFPREFIX, $PDFSUFFIX.
2057
2058 pdflatex
2059 Sets construction variables for the pdflatex utility.
2060
2061 Sets: $LATEXRETRIES, $PDFLATEX, $PDFLATEXCOM, $PDFLATEXFLAGS.
2062
2063 Uses: $PDFLATEXCOMSTR.
2064
2065 pdftex
2066 Sets construction variables for the pdftex utility.
2067
2068 Sets: $LATEXRETRIES, $PDFLATEX, $PDFLATEXCOM, $PDFLATEXFLAGS,
2069 $PDFTEX, $PDFTEXCOM, $PDFTEXFLAGS.
2070
2071 Uses: $PDFLATEXCOMSTR, $PDFTEXCOMSTR.
2072
2073 python
2074 Loads the Python source scanner into the invoking environment. When
2075 loaded, the scanner will attempt to find implicit dependencies for
2076 any Python source files in the list of sources provided to an
2077 Action that uses this environment.
2078
2079 Available since scons 4.0..
2080
2081 qt
2082 Sets construction variables for building Qt applications.
2083
2084 Sets: $QTDIR, $QT_AUTOSCAN, $QT_BINPATH, $QT_CPPPATH, $QT_LIB,
2085 $QT_LIBPATH, $QT_MOC, $QT_MOCCXXPREFIX, $QT_MOCCXXSUFFIX,
2086 $QT_MOCFROMCXXCOM, $QT_MOCFROMCXXFLAGS, $QT_MOCFROMHCOM,
2087 $QT_MOCFROMHFLAGS, $QT_MOCHPREFIX, $QT_MOCHSUFFIX, $QT_UIC,
2088 $QT_UICCOM, $QT_UICDECLFLAGS, $QT_UICDECLPREFIX, $QT_UICDECLSUFFIX,
2089 $QT_UICIMPLFLAGS, $QT_UICIMPLPREFIX, $QT_UICIMPLSUFFIX,
2090 $QT_UISUFFIX.
2091
2092 rmic
2093 Sets construction variables for the rmic utility.
2094
2095 Sets: $JAVACLASSSUFFIX, $RMIC, $RMICCOM, $RMICFLAGS.
2096
2097 Uses: $RMICCOMSTR.
2098
2099 rpcgen
2100 Sets construction variables for building with RPCGEN.
2101
2102 Sets: $RPCGEN, $RPCGENCLIENTFLAGS, $RPCGENFLAGS,
2103 $RPCGENHEADERFLAGS, $RPCGENSERVICEFLAGS, $RPCGENXDRFLAGS.
2104
2105 sgiar
2106 Sets construction variables for the SGI library archiver.
2107
2108 Sets: $AR, $ARCOMSTR, $ARFLAGS, $LIBPREFIX, $LIBSUFFIX, $SHLINK,
2109 $SHLINKFLAGS.
2110
2111 Uses: $ARCOMSTR, $SHLINKCOMSTR.
2112
2113 sgic++
2114 Sets construction variables for the SGI C++ compiler.
2115
2116 Sets: $CXX, $CXXFLAGS, $SHCXX, $SHOBJSUFFIX.
2117
2118 sgicc
2119 Sets construction variables for the SGI C compiler.
2120
2121 Sets: $CXX, $SHOBJSUFFIX.
2122
2123 sgilink
2124 Sets construction variables for the SGI linker.
2125
2126 Sets: $LINK, $RPATHPREFIX, $RPATHSUFFIX, $SHLINKFLAGS.
2127
2128 sunar
2129 Sets construction variables for the Sun library archiver.
2130
2131 Sets: $AR, $ARCOM, $ARFLAGS, $LIBPREFIX, $LIBSUFFIX.
2132
2133 Uses: $ARCOMSTR.
2134
2135 sunc++
2136 Sets construction variables for the Sun C++ compiler.
2137
2138 Sets: $CXX, $CXXVERSION, $SHCXX, $SHCXXFLAGS, $SHOBJPREFIX,
2139 $SHOBJSUFFIX.
2140
2141 suncc
2142 Sets construction variables for the Sun C compiler.
2143
2144 Sets: $CXX, $SHCCFLAGS, $SHOBJPREFIX, $SHOBJSUFFIX.
2145
2146 sunf77
2147 Set construction variables for the Sun f77 Fortran compiler.
2148
2149 Sets: $F77, $FORTRAN, $SHF77, $SHF77FLAGS, $SHFORTRAN,
2150 $SHFORTRANFLAGS.
2151
2152 sunf90
2153 Set construction variables for the Sun f90 Fortran compiler.
2154
2155 Sets: $F90, $FORTRAN, $SHF90, $SHF90FLAGS, $SHFORTRAN,
2156 $SHFORTRANFLAGS.
2157
2158 sunf95
2159 Set construction variables for the Sun f95 Fortran compiler.
2160
2161 Sets: $F95, $FORTRAN, $SHF95, $SHF95FLAGS, $SHFORTRAN,
2162 $SHFORTRANFLAGS.
2163
2164 sunlink
2165 Sets construction variables for the Sun linker.
2166
2167 Sets: $RPATHPREFIX, $RPATHSUFFIX, $SHLINKFLAGS.
2168
2169 swig
2170 Sets construction variables for the SWIG interface generator.
2171
2172 Sets: $SWIG, $SWIGCFILESUFFIX, $SWIGCOM, $SWIGCXXFILESUFFIX,
2173 $SWIGDIRECTORSUFFIX, $SWIGFLAGS, $SWIGINCPREFIX, $SWIGINCSUFFIX,
2174 $SWIGPATH, $SWIGVERSION, $_SWIGINCFLAGS.
2175
2176 Uses: $SWIGCOMSTR.
2177
2178 tar
2179 Sets construction variables for the tar archiver.
2180
2181 Sets: $TAR, $TARCOM, $TARFLAGS, $TARSUFFIX.
2182
2183 Uses: $TARCOMSTR.
2184
2185 tex
2186 Sets construction variables for the TeX formatter and typesetter.
2187
2188 Sets: $BIBTEX, $BIBTEXCOM, $BIBTEXFLAGS, $LATEX, $LATEXCOM,
2189 $LATEXFLAGS, $MAKEINDEX, $MAKEINDEXCOM, $MAKEINDEXFLAGS, $TEX,
2190 $TEXCOM, $TEXFLAGS.
2191
2192 Uses: $BIBTEXCOMSTR, $LATEXCOMSTR, $MAKEINDEXCOMSTR, $TEXCOMSTR.
2193
2194 textfile
2195 Set construction variables for the Textfile and Substfile builders.
2196
2197 Sets: $LINESEPARATOR, $SUBSTFILEPREFIX, $SUBSTFILESUFFIX,
2198 $TEXTFILEPREFIX, $TEXTFILESUFFIX.
2199
2200 Uses: $SUBST_DICT.
2201
2202 tlib
2203 Sets construction variables for the Borlan tib library archiver.
2204
2205 Sets: $AR, $ARCOM, $ARFLAGS, $LIBPREFIX, $LIBSUFFIX.
2206
2207 Uses: $ARCOMSTR.
2208
2209 xgettext
2210 This scons tool is a part of scons gettext toolset. It provides
2211 scons interface to xgettext(1) program, which extracts
2212 internationalized messages from source code. The tool provides
2213 POTUpdate builder to make PO Template files.
2214
2215 Sets: $POTSUFFIX, $POTUPDATE_ALIAS, $XGETTEXTCOM, $XGETTEXTCOMSTR,
2216 $XGETTEXTFLAGS, $XGETTEXTFROM, $XGETTEXTFROMPREFIX,
2217 $XGETTEXTFROMSUFFIX, $XGETTEXTPATH, $XGETTEXTPATHPREFIX,
2218 $XGETTEXTPATHSUFFIX, $_XGETTEXTDOMAIN, $_XGETTEXTFROMFLAGS,
2219 $_XGETTEXTPATHFLAGS.
2220
2221 Uses: $POTDOMAIN.
2222
2223 yacc
2224 Sets construction variables for the yacc parse generator.
2225
2226 Sets: $YACC, $YACCCOM, $YACCFLAGS, $YACCHFILESUFFIX,
2227 $YACCHXXFILESUFFIX, $YACCVCGFILESUFFIX.
2228
2229 Uses: $YACCCOMSTR.
2230
2231 zip
2232 Sets construction variables for the zip archiver.
2233
2234 Sets: $ZIP, $ZIPCOM, $ZIPCOMPRESSION, $ZIPFLAGS, $ZIPSUFFIX.
2235
2236 Uses: $ZIPCOMSTR.
2237
2238 Builder Methods
2239 You tell scons what to build by calling Builders, functions which take
2240 particular action(s) to produce a particular result type
2241 (conventionally described by the builder name such as Program) when
2242 given source files of a particular type. Calling a builder defines one
2243 or more targets to the build system; whether the targets are actually
2244 built on a given invocation is determined by command-line options,
2245 target selection rules, and whether SCons determines the target(s) are
2246 out of date.
2247
2248 SCons defines a number of builders, and you can also write your own.
2249 Builders are attached to a construction environment as methods, and the
2250 available builder methods are listed as key-value pairs in the BUILDERS
2251 attribute of the construction environment. The available builders can
2252 be displayed like this for debugging purposes:
2253
2254 env = Environment()
2255 print("Builders:", list(env['BUILDERS']))
2256
2257 Builder methods take two required arguments: target and source. Either
2258 can be passed as a scalar or as a list. The target and source arguments
2259 can be specified either as positional arguments, in which case target
2260 comes first, or as keyword arguments, using target= and source=.
2261 Although both arguments are nominally required, if there is a single
2262 source and the target can be inferred the target argument can be
2263 omitted (see below). Builder methods also take a variety of keyword
2264 arguments, described below.
2265
2266 The builder may add other targets beyond those requested if indicated
2267 by an Emitter (see the section called “Builder Objects” and, for
2268 example, $PROGEMITTER for more information).
2269
2270 Because long lists of file names can lead to a lot of quoting, scons
2271 supplies a Split global function and a same-named environment method
2272 that splits a single string into a list, using strings of white-space
2273 characters as the delimiter. (similar to the Python string split
2274 method, but succeeds even if the input isn't a string.)
2275
2276 The following are equivalent examples of calling the Program builder
2277 method:
2278
2279 env.Program('bar', ['bar.c', 'foo.c'])
2280 env.Program('bar', Split('bar.c foo.c'))
2281 env.Program('bar', env.Split('bar.c foo.c'))
2282 env.Program(source=['bar.c', 'foo.c'], target='bar')
2283 env.Program(target='bar', source=Split('bar.c foo.c'))
2284 env.Program(target='bar', source=env.Split('bar.c foo.c'))
2285 env.Program('bar', source='bar.c foo.c'.split())
2286
2287 Python follows the POSIX pathname convention for path strings: if a
2288 string begins with the operating system pathname separator (on Windows
2289 both the slash and backslash separator work, and any leading drive
2290 specifier is ignored for the determination) it is considered an
2291 absolute path, otherwise it is a relative path. If the path string
2292 contains no separator characters, it is searched for as a file in the
2293 current directory. If it contains separator characters, the search
2294 follows down from the starting point, which is the top of the directory
2295 tree for an absolute path and the current directory for a relative
2296 path.
2297
2298 scons recognizes a third way to specify path strings: if the string
2299 begins with the # character it is top-relative - it works like a
2300 relative path but the search follows down from the directory containing
2301 the top-level SConstruct rather than from the current directory. The #
2302 is allowed to be followed by a pathname separator, which is ignored if
2303 found in that position. Top-relative paths only work in places where
2304 scons will interpret the path (see some examples below). To be used in
2305 other contexts the string will need to be converted to a relative or
2306 absolute path first.
2307
2308 target and source can be absolute, relative, or top-relative. Relative
2309 pathnames are searched considering the directory of the SConscript file
2310 currently being processed as the "current directory".
2311
2312 Examples:
2313
2314 # The comments describing the targets that will be built
2315 # assume these calls are in a SConscript file in the
2316 # a subdirectory named "subdir".
2317
2318 # Builds the program "subdir/foo" from "subdir/foo.c":
2319 env.Program('foo', 'foo.c')
2320
2321 # Builds the program "/tmp/bar" from "subdir/bar.c":
2322 env.Program('/tmp/bar', 'bar.c')
2323
2324 # An initial '#' or '#/' are equivalent; the following
2325 # calls build the programs "foo" and "bar" (in the
2326 # top-level SConstruct directory) from "subdir/foo.c" and
2327 # "subdir/bar.c", respectively:
2328 env.Program('#foo', 'foo.c')
2329 env.Program('#/bar', 'bar.c')
2330
2331 # Builds the program "other/foo" (relative to the top-level
2332 # SConstruct directory) from "subdir/foo.c":
2333 env.Program('#other/foo', 'foo.c')
2334
2335 # This will not work, only SCons interfaces understand '#',
2336 # os.path.exists is pure Python:
2337 if os.path.exists('#inc/foo.h'):
2338 env.Append(CPPPATH='#inc')
2339
2340 When the target shares the same base name as the source and only the
2341 suffix varies, and if the builder method has a suffix defined for the
2342 target file type, then the target argument may be omitted completely,
2343 and scons will deduce the target file name from the source file name.
2344 The following examples all build the executable program bar (on POSIX
2345 systems) or bar.exe (on Windows systems) from the bar.c source file:
2346
2347 env.Program(target='bar', source='bar.c')
2348 env.Program('bar', source='bar.c')
2349 env.Program(source='bar.c')
2350 env.Program('bar.c')
2351
2352 As a convenience, a srcdir keyword argument may be specified when
2353 calling a Builder. When specified, all source file strings that are not
2354 absolute paths or top-relative paths will be interpreted relative to
2355 the specified srcdir. The following example will build the build/prog
2356 (or build/prog.exe on Windows) program from the files src/f1.c and
2357 src/f2.c:
2358
2359 env.Program('build/prog', ['f1.c', 'f2.c'], srcdir='src')
2360
2361 Keyword arguments that are not specifically recognized are treated as
2362 construction variable overrides, which replace or add those variables
2363 on a limited basis. These overrides will only be in effect when
2364 building the target of the builder call, and will not affect other
2365 parts of the build. For example, if you want to specify some libraries
2366 needed by just one program:
2367
2368 env.Program('hello', 'hello.c', LIBS=['gl', 'glut'])
2369
2370 or generate a shared library with a non-standard suffix:
2371
2372 env.SharedLibrary(
2373 target='word',
2374 source='word.cpp',
2375 SHLIBSUFFIX='.ocx',
2376 LIBSUFFIXES=['.ocx'],
2377 )
2378
2379 Note that both the $SHLIBSUFFIX and $LIBSUFFIXES variables must be set
2380 if you want scons to search automatically for dependencies on the
2381 non-standard library names; see the descriptions below of these
2382 variables for more information.
2383
2384 The optional parse_flags keyword argument is recognized by builders.
2385 This works similarly to the env.MergeFlags method, where the argument
2386 value is broken into individual settings and merged into the
2387 appropriate construction variables.
2388
2389 env.Program('hello', 'hello.c', parse_flags='-Iinclude -DEBUG -lm')
2390
2391 This example adds 'include' to CPPPATH, 'EBUG' to CPPDEFINES, and 'm'
2392 to LIBS.
2393
2394 Although the builder methods defined by scons are, in fact, methods of
2395 a construction environment object, many may also be called without an
2396 explicit environment:
2397
2398 Program('hello', 'hello.c')
2399 SharedLibrary('word', 'word.cpp')
2400
2401 If called this way, methods will internally use the default environment
2402 that consists of the tools and values that scons has determined are
2403 appropriate for the local system.
2404
2405 Builder methods that can be called without an explicit environment
2406 (indicated in the listing of builders without a leading env.) may be
2407 called from custom Python modules that you import into an SConscript
2408 file by adding the following to the Python module:
2409
2410 from SCons.Script import *
2411
2412 Builder methods return a NodeList, a list-like object whose elements
2413 are Nodes, SCons' internal representation of build targets or sources.
2414 See the section called “File and Directory Nodes” for more information.
2415 The returned NodeList object can be passed to other builder methods as
2416 source(s) or passed to any SCons function or method where a filename
2417 would normally be accepted.
2418
2419 For example, to add a specific preprocessor define when compiling one
2420 specific object file but not the others:
2421
2422 bar_obj_list = env.StaticObject('bar.c', CPPDEFINES='-DBAR')
2423 env.Program("prog", ['foo.c', bar_obj_list, 'main.c'])
2424
2425 Using a Node as in this example makes for a more portable build by
2426 avoiding having to specify a platform-specific object suffix when
2427 calling the Program builder method.
2428
2429 The NodeList object is also convenient to pass to the Default function,
2430 for the same reason of avoiding a platform-specific name:
2431
2432 tgt = env.Program("prog", ["foo.c", "bar.c", "main.c"])
2433 Default(tgt)
2434
2435 Builder calls will automatically "flatten" lists passed as source and
2436 target, so they are free to contain elements which are themselves
2437 lists, such as bar_obj_list returned by the StaticObject call above. If
2438 you need to manipulate a list of lists returned by builders directly in
2439 Python code, you can either build a new list by hand:
2440
2441 foo = Object('foo.c')
2442 bar = Object('bar.c')
2443 objects = ['begin.o'] + foo + ['middle.o'] + bar + ['end.o']
2444 for obj in objects:
2445 print(str(obj))
2446
2447 Or you can use the Flatten function supplied by scons to create a list
2448 containing just the Nodes, which may be more convenient:
2449
2450 foo = Object('foo.c')
2451 bar = Object('bar.c')
2452 objects = Flatten(['begin.o', foo, 'middle.o', bar, 'end.o'])
2453 for obj in objects:
2454 print(str(obj))
2455
2456 SCons builder calls return a list-like object, not an actual Python
2457 list, so it is not appropriate to use the Python add operator (+ or +=)
2458 to append builder results to a Python list. Because the list and the
2459 object are different types, Python will not update the original list in
2460 place, but will instead create a new NodeList object containing the
2461 concatenation of the list elements and the builder results. This will
2462 cause problems for any other Python variables in your SCons
2463 configuration that still hold on to a reference to the original list.
2464 Instead, use the Python list extend method to make sure the list is
2465 updated in-place. Example:
2466
2467 object_files = []
2468
2469 # Do NOT use += here:
2470 # object_files += Object('bar.c')
2471 #
2472 # It will not update the object_files list in place.
2473 #
2474 # Instead, use the list extend method:
2475 object_files.extend(Object('bar.c'))
2476
2477 The path name for a Node's file may be used by passing the Node to
2478 Python's builtin str function:
2479
2480 bar_obj_list = env.StaticObject('bar.c', CPPDEFINES='-DBAR')
2481 print("The path to bar_obj is:", str(bar_obj_list[0]))
2482
2483 Note that because the Builder call returns a NodeList, you have to
2484 access the first element in the list, (bar_obj_list[0] in the example)
2485 to get at the Node that actually represents the object file.
2486
2487 Builder calls support a chdir keyword argument that specifies that the
2488 Builder's action(s) should be executed after changing directory. If the
2489 chdir argument is a string or a directory Node, scons will change to
2490 the specified directory. If the chdir is not a string or Node and is
2491 non-zero, then scons will change to the target file's directory.
2492
2493 # scons will change to the "sub" subdirectory
2494 # before executing the "cp" command.
2495 env.Command('sub/dir/foo.out', 'sub/dir/foo.in',
2496 "cp dir/foo.in dir/foo.out",
2497 chdir='sub')
2498
2499 # Because chdir is not a string, scons will change to the
2500 # target's directory ("sub/dir") before executing the
2501 # "cp" command.
2502 env.Command('sub/dir/foo.out', 'sub/dir/foo.in',
2503 "cp foo.in foo.out",
2504 chdir=1)
2505
2506 Note that SCons will not automatically modify its expansion of
2507 construction variables like $TARGET and $SOURCE when using the chdir
2508 keyword argument--that is, the expanded file names will still be
2509 relative to the top-level directory where SConstruct was found, and
2510 consequently incorrect relative to the chdir directory. If you use the
2511 chdir keyword argument, you will typically need to supply a different
2512 command line using expansions like ${TARGET.file} and ${SOURCE.file} to
2513 use just the filename portion of the targets and source.
2514
2515 When trying to handle errors that may occur in a builder method,
2516 consider that the corresponding Action is executed at a different time
2517 than the SConscript file statement calling the builder. It is not
2518 useful to wrap a builder call in a try block, since success in the
2519 builder call is not the same as the builder itself succeeding. If
2520 necessary, a Builder's Action should be coded to exit with a useful
2521 exception message indicating the problem in the SConscript files -
2522 programmatically recovering from build errors is rarely useful.
2523
2524 scons predefines the following builder methods. Depending on the setup
2525 of a particular construction environment and on the type and software
2526 installation status of the underlying system, not all builders may be
2527 available to that construction environment.
2528
2529 CFile(), env.CFile()
2530 Builds a C source file given a lex (.l) or yacc (.y) input file.
2531 The suffix specified by the $CFILESUFFIX construction variable (.c
2532 by default) is automatically added to the target if it is not
2533 already present. Example:
2534
2535 # builds foo.c
2536 env.CFile(target = 'foo.c', source = 'foo.l')
2537 # builds bar.c
2538 env.CFile(target = 'bar', source = 'bar.y')
2539
2540 Command(), env.Command()
2541 The Command "Builder" is actually a function that looks like a
2542 Builder, but takes a required third argument, which is the action
2543 to take to construct the target from the source, used for "one-off"
2544 builds where a full builder is not needed. Thus it does not follow
2545 the builder calling rules described at the start of this section.
2546 See instead the Command function description for the calling syntax
2547 and details.
2548
2549 CompilationDatabase(), env.CompilationDatabase()
2550
2551 CompilationDatabase is a special builder which adds a target to
2552 create a JSON formatted compilation database compatible with clang
2553 tooling (see the LLVM specification[1]). This database is suitable
2554 for consumption by various tools and editors who can use it to
2555 obtain build and dependency information which otherwise would be
2556 internal to SCons. The builder does not require any source files to
2557 be specified, rather it arranges to emit information about all of
2558 the C, C++ and assembler source/output pairs identified in the
2559 build that are not excluded by the optional filter
2560 $COMPILATIONDB_PATH_FILTER. The target is subject to the usual
2561 SCons target selection rules.
2562
2563 If called with no arguments, the builder will default to a target
2564 name of compile_commands.json.
2565
2566 If called with a single positional argument, scons will "deduce"
2567 the target name from that source argument, giving it the same name,
2568 and then ignore the source. This is the usual way to call the
2569 builder if a non-default target name is wanted.
2570
2571 If called with either the target= or source= keyword arguments, the
2572 value of the argument is taken as the target name. If called with
2573 both, the target= value is used and source= is ignored. If called
2574 with multiple sources, the source list will be ignored, since there
2575 is no way to deduce what the intent was; in this case the default
2576 target name will be used.
2577
2578 Note
2579 You must load the compilation_db tool prior to specifying any
2580 part of your build or some source/output files will not show up
2581 in the compilation database.
2582 Available since scons 4.0.
2583
2584 CXXFile(), env.CXXFile()
2585 Builds a C++ source file given a lex (.ll) or yacc (.yy) input
2586 file. The suffix specified by the $CXXFILESUFFIX construction
2587 variable (.cc by default) is automatically added to the target if
2588 it is not already present. Example:
2589
2590 # builds foo.cc
2591 env.CXXFile(target = 'foo.cc', source = 'foo.ll')
2592 # builds bar.cc
2593 env.CXXFile(target = 'bar', source = 'bar.yy')
2594
2595 DocbookEpub(), env.DocbookEpub()
2596 A pseudo-Builder, providing a Docbook toolchain for EPUB output.
2597
2598 env = Environment(tools=['docbook'])
2599 env.DocbookEpub('manual.epub', 'manual.xml')
2600
2601 or simply
2602
2603 env = Environment(tools=['docbook'])
2604 env.DocbookEpub('manual')
2605
2606 DocbookHtml(), env.DocbookHtml()
2607 A pseudo-Builder, providing a Docbook toolchain for HTML output.
2608
2609 env = Environment(tools=['docbook'])
2610 env.DocbookHtml('manual.html', 'manual.xml')
2611
2612 or simply
2613
2614 env = Environment(tools=['docbook'])
2615 env.DocbookHtml('manual')
2616
2617 DocbookHtmlChunked(), env.DocbookHtmlChunked()
2618 A pseudo-Builder providing a Docbook toolchain for chunked HTML
2619 output. It supports the base.dir parameter. The chunkfast.xsl file
2620 (requires "EXSLT") is used as the default stylesheet. Basic syntax:
2621
2622 env = Environment(tools=['docbook'])
2623 env.DocbookHtmlChunked('manual')
2624
2625 where manual.xml is the input file.
2626
2627 If you use the root.filename parameter in your own stylesheets you
2628 have to specify the new target name. This ensures that the
2629 dependencies get correct, especially for the cleanup via “scons
2630 -c”:
2631
2632 env = Environment(tools=['docbook'])
2633 env.DocbookHtmlChunked('mymanual.html', 'manual', xsl='htmlchunk.xsl')
2634
2635 Some basic support for the base.dir parameter is provided. You can
2636 add the base_dir keyword to your Builder call, and the given prefix
2637 gets prepended to all the created filenames:
2638
2639 env = Environment(tools=['docbook'])
2640 env.DocbookHtmlChunked('manual', xsl='htmlchunk.xsl', base_dir='output/')
2641
2642 Make sure that you don't forget the trailing slash for the base
2643 folder, else your files get renamed only!
2644
2645 DocbookHtmlhelp(), env.DocbookHtmlhelp()
2646 A pseudo-Builder, providing a Docbook toolchain for HTMLHELP
2647 output. Its basic syntax is:
2648
2649 env = Environment(tools=['docbook'])
2650 env.DocbookHtmlhelp('manual')
2651
2652 where manual.xml is the input file.
2653
2654 If you use the root.filename parameter in your own stylesheets you
2655 have to specify the new target name. This ensures that the
2656 dependencies get correct, especially for the cleanup via “scons
2657 -c”:
2658
2659 env = Environment(tools=['docbook'])
2660 env.DocbookHtmlhelp('mymanual.html', 'manual', xsl='htmlhelp.xsl')
2661
2662 Some basic support for the base.dir parameter is provided. You can
2663 add the base_dir keyword to your Builder call, and the given prefix
2664 gets prepended to all the created filenames:
2665
2666 env = Environment(tools=['docbook'])
2667 env.DocbookHtmlhelp('manual', xsl='htmlhelp.xsl', base_dir='output/')
2668
2669 Make sure that you don't forget the trailing slash for the base
2670 folder, else your files get renamed only!
2671
2672 DocbookMan(), env.DocbookMan()
2673 A pseudo-Builder, providing a Docbook toolchain for Man page
2674 output. Its basic syntax is:
2675
2676 env = Environment(tools=['docbook'])
2677 env.DocbookMan('manual')
2678
2679 where manual.xml is the input file. Note, that you can specify a
2680 target name, but the actual output names are automatically set from
2681 the refname entries in your XML source.
2682
2683 DocbookPdf(), env.DocbookPdf()
2684 A pseudo-Builder, providing a Docbook toolchain for PDF output.
2685
2686 env = Environment(tools=['docbook'])
2687 env.DocbookPdf('manual.pdf', 'manual.xml')
2688
2689 or simply
2690
2691 env = Environment(tools=['docbook'])
2692 env.DocbookPdf('manual')
2693
2694 DocbookSlidesHtml(), env.DocbookSlidesHtml()
2695 A pseudo-Builder, providing a Docbook toolchain for HTML slides
2696 output.
2697
2698 env = Environment(tools=['docbook'])
2699 env.DocbookSlidesHtml('manual')
2700
2701 If you use the titlefoil.html parameter in your own stylesheets you
2702 have to give the new target name. This ensures that the
2703 dependencies get correct, especially for the cleanup via “scons
2704 -c”:
2705
2706 env = Environment(tools=['docbook'])
2707 env.DocbookSlidesHtml('mymanual.html','manual', xsl='slideshtml.xsl')
2708
2709 Some basic support for the base.dir parameter is provided. You can
2710 add the base_dir keyword to your Builder call, and the given prefix
2711 gets prepended to all the created filenames:
2712
2713 env = Environment(tools=['docbook'])
2714 env.DocbookSlidesHtml('manual', xsl='slideshtml.xsl', base_dir='output/')
2715
2716 Make sure that you don't forget the trailing slash for the base
2717 folder, else your files get renamed only!
2718
2719 DocbookSlidesPdf(), env.DocbookSlidesPdf()
2720 A pseudo-Builder, providing a Docbook toolchain for PDF slides
2721 output.
2722
2723 env = Environment(tools=['docbook'])
2724 env.DocbookSlidesPdf('manual.pdf', 'manual.xml')
2725
2726 or simply
2727
2728 env = Environment(tools=['docbook'])
2729 env.DocbookSlidesPdf('manual')
2730
2731 DocbookXInclude(), env.DocbookXInclude()
2732 A pseudo-Builder, for resolving XIncludes in a separate processing
2733 step.
2734
2735 env = Environment(tools=['docbook'])
2736 env.DocbookXInclude('manual_xincluded.xml', 'manual.xml')
2737
2738 DocbookXslt(), env.DocbookXslt()
2739 A pseudo-Builder, applying a given XSL transformation to the input
2740 file.
2741
2742 env = Environment(tools=['docbook'])
2743 env.DocbookXslt('manual_transformed.xml', 'manual.xml', xsl='transform.xslt')
2744
2745 Note, that this builder requires the xsl parameter to be set.
2746
2747 DVI(), env.DVI()
2748 Builds a .dvi file from a .tex, .ltx or .latex input file. If the
2749 source file suffix is .tex, scons will examine the contents of the
2750 file; if the string \documentclass or \documentstyle is found, the
2751 file is assumed to be a LaTeX file and the target is built by
2752 invoking the $LATEXCOM command line; otherwise, the $TEXCOM command
2753 line is used. If the file is a LaTeX file, the DVI builder method
2754 will also examine the contents of the .aux file and invoke the
2755 $BIBTEX command line if the string bibdata is found, start
2756 $MAKEINDEX to generate an index if a .ind file is found and will
2757 examine the contents .log file and re-run the $LATEXCOM command if
2758 the log file says it is necessary.
2759
2760 The suffix .dvi (hard-coded within TeX itself) is automatically
2761 added to the target if it is not already present. Examples:
2762
2763 # builds from aaa.tex
2764 env.DVI(target = 'aaa.dvi', source = 'aaa.tex')
2765 # builds bbb.dvi
2766 env.DVI(target = 'bbb', source = 'bbb.ltx')
2767 # builds from ccc.latex
2768 env.DVI(target = 'ccc.dvi', source = 'ccc.latex')
2769
2770 Gs(), env.Gs()
2771 A Builder for explicitly calling the gs executable. Depending on
2772 the underlying OS, the different names gs, gsos2 and gswin32c are
2773 tried.
2774
2775 env = Environment(tools=['gs'])
2776 env.Gs(
2777 'cover.jpg',
2778 'scons-scons.pdf',
2779 GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -q',
2780 )
2781
2782 Install(), env.Install()
2783 Installs one or more source files or directories in the specified
2784 target, which must be a directory. The names of the specified
2785 source files or directories remain the same within the destination
2786 directory. The sources may be given as a string or as a node
2787 returned by a builder.
2788
2789 env.Install(target='/usr/local/bin', source=['foo', 'bar'])
2790
2791 Note that if target paths chosen for the Install builder (and the
2792 related InstallAs and InstallVersionedLib builders) are outside the
2793 project tree, such as in the example above, they may not be
2794 selected for "building" by default, since in the absence of other
2795 instructions scons builds targets that are underneath the top
2796 directory (the directory that contains the SConstruct file, usually
2797 the current directory). Use command line targets or the Default
2798 function in this case.
2799
2800 If the --install-sandbox command line option is given, the target
2801 directory will be prefixed by the directory path specified. This is
2802 useful to test installs without installing to a "live" location in
2803 the system.
2804
2805 See also FindInstalledFiles. For more thoughts on installation, see
2806 the User Guide (particularly the section on Command-Line Targets
2807 and the chapters on Installing Files and on Alias Targets).
2808
2809 InstallAs(), env.InstallAs()
2810 Installs one or more source files or directories to specific names,
2811 allowing changing a file or directory name as part of the
2812 installation. It is an error if the target and source arguments
2813 list different numbers of files or directories.
2814
2815 env.InstallAs(target='/usr/local/bin/foo',
2816 source='foo_debug')
2817 env.InstallAs(target=['../lib/libfoo.a', '../lib/libbar.a'],
2818 source=['libFOO.a', 'libBAR.a'])
2819
2820 See the note under Install.
2821
2822 InstallVersionedLib(), env.InstallVersionedLib()
2823 Installs a versioned shared library. The symlinks appropriate to
2824 the architecture will be generated based on symlinks of the source
2825 library.
2826
2827 env.InstallVersionedLib(target='/usr/local/bin/foo',
2828 source='libxyz.1.5.2.so')
2829
2830 See the note under Install.
2831
2832 Jar(), env.Jar()
2833 Builds a Java archive (.jar) file from the specified list of
2834 sources. Any directories in the source list will be searched for
2835 .class files). Any .java files in the source list will be compiled
2836 to .class files by calling the Java Builder.
2837
2838 If the $JARCHDIR value is set, the jar command will change to the
2839 specified directory using the -C option. If $JARCHDIR is not set
2840 explicitly, SCons will use the top of any subdirectory tree in
2841 which Java .class were built by the Java Builder.
2842
2843 If the contents any of the source files begin with the string
2844 Manifest-Version, the file is assumed to be a manifest and is
2845 passed to the jar command with the m option set.
2846
2847 env.Jar(target = 'foo.jar', source = 'classes')
2848
2849 env.Jar(target = 'bar.jar',
2850 source = ['bar1.java', 'bar2.java'])
2851
2852 Java(), env.Java()
2853 Builds one or more Java class files. The sources may be any
2854 combination of explicit .java files, or directory trees which will
2855 be scanned for .java files.
2856
2857 SCons will parse each source .java file to find the classes
2858 (including inner classes) defined within that file, and from that
2859 figure out the target .class files that will be created. The class
2860 files will be placed underneath the specified target directory.
2861
2862 SCons will also search each Java file for the Java package name,
2863 which it assumes can be found on a line beginning with the string
2864 package in the first column; the resulting .class files will be
2865 placed in a directory reflecting the specified package name. For
2866 example, the file Foo.java defining a single public Foo class and
2867 containing a package name of sub.dir will generate a corresponding
2868 sub/dir/Foo.class class file.
2869
2870 Examples:
2871
2872 env.Java(target = 'classes', source = 'src')
2873 env.Java(target = 'classes', source = ['src1', 'src2'])
2874 env.Java(target = 'classes', source = ['File1.java', 'File2.java'])
2875
2876
2877 Java source files can use the native encoding for the underlying
2878 OS. Since SCons compiles in simple ASCII mode by default, the
2879 compiler will generate warnings about unmappable characters, which
2880 may lead to errors as the file is processed further. In this case,
2881 the user must specify the LANG environment variable to tell the
2882 compiler what encoding is used. For portibility, it's best if the
2883 encoding is hard-coded so that the compile will work if it is done
2884 on a system with a different encoding.
2885
2886 env = Environment()
2887 env['ENV']['LANG'] = 'en_GB.UTF-8'
2888
2889
2890 JavaH(), env.JavaH()
2891 Builds C header and source files for implementing Java native
2892 methods. The target can be either a directory in which the header
2893 files will be written, or a header file name which will contain all
2894 of the definitions. The source can be the names of .class files,
2895 the names of .java files to be compiled into .class files by
2896 calling the Java builder method, or the objects returned from the
2897 Java builder method.
2898
2899 If the construction variable $JAVACLASSDIR is set, either in the
2900 environment or in the call to the JavaH builder method itself, then
2901 the value of the variable will be stripped from the beginning of
2902 any .class file names.
2903
2904 Examples:
2905
2906 # builds java_native.h
2907 classes = env.Java(target="classdir", source="src")
2908 env.JavaH(target="java_native.h", source=classes)
2909
2910 # builds include/package_foo.h and include/package_bar.h
2911 env.JavaH(target="include", source=["package/foo.class", "package/bar.class"])
2912
2913 # builds export/foo.h and export/bar.h
2914 env.JavaH(
2915 target="export",
2916 source=["classes/foo.class", "classes/bar.class"],
2917 JAVACLASSDIR="classes",
2918 )
2919
2920 Library(), env.Library()
2921 A synonym for the StaticLibrary builder method.
2922
2923 LoadableModule(), env.LoadableModule()
2924 On most systems, this is the same as SharedLibrary. On Mac OS X
2925 (Darwin) platforms, this creates a loadable module bundle.
2926
2927 M4(), env.M4()
2928 Builds an output file from an M4 input file. This uses a default
2929 $M4FLAGS value of -E, which considers all warnings to be fatal and
2930 stops on the first warning when using the GNU version of m4.
2931 Example:
2932
2933 env.M4(target = 'foo.c', source = 'foo.c.m4')
2934
2935 Moc(), env.Moc()
2936 Builds an output file from a moc input file. Moc input files are
2937 either header files or cxx files. This builder is only available
2938 after using the tool 'qt'. See the $QTDIR variable for more
2939 information. Example:
2940
2941 env.Moc('foo.h') # generates moc_foo.cc
2942 env.Moc('foo.cpp') # generates foo.moc
2943
2944 MOFiles(), env.MOFiles()
2945 This builder belongs to msgfmt tool. The builder compiles PO files
2946 to MO files.
2947
2948
2949 Example 1. Create pl.mo and en.mo by compiling pl.po and en.po:
2950
2951 # ...
2952 env.MOFiles(['pl', 'en'])
2953
2954
2955 Example 2. Compile files for languages defined in LINGUAS file:
2956
2957 # ...
2958 env.MOFiles(LINGUAS_FILE = 1)
2959
2960
2961 Example 3. Create pl.mo and en.mo by compiling pl.po and en.po plus
2962 files for languages defined in LINGUAS file:
2963
2964 # ...
2965 env.MOFiles(['pl', 'en'], LINGUAS_FILE = 1)
2966
2967
2968 Example 4. Compile files for languages defined in LINGUAS file
2969 (another version):
2970
2971 # ...
2972 env['LINGUAS_FILE'] = 1
2973 env.MOFiles()
2974
2975 MSVSProject(), env.MSVSProject()
2976 Builds a Microsoft Visual Studio project file, and by default
2977 builds a solution file as well.
2978
2979 This builds a Visual Studio project file, based on the version of
2980 Visual Studio that is configured (either the latest installed
2981 version, or the version specified by $MSVS_VERSION in the
2982 Environment constructor). For Visual Studio 6, it will generate a
2983 .dsp file. For Visual Studio 7, 8, and 9, it will generate a
2984 .vcproj file. For Visual Studio 10 and later, it will generate a
2985 .vcxproj file.
2986
2987 By default, this also generates a solution file for the specified
2988 project, a .dsw file for Visual Studio 6 or a .sln file for Visual
2989 Studio 7 and later. This behavior may be disabled by specifying
2990 auto_build_solution=0 when you call MSVSProject, in which case you
2991 presumably want to build the solution file(s) by calling the
2992 MSVSSolution Builder (see below).
2993
2994 The MSVSProject builder takes several lists of filenames to be
2995 placed into the project file. These are currently limited to srcs,
2996 incs, localincs, resources, and misc. These are pretty
2997 self-explanatory, but it should be noted that these lists are added
2998 to the $SOURCES construction variable as strings, NOT as SCons File
2999 Nodes. This is because they represent file names to be added to the
3000 project file, not the source files used to build the project file.
3001
3002 The above filename lists are all optional, although at least one
3003 must be specified for the resulting project file to be non-empty.
3004
3005 In addition to the above lists of values, the following values may
3006 be specified:
3007
3008 target
3009 The name of the target .dsp or .vcproj file. The correct suffix
3010 for the version of Visual Studio must be used, but the
3011 $MSVSPROJECTSUFFIX construction variable will be defined to the
3012 correct value (see example below).
3013
3014 variant
3015 The name of this particular variant. For Visual Studio 7
3016 projects, this can also be a list of variant names. These are
3017 typically things like "Debug" or "Release", but really can be
3018 anything you want. For Visual Studio 7 projects, they may also
3019 specify a target platform separated from the variant name by a
3020 | (vertical pipe) character: Debug|Xbox. The default target
3021 platform is Win32. Multiple calls to MSVSProject with different
3022 variants are allowed; all variants will be added to the project
3023 file with their appropriate build targets and sources.
3024
3025 cmdargs
3026 Additional command line arguments for the different variants.
3027 The number of cmdargs entries must match the number of variant
3028 entries, or be empty (not specified). If you give only one, it
3029 will automatically be propagated to all variants.
3030
3031 cppdefines
3032 Preprocessor definitions for the different variants. The number
3033 of cppdefines entries must match the number of variant entries,
3034 or be empty (not specified). If you give only one, it will
3035 automatically be propagated to all variants. If you don't give
3036 this parameter, SCons will use the invoking environment's
3037 CPPDEFINES entry for all variants.
3038
3039 cppflags
3040 Compiler flags for the different variants. If a /std:c++ flag
3041 is found then /Zc:__cplusplus is appended to the flags if not
3042 already found, this ensures that intellisense uses the /std:c++
3043 switch. The number of cppflags entries must match the number of
3044 variant entries, or be empty (not specified). If you give only
3045 one, it will automatically be propagated to all variants. If
3046 you don't give this parameter, SCons will combine the invoking
3047 environment's CCFLAGS, CXXFLAGS, CPPFLAGS entries for all
3048 variants.
3049
3050 cpppaths
3051 Compiler include paths for the different variants. The number
3052 of cpppaths entries must match the number of variant entries,
3053 or be empty (not specified). If you give only one, it will
3054 automatically be propagated to all variants. If you don't give
3055 this parameter, SCons will use the invoking environment's
3056 CPPPATH entry for all variants.
3057
3058 buildtarget
3059 An optional string, node, or list of strings or nodes (one per
3060 build variant), to tell the Visual Studio debugger what output
3061 target to use in what build variant. The number of buildtarget
3062 entries must match the number of variant entries.
3063
3064 runfile
3065 The name of the file that Visual Studio 7 and later will run
3066 and debug. This appears as the value of the Output field in the
3067 resulting Visual Studio project file. If this is not specified,
3068 the default is the same as the specified buildtarget value.
3069
3070 Note that because SCons always executes its build commands from the
3071 directory in which the SConstruct file is located, if you generate
3072 a project file in a different directory than the SConstruct
3073 directory, users will not be able to double-click on the file name
3074 in compilation error messages displayed in the Visual Studio
3075 console output window. This can be remedied by adding the Visual
3076 C/C++ /FC compiler option to the $CCFLAGS variable so that the
3077 compiler will print the full path name of any files that cause
3078 compilation errors.
3079
3080 Example usage:
3081
3082 barsrcs = ['bar.cpp']
3083 barincs = ['bar.h']
3084 barlocalincs = ['StdAfx.h']
3085 barresources = ['bar.rc','resource.h']
3086 barmisc = ['bar_readme.txt']
3087
3088 dll = env.SharedLibrary(target='bar.dll',
3089 source=barsrcs)
3090 buildtarget = [s for s in dll if str(s).endswith('dll')]
3091 env.MSVSProject(target='Bar' + env['MSVSPROJECTSUFFIX'],
3092 srcs=barsrcs,
3093 incs=barincs,
3094 localincs=barlocalincs,
3095 resources=barresources,
3096 misc=barmisc,
3097 buildtarget=buildtarget,
3098 variant='Release')
3099
3100
3101 Starting with version 2.4 of SCons it is also possible to specify
3102 the optional argument DebugSettings, which creates files for
3103 debugging under Visual Studio:
3104
3105 DebugSettings
3106 A dictionary of debug settings that get written to the
3107 .vcproj.user or the .vcxproj.user file, depending on the
3108 version installed. As it is done for cmdargs (see above), you
3109 can specify a DebugSettings dictionary per variant. If you give
3110 only one, it will be propagated to all variants.
3111
3112 Currently, only Visual Studio v9.0 and Visual Studio version v11
3113 are implemented, for other versions no file is generated. To
3114 generate the user file, you just need to add a DebugSettings
3115 dictionary to the environment with the right parameters for your
3116 MSVS version. If the dictionary is empty, or does not contain any
3117 good value, no file will be generated.
3118
3119 Following is a more contrived example, involving the setup of a
3120 project for variants and DebugSettings:
3121
3122 # Assuming you store your defaults in a file
3123 vars = Variables('variables.py')
3124 msvcver = vars.args.get('vc', '9')
3125
3126 # Check command args to force one Microsoft Visual Studio version
3127 if msvcver == '9' or msvcver == '11':
3128 env = Environment(MSVC_VERSION=msvcver+'.0', MSVC_BATCH=False)
3129 else:
3130 env = Environment()
3131
3132 AddOption('--userfile', action='store_true', dest='userfile', default=False,
3133 help="Create Visual Studio Project user file")
3134
3135 #
3136 # 1. Configure your Debug Setting dictionary with options you want in the list
3137 # of allowed options, for instance if you want to create a user file to launch
3138 # a specific application for testing your dll with Microsoft Visual Studio 2008 (v9):
3139 #
3140 V9DebugSettings = {
3141 'Command':'c:\\myapp\\using\\thisdll.exe',
3142 'WorkingDirectory': 'c:\\myapp\\using\\',
3143 'CommandArguments': '-p password',
3144 # 'Attach':'false',
3145 # 'DebuggerType':'3',
3146 # 'Remote':'1',
3147 # 'RemoteMachine': None,
3148 # 'RemoteCommand': None,
3149 # 'HttpUrl': None,
3150 # 'PDBPath': None,
3151 # 'SQLDebugging': None,
3152 # 'Environment': '',
3153 # 'EnvironmentMerge':'true',
3154 # 'DebuggerFlavor': None,
3155 # 'MPIRunCommand': None,
3156 # 'MPIRunArguments': None,
3157 # 'MPIRunWorkingDirectory': None,
3158 # 'ApplicationCommand': None,
3159 # 'ApplicationArguments': None,
3160 # 'ShimCommand': None,
3161 # 'MPIAcceptMode': None,
3162 # 'MPIAcceptFilter': None,
3163 }
3164
3165 #
3166 # 2. Because there are a lot of different options depending on the Microsoft
3167 # Visual Studio version, if you use more than one version you have to
3168 # define a dictionary per version, for instance if you want to create a user
3169 # file to launch a specific application for testing your dll with Microsoft
3170 # Visual Studio 2012 (v11):
3171 #
3172 V10DebugSettings = {
3173 'LocalDebuggerCommand': 'c:\\myapp\\using\\thisdll.exe',
3174 'LocalDebuggerWorkingDirectory': 'c:\\myapp\\using\\',
3175 'LocalDebuggerCommandArguments': '-p password',
3176 # 'LocalDebuggerEnvironment': None,
3177 # 'DebuggerFlavor': 'WindowsLocalDebugger',
3178 # 'LocalDebuggerAttach': None,
3179 # 'LocalDebuggerDebuggerType': None,
3180 # 'LocalDebuggerMergeEnvironment': None,
3181 # 'LocalDebuggerSQLDebugging': None,
3182 # 'RemoteDebuggerCommand': None,
3183 # 'RemoteDebuggerCommandArguments': None,
3184 # 'RemoteDebuggerWorkingDirectory': None,
3185 # 'RemoteDebuggerServerName': None,
3186 # 'RemoteDebuggerConnection': None,
3187 # 'RemoteDebuggerDebuggerType': None,
3188 # 'RemoteDebuggerAttach': None,
3189 # 'RemoteDebuggerSQLDebugging': None,
3190 # 'DeploymentDirectory': None,
3191 # 'AdditionalFiles': None,
3192 # 'RemoteDebuggerDeployDebugCppRuntime': None,
3193 # 'WebBrowserDebuggerHttpUrl': None,
3194 # 'WebBrowserDebuggerDebuggerType': None,
3195 # 'WebServiceDebuggerHttpUrl': None,
3196 # 'WebServiceDebuggerDebuggerType': None,
3197 # 'WebServiceDebuggerSQLDebugging': None,
3198 }
3199
3200 #
3201 # 3. Select the dictionary you want depending on the version of visual Studio
3202 # Files you want to generate.
3203 #
3204 if not env.GetOption('userfile'):
3205 dbgSettings = None
3206 elif env.get('MSVC_VERSION', None) == '9.0':
3207 dbgSettings = V9DebugSettings
3208 elif env.get('MSVC_VERSION', None) == '11.0':
3209 dbgSettings = V10DebugSettings
3210 else:
3211 dbgSettings = None
3212
3213 #
3214 # 4. Add the dictionary to the DebugSettings keyword.
3215 #
3216 barsrcs = ['bar.cpp', 'dllmain.cpp', 'stdafx.cpp']
3217 barincs = ['targetver.h']
3218 barlocalincs = ['StdAfx.h']
3219 barresources = ['bar.rc','resource.h']
3220 barmisc = ['ReadMe.txt']
3221
3222 dll = env.SharedLibrary(target='bar.dll',
3223 source=barsrcs)
3224
3225 env.MSVSProject(target='Bar' + env['MSVSPROJECTSUFFIX'],
3226 srcs=barsrcs,
3227 incs=barincs,
3228 localincs=barlocalincs,
3229 resources=barresources,
3230 misc=barmisc,
3231 buildtarget=[dll[0]] * 2,
3232 variant=('Debug|Win32', 'Release|Win32'),
3233 cmdargs='vc=%s' % msvcver,
3234 DebugSettings=(dbgSettings, {}))
3235
3236
3237 MSVSSolution(), env.MSVSSolution()
3238 Builds a Microsoft Visual Studio solution file.
3239
3240 This builds a Visual Studio solution file, based on the version of
3241 Visual Studio that is configured (either the latest installed
3242 version, or the version specified by $MSVS_VERSION in the
3243 construction environment). For Visual Studio 6, it will generate a
3244 .dsw file. For Visual Studio 7 (.NET), it will generate a .sln
3245 file.
3246
3247 The following values must be specified:
3248
3249 target
3250 The name of the target .dsw or .sln file. The correct suffix
3251 for the version of Visual Studio must be used, but the value
3252 $MSVSSOLUTIONSUFFIX will be defined to the correct value (see
3253 example below).
3254
3255 variant
3256 The name of this particular variant, or a list of variant names
3257 (the latter is only supported for MSVS 7 solutions). These are
3258 typically things like "Debug" or "Release", but really can be
3259 anything you want. For MSVS 7 they may also specify target
3260 platform, like this "Debug|Xbox". Default platform is Win32.
3261
3262 projects
3263 A list of project file names, or Project nodes returned by
3264 calls to the MSVSProject Builder, to be placed into the
3265 solution file. It should be noted that these file names are NOT
3266 added to the $SOURCES environment variable in form of files,
3267 but rather as strings. This is because they represent file
3268 names to be added to the solution file, not the source files
3269 used to build the solution file.
3270
3271 Example Usage:
3272
3273 env.MSVSSolution(
3274 target="Bar" + env["MSVSSOLUTIONSUFFIX"],
3275 projects=["bar" + env["MSVSPROJECTSUFFIX"]],
3276 variant="Release",
3277 )
3278
3279
3280 Ninja(), env.Ninja()
3281
3282 Ninja is a special builder which adds a target to create a ninja
3283 build file. The builder does not require any source files to be
3284 specified.
3285
3286 Note
3287 This is an experimental feature. To enable it you must use one
3288 of the following methods
3289
3290 # On the command line
3291 --experimental=ninja
3292
3293 # Or in your SConstruct
3294 SetOption('experimental', 'ninja')
3295
3296
3297 This functionality is subject to change and/or removal without
3298 deprecation cycle.
3299
3300 To use this tool you must install pypi's ninja package[2]. This
3301 can be done via pip install ninja
3302 If called with no arguments, the builder will default to a target
3303 name of ninja.build.
3304
3305 If called with a single positional argument, scons will "deduce"
3306 the target name from that source argument, giving it the same name,
3307 and then ignore the source. This is the usual way to call the
3308 builder if a non-default target name is wanted.
3309
3310 If called with either the target= or source= keyword arguments, the
3311 value of the argument is taken as the target name. If called with
3312 both, the target= value is used and source= is ignored. If called
3313 with multiple sources, the source list will be ignored, since there
3314 is no way to deduce what the intent was; in this case the default
3315 target name will be used.
3316
3317
3318 Available since scons 4.2.
3319
3320 Object(), env.Object()
3321 A synonym for the StaticObject builder method.
3322
3323 Package(), env.Package()
3324 Builds software distribution packages. A package is a container
3325 format which includes files to install along with metadata.
3326 Packaging is optional, and must be enabled by specifying the
3327 packaging tool. For example:
3328
3329 env = Environment(tools=['default', 'packaging'])
3330
3331
3332 SCons can build packages in a number of well known packaging
3333 formats. The target package type may be selected with the the
3334 $PACKAGETYPE construction variable or the --package-type command
3335 line option. The package type may be a list, in which case SCons
3336 will attempt to build packages for each type in the list. Example:
3337
3338 env.Package(PACKAGETYPE=['src_zip', 'src_targz'], ...other args...)
3339
3340 The currently supported packagers are:
3341
3342 ┌───────────┬────────────────────────────┐
3343 │msi │ Microsoft Installer │
3344 │ │ package │
3345 ├───────────┼────────────────────────────┤
3346 │rpm │ RPM Package Manger package │
3347 ├───────────┼────────────────────────────┤
3348 │ipkg │ Itsy Package Management │
3349 │ │ package │
3350 ├───────────┼────────────────────────────┤
3351 │tarbz2 │ bzip2-compressed tar file │
3352 ├───────────┼────────────────────────────┤
3353 │targz │ gzip-compressed tar file │
3354 ├───────────┼────────────────────────────┤
3355 │tarxz │ xz-compressed tar file │
3356 ├───────────┼────────────────────────────┤
3357 │zip │ zip file │
3358 ├───────────┼────────────────────────────┤
3359 │src_tarbz2 │ bzip2-compressed tar file │
3360 │ │ suitable as source to │
3361 │ │ another packager │
3362 ├───────────┼────────────────────────────┤
3363 │src_targz │ gzip-compressed tar file │
3364 │ │ suitable as source to │
3365 │ │ another packager │
3366 ├───────────┼────────────────────────────┤
3367 │src_tarxz │ xz-compressed tar file │
3368 │ │ suitable as source to │
3369 │ │ another packager │
3370 ├───────────┼────────────────────────────┤
3371 │src_zip │ zip file suitable as │
3372 │ │ source to another packager │
3373 └───────────┴────────────────────────────┘
3374 The file list to include in the package may be specified with the
3375 source keyword argument. If omitted, the FindInstalledFiles
3376 function is called behind the scenes to select all files that have
3377 an Install, InstallAs or InstallVersionedLib Builder attached. If
3378 the target keyword argument is omitted, the target name(s) will be
3379 deduced from the package type(s).
3380
3381 The metadata comes partly from attributes of the files to be
3382 packaged, and partly from packaging tags. Tags can be passed as
3383 keyword arguments to the Package builder call, and may also be
3384 attached to files (or more accurately, Nodes representing files)
3385 with the Tag function. Some package-level tags are mandatory, and
3386 will lead to errors if omitted. The mandatory tags vary depending
3387 on the package type.
3388
3389 While packaging, the builder uses a temporary location named by the
3390 value of the $PACKAGEROOT variable - the package sources are copied
3391 there before packaging.
3392
3393 Packaging example:
3394
3395 env = Environment(tools=["default", "packaging"])
3396 env.Install("/bin/", "my_program")
3397 env.Package(
3398 NAME="foo",
3399 VERSION="1.2.3",
3400 PACKAGEVERSION=0,
3401 PACKAGETYPE="rpm",
3402 LICENSE="gpl",
3403 SUMMARY="balalalalal",
3404 DESCRIPTION="this should be really really long",
3405 X_RPM_GROUP="Application/fu",
3406 SOURCE_URL="https://foo.org/foo-1.2.3.tar.gz",
3407 )
3408
3409 In this example, the target /bin/my_program created by the Install
3410 call would not be built by default since it is not under the
3411 project top directory. However, since no source is specified to the
3412 Package builder, it is selected for packaging by the default
3413 sources rule. Since packaging is done using $PACKAGEROOT, no write
3414 is actually done to the system's /bin directory, and the target
3415 will be selected since after rebasing to underneath $PACKAGEROOT it
3416 is now under the top directory of the project.
3417
3418 PCH(), env.PCH()
3419 Builds a Microsoft Visual C++ precompiled header. Calling this
3420 builder returns a list of two targets: the PCH as the first
3421 element, and the object file as the second element. Normally the
3422 object file is ignored. This builder is only provided when
3423 Microsoft Visual C++ is being used as the compiler. The PCH builder
3424 is generally used in conjunction with the $PCH construction
3425 variable to force object files to use the precompiled header:
3426
3427 env['PCH'] = env.PCH('StdAfx.cpp')[0]
3428
3429 PDF(), env.PDF()
3430 Builds a .pdf file from a .dvi input file (or, by extension, a
3431 .tex, .ltx, or .latex input file). The suffix specified by the
3432 $PDFSUFFIX construction variable (.pdf by default) is added
3433 automatically to the target if it is not already present. Example:
3434
3435 # builds from aaa.tex
3436 env.PDF(target = 'aaa.pdf', source = 'aaa.tex')
3437 # builds bbb.pdf from bbb.dvi
3438 env.PDF(target = 'bbb', source = 'bbb.dvi')
3439
3440 POInit(), env.POInit()
3441 This builder belongs to msginit tool. The builder initializes
3442 missing PO file(s) if $POAUTOINIT is set. If $POAUTOINIT is not set
3443 (default), POInit prints instruction for user (that is supposed to
3444 be a translator), telling how the PO file should be initialized. In
3445 normal projects you should not use POInit and use POUpdate instead.
3446 POUpdate chooses intelligently between msgmerge(1) and msginit(1).
3447 POInit always uses msginit(1) and should be regarded as builder for
3448 special purposes or for temporary use (e.g. for quick, one time
3449 initialization of a bunch of PO files) or for tests.
3450
3451 Target nodes defined through POInit are not built by default
3452 (they're Ignored from '.' node) but are added to special Alias
3453 ('po-create' by default). The alias name may be changed through the
3454 $POCREATE_ALIAS construction variable. All PO files defined through
3455 POInit may be easily initialized by scons po-create.
3456
3457
3458 Example 1. Initialize en.po and pl.po from messages.pot:
3459
3460 # ...
3461 env.POInit(['en', 'pl']) # messages.pot --> [en.po, pl.po]
3462
3463
3464 Example 2. Initialize en.po and pl.po from foo.pot:
3465
3466 # ...
3467 env.POInit(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.po]
3468
3469
3470 Example 3. Initialize en.po and pl.po from foo.pot but using
3471 $POTDOMAIN construction variable:
3472
3473 # ...
3474 env.POInit(['en', 'pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po]
3475
3476
3477 Example 4. Initialize PO files for languages defined in LINGUAS
3478 file. The files will be initialized from template messages.pot:
3479
3480 # ...
3481 env.POInit(LINGUAS_FILE = 1) # needs 'LINGUAS' file
3482
3483
3484 Example 5. Initialize en.po and pl.pl PO files plus files for
3485 languages defined in LINGUAS file. The files will be initialized
3486 from template messages.pot:
3487
3488 # ...
3489 env.POInit(['en', 'pl'], LINGUAS_FILE = 1)
3490
3491
3492 Example 6. You may preconfigure your environment first, and then
3493 initialize PO files:
3494
3495 # ...
3496 env['POAUTOINIT'] = 1
3497 env['LINGUAS_FILE'] = 1
3498 env['POTDOMAIN'] = 'foo'
3499 env.POInit()
3500
3501 which has same efect as:
3502
3503 # ...
3504 env.POInit(POAUTOINIT = 1, LINGUAS_FILE = 1, POTDOMAIN = 'foo')
3505
3506 PostScript(), env.PostScript()
3507 Builds a .ps file from a .dvi input file (or, by extension, a .tex,
3508 .ltx, or .latex input file). The suffix specified by the $PSSUFFIX
3509 construction variable (.ps by default) is added automatically to
3510 the target if it is not already present. Example:
3511
3512 # builds from aaa.tex
3513 env.PostScript(target = 'aaa.ps', source = 'aaa.tex')
3514 # builds bbb.ps from bbb.dvi
3515 env.PostScript(target = 'bbb', source = 'bbb.dvi')
3516
3517 POTUpdate(), env.POTUpdate()
3518 The builder belongs to xgettext tool. The builder updates target
3519 POT file if exists or creates one if it doesn't. The node is not
3520 built by default (i.e. it is Ignored from '.'), but only on demand
3521 (i.e. when given POT file is required or when special alias is
3522 invoked). This builder adds its targe node (messages.pot, say) to a
3523 special alias (pot-update by default, see $POTUPDATE_ALIAS) so you
3524 can update/create them easily with scons pot-update. The file is
3525 not written until there is no real change in internationalized
3526 messages (or in comments that enter POT file).
3527
3528
3529 Note
3530 You may see xgettext(1) being invoked by the xgettext tool even
3531 if there is no real change in internationalized messages (so
3532 the POT file is not being updated). This happens every time a
3533 source file has changed. In such case we invoke xgettext(1) and
3534 compare its output with the content of POT file to decide
3535 whether the file should be updated or not.
3536
3537
3538 Example 1. Let's create po/ directory and place following
3539 SConstruct script there:
3540
3541 # SConstruct in 'po/' subdir
3542 env = Environment( tools = ['default', 'xgettext'] )
3543 env.POTUpdate(['foo'], ['../a.cpp', '../b.cpp'])
3544 env.POTUpdate(['bar'], ['../c.cpp', '../d.cpp'])
3545
3546 Then invoke scons few times:
3547
3548 user@host:$ scons # Does not create foo.pot nor bar.pot
3549 user@host:$ scons foo.pot # Updates or creates foo.pot
3550 user@host:$ scons pot-update # Updates or creates foo.pot and bar.pot
3551 user@host:$ scons -c # Does not clean foo.pot nor bar.pot.
3552
3553 the results shall be as the comments above say.
3554
3555
3556 Example 2. The POTUpdate builder may be used with no target
3557 specified, in which case default target messages.pot will be used.
3558 The default target may also be overridden by setting $POTDOMAIN
3559 construction variable or providing it as an override to POTUpdate
3560 builder:
3561
3562
3563 # SConstruct script
3564 env = Environment( tools = ['default', 'xgettext'] )
3565 env['POTDOMAIN'] = "foo"
3566 env.POTUpdate(source = ["a.cpp", "b.cpp"]) # Creates foo.pot ...
3567 env.POTUpdate(POTDOMAIN = "bar", source = ["c.cpp", "d.cpp"]) # and bar.pot
3568
3569
3570 Example 3. The sources may be specified within separate file, for
3571 example POTFILES.in:
3572
3573
3574 # POTFILES.in in 'po/' subdirectory
3575 ../a.cpp
3576 ../b.cpp
3577 # end of file
3578
3579 The name of the file (POTFILES.in) containing the list of sources
3580 is provided via $XGETTEXTFROM:
3581
3582
3583 # SConstruct file in 'po/' subdirectory
3584 env = Environment( tools = ['default', 'xgettext'] )
3585 env.POTUpdate(XGETTEXTFROM = 'POTFILES.in')
3586
3587
3588 Example 4. You may use $XGETTEXTPATH to define source search path.
3589 Assume, for example, that you have files a.cpp, b.cpp,
3590 po/SConstruct, po/POTFILES.in. Then your POT-related files could
3591 look as below:
3592
3593 # POTFILES.in in 'po/' subdirectory
3594 a.cpp
3595 b.cpp
3596 # end of file
3597
3598 # SConstruct file in 'po/' subdirectory
3599 env = Environment( tools = ['default', 'xgettext'] )
3600 env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH='../')
3601
3602
3603 Example 5. Multiple search directories may be defined within a
3604 list, i.e. XGETTEXTPATH = ['dir1', 'dir2', ...]. The order in the
3605 list determines the search order of source files. The path to the
3606 first file found is used.
3607
3608 Let's create 0/1/po/SConstruct script:
3609
3610 # SConstruct file in '0/1/po/' subdirectory
3611 env = Environment( tools = ['default', 'xgettext'] )
3612 env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../', '../../'])
3613
3614 and 0/1/po/POTFILES.in:
3615
3616 # POTFILES.in in '0/1/po/' subdirectory
3617 a.cpp
3618 # end of file
3619
3620 Write two *.cpp files, the first one is 0/a.cpp:
3621
3622 /* 0/a.cpp */
3623 gettext("Hello from ../../a.cpp")
3624
3625 and the second is 0/1/a.cpp:
3626
3627 /* 0/1/a.cpp */
3628 gettext("Hello from ../a.cpp")
3629
3630 then run scons. You'll obtain 0/1/po/messages.pot with the message
3631 "Hello from ../a.cpp". When you reverse order in $XGETTEXTFOM, i.e.
3632 when you write SConscript as
3633
3634 # SConstruct file in '0/1/po/' subdirectory
3635 env = Environment( tools = ['default', 'xgettext'] )
3636 env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../'])
3637
3638 then the messages.pot will contain msgid "Hello from ../../a.cpp"
3639 line and not msgid "Hello from ../a.cpp".
3640
3641 POUpdate(), env.POUpdate()
3642 The builder belongs to msgmerge tool. The builder updates PO files
3643 with msgmerge(1), or initializes missing PO files as described in
3644 documentation of msginit tool and POInit builder (see also
3645 $POAUTOINIT). Note, that POUpdate does not add its targets to
3646 po-create alias as POInit does.
3647
3648 Target nodes defined through POUpdate are not built by default
3649 (they're Ignored from '.' node). Instead, they are added
3650 automatically to special Alias ('po-update' by default). The alias
3651 name may be changed through the $POUPDATE_ALIAS construction
3652 variable. You can easily update PO files in your project by scons
3653 po-update.
3654
3655
3656 Example 1. Update en.po and pl.po from messages.pot template (see
3657 also $POTDOMAIN), assuming that the later one exists or there is
3658 rule to build it (see POTUpdate):
3659
3660 # ...
3661 env.POUpdate(['en','pl']) # messages.pot --> [en.po, pl.po]
3662
3663
3664 Example 2. Update en.po and pl.po from foo.pot template:
3665
3666 # ...
3667 env.POUpdate(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.pl]
3668
3669
3670 Example 3. Update en.po and pl.po from foo.pot (another version):
3671
3672 # ...
3673 env.POUpdate(['en', 'pl'], POTDOMAIN='foo') # foo.pot -- > [en.po, pl.pl]
3674
3675
3676 Example 4. Update files for languages defined in LINGUAS file. The
3677 files are updated from messages.pot template:
3678
3679 # ...
3680 env.POUpdate(LINGUAS_FILE = 1) # needs 'LINGUAS' file
3681
3682
3683 Example 5. Same as above, but update from foo.pot template:
3684
3685 # ...
3686 env.POUpdate(LINGUAS_FILE = 1, source = ['foo'])
3687
3688
3689 Example 6. Update en.po and pl.po plus files for languages defined
3690 in LINGUAS file. The files are updated from messages.pot template:
3691
3692 # produce 'en.po', 'pl.po' + files defined in 'LINGUAS':
3693 env.POUpdate(['en', 'pl' ], LINGUAS_FILE = 1)
3694
3695
3696 Example 7. Use $POAUTOINIT to automatically initialize PO file if
3697 it doesn't exist:
3698
3699 # ...
3700 env.POUpdate(LINGUAS_FILE = 1, POAUTOINIT = 1)
3701
3702
3703 Example 8. Update PO files for languages defined in LINGUAS file.
3704 The files are updated from foo.pot template. All necessary settings
3705 are pre-configured via environment.
3706
3707 # ...
3708 env['POAUTOINIT'] = 1
3709 env['LINGUAS_FILE'] = 1
3710 env['POTDOMAIN'] = 'foo'
3711 env.POUpdate()
3712
3713 Program(), env.Program()
3714 Builds an executable given one or more object files or C, C++, D,
3715 or Fortran source files. If any C, C++, D or Fortran source files
3716 are specified, then they will be automatically compiled to object
3717 files using the Object builder method; see that builder method's
3718 description for a list of legal source file suffixes and how they
3719 are interpreted. The target executable file prefix, specified by
3720 the $PROGPREFIX construction variable (nothing by default), and
3721 suffix, specified by the $PROGSUFFIX construction variable (by
3722 default, .exe on Windows systems, nothing on POSIX systems), are
3723 automatically added to the target if not already present. Example:
3724
3725 env.Program(target='foo', source=['foo.o', 'bar.c', 'baz.f'])
3726
3727 ProgramAllAtOnce(), env.ProgramAllAtOnce()
3728 Builds an executable from D sources without first creating
3729 individual objects for each file.
3730
3731 D sources can be compiled file-by-file as C and C++ source are, and
3732 D is integrated into the scons Object and Program builders for this
3733 model of build. D codes can though do whole source meta-programming
3734 (some of the testing frameworks do this). For this it is imperative
3735 that all sources are compiled and linked in a single call to the D
3736 compiler. This builder serves that purpose.
3737
3738 env.ProgramAllAtOnce('executable', ['mod_a.d, mod_b.d', 'mod_c.d'])
3739
3740
3741 This command will compile the modules mod_a, mod_b, and mod_c in a
3742 single compilation process without first creating object files for
3743 the modules. Some of the D compilers will create executable.o
3744 others will not.
3745
3746 RES(), env.RES()
3747 Builds a Microsoft Visual C++ resource file. This builder method is
3748 only provided when Microsoft Visual C++ or MinGW is being used as
3749 the compiler. The .res (or .o for MinGW) suffix is added to the
3750 target name if no other suffix is given. The source file is scanned
3751 for implicit dependencies as though it were a C file. Example:
3752
3753 env.RES('resource.rc')
3754
3755 RMIC(), env.RMIC()
3756 Builds stub and skeleton class files for remote objects from Java
3757 .class files. The target is a directory relative to which the stub
3758 and skeleton class files will be written. The source can be the
3759 names of .class files, or the objects return from the Java builder
3760 method.
3761
3762 If the construction variable $JAVACLASSDIR is set, either in the
3763 environment or in the call to the RMIC builder method itself, then
3764 the value of the variable will be stripped from the beginning of
3765 any .class file names.
3766
3767 classes = env.Java(target = 'classdir', source = 'src')
3768 env.RMIC(target = 'outdir1', source = classes)
3769
3770 env.RMIC(target = 'outdir2',
3771 source = ['package/foo.class', 'package/bar.class'])
3772
3773 env.RMIC(target = 'outdir3',
3774 source = ['classes/foo.class', 'classes/bar.class'],
3775 JAVACLASSDIR = 'classes')
3776
3777 RPCGenClient(), env.RPCGenClient()
3778 Generates an RPC client stub (_clnt.c) file from a specified RPC
3779 (.x) source file. Because rpcgen only builds output files in the
3780 local directory, the command will be executed in the source file's
3781 directory by default.
3782
3783 # Builds src/rpcif_clnt.c
3784 env.RPCGenClient('src/rpcif.x')
3785
3786 RPCGenHeader(), env.RPCGenHeader()
3787 Generates an RPC header (.h) file from a specified RPC (.x) source
3788 file. Because rpcgen only builds output files in the local
3789 directory, the command will be executed in the source file's
3790 directory by default.
3791
3792 # Builds src/rpcif.h
3793 env.RPCGenHeader('src/rpcif.x')
3794
3795 RPCGenService(), env.RPCGenService()
3796 Generates an RPC server-skeleton (_svc.c) file from a specified RPC
3797 (.x) source file. Because rpcgen only builds output files in the
3798 local directory, the command will be executed in the source file's
3799 directory by default.
3800
3801 # Builds src/rpcif_svc.c
3802 env.RPCGenClient('src/rpcif.x')
3803
3804 RPCGenXDR(), env.RPCGenXDR()
3805 Generates an RPC XDR routine (_xdr.c) file from a specified RPC
3806 (.x) source file. Because rpcgen only builds output files in the
3807 local directory, the command will be executed in the source file's
3808 directory by default.
3809
3810 # Builds src/rpcif_xdr.c
3811 env.RPCGenClient('src/rpcif.x')
3812
3813 SharedLibrary(), env.SharedLibrary()
3814 Builds a shared library (.so on a POSIX system, .dll on Windows)
3815 given one or more object files or C, C++, D or Fortran source
3816 files. If any source files are given, then they will be
3817 automatically compiled to object files. The target library file
3818 prefix, specified by the $SHLIBPREFIX construction variable (by
3819 default, lib on POSIX systems, nothing on Windows systems), and
3820 suffix, specified by the $SHLIBSUFFIX construction variable (by
3821 default, .dll on Windows systems, .so on POSIX systems), are
3822 automatically added to the target if not already present. Example:
3823
3824 env.SharedLibrary(target='bar', source=['bar.c', 'foo.o'])
3825
3826 On Windows systems, the SharedLibrary builder method will always
3827 build an import library (.lib) in addition to the shared library
3828 (.dll), adding a .lib library with the same basename if there is
3829 not already a .lib file explicitly listed in the targets.
3830
3831 On Cygwin systems, the SharedLibrary builder method will always
3832 build an import library (.dll.a) in addition to the shared library
3833 (.dll), adding a .dll.a library with the same basename if there is
3834 not already a .dll.a file explicitly listed in the targets.
3835
3836 Any object files listed in the source must have been built for a
3837 shared library (that is, using the SharedObject builder method).
3838 scons will raise an error if there is any mismatch.
3839
3840 On some platforms, there is a distinction between a shared library
3841 (loaded automatically by the system to resolve external references)
3842 and a loadable module (explicitly loaded by user action). For
3843 maximum portability, use the LoadableModule builder for the latter.
3844
3845 When the $SHLIBVERSION construction variable is defined, a
3846 versioned shared library is created. This modifies $SHLINKFLAGS as
3847 required, adds the version number to the library name, and creates
3848 any symbolic links that are needed.
3849
3850 env.SharedLibrary(target='bar', source=['bar.c', 'foo.o'], SHLIBVERSION='1.5.2')
3851
3852 On a POSIX system, versions with a single token create exactly one
3853 symlink: libbar.so.6 would have symlink libbar.so only. On a POSIX
3854 system, versions with two or more tokens create exactly two
3855 symlinks: libbar.so.2.3.1 would have symlinks libbar.so and
3856 libbar.so.2; on a Darwin (OSX) system the library would be
3857 libbar.2.3.1.dylib and the link would be libbar.dylib.
3858
3859 On Windows systems, specifying register=1 will cause the .dll to be
3860 registered after it is built. The command that is run is determined
3861 by the $REGSVR construction variable (regsvr32 by default), and the
3862 flags passed are determined by $REGSVRFLAGS. By default,
3863 $REGSVRFLAGS includes the /s option, to prevent dialogs from
3864 popping up and requiring user attention when it is run. If you
3865 change $REGSVRFLAGS, be sure to include the /s option. For example,
3866
3867 env.SharedLibrary(target='bar', source=['bar.cxx', 'foo.obj'], register=1)
3868
3869 will register bar.dll as a COM object when it is done linking it.
3870
3871 SharedObject(), env.SharedObject()
3872 Builds an object file intended for inclusion in a shared library.
3873 Source files must have one of the same set of extensions specified
3874 above for the StaticObject builder method. On some platforms
3875 building a shared object requires additional compiler option (e.g.
3876 -fPIC for gcc) in addition to those needed to build a normal
3877 (static) object, but on some platforms there is no difference
3878 between a shared object and a normal (static) one. When there is a
3879 difference, SCons will only allow shared objects to be linked into
3880 a shared library, and will use a different suffix for shared
3881 objects. On platforms where there is no difference, SCons will
3882 allow both normal (static) and shared objects to be linked into a
3883 shared library, and will use the same suffix for shared and normal
3884 (static) objects. The target object file prefix, specified by the
3885 $SHOBJPREFIX construction variable (by default, the same as
3886 $OBJPREFIX), and suffix, specified by the $SHOBJSUFFIX construction
3887 variable, are automatically added to the target if not already
3888 present. Examples:
3889
3890 env.SharedObject(target='ddd', source='ddd.c')
3891 env.SharedObject(target='eee.o', source='eee.cpp')
3892 env.SharedObject(target='fff.obj', source='fff.for')
3893
3894 Note that the source files will be scanned according to the suffix
3895 mappings in the SourceFileScanner object. See the manpage section
3896 "Scanner Objects" for more information.
3897
3898 StaticLibrary(), env.StaticLibrary()
3899 Builds a static library given one or more object files or C, C++, D
3900 or Fortran source files. If any source files are given, then they
3901 will be automatically compiled to object files. The static library
3902 file prefix, specified by the $LIBPREFIX construction variable (by
3903 default, lib on POSIX systems, nothing on Windows systems), and
3904 suffix, specified by the $LIBSUFFIX construction variable (by
3905 default, .lib on Windows systems, .a on POSIX systems), are
3906 automatically added to the target if not already present. Example:
3907
3908 env.StaticLibrary(target='bar', source=['bar.c', 'foo.o'])
3909
3910 Any object files listed in the source must have been built for a
3911 static library (that is, using the StaticObject builder method).
3912 scons will raise an error if there is any mismatch.
3913
3914 StaticObject(), env.StaticObject()
3915 Builds a static object file from one or more C, C++, D, or Fortran
3916 source files. Source files must have one of the following
3917 extensions:
3918
3919 .asm assembly language file
3920 .ASM assembly language file
3921 .c C file
3922 .C Windows: C file
3923 POSIX: C++ file
3924 .cc C++ file
3925 .cpp C++ file
3926 .cxx C++ file
3927 .cxx C++ file
3928 .c++ C++ file
3929 .C++ C++ file
3930 .d D file
3931 .f Fortran file
3932 .F Windows: Fortran file
3933 POSIX: Fortran file + C pre-processor
3934 .for Fortran file
3935 .FOR Fortran file
3936 .fpp Fortran file + C pre-processor
3937 .FPP Fortran file + C pre-processor
3938 .m Object C file
3939 .mm Object C++ file
3940 .s assembly language file
3941 .S Windows: assembly language file
3942 ARM: CodeSourcery Sourcery Lite
3943 .sx assembly language file + C pre-processor
3944 POSIX: assembly language file + C pre-processor
3945 .spp assembly language file + C pre-processor
3946 .SPP assembly language file + C pre-processor
3947
3948 The target object file prefix, specified by the $OBJPREFIX
3949 construction variable (nothing by default), and suffix, specified
3950 by the $OBJSUFFIX construction variable (.obj on Windows systems,
3951 .o on POSIX systems), are automatically added to the target if not
3952 already present. Examples:
3953
3954 env.StaticObject(target='aaa', source='aaa.c')
3955 env.StaticObject(target='bbb.o', source='bbb.c++')
3956 env.StaticObject(target='ccc.obj', source='ccc.f')
3957
3958 Note that the source files will be scanned according to the suffix
3959 mappings in the SourceFileScanner object. See the manpage section
3960 "Scanner Objects" for more information.
3961
3962 Substfile(), env.Substfile()
3963 The Substfile builder creates a single text file from a template
3964 consisting of a file or set of files (or nodes), replacing text
3965 using the $SUBST_DICT construction variable (if set). If a set,
3966 they are concatenated into the target file using the value of the
3967 $LINESEPARATOR construction variable as a separator between
3968 contents; the separator is not emitted after the contents of the
3969 last file. Nested lists of source files are flattened. See also
3970 Textfile.
3971
3972 If a single source file name is specified and has a .in suffix, the
3973 suffix is stripped and the remainder of the name is used as the
3974 default target name.
3975
3976 The prefix and suffix specified by the $SUBSTFILEPREFIX and
3977 $SUBSTFILESUFFIX construction variables (an empty string by default
3978 in both cases) are automatically added to the target if they are
3979 not already present.
3980
3981 If a construction variable named $SUBST_DICT is present, it may be
3982 either a Python dictionary or a sequence of (key, value) tuples. If
3983 it is a dictionary it is converted into a list of tuples with
3984 unspecified order, so if one key is a prefix of another key or if
3985 one substitution could be further expanded by another subsitition,
3986 it is unpredictable whether the expansion will occur.
3987
3988 Any occurrences of a key in the source are replaced by the
3989 corresponding value, which may be a Python callable function or a
3990 string. If the value is a callable, it is called with no arguments
3991 to get a string. Strings are subst-expanded and the result replaces
3992 the key.
3993
3994 env = Environment(tools=['default'])
3995
3996 env['prefix'] = '/usr/bin'
3997 script_dict = {'@prefix@': '/bin', '@exec_prefix@': '$prefix'}
3998 env.Substfile('script.in', SUBST_DICT=script_dict)
3999
4000 conf_dict = {'%VERSION%': '1.2.3', '%BASE%': 'MyProg'}
4001 env.Substfile('config.h.in', conf_dict, SUBST_DICT=conf_dict)
4002
4003 # UNPREDICTABLE - one key is a prefix of another
4004 bad_foo = {'$foo': '$foo', '$foobar': '$foobar'}
4005 env.Substfile('foo.in', SUBST_DICT=bad_foo)
4006
4007 # PREDICTABLE - keys are applied longest first
4008 good_foo = [('$foobar', '$foobar'), ('$foo', '$foo')]
4009 env.Substfile('foo.in', SUBST_DICT=good_foo)
4010
4011 # UNPREDICTABLE - one substitution could be futher expanded
4012 bad_bar = {'@bar@': '@soap@', '@soap@': 'lye'}
4013 env.Substfile('bar.in', SUBST_DICT=bad_bar)
4014
4015 # PREDICTABLE - substitutions are expanded in order
4016 good_bar = (('@bar@', '@soap@'), ('@soap@', 'lye'))
4017 env.Substfile('bar.in', SUBST_DICT=good_bar)
4018
4019 # the SUBST_DICT may be in common (and not an override)
4020 substutions = {}
4021 subst = Environment(tools=['textfile'], SUBST_DICT=substitutions)
4022 substitutions['@foo@'] = 'foo'
4023 subst['SUBST_DICT']['@bar@'] = 'bar'
4024 subst.Substfile(
4025 'pgm1.c',
4026 [Value('#include "@foo@.h"'), Value('#include "@bar@.h"'), "common.in", "pgm1.in"],
4027 )
4028 subst.Substfile(
4029 'pgm2.c',
4030 [Value('#include "@foo@.h"'), Value('#include "@bar@.h"'), "common.in", "pgm2.in"],
4031 )
4032
4033
4034 Tar(), env.Tar()
4035 Builds a tar archive of the specified files and/or directories.
4036 Unlike most builder methods, the Tar builder method may be called
4037 multiple times for a given target; each additional call adds to the
4038 list of entries that will be built into the archive. Any source
4039 directories will be scanned for changes to any on-disk files,
4040 regardless of whether or not scons knows about them from other
4041 Builder or function calls.
4042
4043 env.Tar('src.tar', 'src')
4044
4045 # Create the stuff.tar file.
4046 env.Tar('stuff', ['subdir1', 'subdir2'])
4047 # Also add "another" to the stuff.tar file.
4048 env.Tar('stuff', 'another')
4049
4050 # Set TARFLAGS to create a gzip-filtered archive.
4051 env = Environment(TARFLAGS = '-c -z')
4052 env.Tar('foo.tar.gz', 'foo')
4053
4054 # Also set the suffix to .tgz.
4055 env = Environment(TARFLAGS = '-c -z',
4056 TARSUFFIX = '.tgz')
4057 env.Tar('foo')
4058
4059 Textfile(), env.Textfile()
4060 The Textfile builder generates a single text file from a template
4061 consisting of a list of strings, replacing text using the
4062 $SUBST_DICT construction variable (if set) - see Substfile for a
4063 description of replacement. The strings will be separated in the
4064 target file using the value of the $LINESEPARATOR construction
4065 variable; the line separator is not emitted after the last string.
4066 Nested lists of source strings are flattened. Source strings need
4067 not literally be Python strings: they can be Nodes or Python
4068 objects that convert cleanly to Value nodes
4069
4070 The prefix and suffix specified by the $TEXTFILEPREFIX and
4071 $TEXTFILESUFFIX construction variables (by default an empty string
4072 and .txt, respectively) are automatically added to the target if
4073 they are not already present. Examples:
4074
4075 # builds/writes foo.txt
4076 env.Textfile(target='foo.txt', source=['Goethe', 42, 'Schiller'])
4077
4078 # builds/writes bar.txt
4079 env.Textfile(target='bar', source=['lalala', 'tanteratei'], LINESEPARATOR='|*')
4080
4081 # nested lists are flattened automatically
4082 env.Textfile(target='blob', source=['lalala', ['Goethe', 42, 'Schiller'], 'tanteratei'])
4083
4084 # files may be used as input by wraping them in File()
4085 env.Textfile(
4086 target='concat', # concatenate files with a marker between
4087 source=[File('concat1'), File('concat2')],
4088 LINESEPARATOR='====================\n',
4089 )
4090
4091 Results:
4092
4093 foo.txt
4094
4095 Goethe
4096 42
4097 Schiller
4098
4099 bar.txt
4100
4101 lalala|*tanteratei
4102
4103 blob.txt
4104
4105 lalala
4106 Goethe
4107 42
4108 Schiller
4109 tanteratei
4110
4111 Translate(), env.Translate()
4112 This pseudo-builder belongs to gettext toolset. The builder
4113 extracts internationalized messages from source files, updates POT
4114 template (if necessary) and then updates PO translations (if
4115 necessary). If $POAUTOINIT is set, missing PO files will be
4116 automatically created (i.e. without translator person
4117 intervention). The variables $LINGUAS_FILE and $POTDOMAIN are taken
4118 into acount too. All other construction variables used by
4119 POTUpdate, and POUpdate work here too.
4120
4121
4122 Example 1. The simplest way is to specify input files and output
4123 languages inline in a SCons script when invoking Translate
4124
4125 # SConscript in 'po/' directory
4126 env = Environment( tools = ["default", "gettext"] )
4127 env['POAUTOINIT'] = 1
4128 env.Translate(['en','pl'], ['../a.cpp','../b.cpp'])
4129
4130
4131 Example 2. If you wish, you may also stick to conventional style
4132 known from autotools, i.e. using POTFILES.in and LINGUAS files
4133
4134 # LINGUAS
4135 en pl
4136 #end
4137
4138 # POTFILES.in
4139 a.cpp
4140 b.cpp
4141 # end
4142
4143 # SConscript
4144 env = Environment( tools = ["default", "gettext"] )
4145 env['POAUTOINIT'] = 1
4146 env['XGETTEXTPATH'] = ['../']
4147 env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in')
4148
4149 The last approach is perhaps the recommended one. It allows easily
4150 split internationalization/localization onto separate SCons
4151 scripts, where a script in source tree is responsible for
4152 translations (from sources to PO files) and script(s) under variant
4153 directories are responsible for compilation of PO to MO files to
4154 and for installation of MO files. The "gluing factor" synchronizing
4155 these two scripts is then the content of LINGUAS file. Note, that
4156 the updated POT and PO files are usually going to be committed back
4157 to the repository, so they must be updated within the source
4158 directory (and not in variant directories). Additionaly, the file
4159 listing of po/ directory contains LINGUAS file, so the source tree
4160 looks familiar to translators, and they may work with the project
4161 in their usual way.
4162
4163
4164 Example 3. Let's prepare a development tree as below
4165
4166 project/
4167 + SConstruct
4168 + build/
4169 + src/
4170 + po/
4171 + SConscript
4172 + SConscript.i18n
4173 + POTFILES.in
4174 + LINGUAS
4175
4176 with build being variant directory. Write the top-level SConstruct
4177 script as follows
4178
4179 # SConstruct
4180 env = Environment( tools = ["default", "gettext"] )
4181 VariantDir('build', 'src', duplicate = 0)
4182 env['POAUTOINIT'] = 1
4183 SConscript('src/po/SConscript.i18n', exports = 'env')
4184 SConscript('build/po/SConscript', exports = 'env')
4185
4186 the src/po/SConscript.i18n as
4187
4188 # src/po/SConscript.i18n
4189 Import('env')
4190 env.Translate(LINGUAS_FILE=1, XGETTEXTFROM='POTFILES.in', XGETTEXTPATH=['../'])
4191
4192 and the src/po/SConscript
4193
4194 # src/po/SConscript
4195 Import('env')
4196 env.MOFiles(LINGUAS_FILE = 1)
4197
4198 Such setup produces POT and PO files under source tree in src/po/
4199 and binary MO files under variant tree in build/po/. This way the
4200 POT and PO files are separated from other output files, which must
4201 not be committed back to source repositories (e.g. MO files).
4202
4203
4204 Note
4205 In above example, the PO files are not updated, nor created
4206 automatically when you issue scons '.' command. The files must
4207 be updated (created) by hand via scons po-update and then MO
4208 files can be compiled by running scons '.'.
4209
4210 TypeLibrary(), env.TypeLibrary()
4211 Builds a Windows type library (.tlb) file from an input IDL file
4212 (.idl). In addition, it will build the associated interface stub
4213 and proxy source files, naming them according to the base name of
4214 the .idl file. For example,
4215
4216 env.TypeLibrary(source="foo.idl")
4217
4218 Will create foo.tlb, foo.h, foo_i.c, foo_p.c and foo_data.c files.
4219
4220 Uic(), env.Uic()
4221 Builds a header file, an implementation file and a moc file from an
4222 ui file. and returns the corresponding nodes in the above order.
4223 This builder is only available after using the tool 'qt'. Note: you
4224 can specify .ui files directly as source files to the Program,
4225 Library and SharedLibrary builders without using this builder.
4226 Using this builder lets you override the standard naming
4227 conventions (be careful: prefixes are always prepended to names of
4228 built files; if you don't want prefixes, you may set them to ``).
4229 See the $QTDIR variable for more information. Example:
4230
4231 env.Uic('foo.ui') # -> ['foo.h', 'uic_foo.cc', 'moc_foo.cc']
4232 env.Uic(target = Split('include/foo.h gen/uicfoo.cc gen/mocfoo.cc'),
4233 source = 'foo.ui') # -> ['include/foo.h', 'gen/uicfoo.cc', 'gen/mocfoo.cc']
4234
4235 Zip(), env.Zip()
4236 Builds a zip archive of the specified files and/or directories.
4237 Unlike most builder methods, the Zip builder method may be called
4238 multiple times for a given target; each additional call adds to the
4239 list of entries that will be built into the archive. Any source
4240 directories will be scanned for changes to any on-disk files,
4241 regardless of whether or not scons knows about them from other
4242 Builder or function calls.
4243
4244 env.Zip('src.zip', 'src')
4245
4246 # Create the stuff.zip file.
4247 env.Zip('stuff', ['subdir1', 'subdir2'])
4248 # Also add "another" to the stuff.tar file.
4249 env.Zip('stuff', 'another')
4250
4251 All targets of builder methods automatically depend on their sources.
4252 An explicit dependency can be specified using the env.Depends method of
4253 a construction environment (see below).
4254
4255 In addition, scons automatically scans source files for various
4256 programming languages, so the dependencies do not need to be specified
4257 explicitly. By default, SCons can C source files, C++ source files,
4258 Fortran source files with .F (POSIX systems only), .fpp, or .FPP file
4259 extensions, and assembly language files with .S (POSIX systems only),
4260 .spp, or .SPP files extensions for C preprocessor dependencies. SCons
4261 also has default support for scanning D source files, You can also
4262 write your own Scanners to add support for additional source file
4263 types. These can be added to the default Scanner object used by the
4264 Object, StaticObject and SharedObject Builders by adding them to the
4265 SourceFileScanner object. See the section called “Scanner Objects” for
4266 more information about defining your own Scanner objects and using the
4267 SourceFileScanner object.
4268
4269 Methods and Functions To Do Things
4270 In addition to Builder methods, scons provides a number of other
4271 construction environment methods and global functions to manipulate the
4272 build configuration.
4273
4274 Usually, a construction environment method and global function with the
4275 same name both exist for convenience. In the following list, the global
4276 function is documented in this style:
4277
4278 Function(arguments, [optional arguments])
4279
4280 and the construction environment method looks like:
4281
4282 env.Function(arguments, [optional arguments])
4283
4284 If the function can be called both ways, then both forms are listed.
4285
4286 The global function and same-named construction environment method
4287 provide almost identical functionality, with a couple of exceptions.
4288 First, many of the construction environment methods affect only that
4289 construction environment, while the global function has a global
4290 effect. Second, where appropriate, calling the functionality through a
4291 construction environment will substitute construction variables into
4292 any supplied string arguments, while the global function doesn't have
4293 the context of a construction environment to pick variables from, so it
4294 cannot perform the substitution. For example:
4295
4296 Default('$FOO')
4297
4298 env = Environment(FOO='foo')
4299 env.Default('$FOO')
4300
4301 In the above example, the call to the global Default function will add
4302 a target named $FOO to the list of default targets, while the call to
4303 the env.Default construction environment method will expand the value
4304 and add a target named foo to the list of default targets. For more on
4305 construction variable expansion, see the next section on construction
4306 variables.
4307
4308 Global functions may be called from custom Python modules that you
4309 import into an SConscript file by adding the following import to the
4310 Python module:
4311
4312 from SCons.Script import *
4313
4314 Construction environment methods and global functions provided by scons
4315 include:
4316
4317 Action(action, [output, [var, ...]] [key=value, ...]),
4318 env.Action(action, [output, [var, ...]] [key=value, ...])
4319 A factory function to create an Action object for the specified
4320 action. See the manpage section "Action Objects" for a complete
4321 explanation of the arguments and behavior.
4322
4323 Note that the env.Action form of the invocation will expand
4324 construction variables in any argument strings, including the
4325 action argument, at the time it is called using the construction
4326 variables in the env construction environment through which
4327 env.Action was called. The Action global function form delays all
4328 variable expansion until the Action object is actually used.
4329
4330 AddMethod(object, function, [name]), env.AddMethod(function, [name])
4331 Adds function to an object as a method. function will be called
4332 with an instance object as the first argument as for other methods.
4333 If name is given, it is used as the name of the new method, else
4334 the name of function is used.
4335
4336 When the global function AddMethod is called, the object to add the
4337 method to must be passed as the first argument; typically this will
4338 be Environment, in order to create a method which applies to all
4339 construction environments subsequently constructed. When called
4340 using the env.AddMethod form, the method is added to the specified
4341 construction environment only. Added methods propagate through
4342 env.Clone calls.
4343
4344 Examples:
4345
4346 # Function to add must accept an instance argument.
4347 # The Python convention is to call this 'self'.
4348 def my_method(self, arg):
4349 print("my_method() got", arg)
4350
4351 # Use the global function to add a method to the Environment class:
4352 AddMethod(Environment, my_method)
4353 env = Environment()
4354 env.my_method('arg')
4355
4356 # Use the optional name argument to set the name of the method:
4357 env.AddMethod(my_method, 'other_method_name')
4358 env.other_method_name('another arg')
4359
4360 AddOption(arguments)
4361 Adds a local (project-specific) command-line option. arguments are
4362 the same as those supported by the add_option method in the
4363 standard Python library module optparse, with a few additional
4364 capabilities noted below. See the documentation for optparse for a
4365 thorough discussion of its option-processing capabities.
4366
4367 In addition to the arguments and values supported by the optparse
4368 add_option method, AddOption allows setting the nargs keyword value
4369 to a string consisting of a question mark ('?') to indicate that
4370 the option argument for that option string is optional. If the
4371 option string is present on the command line but has no matching
4372 option argument, the value of the const keyword argument is
4373 produced as the value of the option. If the option string is
4374 omitted from the command line, the value of the default keyword
4375 argument is produced, as usual; if there is no default keyword
4376 argument in the AddOption call, None is produced.
4377
4378
4379 optparse recognizes abbreviations of long option names, as long as
4380 they can be unambiguously resolved. For example, if add_option is
4381 called to define a --devicename option, it will recognize --device,
4382 --dev and so forth as long as there is no other option which could
4383 also match to the same abbreviation. Options added via AddOption do
4384 not support the automatic recognition of abbreviations. Instead, to
4385 allow specific abbreviations, include them as synonyms in the
4386 AddOption call itself.
4387
4388 Once a new command-line option has been added with AddOption, the
4389 option value may be accessed using GetOption or env.GetOption.
4390 SetOption is not currently supported for options added with
4391 AddOption.
4392
4393 Help text for an option is a combination of the string supplied in
4394 the help keyword argument to AddOption and information collected
4395 from the other keyword arguments. Such help is displayed if the -h
4396 command line option is used (but not with -H). Help for all local
4397 options is displayed under the separate heading Local Options. The
4398 options are unsorted - they will appear in the help text in the
4399 order in which the AddOption calls occur.
4400
4401 Example:
4402
4403 AddOption(
4404 '--prefix',
4405 dest='prefix',
4406 nargs=1,
4407 type='string',
4408 action='store',
4409 metavar='DIR',
4410 help='installation prefix',
4411 )
4412 env = Environment(PREFIX=GetOption('prefix'))
4413
4414 For that example, the following help text would be produced:
4415
4416 Local Options:
4417 --prefix=DIR installation prefix
4418
4419 Help text for local options may be unavailable if the Help function
4420 has been called, see the Help documentation for details.
4421
4422 Note
4423 As an artifact of the internal implementation, the behavior of
4424 options added by AddOption which take option arguments is
4425 undefined if whitespace (rather than an = sign) is used as the
4426 separator on the command line. Users should avoid such usage;
4427 it is recommended to add a note to this effect to project
4428 documentation if the situation is likely to arise. In addition,
4429 if the nargs keyword is used to specify more than one following
4430 option argument (that is, with a value of 2 or greater), such
4431 arguments would necessarily be whitespace separated, triggering
4432 the issue. Developers should not use AddOption this way. Future
4433 versions of SCons will likely forbid such usage.
4434
4435 AddPostAction(target, action), env.AddPostAction(target, action)
4436 Arranges for the specified action to be performed after the
4437 specified target has been built. The specified action(s) may be an
4438 Action object, or anything that can be converted into an Action
4439 object See the manpage section "Action Objects" for a complete
4440 explanation.
4441
4442 When multiple targets are supplied, the action may be called
4443 multiple times, once after each action that generates one or more
4444 targets in the list.
4445
4446 AddPreAction(target, action), env.AddPreAction(target, action)
4447 Arranges for the specified action to be performed before the
4448 specified target is built. The specified action(s) may be an Action
4449 object, or anything that can be converted into an Action object See
4450 the manpage section "Action Objects" for a complete explanation.
4451
4452 When multiple targets are specified, the action(s) may be called
4453 multiple times, once before each action that generates one or more
4454 targets in the list.
4455
4456 Note that if any of the targets are built in multiple steps, the
4457 action will be invoked just before the "final" action that
4458 specifically generates the specified target(s). For example, when
4459 building an executable program from a specified source .c file via
4460 an intermediate object file:
4461
4462 foo = Program('foo.c')
4463 AddPreAction(foo, 'pre_action')
4464
4465 The specified pre_action would be executed before scons calls the
4466 link command that actually generates the executable program binary
4467 foo, not before compiling the foo.c file into an object file.
4468
4469 Alias(alias, [targets, [action]]), env.Alias(alias, [targets,
4470 [action]])
4471 Creates one or more phony targets that expand to one or more other
4472 targets. An optional action (command) or list of actions can be
4473 specified that will be executed whenever the any of the alias
4474 targets are out-of-date. Returns the Node object representing the
4475 alias, which exists outside of any file system. This Node object,
4476 or the alias name, may be used as a dependency of any other target,
4477 including another alias. Alias can be called multiple times for
4478 the same alias to add additional targets to the alias, or
4479 additional actions to the list for this alias. Aliases are global
4480 even if set through the construction environment method.
4481
4482 Examples:
4483
4484 Alias('install')
4485 Alias('install', '/usr/bin')
4486 Alias(['install', 'install-lib'], '/usr/local/lib')
4487
4488 env.Alias('install', ['/usr/local/bin', '/usr/local/lib'])
4489 env.Alias('install', ['/usr/local/man'])
4490
4491 env.Alias('update', ['file1', 'file2'], "update_database $SOURCES")
4492
4493 AllowSubstExceptions([exception, ...])
4494 Specifies the exceptions that will be allowed when expanding
4495 construction variables. By default, any construction variable
4496 expansions that generate a NameError or IndexError exception will
4497 expand to a '' (an empty string) and not cause scons to fail. All
4498 exceptions not in the specified list will generate an error message
4499 and terminate processing.
4500
4501 If AllowSubstExceptions is called multiple times, each call
4502 completely overwrites the previous list of allowed exceptions.
4503
4504 Example:
4505
4506 # Requires that all construction variable names exist.
4507 # (You may wish to do this if you want to enforce strictly
4508 # that all construction variables must be defined before use.)
4509 AllowSubstExceptions()
4510
4511 # Also allow a string containing a zero-division expansion
4512 # like '${1 / 0}' to evalute to ''.
4513 AllowSubstExceptions(IndexError, NameError, ZeroDivisionError)
4514
4515 AlwaysBuild(target, ...), env.AlwaysBuild(target, ...)
4516 Marks each given target so that it is always assumed to be out of
4517 date, and will always be rebuilt if needed. Note, however, that
4518 AlwaysBuild does not add its target(s) to the default target list,
4519 so the targets will only be built if they are specified on the
4520 command line, or are a dependent of a target specified on the
4521 command line--but they will always be built if so specified.
4522 Multiple targets can be passed in to a single call to AlwaysBuild.
4523
4524 env.Append(key=val, [...])
4525 Intelligently append values to construction variables in the
4526 construction environment named by env. The construction variables
4527 and values to add to them are passed as key=val pairs (Python
4528 keyword arguments). env.Append is designed to allow adding values
4529 without normally having to know the data type of an existing
4530 construction variable. Regular Python syntax can also be used to
4531 manipulate the construction variable, but for that you must know
4532 the type of the construction variable: for example, different
4533 Python syntax is needed to combine a list of values with a single
4534 string value, or vice versa. Some pre-defined construction
4535 variables do have type expectations based on how SCons will use
4536 them, for example $CPPDEFINES is normally a string or a list of
4537 strings, but can be a string, a list of strings, a list of tuples,
4538 or a dictionary, while $LIBEMITTER would expect a callable or list
4539 of callables, and $BUILDERS would expect a mapping type. Consult
4540 the documentation for the various construction variables for more
4541 details.
4542
4543 The following descriptions apply to both the append and prepend
4544 functions, the only difference being the insertion point of the
4545 added values.
4546
4547 If env. does not have a construction variable indicated by key, val
4548 is added to the environment under that key as-is.
4549
4550
4551 val can be almost any type, and SCons will combine it with an
4552 existing value into an appropriate type, but there are a few
4553 special cases to be aware of. When two strings are combined, the
4554 result is normally a new string, with the caller responsible for
4555 supplying any needed separation. The exception to this is the
4556 construction variable $CPPDEFINES, in which each item will be
4557 postprocessed by adding a prefix and/or suffix, so the contents are
4558 treated as a list of strings, that is, adding a string will result
4559 in a separate string entry, not a combined string. For $CPPDEFINES
4560 as well as for $LIBS, and the various *PATH variables, SCons will
4561 supply the compiler-specific syntax (e.g. adding a -D or /D prefix
4562 for $CPPDEFINES), so this syntax should be omitted when adding
4563 values to these variables. Example (gcc syntax shown in the
4564 expansion of CPPDEFINES):
4565
4566 env = Environment(CXXFLAGS="-std=c11", CPPDEFINES="RELEASE")
4567 print("CXXFLAGS={}, CPPDEFINES={}".format(env['CXXFLAGS'], env['CPPDEFINES']))
4568 # notice including a leading space in CXXFLAGS value
4569 env.Append(CXXFLAGS=" -O", CPPDEFINES="EXTRA")
4570 print("CXXFLAGS={}, CPPDEFINES={}".format(env['CXXFLAGS'], env['CPPDEFINES']))
4571 print("CPPDEFINES will expand to {}".format(env.subst("$_CPPDEFFLAGS")))
4572
4573 $ scons -Q
4574 CXXFLAGS=-std=c11, CPPDEFINES=RELEASE
4575 CXXFLAGS=-std=c11 -O, CPPDEFINES=['RELEASE', 'EXTRA']
4576 CPPDEFINES will expand to -DRELEASE -DEXTRA
4577 scons: `.' is up to date.
4578
4579 Because $CPPDEFINES is intended to describe C/C++ pre-processor
4580 macro definitions, it accepts additional syntax. Preprocessor
4581 macros can be valued, or un-valued, as in -DBAR=1 or -DFOO. The
4582 macro can be be supplied as a complete string including the value,
4583 or as a tuple (or list) of macro, value, or as a dictionary.
4584 Example (again gcc syntax in the expanded defines):
4585
4586 env = Environment(CPPDEFINES="FOO")
4587 print("CPPDEFINES={}".format(env['CPPDEFINES']))
4588 env.Append(CPPDEFINES="BAR=1")
4589 print("CPPDEFINES={}".format(env['CPPDEFINES']))
4590 env.Append(CPPDEFINES=("OTHER", 2))
4591 print("CPPDEFINES={}".format(env['CPPDEFINES']))
4592 env.Append(CPPDEFINES={"EXTRA": "arg"})
4593 print("CPPDEFINES={}".format(env['CPPDEFINES']))
4594 print("CPPDEFINES will expand to {}".format(env.subst("$_CPPDEFFLAGS")))
4595
4596 $ scons -Q
4597 CPPDEFINES=FOO
4598 CPPDEFINES=['FOO', 'BAR=1']
4599 CPPDEFINES=['FOO', 'BAR=1', ('OTHER', 2)]
4600 CPPDEFINES=['FOO', 'BAR=1', ('OTHER', 2), {'EXTRA': 'arg'}]
4601 CPPDEFINES will expand to -DFOO -DBAR=1 -DOTHER=2 -DEXTRA=arg
4602 scons: `.' is up to date.
4603
4604 Adding a string val to a dictonary construction variable will enter
4605 val as the key in the dict, and None as its value. Using a tuple
4606 type to supply a key + value only works for the special case of
4607 $CPPDEFINES described above.
4608
4609 Although most combinations of types work without needing to know
4610 the details, some combinations do not make sense and a Python
4611 exception will be raised.
4612
4613 When using env.Append to modify construction variables which are
4614 path specifications (normally, those names which end in PATH), it
4615 is recommended to add the values as a list of strings, even if
4616 there is only a single string to add. The same goes for adding
4617 library names to $LIBS.
4618
4619 env.Append(CPPPATH=["#/include"])
4620
4621 See also env.AppendUnique, env.Prepend and env.PrependUnique.
4622
4623 env.AppendENVPath(name, newpath, [envname, sep, delete_existing=False])
4624 Append new path elements to the given path in the specified
4625 external environment ($ENV by default). This will only add any
4626 particular path once (leaving the last one it encounters and
4627 ignoring the rest, to preserve path order), and to help assure
4628 this, will normalize all paths (using os.path.normpath and
4629 os.path.normcase). This can also handle the case where the given
4630 old path variable is a list instead of a string, in which case a
4631 list will be returned instead of a string.
4632
4633 If delete_existing is False, then adding a path that already exists
4634 will not move it to the end; it will stay where it is in the list.
4635
4636 Example:
4637
4638 print('before:', env['ENV']['INCLUDE'])
4639 include_path = '/foo/bar:/foo'
4640 env.AppendENVPath('INCLUDE', include_path)
4641 print('after:', env['ENV']['INCLUDE'])
4642
4643 Yields:
4644
4645 before: /foo:/biz
4646 after: /biz:/foo/bar:/foo
4647
4648 env.AppendUnique(key=val, [...], delete_existing=False)
4649 Append values to construction variables in the current construction
4650 environment, maintaining uniqueness. Works like env.Append (see for
4651 details), except that values already present in the construction
4652 variable will not be added again. If delete_existing is True, the
4653 existing matching value is first removed, and the requested value
4654 is added, having the effect of moving such values to the end.
4655
4656 Example:
4657
4658 env.AppendUnique(CCFLAGS='-g', FOO=['foo.yyy'])
4659
4660 See also env.Append, env.Prepend and env.PrependUnique.
4661
4662 Builder(action, [arguments]), env.Builder(action, [arguments])
4663 Creates a Builder object for the specified action. See the manpage
4664 section "Builder Objects" for a complete explanation of the
4665 arguments and behavior.
4666
4667 Note that the env.Builder() form of the invocation will expand
4668 construction variables in any arguments strings, including the
4669 action argument, at the time it is called using the construction
4670 variables in the env construction environment through which
4671 env.Builder was called. The Builder form delays all variable
4672 expansion until after the Builder object is actually called.
4673
4674 CacheDir(cache_dir, custom_class=None), env.CacheDir(cache_dir,
4675 custom_class=None)
4676 Direct scons to maintain a derived-file cache in cache_dir. The
4677 derived files in the cache will be shared among all the builds
4678 specifying the same cache_dir. Specifying a cache_dir of None
4679 disables derived file caching.
4680
4681 When specifying a custom_class which should be a class type which
4682 is a subclass of SCons.CacheDir.CacheDir, SCons will internally
4683 invoke this class to use for performing caching operations. This
4684 argument is optional and if left to default None, will use the
4685 default SCons.CacheDir.CacheDir class.
4686
4687 Calling the environment method env.CacheDir limits the effect to
4688 targets built through the specified construction environment.
4689 Calling the global function CacheDir sets a global default that
4690 will be used by all targets built through construction environments
4691 that do not set up environment-specific caching by calling
4692 env.CacheDir.
4693
4694 When derived-file caching is being used and scons finds a derived
4695 file that needs to be rebuilt, it will first look in the cache to
4696 see if a file with matching build signature exists (indicating the
4697 input file(s) and build action(s) were identical to those for the
4698 current target), and if so, will retrieve the file from the cache.
4699 scons will report Retrieved `file' from cache instead of the normal
4700 build message. If the derived file is not present in the cache,
4701 scons will build it and then place a copy of the built file in the
4702 cache, identified by its build signature, for future use.
4703
4704 The Retrieved `file' from cache messages are useful for human
4705 consumption, but less so when comparing log files between scons
4706 runs which will show differences that are noisy and not actually
4707 significant. To disable, use the --cache-show option. With this
4708 option, scons will print the action that would have been used to
4709 build the file without considering cache retrieval.
4710
4711 Derived-file caching may be disabled for any invocation of scons by
4712 giving the --cache-disable command line option. Cache updating may
4713 be disabled, leaving cache fetching enabled, by giving the
4714 --cache-readonly.
4715
4716 If the --cache-force option is used, scons will place a copy of all
4717 derived files in the cache, even if they already existed and were
4718 not built by this invocation. This is useful to populate a cache
4719 the first time a cache_dir is used for a build, or to bring a cache
4720 up to date after a build with cache updating disabled
4721 (--cache-disable or --cache-readonly) has been done.
4722
4723 The NoCache method can be used to disable caching of specific
4724 files. This can be useful if inputs and/or outputs of some tool are
4725 impossible to predict or prohibitively large.
4726
4727 Clean(targets, files_or_dirs), env.Clean(targets, files_or_dirs)
4728 This specifies a list of files or directories which should be
4729 removed whenever the targets are specified with the -c command line
4730 option. The specified targets may be a list or an individual
4731 target. Multiple calls to Clean are legal, and create new targets
4732 or add files and directories to the clean list for the specified
4733 targets.
4734
4735 Multiple files or directories should be specified either as
4736 separate arguments to the Clean method, or as a list. Clean will
4737 also accept the return value of any of the construction environment
4738 Builder methods. Examples:
4739
4740 The related NoClean function overrides calling Clean for the same
4741 target, and any targets passed to both functions will not be
4742 removed by the -c option.
4743
4744 Examples:
4745
4746 Clean('foo', ['bar', 'baz'])
4747 Clean('dist', env.Program('hello', 'hello.c'))
4748 Clean(['foo', 'bar'], 'something_else_to_clean')
4749
4750 In this example, installing the project creates a subdirectory for
4751 the documentation. This statement causes the subdirectory to be
4752 removed if the project is deinstalled.
4753
4754 Clean(docdir, os.path.join(docdir, projectname))
4755
4756 env.Clone([key=val, ...])
4757 Returns a separate copy of a construction environment. If there are
4758 any keyword arguments specified, they are added to the returned
4759 copy, overwriting any existing values for the keywords.
4760
4761 Example:
4762
4763 env2 = env.Clone()
4764 env3 = env.Clone(CCFLAGS='-g')
4765
4766 Additionally, a list of tools and a toolpath may be specified, as
4767 in the Environment constructor:
4768
4769 def MyTool(env):
4770 env['FOO'] = 'bar'
4771
4772 env4 = env.Clone(tools=['msvc', MyTool])
4773
4774 The parse_flags keyword argument is also recognized to allow
4775 merging command-line style arguments into the appropriate
4776 construction variables (see env.MergeFlags).
4777
4778 # create an environment for compiling programs that use wxWidgets
4779 wx_env = env.Clone(parse_flags='!wx-config --cflags --cxxflags')
4780
4781 Command(target, source, action, [key=val, ...]), env.Command(target,
4782 source, action, [key=val, ...])
4783 Executes a specific action (or list of actions) to build a target
4784 file or files from a source file or files. This is more convenient
4785 than defining a separate Builder object for a single special-case
4786 build.
4787
4788 The Command function accepts source_scanner, target_scanner,
4789 source_factory, and target_factory keyword arguments. These
4790 arguments can be used to specify a Scanner object that will be used
4791 to apply a custom scanner for a source or target. For example, the
4792 global DirScanner object can be used if any of the sources will be
4793 directories that must be scanned on-disk for changes to files that
4794 aren't already specified in other Builder of function calls. The
4795 *_factory arguments take a factory function that Command will use
4796 to turn any sources or targets specified as strings into SCons
4797 Nodes. See the manpage section "Builder Objects" for more
4798 information about how these arguments work in a Builder.
4799
4800 Any other keyword arguments specified override any same-named
4801 existing construction variables.
4802
4803 An action can be an external command, specified as a string, or a
4804 callable Python object; see the manpage section "Action Objects"
4805 for more complete information. Also note that a string specifying
4806 an external command may be preceded by an at-sign (@) to suppress
4807 printing the command in question, or by a hyphen (-) to ignore the
4808 exit status of the external command.
4809
4810 Examples:
4811
4812 env.Command(
4813 target='foo.out',
4814 source='foo.in',
4815 action="$FOO_BUILD < $SOURCES > $TARGET"
4816 )
4817
4818 env.Command(
4819 target='bar.out',
4820 source='bar.in',
4821 action=["rm -f $TARGET", "$BAR_BUILD < $SOURCES > $TARGET"],
4822 ENV={'PATH': '/usr/local/bin/'},
4823 )
4824
4825
4826 import os
4827 def rename(env, target, source):
4828 os.rename('.tmp', str(target[0]))
4829
4830
4831 env.Command(
4832 target='baz.out',
4833 source='baz.in',
4834 action=["$BAZ_BUILD < $SOURCES > .tmp", rename],
4835 )
4836
4837 Note that the Command function will usually assume, by default,
4838 that the specified targets and/or sources are Files, if no other
4839 part of the configuration identifies what type of entries they are.
4840 If necessary, you can explicitly specify that targets or source
4841 nodes should be treated as directories by using the Dir or env.Dir
4842 functions.
4843
4844 Examples:
4845
4846 env.Command('ddd.list', Dir('ddd'), 'ls -l $SOURCE > $TARGET')
4847
4848 env['DISTDIR'] = 'destination/directory'
4849 env.Command(env.Dir('$DISTDIR')), None, make_distdir)
4850
4851 Also note that SCons will usually automatically create any
4852 directory necessary to hold a target file, so you normally don't
4853 need to create directories by hand.
4854
4855 Configure(env, [custom_tests, conf_dir, log_file, config_h]),
4856 env.Configure([custom_tests, conf_dir, log_file, config_h])
4857 Creates a Configure object for integrated functionality similar to
4858 GNU autoconf. See the manpage section "Configure Contexts" for a
4859 complete explanation of the arguments and behavior.
4860
4861 Decider(function), env.Decider(function)
4862 Specifies that all up-to-date decisions for targets built through
4863 this construction environment will be handled by the specified
4864 function. function can be the name of a function or one of the
4865 following strings that specify the predefined decision function
4866 that will be applied:
4867
4868 "timestamp-newer"
4869 Specifies that a target shall be considered out of date and
4870 rebuilt if the dependency's timestamp is newer than the target
4871 file's timestamp. This is the behavior of the classic Make
4872 utility, and make can be used a synonym for timestamp-newer.
4873
4874 "timestamp-match"
4875 Specifies that a target shall be considered out of date and
4876 rebuilt if the dependency's timestamp is different than the
4877 timestamp recorded the last time the target was built. This
4878 provides behavior very similar to the classic Make utility (in
4879 particular, files are not opened up so that their contents can
4880 be checksummed) except that the target will also be rebuilt if
4881 a dependency file has been restored to a version with an
4882 earlier timestamp, such as can happen when restoring files from
4883 backup archives.
4884
4885 "content"
4886 Specifies that a target shall be considered out of date and
4887 rebuilt if the dependency's content has changed since the last
4888 time the target was built, as determined be performing an
4889 checksum on the dependency's contents and comparing it to the
4890 checksum recorded the last time the target was built. MD5 can
4891 be used as a synonym for content, but it is deprecated.
4892
4893 "content-timestamp"
4894 Specifies that a target shall be considered out of date and
4895 rebuilt if the dependency's content has changed since the last
4896 time the target was built, except that dependencies with a
4897 timestamp that matches the last time the target was rebuilt
4898 will be assumed to be up-to-date and not rebuilt. This provides
4899 behavior very similar to the content behavior of always
4900 checksumming file contents, with an optimization of not
4901 checking the contents of files whose timestamps haven't
4902 changed. The drawback is that SCons will not detect if a file's
4903 content has changed but its timestamp is the same, as might
4904 happen in an automated script that runs a build, updates a
4905 file, and runs the build again, all within a single second.
4906 MD5-timestamp can be used as a synonym for content-timestamp,
4907 but it is deprecated.
4908
4909 Examples:
4910
4911 # Use exact timestamp matches by default.
4912 Decider('timestamp-match')
4913
4914 # Use hash content signatures for any targets built
4915 # with the attached construction environment.
4916 env.Decider('content')
4917
4918 In addition to the above already-available functions, the function
4919 argument may be a Python function you supply. Such a function must
4920 accept the following four arguments:
4921
4922 dependency
4923 The Node (file) which should cause the target to be rebuilt if
4924 it has "changed" since the last tme target was built.
4925
4926 target
4927 The Node (file) being built. In the normal case, this is what
4928 should get rebuilt if the dependency has "changed."
4929
4930 prev_ni
4931 Stored information about the state of the dependency the last
4932 time the target was built. This can be consulted to match
4933 various file characteristics such as the timestamp, size, or
4934 content signature.
4935
4936 repo_node
4937 If set, use this Node instead of the one specified by
4938 dependency to determine if the dependency has changed. This
4939 argument is optional so should be written as a default argument
4940 (typically it would be written as repo_node=None). A caller
4941 will normally only set this if the target only exists in a
4942 Repository.
4943
4944 The function should return a value which evaluates True if the
4945 dependency has "changed" since the last time the target was built
4946 (indicating that the target should be rebuilt), and a value which
4947 evaluates False otherwise (indicating that the target should not be
4948 rebuilt). Note that the decision can be made using whatever
4949 criteria are appopriate. Ignoring some or all of the function
4950 arguments is perfectly normal.
4951
4952 Example:
4953
4954 def my_decider(dependency, target, prev_ni, repo_node=None):
4955 return not os.path.exists(str(target))
4956
4957 env.Decider(my_decider)
4958
4959 Default(target[, ...]), env.Default(target[, ...])
4960 Specify default targets to the SCons target selection mechanism.
4961 Any call to Default will cause SCons to use the defined default
4962 target list instead of its built-in algorithm for determining
4963 default targets (see the manpage section "Target Selection").
4964
4965
4966 target may be one or more strings, a list of strings, a NodeList as
4967 returned by a Builder, or None. A string target may be the name of
4968 a file or directory, or a target previously defined by a call to
4969 Alias (defining the alias later will still create the alias, but it
4970 will not be recognized as a default). Calls to Default are
4971 additive. A target of None will clear any existing default target
4972 list; subsequent calls to Default will add to the (now empty)
4973 default target list like normal.
4974
4975 Both forms of this call affect the same global list of default
4976 targets; the construction environment method applies construction
4977 variable expansion to the targets.
4978
4979 The current list of targets added using Default is available in the
4980 DEFAULT_TARGETS list (see below).
4981
4982 Examples:
4983
4984 Default('foo', 'bar', 'baz')
4985 env.Default(['a', 'b', 'c'])
4986 hello = env.Program('hello', 'hello.c')
4987 env.Default(hello)
4988
4989 DefaultEnvironment([**kwargs])
4990 Instantiates and returns the default construction environment
4991 object. The default environment is used internally by SCons in
4992 order to execute many of the global functions in this list (that
4993 is, those not called as methods of a specific construction
4994 environment). It is not mandatory to call DefaultEnvironment: the
4995 default environment will be instantiated automatically when the
4996 build phase begins if the function has not been called, however
4997 calling it explicitly gives the opportunity to affect and examine
4998 the contents of the default environment.
4999
5000 The default environment is a singleton, so the keyword arguments
5001 affect it only on the first call, on subsequent calls the
5002 already-constructed object is returned and any keyword arguments
5003 are silently ignored. The default environment can be modified after
5004 instantiation in the same way as any construction environment.
5005 Modifying the default environment has no effect on the construction
5006 environment constructed by an Environment or Clone call.
5007
5008 Depends(target, dependency), env.Depends(target, dependency)
5009 Specifies an explicit dependency; the target will be rebuilt
5010 whenever the dependency has changed. Both the specified target and
5011 dependency can be a string (usually the path name of a file or
5012 directory) or Node objects, or a list of strings or Node objects
5013 (such as returned by a Builder call). This should only be necessary
5014 for cases where the dependency is not caught by a Scanner for the
5015 file.
5016
5017 Example:
5018
5019 env.Depends('foo', 'other-input-file-for-foo')
5020
5021 mylib = env.Library('mylib.c')
5022 installed_lib = env.Install('lib', mylib)
5023 bar = env.Program('bar.c')
5024
5025 # Arrange for the library to be copied into the installation
5026 # directory before trying to build the "bar" program.
5027 # (Note that this is for example only. A "real" library
5028 # dependency would normally be configured through the $LIBS
5029 # and $LIBPATH variables, not using an env.Depends() call.)
5030
5031 env.Depends(bar, installed_lib)
5032
5033 env.Detect(progs)
5034 Find an executable from one or more choices: progs may be a string
5035 or a list of strings. Returns the first value from progs that was
5036 found, or None. Executable is searched by checking the paths
5037 specified by env['ENV']['PATH']. On Windows systems, additionally
5038 applies the filename suffixes found in env['ENV']['PATHEXT'] but
5039 will not include any such extension in the return value.
5040 env.Detect is a wrapper around env.WhereIs.
5041
5042 env.Dictionary([vars])
5043 Returns a dictionary object containing the construction variables
5044 in the construction environment. If there are any arguments
5045 specified, the values of the specified construction variables are
5046 returned as a string (if one argument) or as a list of strings.
5047
5048 Example:
5049
5050 cvars = env.Dictionary()
5051 cc_values = env.Dictionary('CC', 'CCFLAGS', 'CCCOM')
5052
5053 Dir(name, [directory]), env.Dir(name, [directory])
5054 Returns Directory Node(s). A Directory Node is an object that
5055 represents a directory. name can be a relative or absolute path or
5056 a list of such paths. directory is an optional directory that will
5057 be used as the parent directory. If no directory is specified, the
5058 current script's directory is used as the parent.
5059
5060 If name is a single pathname, the corresponding node is returned.
5061 If name is a list, SCons returns a list of nodes. Construction
5062 variables are expanded in name.
5063
5064 Directory Nodes can be used anywhere you would supply a string as a
5065 directory name to a Builder method or function. Directory Nodes
5066 have attributes and methods that are useful in many situations; see
5067 manpage section "File and Directory Nodes" for more information.
5068
5069 env.Dump([key], [format])
5070 Serializes construction variables to a string. The method supports
5071 the following formats specified by format:
5072
5073 pretty
5074 Returns a pretty printed representation of the environment (if
5075 format is not specified, this is the default).
5076
5077 json
5078 Returns a JSON-formatted string representation of the
5079 environment.
5080
5081 If key is None (the default) the entire dictionary of construction
5082 variables is serialized. If supplied, it is taken as the name of a
5083 construction variable whose value is serialized.
5084
5085 This SConstruct:
5086
5087 env=Environment()
5088 print(env.Dump('CCCOM'))
5089
5090 will print:
5091
5092 '$CC -c -o $TARGET $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES'
5093
5094 While this SConstruct:
5095
5096 env = Environment()
5097 print(env.Dump())
5098
5099 will print:
5100
5101 { 'AR': 'ar',
5102 'ARCOM': '$AR $ARFLAGS $TARGET $SOURCES\n$RANLIB $RANLIBFLAGS $TARGET',
5103 'ARFLAGS': ['r'],
5104 'AS': 'as',
5105 'ASCOM': '$AS $ASFLAGS -o $TARGET $SOURCES',
5106 'ASFLAGS': [],
5107 ...
5108
5109 EnsurePythonVersion(major, minor), env.EnsurePythonVersion(major,
5110 minor)
5111 Ensure that the Python version is at least major.minor. This
5112 function will print out an error message and exit SCons with a
5113 non-zero exit code if the actual Python version is not late enough.
5114
5115 Example:
5116
5117 EnsurePythonVersion(2,2)
5118
5119 EnsureSConsVersion(major, minor, [revision]),
5120 env.EnsureSConsVersion(major, minor, [revision])
5121 Ensure that the SCons version is at least major.minor, or
5122 major.minor.revision. if revision is specified. This function will
5123 print out an error message and exit SCons with a non-zero exit code
5124 if the actual SCons version is not late enough.
5125
5126 Examples:
5127
5128 EnsureSConsVersion(0,14)
5129
5130 EnsureSConsVersion(0,96,90)
5131
5132 Environment([key=value, ...]), env.Environment([key=value, ...])
5133 Return a new construction environment initialized with the
5134 specified key=value pairs. The keyword arguments parse_flags,
5135 platform, toolpath, tools and variables are also specially
5136 recognized. See the manpage section "Construction Environments" for
5137 more details.
5138
5139 Execute(action, [strfunction, varlist]), env.Execute(action,
5140 [strfunction, varlist])
5141 Executes an Action object. The specified action may be an Action
5142 object (see manpage section "Action Objects" for an explanation of
5143 behavior), or it may be a command-line string, list of commands, or
5144 executable Python function, each of which will be converted into an
5145 Action object and then executed. Any additional arguments to
5146 Execute (strfunction, varlist) are passed on to the Action factory
5147 function which actually creates the Action object. The exit value
5148 of the command or return value of the Python function will be
5149 returned.
5150
5151 Note that scons will print an error message if the executed action
5152 fails--that is, exits with or returns a non-zero value. scons will
5153 not, however, automatically terminate the build if the specified
5154 action fails. If you want the build to stop in response to a failed
5155 Execute call, you must explicitly check for a non-zero return
5156 value:
5157
5158 Execute(Copy('file.out', 'file.in'))
5159
5160 if Execute("mkdir sub/dir/ectory"):
5161 # The mkdir failed, don't try to build.
5162 Exit(1)
5163
5164 Exit([value]), env.Exit([value])
5165 This tells scons to exit immediately with the specified value. A
5166 default exit value of 0 (zero) is used if no value is specified.
5167
5168 Export([vars...], [key=value...]), env.Export([vars...],
5169 [key=value...])
5170 Exports variables from the current SConscript file to a global
5171 collection where they can be imported by other SConscript files.
5172 vars may be one or more strings representing variable names to be
5173 exported. If a string contains whitespace, it is split into
5174 separate strings, as if multiple string arguments had been given. A
5175 vars argument may also be a dictionary, which can be used to map
5176 variables to different names when exported. Keyword arguments can
5177 be used to provide names and their values.
5178
5179
5180 Export calls are cumulative. Specifying a previously exported
5181 variable will overwrite the earlier value. Both local variables and
5182 global variables can be exported.
5183
5184 Examples:
5185
5186 env = Environment()
5187 # Make env available for all SConscript files to Import().
5188 Export("env")
5189
5190 package = 'my_name'
5191 # Make env and package available for all SConscript files:.
5192 Export("env", "package")
5193
5194 # Make env and package available for all SConscript files:
5195 Export(["env", "package"])
5196
5197 # Make env available using the name debug:
5198 Export(debug=env)
5199
5200 # Make env available using the name debug:
5201 Export({"debug": env})
5202
5203 Note that the SConscript function supports an exports argument that
5204 allows exporting a variable or set of variables to a specific
5205 SConscript file or files. See the description below.
5206
5207 File(name, [directory]), env.File(name, [directory])
5208 Returns File Node(s). A File Node is an object that represents a
5209 file. name can be a relative or absolute path or a list of such
5210 paths. directory is an optional directory that will be used as the
5211 parent directory. If no directory is specified, the current
5212 script's directory is used as the parent.
5213
5214 If name is a single pathname, the corresponding node is returned.
5215 If name is a list, SCons returns a list of nodes. Construction
5216 variables are expanded in name.
5217
5218 File Nodes can be used anywhere you would supply a string as a file
5219 name to a Builder method or function. File Nodes have attributes
5220 and methods that are useful in many situations; see manpage section
5221 "File and Directory Nodes" for more information.
5222
5223 FindFile(file, dirs), env.FindFile(file, dirs)
5224 Search for file in the path specified by dirs. dirs may be a list
5225 of directory names or a single directory name. In addition to
5226 searching for files that exist in the filesystem, this function
5227 also searches for derived files that have not yet been built.
5228
5229 Example:
5230
5231 foo = env.FindFile('foo', ['dir1', 'dir2'])
5232
5233 FindInstalledFiles(), env.FindInstalledFiles()
5234 Returns the list of targets set up by the Install or InstallAs
5235 builders.
5236
5237 This function serves as a convenient method to select the contents
5238 of a binary package.
5239
5240 Example:
5241
5242 Install('/bin', ['executable_a', 'executable_b'])
5243
5244 # will return the file node list
5245 # ['/bin/executable_a', '/bin/executable_b']
5246 FindInstalledFiles()
5247
5248 Install('/lib', ['some_library'])
5249
5250 # will return the file node list
5251 # ['/bin/executable_a', '/bin/executable_b', '/lib/some_library']
5252 FindInstalledFiles()
5253
5254 FindPathDirs(variable)
5255 Returns a function (actually a callable Python object) intended to
5256 be used as the path_function of a Scanner object. The returned
5257 object will look up the specified variable in a construction
5258 environment and treat the construction variable's value as a list
5259 of directory paths that should be searched (like $CPPPATH,
5260 $LIBPATH, etc.).
5261
5262 Note that use of FindPathDirs is generally preferable to writing
5263 your own path_function for the following reasons: 1) The returned
5264 list will contain all appropriate directories found in source trees
5265 (when VariantDir is used) or in code repositories (when Repository
5266 or the -Y option are used). 2) scons will identify expansions of
5267 variable that evaluate to the same list of directories as, in fact,
5268 the same list, and avoid re-scanning the directories for files,
5269 when possible.
5270
5271 Example:
5272
5273 def my_scan(node, env, path, arg):
5274 # Code to scan file contents goes here...
5275 return include_files
5276
5277 scanner = Scanner(name = 'myscanner',
5278 function = my_scan,
5279 path_function = FindPathDirs('MYPATH'))
5280
5281 FindSourceFiles(node='"."'), env.FindSourceFiles(node='"."')
5282 Returns the list of nodes which serve as the source of the built
5283 files. It does so by inspecting the dependency tree starting at the
5284 optional argument node which defaults to the '"."'-node. It will
5285 then return all leaves of node. These are all children which have
5286 no further children.
5287
5288 This function is a convenient method to select the contents of a
5289 Source Package.
5290
5291 Example:
5292
5293 Program('src/main_a.c')
5294 Program('src/main_b.c')
5295 Program('main_c.c')
5296
5297 # returns ['main_c.c', 'src/main_a.c', 'SConstruct', 'src/main_b.c']
5298 FindSourceFiles()
5299
5300 # returns ['src/main_b.c', 'src/main_a.c' ]
5301 FindSourceFiles('src')
5302
5303 As you can see build support files (SConstruct in the above
5304 example) will also be returned by this function.
5305
5306 Flatten(sequence), env.Flatten(sequence)
5307 Takes a sequence (that is, a Python list or tuple) that may contain
5308 nested sequences and returns a flattened list containing all of the
5309 individual elements in any sequence. This can be helpful for
5310 collecting the lists returned by calls to Builders; other Builders
5311 will automatically flatten lists specified as input, but direct
5312 Python manipulation of these lists does not.
5313
5314 Examples:
5315
5316 foo = Object('foo.c')
5317 bar = Object('bar.c')
5318
5319 # Because `foo' and `bar' are lists returned by the Object() Builder,
5320 # `objects' will be a list containing nested lists:
5321 objects = ['f1.o', foo, 'f2.o', bar, 'f3.o']
5322
5323 # Passing such a list to another Builder is all right because
5324 # the Builder will flatten the list automatically:
5325 Program(source = objects)
5326
5327 # If you need to manipulate the list directly using Python, you need to
5328 # call Flatten() yourself, or otherwise handle nested lists:
5329 for object in Flatten(objects):
5330 print(str(object))
5331
5332 GetBuildFailures()
5333 Returns a list of exceptions for the actions that failed while
5334 attempting to build targets. Each element in the returned list is a
5335 BuildError object with the following attributes that record various
5336 aspects of the build failure:
5337
5338
5339 .node The node that was being built when the build failure
5340 occurred.
5341
5342
5343 .status The numeric exit status returned by the command or Python
5344 function that failed when trying to build the specified Node.
5345
5346
5347 .errstr The SCons error string describing the build failure. (This
5348 is often a generic message like "Error 2" to indicate that an
5349 executed command exited with a status of 2.)
5350
5351
5352 .filename The name of the file or directory that actually caused
5353 the failure. This may be different from the .node attribute. For
5354 example, if an attempt to build a target named sub/dir/target fails
5355 because the sub/dir directory could not be created, then the .node
5356 attribute will be sub/dir/target but the .filename attribute will
5357 be sub/dir.
5358
5359
5360 .executor The SCons Executor object for the target Node being
5361 built. This can be used to retrieve the construction environment
5362 used for the failed action.
5363
5364
5365 .action The actual SCons Action object that failed. This will be
5366 one specific action out of the possible list of actions that would
5367 have been executed to build the target.
5368
5369
5370 .command The actual expanded command that was executed and failed,
5371 after expansion of $TARGET, $SOURCE, and other construction
5372 variables.
5373
5374 Note that the GetBuildFailures function will always return an empty
5375 list until any build failure has occurred, which means that
5376 GetBuildFailures will always return an empty list while the
5377 SConscript files are being read. Its primary intended use is for
5378 functions that will be executed before SCons exits by passing them
5379 to the standard Python atexit.register() function. Example:
5380
5381 import atexit
5382
5383 def print_build_failures():
5384 from SCons.Script import GetBuildFailures
5385 for bf in GetBuildFailures():
5386 print("%s failed: %s" % (bf.node, bf.errstr))
5387
5388 atexit.register(print_build_failures)
5389
5390 GetBuildPath(file, [...]), env.GetBuildPath(file, [...])
5391 Returns the scons path name (or names) for the specified file (or
5392 files). The specified file or files may be scons Nodes or strings
5393 representing path names.
5394
5395 GetLaunchDir(), env.GetLaunchDir()
5396 Returns the absolute path name of the directory from which scons
5397 was initially invoked. This can be useful when using the -u, -U or
5398 -D options, which internally change to the directory in which the
5399 SConstruct file is found.
5400
5401 GetOption(name), env.GetOption(name)
5402 This function provides a way to query the value of options which
5403 can be set via the command line or using the SetOption function.
5404
5405
5406 name can be an entry from the following table, which shows the
5407 corresponding command line arguments that could affect the value.
5408 name can be also be the destination variable name from a
5409 project-specific option added using the AddOption function, as long
5410 as the addition happens prior to the GetOption call in the
5411 SConscript files.
5412
5413 ┌────────────────────────┬───────────────────────────┬────────────────────┐
5414 │Query name │ Command-line │ Notes │
5415 │ │ options │ │
5416 ├────────────────────────┼───────────────────────────┼────────────────────┤
5417 │cache_debug │ --cache-debug │ │
5418 ├────────────────────────┼───────────────────────────┼────────────────────┤
5419 │cache_disable │ --cache-disable, │ │
5420 │ │ --no-cache │ │
5421 ├────────────────────────┼───────────────────────────┼────────────────────┤
5422 │cache_force │ --cache-force, │ │
5423 │ │ --cache-populate │ │
5424 ├────────────────────────┼───────────────────────────┼────────────────────┤
5425 │cache_readonly │ --cache-readonly │ │
5426 ├────────────────────────┼───────────────────────────┼────────────────────┤
5427 │cache_show │ --cache-show │ │
5428 ├────────────────────────┼───────────────────────────┼────────────────────┤
5429 │clean │ -c, │ │
5430 │ │ --clean, │ │
5431 │ │ --remove │ │
5432 ├────────────────────────┼───────────────────────────┼────────────────────┤
5433 │climb_up │ -D │ │
5434 │ │ -U │ │
5435 │ │ -u │ │
5436 │ │ --up │ │
5437 │ │ --search_up │ │
5438 ├────────────────────────┼───────────────────────────┼────────────────────┤
5439 │config │ --config │ │
5440 ├────────────────────────┼───────────────────────────┼────────────────────┤
5441 │debug │ --debug │ │
5442 ├────────────────────────┼───────────────────────────┼────────────────────┤
5443 │directory │ -C, --directory │ │
5444 ├────────────────────────┼───────────────────────────┼────────────────────┤
5445 │diskcheck │ --diskcheck │ │
5446 ├────────────────────────┼───────────────────────────┼────────────────────┤
5447 │duplicate │ --duplicate │ │
5448 ├────────────────────────┼───────────────────────────┼────────────────────┤
5449 │enable_virtualenv │ --enable-virtualenv │ │
5450 ├────────────────────────┼───────────────────────────┼────────────────────┤
5451 │experimental │ --experimental │ since 4.2 │
5452 ├────────────────────────┼───────────────────────────┼────────────────────┤
5453 │file │ -f, │ │
5454 │ │ --file, │ │
5455 │ │ --makefile, │ │
5456 │ │ --sconstruct │ │
5457 ├────────────────────────┼───────────────────────────┼────────────────────┤
5458 │hash_format │ --hash-format │ since 4.2 │
5459 ├────────────────────────┼───────────────────────────┼────────────────────┤
5460 │help │ -h, --help │ │
5461 ├────────────────────────┼───────────────────────────┼────────────────────┤
5462 │ignore_errors │ -i, --ignore-errors │ │
5463 ├────────────────────────┼───────────────────────────┼────────────────────┤
5464 │ignore_virtualenv │ --ignore-virtualenv │ │
5465 ├────────────────────────┼───────────────────────────┼────────────────────┤
5466 │implicit_cache │ --implicit-cache │ │
5467 ├────────────────────────┼───────────────────────────┼────────────────────┤
5468 │implicit_deps_changed │ --implicit-deps-changed │ │
5469 ├────────────────────────┼───────────────────────────┼────────────────────┤
5470 │implicit_deps_unchanged │ --implicit-deps-unchanged │ │
5471 ├────────────────────────┼───────────────────────────┼────────────────────┤
5472 │include_dir │ -I, --include-dir │ │
5473 ├────────────────────────┼───────────────────────────┼────────────────────┤
5474 │install_sandbox │ --install-sandbox │ Available only if │
5475 │ │ │ the install tool │
5476 │ │ │ has been called │
5477 ├────────────────────────┼───────────────────────────┼────────────────────┤
5478 │keep_going │ -k, --keep-going │ │
5479 ├────────────────────────┼───────────────────────────┼────────────────────┤
5480 │max_drift │ --max-drift │ │
5481 ├────────────────────────┼───────────────────────────┼────────────────────┤
5482 │md5_chunksize │ --hash-chunksize, │ --hash-chunksize │
5483 │ │ --md5-chunksize │ since 4.2 │
5484 ├────────────────────────┼───────────────────────────┼────────────────────┤
5485 │no_exec │ -n, │ │
5486 │ │ --no-exec, │ │
5487 │ │ --just-print, │ │
5488 │ │ --dry-run, │ │
5489 │ │ --recon │ │
5490 ├────────────────────────┼───────────────────────────┼────────────────────┤
5491 │no_progress │ -Q │ │
5492 ├────────────────────────┼───────────────────────────┼────────────────────┤
5493 │num_jobs │ -j, --jobs │ │
5494 ├────────────────────────┼───────────────────────────┼────────────────────┤
5495 │package_type │ --package-type │ Available only if │
5496 │ │ │ the packaging tool │
5497 │ │ │ has been called │
5498 ├────────────────────────┼───────────────────────────┼────────────────────┤
5499 │profile_file │ --profile │ │
5500 ├────────────────────────┼───────────────────────────┼────────────────────┤
5501 │question │ -q, --question │ │
5502 ├────────────────────────┼───────────────────────────┼────────────────────┤
5503 │random │ --random │ │
5504 ├────────────────────────┼───────────────────────────┼────────────────────┤
5505 │repository │ -Y, │ │
5506 │ │ --repository, │ │
5507 │ │ --srcdir │ │
5508 ├────────────────────────┼───────────────────────────┼────────────────────┤
5509 │silent │ -s, │ │
5510 │ │ --silent, │ │
5511 │ │ --quiet │ │
5512 ├────────────────────────┼───────────────────────────┼────────────────────┤
5513 │site_dir │ --site-dir, --no-site-dir │ │
5514 ├────────────────────────┼───────────────────────────┼────────────────────┤
5515 │stack_size │ --stack-size │ │
5516 ├────────────────────────┼───────────────────────────┼────────────────────┤
5517 │taskmastertrace_file │ --taskmastertrace │ │
5518 ├────────────────────────┼───────────────────────────┼────────────────────┤
5519 │tree_printers │ --tree │ │
5520 ├────────────────────────┼───────────────────────────┼────────────────────┤
5521 │warn │ --warn, --warning │ │
5522 └────────────────────────┴───────────────────────────┴────────────────────┘
5523 See the documentation for the corresponding command line option for
5524 information about each specific option.
5525
5526 Glob(pattern, [ondisk, source, strings, exclude]), env.Glob(pattern,
5527 [ondisk, source, strings, exclude])
5528 Returns Nodes (or strings) that match the specified pattern,
5529 relative to the directory of the current SConscript file. The
5530 evironment method form (env.Glob) performs string substition on
5531 pattern and returns whatever matches the resulting expanded
5532 pattern.
5533
5534 The specified pattern uses Unix shell style metacharacters for
5535 matching:
5536
5537 * matches everything
5538 ? matches any single character
5539 [seq] matches any character in seq
5540 [!seq] matches any char not in seq
5541
5542 If the first character of a filename is a dot, it must be matched
5543 explicitly. Character matches do not span directory separators.
5544
5545 The Glob knows about repositories (see the Repository function) and
5546 source directories (see the VariantDir function) and returns a Node
5547 (or string, if so configured) in the local (SConscript) directory
5548 if a matching Node is found anywhere in a corresponding repository
5549 or source directory.
5550
5551 The ondisk argument may be set to a value which evaluates False to
5552 disable the search for matches on disk, thereby only returning
5553 matches among already-configured File or Dir Nodes. The default
5554 behavior is to return corresponding Nodes for any on-disk matches
5555 found.
5556
5557 The source argument may be set to a value which evaluates True to
5558 specify that, when the local directory is a VariantDir, the
5559 returned Nodes should be from the corresponding source directory,
5560 not the local directory.
5561
5562 The strings argument may be set to a value which evaluates True to
5563 have the Glob function return strings, not Nodes, that represent
5564 the matched files or directories. The returned strings will be
5565 relative to the local (SConscript) directory. (Note that This may
5566 make it easier to perform arbitrary manipulation of file names, but
5567 if the returned strings are passed to a different SConscript file,
5568 any Node translation will be relative to the other SConscript
5569 directory, not the original SConscript directory.)
5570
5571 The exclude argument may be set to a pattern or a list of patterns
5572 (following the same Unix shell semantics) which must be filtered
5573 out of returned elements. Elements matching a least one pattern of
5574 this list will be excluded.
5575
5576 Examples:
5577
5578 Program("foo", Glob("*.c"))
5579 Zip("/tmp/everything", Glob(".??*") + Glob("*"))
5580 sources = Glob("*.cpp", exclude=["os_*_specific_*.cpp"]) + \
5581 Glob( "os_%s_specific_*.cpp" % currentOS)
5582
5583 Help(text, append=False), env.Help(text, append=False)
5584 Specifies a local help message to be printed if the -h argument is
5585 given to scons. Subsequent calls to Help append text to the
5586 previously defined local help text.
5587
5588 For the first call to Help only, if append is False (the default)
5589 any local help message generated through AddOption calls is
5590 replaced. If append is True, text is appended to the existing help
5591 text.
5592
5593 Ignore(target, dependency), env.Ignore(target, dependency)
5594 The specified dependency file(s) will be ignored when deciding if
5595 the target file(s) need to be rebuilt.
5596
5597 You can also use Ignore to remove a target from the default build.
5598 In order to do this you must specify the directory the target will
5599 be built in as the target, and the file you want to skip building
5600 as the dependency.
5601
5602 Note that this will only remove the dependencies listed from the
5603 files built by default. It will still be built if that dependency
5604 is needed by another object being built. See the third and forth
5605 examples below.
5606
5607 Examples:
5608
5609 env.Ignore('foo', 'foo.c')
5610 env.Ignore('bar', ['bar1.h', 'bar2.h'])
5611 env.Ignore('.', 'foobar.obj')
5612 env.Ignore('bar', 'bar/foobar.obj')
5613
5614 Import(vars...), env.Import(vars...)
5615 Imports variables into the current SConscript file. vars must be
5616 strings representing names of variables which have been previously
5617 exported either by the Export function or by the exports argument
5618 to SConscript. Variables exported by SConscript take precedence.
5619 Multiple variable names can be passed to Import as separate
5620 arguments or as words in a space-separated string. The wildcard "*"
5621 can be used to import all available variables.
5622
5623 Examples:
5624
5625 Import("env")
5626 Import("env", "variable")
5627 Import(["env", "variable"])
5628 Import("*")
5629
5630 Literal(string), env.Literal(string)
5631 The specified string will be preserved as-is and not have
5632 construction variables expanded.
5633
5634 Local(targets), env.Local(targets)
5635 The specified targets will have copies made in the local tree, even
5636 if an already up-to-date copy exists in a repository. Returns a
5637 list of the target Node or Nodes.
5638
5639 env.MergeFlags(arg, [unique])
5640 Merges values from arg into construction variables in the current
5641 construction environment. If arg is not a dictionary, it is
5642 converted to one by calling env.ParseFlags on the argument before
5643 the values are merged. Note that arg must be a single value, so
5644 multiple strings must be passed in as a list, not as separate
5645 arguments to env.MergeFlags.
5646
5647 By default, duplicate values are eliminated; you can, however,
5648 specify unique=False to allow duplicate values to be added. When
5649 eliminating duplicate values, any construction variables that end
5650 with the string PATH keep the left-most unique value. All other
5651 construction variables keep the right-most unique value.
5652
5653 Examples:
5654
5655 # Add an optimization flag to $CCFLAGS.
5656 env.MergeFlags('-O3')
5657
5658 # Combine the flags returned from running pkg-config with an optimization
5659 # flag and merge the result into the construction variables.
5660 env.MergeFlags(['!pkg-config gtk+-2.0 --cflags', '-O3'])
5661
5662 # Combine an optimization flag with the flags returned from running pkg-config
5663 # twice and merge the result into the construction variables.
5664 env.MergeFlags(['-O3',
5665 '!pkg-config gtk+-2.0 --cflags --libs',
5666 '!pkg-config libpng12 --cflags --libs'])
5667
5668 NoCache(target, ...), env.NoCache(target, ...)
5669 Specifies a list of files which should not be cached whenever the
5670 CacheDir method has been activated. The specified targets may be a
5671 list or an individual target.
5672
5673 Multiple files should be specified either as separate arguments to
5674 the NoCache method, or as a list. NoCache will also accept the
5675 return value of any of the construction environment Builder
5676 methods.
5677
5678 Calling NoCache on directories and other non-File Node types has no
5679 effect because only File Nodes are cached.
5680
5681 Examples:
5682
5683 NoCache('foo.elf')
5684 NoCache(env.Program('hello', 'hello.c'))
5685
5686 NoClean(target, ...), env.NoClean(target, ...)
5687 Specifies a list of files or directories which should not be
5688 removed whenever the targets (or their dependencies) are specified
5689 with the -c command line option. The specified targets may be a
5690 list or an individual target. Multiple calls to NoClean are legal,
5691 and prevent each specified target from being removed by calls to
5692 the -c option.
5693
5694 Multiple files or directories should be specified either as
5695 separate arguments to the NoClean method, or as a list. NoClean
5696 will also accept the return value of any of the construction
5697 environment Builder methods.
5698
5699 Calling NoClean for a target overrides calling Clean for the same
5700 target, and any targets passed to both functions will not be
5701 removed by the -c option.
5702
5703 Examples:
5704
5705 NoClean('foo.elf')
5706 NoClean(env.Program('hello', 'hello.c'))
5707
5708 env.ParseConfig(command, [function, unique])
5709 Updates the current construction environment with the values
5710 extracted from the output from running external command, by calling
5711 a helper function function which understands the output of command.
5712 command may be a string or a list of strings representing the
5713 command and its arguments. If function is not given, env.MergeFlags
5714 is used. By default, duplicate values are not added to any
5715 construction variables; you can specify unique=False to allow
5716 duplicate values to be added.
5717
5718 If env.MergeFlags is used, it expects a response in the style of a
5719 *-config command typical of the POSIX programming environment (for
5720 example, gtk-config) and adds the options to the appropriate
5721 construction variables. Interpreted options and the construction
5722 variables they affect are as specified for the env.ParseFlags
5723 method (which env.MergeFlags calls). See that method's description
5724 for a table of options and corresponding construction variables.
5725
5726 If env.MergeFlags cannot interpret the results of command, you can
5727 suppply a custom function to do so. function must accept three
5728 arguments: the construction environment to modify, the string
5729 returned by running command, and the optional unique flag.
5730
5731 ParseDepends(filename, [must_exist, only_one]),
5732 env.ParseDepends(filename, [must_exist, only_one])
5733 Parses the contents of the specified filename as a list of
5734 dependencies in the style of Make or mkdep, and explicitly
5735 establishes all of the listed dependencies.
5736
5737 By default, it is not an error if the specified filename does not
5738 exist. The optional must_exist argument may be set to a non-zero
5739 value to have scons throw an exception and generate an error if the
5740 file does not exist, or is otherwise inaccessible.
5741
5742 The optional only_one argument may be set to a non-zero value to
5743 have scons thrown an exception and generate an error if the file
5744 contains dependency information for more than one target. This can
5745 provide a small sanity check for files intended to be generated by,
5746 for example, the gcc -M flag, which should typically only write
5747 dependency information for one output file into a corresponding .d
5748 file.
5749
5750 The filename and all of the files listed therein will be
5751 interpreted relative to the directory of the SConscript file which
5752 calls the ParseDepends function.
5753
5754 env.ParseFlags(flags, ...)
5755 Parses one or more strings containing typical command-line flags
5756 for GCC tool chains and returns a dictionary with the flag values
5757 separated into the appropriate SCons construction variables. This
5758 is intended as a companion to the env.MergeFlags method, but allows
5759 for the values in the returned dictionary to be modified, if
5760 necessary, before merging them into the construction environment.
5761 (Note that env.MergeFlags will call this method if its argument is
5762 not a dictionary, so it is usually not necessary to call
5763 env.ParseFlags directly unless you want to manipulate the values.)
5764
5765 If the first character in any string is an exclamation mark (!),
5766 the rest of the string is executed as a command, and the output
5767 from the command is parsed as GCC tool chain command-line flags and
5768 added to the resulting dictionary.
5769
5770 Flag values are translated accordig to the prefix found, and added
5771 to the following construction variables:
5772
5773 -arch CCFLAGS, LINKFLAGS
5774 -D CPPDEFINES
5775 -framework FRAMEWORKS
5776 -frameworkdir= FRAMEWORKPATH
5777 -fmerge-all-constants CCFLAGS, LINKFLAGS
5778 -fopenmp CCFLAGS, LINKFLAGS
5779 -include CCFLAGS
5780 -imacros CCFLAGS
5781 -isysroot CCFLAGS, LINKFLAGS
5782 -isystem CCFLAGS
5783 -iquote CCFLAGS
5784 -idirafter CCFLAGS
5785 -I CPPPATH
5786 -l LIBS
5787 -L LIBPATH
5788 -mno-cygwin CCFLAGS, LINKFLAGS
5789 -mwindows LINKFLAGS
5790 -openmp CCFLAGS, LINKFLAGS
5791 -pthread CCFLAGS, LINKFLAGS
5792 -std= CFLAGS
5793 -Wa, ASFLAGS, CCFLAGS
5794 -Wl,-rpath= RPATH
5795 -Wl,-R, RPATH
5796 -Wl,-R RPATH
5797 -Wl, LINKFLAGS
5798 -Wp, CPPFLAGS
5799 - CCFLAGS
5800 + CCFLAGS, LINKFLAGS
5801
5802 Any other strings not associated with options are assumed to be the
5803 names of libraries and added to the $LIBS construction variable.
5804
5805 Examples (all of which produce the same result):
5806
5807 dict = env.ParseFlags('-O2 -Dfoo -Dbar=1')
5808 dict = env.ParseFlags('-O2', '-Dfoo', '-Dbar=1')
5809 dict = env.ParseFlags(['-O2', '-Dfoo -Dbar=1'])
5810 dict = env.ParseFlags('-O2', '!echo -Dfoo -Dbar=1')
5811
5812 Platform(string)
5813 The Platform form returns a callable object that can be used to
5814 initialize a construction environment using the platform keyword of
5815 the Environment function.
5816
5817 Example:
5818
5819 env = Environment(platform=Platform('win32'))
5820
5821 The env.Platform form applies the callable object for the specified
5822 platform string to the environment through which the method was
5823 called.
5824
5825 env.Platform('posix')
5826
5827 Note that the win32 platform adds the SystemDrive and SystemRoot
5828 variables from the user's external environment to the construction
5829 environment's $ENV dictionary. This is so that any executed
5830 commands that use sockets to connect with other systems (such as
5831 fetching source files from external CVS repository specifications
5832 like :pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons) will
5833 work on Windows systems.
5834
5835 Precious(target, ...), env.Precious(target, ...)
5836 Marks each given target as precious so it is not deleted before it
5837 is rebuilt. Normally scons deletes a target before building it.
5838 Multiple targets can be passed in to a single call to Precious.
5839
5840 env.Prepend(key=val, [...])
5841 Prepend values to construction variables in the current
5842 construction environment, Works like env.Append (see for details),
5843 except that values are added to the front, rather than the end, of
5844 any existing value of the construction variable
5845
5846 Example:
5847
5848 env.Prepend(CCFLAGS='-g ', FOO=['foo.yyy'])
5849
5850 See also env.Append, env.AppendUnique and env.PrependUnique.
5851
5852 env.PrependENVPath(name, newpath, [envname, sep, delete_existing])
5853 Prepend new path elements to the given path in the specified
5854 external environment ($ENV by default). This will only add any
5855 particular path once (leaving the first one it encounters and
5856 ignoring the rest, to preserve path order), and to help assure
5857 this, will normalize all paths (using os.path.normpath and
5858 os.path.normcase). This can also handle the case where the given
5859 old path variable is a list instead of a string, in which case a
5860 list will be returned instead of a string.
5861
5862 If delete_existing is False, then adding a path that already exists
5863 will not move it to the beginning; it will stay where it is in the
5864 list.
5865
5866 Example:
5867
5868 print('before:', env['ENV']['INCLUDE'])
5869 include_path = '/foo/bar:/foo'
5870 env.PrependENVPath('INCLUDE', include_path)
5871 print('after:', env['ENV']['INCLUDE'])
5872
5873 Yields:
5874
5875 before: /biz:/foo
5876 after: /foo/bar:/foo:/biz
5877
5878 env.PrependUnique(key=val, delete_existing=False, [...])
5879 Prepend values to construction variables in the current
5880 construction environment, maintaining uniqueness. Works like
5881 env.Append (see for details), except that values are added to the
5882 front, rather than the end, of any existing value of the the
5883 construction variable, and values already present in the
5884 construction variable will not be added again. If delete_existing
5885 is True, the existing matching value is first removed, and the
5886 requested value is inserted, having the effect of moving such
5887 values to the front.
5888
5889 Example:
5890
5891 env.PrependUnique(CCFLAGS='-g', FOO=['foo.yyy'])
5892
5893 See also env.Append, env.AppendUnique and env.Prepend.
5894
5895 Progress(callable, [interval]), Progress(string, [interval, file,
5896 overwrite]), Progress(list_of_strings, [interval, file, overwrite])
5897 Allows SCons to show progress made during the build by displaying a
5898 string or calling a function while evaluating Nodes (e.g. files).
5899
5900 If the first specified argument is a Python callable (a function or
5901 an object that has a __call__ method), the function will be called
5902 once every interval times a Node is evaluated (default 1). The
5903 callable will be passed the evaluated Node as its only argument.
5904 (For future compatibility, it's a good idea to also add *args and
5905 **kwargs as arguments to your function or method signatures. This
5906 will prevent the code from breaking if SCons ever changes the
5907 interface to call the function with additional arguments in the
5908 future.)
5909
5910 An example of a simple custom progress function that prints a
5911 string containing the Node name every 10 Nodes:
5912
5913 def my_progress_function(node, *args, **kwargs):
5914 print('Evaluating node %s!' % node)
5915 Progress(my_progress_function, interval=10)
5916
5917 A more complicated example of a custom progress display object that
5918 prints a string containing a count every 100 evaluated Nodes. Note
5919 the use of \r (a carriage return) at the end so that the string
5920 will overwrite itself on a display:
5921
5922 import sys
5923 class ProgressCounter(object):
5924 count = 0
5925 def __call__(self, node, *args, **kw):
5926 self.count += 100
5927 sys.stderr.write('Evaluated %s nodes\r' % self.count)
5928
5929 Progress(ProgressCounter(), interval=100)
5930
5931 If the first argument to Progress is a string or list of strings,
5932 it is taken as text to be displayed every interval evaluated Nodes.
5933 If the first argument is a list of strings, then each string in the
5934 list will be displayed in rotating fashion every interval evaluated
5935 Nodes.
5936
5937 The default is to print the string on standard output. An alternate
5938 output stream may be specified with the file keyword argument,
5939 which the caller must pass already opened.
5940
5941 The following will print a series of dots on the error output, one
5942 dot for every 100 evaluated Nodes:
5943
5944 import sys
5945 Progress('.', interval=100, file=sys.stderr)
5946
5947 If the string contains the verbatim substring $TARGET;, it will be
5948 replaced with the Node. Note that, for performance reasons, this is
5949 not a regular SCons variable substition, so you can not use other
5950 variables or use curly braces. The following example will print the
5951 name of every evaluated Node, using a carriage return) (\r) to
5952 cause each line to overwritten by the next line, and the overwrite
5953 keyword argument (default False) to make sure the
5954 previously-printed file name is overwritten with blank spaces:
5955
5956 import sys
5957 Progress('$TARGET\r', overwrite=True)
5958
5959 A list of strings can be used to implement a "spinner" on the
5960 user's screen as follows, changing every five evaluated Nodes:
5961
5962 Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5)
5963
5964 Pseudo(target, ...), env.Pseudo(target, ...)
5965 This indicates that each given target should not be created by the
5966 build rule, and if the target is created, an error will be
5967 generated. This is similar to the gnu make .PHONY target. However,
5968 in the vast majority of cases, an Alias is more appropriate.
5969 Multiple targets can be passed in to a single call to Pseudo.
5970
5971 PyPackageDir(modulename), env.PyPackageDir(modulename)
5972 This returns a Directory Node similar to Dir. The python module /
5973 package is looked up and if located the directory is returned for
5974 the location. modulename Is a named python package / module to
5975 lookup the directory for it's location.
5976
5977 If modulename is a list, SCons returns a list of Dir nodes.
5978 Construction variables are expanded in modulename.
5979
5980 env.Replace(key=val, [...])
5981 Replaces construction variables in the Environment with the
5982 specified keyword arguments.
5983
5984 Example:
5985
5986 env.Replace(CCFLAGS='-g', FOO='foo.xxx')
5987
5988 Repository(directory), env.Repository(directory)
5989 Specifies that directory is a repository to be searched for files.
5990 Multiple calls to Repository are legal, and each one adds to the
5991 list of repositories that will be searched.
5992
5993 To scons, a repository is a copy of the source tree, from the
5994 top-level directory on down, which may contain both source files
5995 and derived files that can be used to build targets in the local
5996 source tree. The canonical example would be an official source tree
5997 maintained by an integrator. If the repository contains derived
5998 files, then the derived files should have been built using scons,
5999 so that the repository contains the necessary signature information
6000 to allow scons to figure out when it is appropriate to use the
6001 repository copy of a derived file, instead of building one locally.
6002
6003 Note that if an up-to-date derived file already exists in a
6004 repository, scons will not make a copy in the local directory tree.
6005 In order to guarantee that a local copy will be made, use the Local
6006 method.
6007
6008 Requires(target, prerequisite), env.Requires(target, prerequisite)
6009 Specifies an order-only relationship between the specified target
6010 file(s) and the specified prerequisite file(s). The prerequisite
6011 file(s) will be (re)built, if necessary, before the target file(s),
6012 but the target file(s) do not actually depend on the prerequisites
6013 and will not be rebuilt simply because the prerequisite file(s)
6014 change.
6015
6016 Example:
6017
6018 env.Requires('foo', 'file-that-must-be-built-before-foo')
6019
6020 Return([vars..., stop=True])
6021 Return to the calling SConscript, optionally returning the values
6022 of variables named in vars. Multiple strings contaning variable
6023 names may be passed to Return. A string containing white space is
6024 split into individual variable names. Returns the value if one
6025 variable is specified, else returns a tuple of values. Returns an
6026 empty tuple if vars is omitted.
6027
6028 By default Return stops processing the current SConscript and
6029 returns immediately. The optional stop keyword argument may be set
6030 to a false value to continue processing the rest of the SConscript
6031 file after the Return call (this was the default behavior prior to
6032 SCons 0.98.) However, the values returned are still the values of
6033 the variables in the named vars at the point Return was called.
6034
6035 Examples:
6036
6037 # Returns no values (evaluates False)
6038 Return()
6039
6040 # Returns the value of the 'foo' Python variable.
6041 Return("foo")
6042
6043 # Returns the values of the Python variables 'foo' and 'bar'.
6044 Return("foo", "bar")
6045
6046 # Returns the values of Python variables 'val1' and 'val2'.
6047 Return('val1 val2')
6048
6049 Scanner(function, [name, argument, skeys, path_function, node_class,
6050 node_factory, scan_check, recursive]), env.Scanner(function, [name,
6051 argument, skeys, path_function, node_class, node_factory, scan_check,
6052 recursive])
6053 Creates a Scanner object for the specified function. See manpage
6054 section "Scanner Objects" for a complete explanation of the
6055 arguments and behavior.
6056
6057 SConscript(scripts, [exports, variant_dir, duplicate, must_exist]),
6058 env.SConscript(scripts, [exports, variant_dir, duplicate, must_exist]),
6059 SConscript(dirs=subdirs, [name=script, exports, variant_dir, duplicate,
6060 must_exist]), env.SConscript(dirs=subdirs, [name=script, exports,
6061 variant_dir, duplicate, must_exist])
6062 Execute one or more subsidiary SConscript (configuration) files.
6063 There are two ways to call the SConscript function.
6064
6065 The first calling style is to explicitly specify one or more
6066 scripts as the first argument. A single script may be specified as
6067 a string; multiple scripts must be specified as a list (either
6068 explicitly or as created by a function like Split). Examples:
6069
6070 SConscript('SConscript') # run SConscript in the current directory
6071 SConscript('src/SConscript') # run SConscript in the src directory
6072 SConscript(['src/SConscript', 'doc/SConscript'])
6073 config = SConscript('MyConfig.py')
6074
6075 The second way to call SConscript is to specify a list of
6076 (sub)directory names as a dirs=subdirs keyword argument. In this
6077 case, scons will execute a subsidiary configuration file named
6078 SConscript in each of the specified directories. You may specify a
6079 name other than SConscript by supplying an optional name=script
6080 keyword argument. The first three examples below have the same
6081 effect as the first three examples above:
6082
6083 SConscript(dirs='.') # run SConscript in the current directory
6084 SConscript(dirs='src') # run SConscript in the src directory
6085 SConscript(dirs=['src', 'doc'])
6086 SConscript(dirs=['sub1', 'sub2'], name='MySConscript')
6087
6088 The optional exports argument provides a string or list of strings
6089 representing variable names, or a dictionary of named values, to
6090 export. These variables are locally exported only to the called
6091 SConscript file(s) and do not affect the global pool of variables
6092 managed by the Export function. The subsidiary SConscript files
6093 must use the Import function to import the variables. Examples:
6094
6095 foo = SConscript('sub/SConscript', exports='env')
6096 SConscript('dir/SConscript', exports=['env', 'variable'])
6097 SConscript(dirs='subdir', exports='env variable')
6098 SConscript(dirs=['one', 'two', 'three'], exports='shared_info')
6099
6100 If the optional variant_dir argument is present, it causes an
6101 effect equivalent to the VariantDir function. The variant_dir
6102 argument is interpreted relative to the directory of the calling
6103 SConscript file. The optional duplicate argument is interpreted as
6104 for VariantDir. If variant_dir is omitted, the duplicate argument
6105 is ignored. See the description of VariantDir below for additional
6106 details and restrictions.
6107
6108 If variant_dir is present, the source directory is the directory in
6109 which the SConscript file resides and the SConscript file is
6110 evaluated as if it were in the variant_dir directory:
6111
6112 SConscript('src/SConscript', variant_dir='build')
6113
6114 is equivalent to
6115
6116 VariantDir('build', 'src')
6117 SConscript('build/SConscript')
6118
6119 This later paradigm is often used when the sources are in the same
6120 directory as the SConstruct:
6121
6122 SConscript('SConscript', variant_dir='build')
6123
6124 is equivalent to
6125
6126 VariantDir('build', '.')
6127 SConscript('build/SConscript')
6128
6129
6130
6131 If the optional must_exist is True, causes an exception to be
6132 raised if a requested SConscript file is not found. The current
6133 default is False, causing only a warning to be emitted, but this
6134 default is deprecated (since 3.1). For scripts which truly intend
6135 to be optional, transition to explicitly supplying must_exist=False
6136 to the SConscript call.
6137
6138 Here are some composite examples:
6139
6140 # collect the configuration information and use it to build src and doc
6141 shared_info = SConscript('MyConfig.py')
6142 SConscript('src/SConscript', exports='shared_info')
6143 SConscript('doc/SConscript', exports='shared_info')
6144
6145 # build debugging and production versions. SConscript
6146 # can use Dir('.').path to determine variant.
6147 SConscript('SConscript', variant_dir='debug', duplicate=0)
6148 SConscript('SConscript', variant_dir='prod', duplicate=0)
6149
6150 # build debugging and production versions. SConscript
6151 # is passed flags to use.
6152 opts = { 'CPPDEFINES' : ['DEBUG'], 'CCFLAGS' : '-pgdb' }
6153 SConscript('SConscript', variant_dir='debug', duplicate=0, exports=opts)
6154 opts = { 'CPPDEFINES' : ['NODEBUG'], 'CCFLAGS' : '-O' }
6155 SConscript('SConscript', variant_dir='prod', duplicate=0, exports=opts)
6156
6157 # build common documentation and compile for different architectures
6158 SConscript('doc/SConscript', variant_dir='build/doc', duplicate=0)
6159 SConscript('src/SConscript', variant_dir='build/x86', duplicate=0)
6160 SConscript('src/SConscript', variant_dir='build/ppc', duplicate=0)
6161
6162
6163 SConscript returns the values of any variables named by the
6164 executed SConscript(s) in arguments to the Return function (see
6165 above for details). If a single SConscript call causes multiple
6166 scripts to be executed, the return value is a tuple containing the
6167 returns of all of the scripts. If an executed script does not
6168 explicitly call Return, it returns None.
6169
6170 SConscriptChdir(value), env.SConscriptChdir(value)
6171 By default, scons changes its working directory to the directory in
6172 which each subsidiary SConscript file lives. This behavior may be
6173 disabled by specifying either:
6174
6175 SConscriptChdir(0)
6176 env.SConscriptChdir(0)
6177
6178 in which case scons will stay in the top-level directory while
6179 reading all SConscript files. (This may be necessary when building
6180 from repositories, when all the directories in which SConscript
6181 files may be found don't necessarily exist locally.) You may enable
6182 and disable this ability by calling SConscriptChdir() multiple
6183 times.
6184
6185 Example:
6186
6187 env = Environment()
6188 SConscriptChdir(0)
6189 SConscript('foo/SConscript') # will not chdir to foo
6190 env.SConscriptChdir(1)
6191 SConscript('bar/SConscript') # will chdir to bar
6192
6193 SConsignFile([name, dbm_module]), env.SConsignFile([name, dbm_module])
6194 Specify where to store the SCons file signature database, and which
6195 database format to use. This may be useful to specify alternate
6196 database files and/or file locations for different types of builds.
6197
6198 The optional name argument is the base name of the database
6199 file(s). If not an absolute path name, these are placed relative to
6200 the directory containing the top-level SConstruct file. The default
6201 is .sconsign. The actual database file(s) stored on disk may have
6202 an appropriate suffix appended by the chosen dbm_module
6203
6204 The optional dbm_module argument specifies which Python database
6205 module to use for reading/writing the file. The module must be
6206 imported first; then the imported module name is passed as the
6207 argument. The default is a custom SCons.dblite module that uses
6208 pickled Python data structures, which works on all Python versions.
6209 See documentation of the Python dbm module for other available
6210 types.
6211
6212 If called with no arguments, the database will default to
6213 .sconsign.dblite in the top directory of the project, which is also
6214 the default if if SConsignFile is not called.
6215
6216 The setting is global, so the only difference between the global
6217 function and the environment method form is variable expansion on
6218 name. There should only be one active call to this function/method
6219 in a given build setup.
6220
6221 If name is set to None, scons will store file signatures in a
6222 separate .sconsign file in each directory, not in a single combined
6223 database file. This is a backwards-compatibility meaure to support
6224 what was the default behavior prior to SCons 0.97 (i.e. before
6225 2008). Use of this mode is discouraged and may be deprecated in a
6226 future SCons release.
6227
6228 Examples:
6229
6230 # Explicitly stores signatures in ".sconsign.dblite"
6231 # in the top-level SConstruct directory (the default behavior).
6232 SConsignFile()
6233
6234 # Stores signatures in the file "etc/scons-signatures"
6235 # relative to the top-level SConstruct directory.
6236 # SCons will add a database suffix to this name.
6237 SConsignFile("etc/scons-signatures")
6238
6239 # Stores signatures in the specified absolute file name.
6240 # SCons will add a database suffix to this name.
6241 SConsignFile("/home/me/SCons/signatures")
6242
6243 # Stores signatures in a separate .sconsign file
6244 # in each directory.
6245 SConsignFile(None)
6246
6247 # Stores signatures in a GNU dbm format .sconsign file
6248 import dbm.gnu
6249 SConsignFile(dbm_module=dbm.gnu)
6250
6251 env.SetDefault(key=val, [...])
6252 Sets construction variables to default values specified with the
6253 keyword arguments if (and only if) the variables are not already
6254 set. The following statements are equivalent:
6255
6256 env.SetDefault(FOO='foo')
6257 if 'FOO' not in env:
6258 env['FOO'] = 'foo'
6259
6260 SetOption(name, value), env.SetOption(name, value)
6261 Sets scons option variable name to value. These options are all
6262 also settable via command-line options but the variable name may
6263 differ from the command-line option name - see the table for
6264 correspondences. A value set via command-line option will take
6265 precedence over one set with SetOption, which allows setting a
6266 project default in the scripts and temporarily overriding it via
6267 command line. SetOption calls can also be placed in the
6268 site_init.py file.
6269
6270 See the documentation in the manpage for the corresponding command
6271 line option for information about each specific option. The value
6272 parameter is mandatory, for option values which are boolean in
6273 nature (that is, the command line option does not take an argument)
6274 use a value which evaluates to true (e.g. True, 1) or false (e.g.
6275 False, 0).
6276
6277 Options which affect the reading and processing of SConscript files
6278 are not settable using SetOption since those files must be read in
6279 order to find the SetOption call in the first place.
6280
6281 The settable variables with their associated command-line options
6282 are:
6283
6284 ┌────────────────────────┬───────────────────────────┬─────────────────────┐
6285 │Settable name │ Command-line │ Notes │
6286 │ │ options │ │
6287 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6288 │clean │ -c, │ │
6289 │ │ --clean, │ │
6290 │ │ --remove │ │
6291 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6292 │diskcheck │ --diskcheck │ │
6293 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6294 │duplicate │ --duplicate │ │
6295 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6296 │experimental │ --experimental │ since 4.2 │
6297 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6298 │hash_chunksize │ --hash-chunksize │ Actually sets │
6299 │ │ │ md5_chunksize. │
6300 │ │ │ since 4.2 │
6301 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6302 │hash_format │ --hash-format │ since 4.2 │
6303 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6304 │help │ -h, --help │ │
6305 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6306 │implicit_cache │ --implicit-cache │ │
6307 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6308 │implicit_deps_changed │ --implicit-deps-changed │ Also sets │
6309 │ │ │ implicit_cache. │
6310 │ │ │ (settable since │
6311 │ │ │ 4.2) │
6312 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6313 │implicit_deps_unchanged │ --implicit-deps-unchanged │ Also sets │
6314 │ │ │ implicit_cache. │
6315 │ │ │ (settable since │
6316 │ │ │ 4.2) │
6317 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6318 │max_drift │ --max-drift │ │
6319 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6320 │md5_chunksize │ --md5-chunksize │ │
6321 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6322 │no_exec │ -n, │ │
6323 │ │ --no-exec, │ │
6324 │ │ --just-print, │ │
6325 │ │ --dry-run, │ │
6326 │ │ --recon │ │
6327 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6328 │no_progress │ -Q │ See │
6329 │ │ │ [3] │
6330 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6331 │num_jobs │ -j, --jobs │ │
6332 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6333 │random │ --random │ │
6334 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6335 │silent │ -s, │ │
6336 │ │ --silent, │ │
6337 │ │ --quiet │ │
6338 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6339 │stack_size │ --stack-size │ │
6340 ├────────────────────────┼───────────────────────────┼─────────────────────┤
6341 │warn │ --warn │ │
6342 ├────────────────────────┴───────────────────────────┴─────────────────────┤
6343 │---- │
6344 │[a] If no_progress is set via SetOption in an SConscript │
6345 │file (but not if set in a site_init.py file) there will │
6346 │still be an initial status message about reading │
6347 │SConscript files since SCons has to start reading them │
6348 │before it can see the SetOption. │
6349 └──────────────────────────────────────────────────────────────────────────┘
6350 Example:
6351
6352 SetOption('max_drift', 0)
6353
6354 SideEffect(side_effect, target), env.SideEffect(side_effect, target)
6355 Declares side_effect as a side effect of building target. Both
6356 side_effect and target can be a list, a file name, or a node. A
6357 side effect is a target file that is created or updated as a side
6358 effect of building other targets. For example, a Windows PDB file
6359 is created as a side effect of building the .obj files for a static
6360 library, and various log files are created updated as side effects
6361 of various TeX commands. If a target is a side effect of multiple
6362 build commands, scons will ensure that only one set of commands is
6363 executed at a time. Consequently, you only need to use this method
6364 for side-effect targets that are built as a result of multiple
6365 build commands.
6366
6367 Because multiple build commands may update the same side effect
6368 file, by default the side_effect target is not automatically
6369 removed when the target is removed by the -c option. (Note,
6370 however, that the side_effect might be removed as part of cleaning
6371 the directory in which it lives.) If you want to make sure the
6372 side_effect is cleaned whenever a specific target is cleaned, you
6373 must specify this explicitly with the Clean or env.Clean function.
6374
6375 This function returns the list of side effect Node objects that
6376 were successfully added. If the list of side effects contained any
6377 side effects that had already been added, they are not added and
6378 included in the returned list.
6379
6380 Split(arg), env.Split(arg)
6381 Returns a list of file names or other objects. If arg is a string,
6382 it will be split on strings of white-space characters within the
6383 string, making it easier to write long lists of file names. If arg
6384 is already a list, the list will be returned untouched. If arg is
6385 any other type of object, it will be returned as a list containing
6386 just the object.
6387
6388 Example:
6389
6390 files = Split("f1.c f2.c f3.c")
6391 files = env.Split("f4.c f5.c f6.c")
6392 files = Split("""
6393 f7.c
6394 f8.c
6395 f9.c
6396 """)
6397
6398 env.subst(input, [raw, target, source, conv])
6399 Performs construction variable interpolation on the specified
6400 string or sequence argument input.
6401
6402 By default, leading or trailing white space will be removed from
6403 the result. and all sequences of white space will be compressed to
6404 a single space character. Additionally, any $( and $) character
6405 sequences will be stripped from the returned string, The optional
6406 raw argument may be set to 1 if you want to preserve white space
6407 and $(-$) sequences. The raw argument may be set to 2 if you want
6408 to strip all characters between any $( and $) pairs (as is done for
6409 signature calculation).
6410
6411 If the input is a sequence (list or tuple), the individual elements
6412 of the sequence will be expanded, and the results will be returned
6413 as a list.
6414
6415 The optional target and source keyword arguments must be set to
6416 lists of target and source nodes, respectively, if you want the
6417 $TARGET, $TARGETS, $SOURCE and $SOURCES to be available for
6418 expansion. This is usually necessary if you are calling env.subst
6419 from within a Python function used as an SCons action.
6420
6421 Returned string values or sequence elements are converted to their
6422 string representation by default. The optional conv argument may
6423 specify a conversion function that will be used in place of the
6424 default. For example, if you want Python objects (including SCons
6425 Nodes) to be returned as Python objects, you can use the Python Λ
6426 idiom to pass in an unnamed function that simply returns its
6427 unconverted argument.
6428
6429 Example:
6430
6431 print(env.subst("The C compiler is: $CC"))
6432
6433 def compile(target, source, env):
6434 sourceDir = env.subst(
6435 "${SOURCE.srcdir}",
6436 target=target,
6437 source=source
6438 )
6439
6440 source_nodes = env.subst('$EXPAND_TO_NODELIST', conv=lambda x: x)
6441
6442 Tag(node, tags)
6443 Annotates file or directory Nodes with information about how the
6444 Package Builder should package those files or directories. All
6445 Node-level tags are optional.
6446
6447 Examples:
6448
6449 # makes sure the built library will be installed with 644 file access mode
6450 Tag(Library('lib.c'), UNIX_ATTR="0o644")
6451
6452 # marks file2.txt to be a documentation file
6453 Tag('file2.txt', DOC)
6454
6455 Tool(name, [toolpath, **kwargs]), env.Tool(name, [toolpath, **kwargs])
6456 Locates the tool specification module name and returns a callable
6457 tool object for that tool. The tool module is searched for in
6458 standard locations and in any paths specified by the optional
6459 toolpath parameter. The standard locations are SCons' own internal
6460 path for tools plus the toolpath, if any (see the Tools section in
6461 the manual page for more details). Any additional keyword arguments
6462 kwargs are passed to the tool module's generate function during
6463 tool object construction.
6464
6465 When called, the tool object updates a construction environment
6466 with construction variables and arranges any other initialization
6467 needed to use the mechanisms that tool describes.
6468
6469 When the env.Tool form is used, the tool object is automatically
6470 called to update env and the value of tool is appended to the
6471 $TOOLS construction variable in that environment.
6472
6473 Examples:
6474
6475 env.Tool('gcc')
6476 env.Tool('opengl', toolpath=['build/tools'])
6477
6478 When the global function Tool form is used, the tool object is
6479 constructed but not called, as it lacks the context of an
6480 environment to update. The tool object can be passed to an
6481 Environment or Clone call as part of the tools keyword argument, in
6482 which case the tool is applied to the environment being
6483 constructed, or it can be called directly, in which case a
6484 construction environment to update must be passed as the argument.
6485 Either approach will also update the $TOOLS construction variable.
6486
6487 Examples:
6488
6489 env = Environment(tools=[Tool('msvc')])
6490
6491 env = Environment()
6492 msvctool = Tool('msvc')
6493 msvctool(env) # adds 'msvc' to the TOOLS variable
6494 gltool = Tool('opengl', toolpath = ['tools'])
6495 gltool(env) # adds 'opengl' to the TOOLS variable
6496
6497
6498 Changed in SCons 4.2: env.Tool now returns the tool object,
6499 previously it did not return (i.e. returned None).
6500
6501 Value(value, [built_value], [name]), env.Value(value, [built_value],
6502 [name])
6503 Returns a Node object representing the specified Python value.
6504 Value Nodes can be used as dependencies of targets. If the result
6505 of calling str(value) changes between SCons runs, any targets
6506 depending on Value(value) will be rebuilt. (This is true even when
6507 using timestamps to decide if files are up-to-date.) When using
6508 timestamp source signatures, Value Nodes' timestamps are equal to
6509 the system time when the Node is created. name can be provided as
6510 an alternative name for the resulting Value node; this is advised
6511 if the value parameter can't be converted to a string.
6512
6513 The returned Value Node object has a write() method that can be
6514 used to "build" a Value Node by setting a new value. The optional
6515 built_value argument can be specified when the Value Node is
6516 created to indicate the Node should already be considered "built."
6517 There is a corresponding read() method that will return the built
6518 value of the Node.
6519
6520 Examples:
6521
6522 env = Environment()
6523
6524 def create(target, source, env):
6525 # A function that will write a 'prefix=$SOURCE'
6526 # string into the file name specified as the
6527 # $TARGET.
6528 with open(str(target[0]), 'wb') as f:
6529 f.write('prefix=' + source[0].get_contents())
6530
6531 # Fetch the prefix= argument, if any, from the command
6532 # line, and use /usr/local as the default.
6533 prefix = ARGUMENTS.get('prefix', '/usr/local')
6534
6535 # Attach a .Config() builder for the above function action
6536 # to the construction environment.
6537 env['BUILDERS']['Config'] = Builder(action = create)
6538 env.Config(target = 'package-config', source = Value(prefix))
6539
6540 def build_value(target, source, env):
6541 # A function that "builds" a Python Value by updating
6542 # the the Python value with the contents of the file
6543 # specified as the source of the Builder call ($SOURCE).
6544 target[0].write(source[0].get_contents())
6545
6546 output = env.Value('before')
6547 input = env.Value('after')
6548
6549 # Attach a .UpdateValue() builder for the above function
6550 # action to the construction environment.
6551 env['BUILDERS']['UpdateValue'] = Builder(action = build_value)
6552 env.UpdateValue(target = Value(output), source = Value(input))
6553
6554 VariantDir(variant_dir, src_dir, [duplicate]),
6555 env.VariantDir(variant_dir, src_dir, [duplicate])
6556 Sets up an alternate build location. When building in the
6557 variant_dir, SCons backfills as needed with files from src_dir to
6558 create a complete build directory. VariantDir can be called
6559 multiple times with the same src_dir to set up multiple builds with
6560 different options (variants).
6561
6562 The variant location must be in or underneath the project top
6563 directory, and src_dir may not be underneath variant_dir.
6564
6565 By default, SCons physically duplicates the source files and
6566 SConscript files as needed into the variant tree. Thus, a build
6567 performed in the variant tree is guaranteed to be identical to a
6568 build performed in the source tree even if intermediate source
6569 files are generated during the build, or if preprocessors or other
6570 scanners search for included files relative to the source file, or
6571 if individual compilers or other invoked tools are hard-coded to
6572 put derived files in the same directory as source files. Only the
6573 files SCons calculates are needed for the build are duplicated into
6574 variant_dir.
6575
6576 If possible on the platform, the duplication is performed by
6577 linking rather than copying. This behavior is affected by the
6578 --duplicate command-line option.
6579
6580 Duplicating the source files may be disabled by setting the
6581 duplicate argument to False. This will cause SCons to invoke
6582 Builders using the path names of source files in src_dir and the
6583 path names of derived files within variant_dir. This is more
6584 efficient than duplicate=True, and is safe for most builds; revert
6585 to True if it causes problems.
6586
6587
6588 VariantDir works most naturally with used with a subsidiary
6589 SConscript file. The subsidiary SConscript file is called as if it
6590 were in variant_dir, regardless of the value of duplicate. This is
6591 how you tell scons which variant of a source tree to build:
6592
6593 # run src/SConscript in two variant directories
6594 VariantDir('build/variant1', 'src')
6595 SConscript('build/variant1/SConscript')
6596 VariantDir('build/variant2', 'src')
6597 SConscript('build/variant2/SConscript')
6598
6599 See also the SConscript function, described above, for another way
6600 to specify a variant directory in conjunction with calling a
6601 subsidiary SConscript file.
6602
6603 Examples:
6604
6605 # use names in the build directory, not the source directory
6606 VariantDir('build', 'src', duplicate=0)
6607 Program('build/prog', 'build/source.c')
6608
6609 # this builds both the source and docs in a separate subtree
6610 VariantDir('build', '.', duplicate=0)
6611 SConscript(dirs=['build/src','build/doc'])
6612
6613 # same as previous example, but only uses SConscript
6614 SConscript(dirs='src', variant_dir='build/src', duplicate=0)
6615 SConscript(dirs='doc', variant_dir='build/doc', duplicate=0)
6616
6617 WhereIs(program, [path, pathext, reject]), env.WhereIs(program, [path,
6618 pathext, reject])
6619 Searches for the specified executable program, returning the full
6620 path to the program or None.
6621
6622 When called as a construction environment method, searches the
6623 paths in the path keyword argument, or if None (the default) the
6624 paths listed in the construction environment (env['ENV']['PATH']).
6625 The external environment's path list (os.environ['PATH']) is used
6626 as a fallback if the key env['ENV']['PATH'] does not exist.
6627
6628 On Windows systems, searches for executable programs with any of
6629 the file extensions listed in the pathext keyword argument, or if
6630 None (the default) the pathname extensions listed in the
6631 construction environment (env['ENV']['PATHEXT']). The external
6632 environment's pathname extensions list (os.environ['PATHEXT']) is
6633 used as a fallback if the key env['ENV']['PATHEXT'] does not exist.
6634
6635 When called as a global function, uses the external environment's
6636 path os.environ['PATH'] and path extensions os.environ['PATHEXT'],
6637 respectively, if path and pathext are None.
6638
6639 Will not select any path name or names in the optional reject list.
6640
6641 SConscript Variables
6642 In addition to the global functions and methods, scons supports a
6643 number of variables that can be used in SConscript files to affect how
6644 you want the build to be performed.
6645
6646 ARGLIST
6647 A list of the keyword=value arguments specified on the command
6648 line. Each element in the list is a tuple containing the argument.
6649 The separate keyword and value elements of the tuple can be
6650 accessed by subscripting for elements [0] and [1] of the tuple, or,
6651 more readably, by using tuple unpacking. Example:
6652
6653 print("first keyword, value =", ARGLIST[0][0], ARGLIST[0][1])
6654 print("second keyword, value =", ARGLIST[1][0], ARGLIST[1][1])
6655 key, value = ARGLIST[2]
6656 print("third keyword, value =", key, value)
6657 for key, value in ARGLIST:
6658 # process key and value
6659
6660 ARGUMENTS
6661 A dictionary of all the keyword=value arguments specified on the
6662 command line. The dictionary is not in order, and if a given
6663 keyword has more than one value assigned to it on the command line,
6664 the last (right-most) value is the one in the ARGUMENTS dictionary.
6665
6666 Example:
6667
6668 if ARGUMENTS.get('debug', 0):
6669 env = Environment(CCFLAGS='-g')
6670 else:
6671 env = Environment()
6672
6673 BUILD_TARGETS
6674 A list of the targets which scons has been asked to build. The
6675 contents will be either those targets listed on the command line,
6676 or, if none, those targets set via calls to the Default function.
6677 It does not contain any dependent targets that scons selects for
6678 building as a result of making the sure the specified targets are
6679 up to date, if those targets did not appear on the command line.
6680 The list is empty if neither command line targets or Default calls
6681 are present.
6682
6683 The elements of this list may be strings or nodes, so you should
6684 run the list through the Python str function to make sure any Node
6685 path names are converted to strings.
6686
6687 Because this list may be taken from the list of targets specified
6688 using the Default function, the contents of the list may change on
6689 each successive call to Default. See the DEFAULT_TARGETS list,
6690 below, for additional information.
6691
6692 Example:
6693
6694 if 'foo' in BUILD_TARGETS:
6695 print("Don't forget to test the `foo' program!")
6696 if 'special/program' in BUILD_TARGETS:
6697 SConscript('special')
6698
6699 COMMAND_LINE_TARGETS
6700 A list of the targets explicitly specified on the command line. If
6701 there are command line targets, this list will have the same
6702 contents as BUILD_TARGETS. If there are no targets specified on the
6703 command line, the list is empty. The elements of this list are
6704 strings. This can be used, for example, to take specific actions
6705 only when certain targets are explicitly being built.
6706
6707 Example:
6708
6709 if 'foo' in COMMAND_LINE_TARGETS:
6710 print("Don't forget to test the `foo' program!")
6711 if 'special/program' in COMMAND_LINE_TARGETS:
6712 SConscript('special')
6713
6714 DEFAULT_TARGETS
6715 A list of the target nodes that have been specified using the
6716 Default function. If there are no command line targets, this list
6717 will have the same contents as BUILD_TARGETS. Since the elements of
6718 the list are nodes, you need to call the Python str function on
6719 them to get the path name for each Node.
6720
6721 Example:
6722
6723 print(str(DEFAULT_TARGETS[0]))
6724 if 'foo' in [str(t) for t in DEFAULT_TARGETS]:
6725 print("Don't forget to test the `foo' program!")
6726
6727 The contents of the DEFAULT_TARGETS list change on on each
6728 successive call to the Default function:
6729
6730 print([str(t) for t in DEFAULT_TARGETS]) # originally []
6731 Default('foo')
6732 print([str(t) for t in DEFAULT_TARGETS]) # now a node ['foo']
6733 Default('bar')
6734 print([str(t) for t in DEFAULT_TARGETS]) # now a node ['foo', 'bar']
6735 Default(None)
6736 print([str(t) for t in DEFAULT_TARGETS]) # back to []
6737
6738 Consequently, be sure to use DEFAULT_TARGETS only after you've made
6739 all of your Default() calls, or else simply be careful of the order
6740 of these statements in your SConscript files so that you don't look
6741 for a specific default target before it's actually been added to
6742 the list.
6743
6744 These variables may be accessed from custom Python modules that you
6745 import into an SConscript file by adding the following to the Python
6746 module:
6747
6748 from SCons.Script import *
6749
6750 Construction Variables
6751 A construction environment has an associated dictionary of construction
6752 variables that are used by built-in or user-supplied build rules.
6753 Construction variable naming must follow the same rules as Python
6754 identifier naming: the initial character must be an underscore or
6755 letter, followed by any number of underscores, letters, or digits. A
6756 construction environment is not a Python dictionary itself, but it can
6757 be indexed like one to access a construction variable:
6758
6759 env["CC"] = "cc"
6760 flags = env.get("CPPDEFINES", [])
6761
6762 Construction variables can also be retrieved and set by using the
6763 Dictionary method of the construction environment to create an actual
6764 dictionary:
6765
6766 cvars = env.Dictionary()
6767 cvars["CC"] = "cc"
6768
6769 Construction variables can also be passed to the construction
6770 environment constructor:
6771
6772 env = Environment(CC="cc")
6773
6774 or when copying a construction environment using the Clone method:
6775
6776 env2 = env.Clone(CC="cl.exe")
6777
6778 Construction variables can also be supplied as keyword arguments to a
6779 builder, in which case those settings affect only the work done by that
6780 builder call, and not the construction environment as a whole. This
6781 concept is called an override:
6782
6783 env.Program('hello', 'hello.c', LIBS=['gl', 'glut'])
6784
6785 A number of useful construction variables are automatically defined by
6786 scons for each supported platform, and you can modify these or define
6787 any additional construction variables for your own use, taking care not
6788 to overwrite ones which SCons is using. The following is a list of the
6789 possible automatically defined construction variables.
6790
6791 Note the actual list available at execution time will never include all
6792 of these, as the ones detected as not being useful (wrong platform,
6793 necessary external command or files not installed, etc.) will not be
6794 set up. Correct build setups should be resilient to the possible
6795 absence of certain construction variables before using them, for
6796 example by using a Python dictionary get method to retrieve the value
6797 and taking alternative action if the return indicates the variable is
6798 unset. The env.Dump method can be called to examine the construction
6799 variables set in a particular environment.
6800
6801 __LDMODULEVERSIONFLAGS
6802 This construction variable automatically introduces
6803 $_LDMODULEVERSIONFLAGS if $LDMODULEVERSION is set. Othervise it
6804 evaluates to an empty string.
6805
6806 __NINJA_NO
6807 Internal flag. Used to tell SCons whether or not to try to import
6808 pypi's ninja python package. This is set to True when being called
6809 by Ninja?
6810
6811 __SHLIBVERSIONFLAGS
6812 This construction variable automatically introduces
6813 $_SHLIBVERSIONFLAGS if $SHLIBVERSION is set. Othervise it evaluates
6814 to an empty string.
6815
6816 APPLELINK_COMPATIBILITY_VERSION
6817 On Mac OS X this is used to set the linker flag:
6818 -compatibility_version
6819
6820 The value is specified as X[.Y[.Z]] where X is between 1 and 65535,
6821 Y can be omitted or between 1 and 255, Z can be omitted or between
6822 1 and 255. This value will be derived from $SHLIBVERSION if not
6823 specified. The lowest digit will be dropped and replaced by a 0.
6824
6825 If the $APPLELINK_NO_COMPATIBILITY_VERSION is set then no
6826 -compatibility_version will be output.
6827
6828 See MacOS's ld manpage for more details
6829
6830 _APPLELINK_COMPATIBILITY_VERSION
6831 A macro (by default a generator function) used to create the linker
6832 flags to specify apple's linker's -compatibility_version flag. The
6833 default generator uses $APPLELINK_COMPATIBILITY_VERSION and
6834 $APPLELINK_NO_COMPATIBILITY_VERSION and $SHLIBVERSION to determine
6835 the correct flag.
6836
6837 APPLELINK_CURRENT_VERSION
6838 On Mac OS X this is used to set the linker flag: -current_version
6839
6840 The value is specified as X[.Y[.Z]] where X is between 1 and 65535,
6841 Y can be omitted or between 1 and 255, Z can be omitted or between
6842 1 and 255. This value will be set to $SHLIBVERSION if not
6843 specified.
6844
6845 If the $APPLELINK_NO_CURRENT_VERSION is set then no
6846 -current_version will be output.
6847
6848 See MacOS's ld manpage for more details
6849
6850 _APPLELINK_CURRENT_VERSION
6851 A macro (by default a generator function) used to create the linker
6852 flags to specify apple's linker's -current_version flag. The
6853 default generator uses $APPLELINK_CURRENT_VERSION and
6854 $APPLELINK_NO_CURRENT_VERSION and $SHLIBVERSION to determine the
6855 correct flag.
6856
6857 APPLELINK_NO_COMPATIBILITY_VERSION
6858 Set this to any True (1|True|non-empty string) value to disable
6859 adding -compatibility_version flag when generating versioned shared
6860 libraries.
6861
6862 This overrides $APPLELINK_COMPATIBILITY_VERSION.
6863
6864 APPLELINK_NO_CURRENT_VERSION
6865 Set this to any True (1|True|non-empty string) value to disable
6866 adding -current_version flag when generating versioned shared
6867 libraries.
6868
6869 This overrides $APPLELINK_CURRENT_VERSION.
6870
6871 AR
6872 The static library archiver.
6873
6874 ARCHITECTURE
6875 Specifies the system architecture for which the package is being
6876 built. The default is the system architecture of the machine on
6877 which SCons is running. This is used to fill in the Architecture:
6878 field in an Ipkg control file, and the BuildArch: field in the RPM
6879 .spec file, as well as forming part of the name of a generated RPM
6880 package file.
6881
6882 See the Package builder.
6883
6884 ARCOM
6885 The command line used to generate a static library from object
6886 files.
6887
6888 ARCOMSTR
6889 The string displayed when a static library is generated from object
6890 files. If this is not set, then $ARCOM (the command line) is
6891 displayed.
6892
6893 env = Environment(ARCOMSTR = "Archiving $TARGET")
6894
6895 ARFLAGS
6896 General options passed to the static library archiver.
6897
6898 AS
6899 The assembler.
6900
6901 ASCOM
6902 The command line used to generate an object file from an
6903 assembly-language source file.
6904
6905 ASCOMSTR
6906 The string displayed when an object file is generated from an
6907 assembly-language source file. If this is not set, then $ASCOM (the
6908 command line) is displayed.
6909
6910 env = Environment(ASCOMSTR = "Assembling $TARGET")
6911
6912 ASFLAGS
6913 General options passed to the assembler.
6914
6915 ASPPCOM
6916 The command line used to assemble an assembly-language source file
6917 into an object file after first running the file through the C
6918 preprocessor. Any options specified in the $ASFLAGS and $CPPFLAGS
6919 construction variables are included on this command line.
6920
6921 ASPPCOMSTR
6922 The string displayed when an object file is generated from an
6923 assembly-language source file after first running the file through
6924 the C preprocessor. If this is not set, then $ASPPCOM (the command
6925 line) is displayed.
6926
6927 env = Environment(ASPPCOMSTR = "Assembling $TARGET")
6928
6929 ASPPFLAGS
6930 General options when an assembling an assembly-language source file
6931 into an object file after first running the file through the C
6932 preprocessor. The default is to use the value of $ASFLAGS.
6933
6934 BIBTEX
6935 The bibliography generator for the TeX formatter and typesetter and
6936 the LaTeX structured formatter and typesetter.
6937
6938 BIBTEXCOM
6939 The command line used to call the bibliography generator for the
6940 TeX formatter and typesetter and the LaTeX structured formatter and
6941 typesetter.
6942
6943 BIBTEXCOMSTR
6944 The string displayed when generating a bibliography for TeX or
6945 LaTeX. If this is not set, then $BIBTEXCOM (the command line) is
6946 displayed.
6947
6948 env = Environment(BIBTEXCOMSTR = "Generating bibliography $TARGET")
6949
6950 BIBTEXFLAGS
6951 General options passed to the bibliography generator for the TeX
6952 formatter and typesetter and the LaTeX structured formatter and
6953 typesetter.
6954
6955 BUILDERS
6956 A dictionary mapping the names of the builders available through
6957 the construction environment to underlying Builder objects. Custom
6958 builders need to be added to this to make them available.
6959
6960 A platform-dependent default list of builders such as Program,
6961 Library etc. is used to populate this construction variable when
6962 the construction environment is initialized via the
6963 presence/absence of the tools those builders depend on. $BUILDERS
6964 can be examined to learn which builders will actually be available
6965 at run-time.
6966
6967 Note that if you initialize this construction variable through
6968 assignment when the construction environment is created, that value
6969 for $BUILDERS will override any defaults:
6970
6971 bld = Builder(action='foobuild < $SOURCE > $TARGET')
6972 env = Environment(BUILDERS={'NewBuilder': bld})
6973
6974 To instead use a new Builder object in addition to the default
6975 Builders, add your new Builder object like this:
6976
6977 env = Environment()
6978 env.Append(BUILDERS={'NewBuilder': bld})
6979
6980 or this:
6981
6982 env = Environment()
6983 env['BUILDERS']['NewBuilder'] = bld
6984
6985 CACHEDIR_CLASS
6986 The class type that SCons should use when instantiating a new
6987 CacheDir for the given environment. It must be a subclass of the
6988 SCons.CacheDir.CacheDir class.
6989
6990 CC
6991 The C compiler.
6992
6993 CCCOM
6994 The command line used to compile a C source file to a (static)
6995 object file. Any options specified in the $CFLAGS, $CCFLAGS and
6996 $CPPFLAGS construction variables are included on this command line.
6997 See also $SHCCCOM for compiling to shared objects.
6998
6999 CCCOMSTR
7000 If set, the string displayed when a C source file is compiled to a
7001 (static) object file. If not set, then $CCCOM (the command line) is
7002 displayed. See also $SHCCCOMSTR for compiling to shared objects.
7003
7004 env = Environment(CCCOMSTR = "Compiling static object $TARGET")
7005
7006 CCFLAGS
7007 General options that are passed to the C and C++ compilers. See
7008 also $SHCCFLAGS for compiling to shared objects.
7009
7010 CCPCHFLAGS
7011 Options added to the compiler command line to support building with
7012 precompiled headers. The default value expands expands to the
7013 appropriate Microsoft Visual C++ command-line options when the $PCH
7014 construction variable is set.
7015
7016 CCPDBFLAGS
7017 Options added to the compiler command line to support storing
7018 debugging information in a Microsoft Visual C++ PDB file. The
7019 default value expands expands to appropriate Microsoft Visual C++
7020 command-line options when the $PDB construction variable is set.
7021
7022 The Visual C++ compiler option that SCons uses by default to
7023 generate PDB information is /Z7. This works correctly with parallel
7024 (-j) builds because it embeds the debug information in the
7025 intermediate object files, as opposed to sharing a single PDB file
7026 between multiple object files. This is also the only way to get
7027 debug information embedded into a static library. Using the /Zi
7028 instead may yield improved link-time performance, although parallel
7029 builds will no longer work.
7030
7031 You can generate PDB files with the /Zi switch by overriding the
7032 default $CCPDBFLAGS variable as follows:
7033
7034 env['CCPDBFLAGS'] = ['${(PDB and "/Zi /Fd%s" % File(PDB)) or ""}']
7035
7036 An alternative would be to use the /Zi to put the debugging
7037 information in a separate .pdb file for each object file by
7038 overriding the $CCPDBFLAGS variable as follows:
7039
7040 env['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
7041
7042 CCVERSION
7043 The version number of the C compiler. This may or may not be set,
7044 depending on the specific C compiler being used.
7045
7046 CFILESUFFIX
7047 The suffix for C source files. This is used by the internal CFile
7048 builder when generating C files from Lex (.l) or YACC (.y) input
7049 files. The default suffix, of course, is .c (lower case). On
7050 case-insensitive systems (like Windows), SCons also treats .C
7051 (upper case) files as C files.
7052
7053 CFLAGS
7054 General options that are passed to the C compiler (C only; not
7055 C++). See also $SHCFLAGS for compiling to shared objects.
7056
7057 CHANGE_SPECFILE
7058 A hook for modifying the file that controls the packaging build
7059 (the .spec for RPM, the control for Ipkg, the .wxs for MSI). If
7060 set, the function will be called after the SCons template for the
7061 file has been written.
7062
7063 See the Package builder.
7064
7065 CHANGED_SOURCES
7066 A reserved variable name that may not be set or used in a
7067 construction environment. (See the manpage section "Variable
7068 Substitution" for more information).
7069
7070 CHANGED_TARGETS
7071 A reserved variable name that may not be set or used in a
7072 construction environment. (See the manpage section "Variable
7073 Substitution" for more information).
7074
7075 CHANGELOG
7076 The name of a file containing the change log text to be included in
7077 the package. This is included as the %changelog section of the RPM
7078 .spec file.
7079
7080 See the Package builder.
7081
7082 COMPILATIONDB_COMSTR
7083 The string displayed when the CompilationDatabase builder's action
7084 is run.
7085
7086 COMPILATIONDB_PATH_FILTER
7087 A string which instructs CompilationDatabase to only include
7088 entries where the output member matches the pattern in the filter
7089 string using fnmatch, which uses glob style wildcards.
7090
7091 The default value is an empty string '', which disables filtering.
7092
7093 COMPILATIONDB_USE_ABSPATH
7094 A boolean flag to instruct CompilationDatabase whether to write the
7095 file and output members in the compilation database using absolute
7096 or relative paths.
7097
7098 The default value is False (use relative paths)
7099
7100 _concat
7101 A function used to produce variables like $_CPPINCFLAGS. It takes
7102 four mandatory arguments, and up to 4 additional optional
7103 arguments: 1) a prefix to concatenate onto each element, 2) a list
7104 of elements, 3) a suffix to concatenate onto each element, 4) an
7105 environment for variable interpolation, 5) an optional function
7106 that will be called to transform the list before concatenation, 6)
7107 an optionally specified target (Can use TARGET), 7) an optionally
7108 specified source (Can use SOURCE), 8) optional affect_signature
7109 flag which will wrap non-empty returned value with $( and $) to
7110 indicate the contents should not affect the signature of the
7111 generated command line.
7112
7113 env['_CPPINCFLAGS'] = '${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}'
7114
7115
7116 CONFIGUREDIR
7117 The name of the directory in which Configure context test files are
7118 written. The default is .sconf_temp in the top-level directory
7119 containing the SConstruct file.
7120
7121 CONFIGURELOG
7122 The name of the Configure context log file. The default is
7123 config.log in the top-level directory containing the SConstruct
7124 file.
7125
7126 _CPPDEFFLAGS
7127 An automatically-generated construction variable containing the C
7128 preprocessor command-line options to define values. The value of
7129 $_CPPDEFFLAGS is created by respectively prepending and appending
7130 $CPPDEFPREFIX and $CPPDEFSUFFIX to each definition in $CPPDEFINES.
7131
7132 CPPDEFINES
7133 A platform independent specification of C preprocessor macro
7134 definitions. The definitions will be added to command lines through
7135 the automatically-generated $_CPPDEFFLAGS construction variable
7136 (see above), which is constructed according to the type of value of
7137 $CPPDEFINES:
7138
7139 If $CPPDEFINES is a string, the values of the $CPPDEFPREFIX and
7140 $CPPDEFSUFFIX construction variables will be respectively prepended
7141 and appended to each definition in $CPPDEFINES.
7142
7143 # Will add -Dxyz to POSIX compiler command lines,
7144 # and /Dxyz to Microsoft Visual C++ command lines.
7145 env = Environment(CPPDEFINES='xyz')
7146
7147 If $CPPDEFINES is a list, the values of the $CPPDEFPREFIX and
7148 $CPPDEFSUFFIX construction variables will be respectively prepended
7149 and appended to each element in the list. If any element is a list
7150 or tuple, then the first item is the name being defined and the
7151 second item is its value:
7152
7153 # Will add -DB=2 -DA to POSIX compiler command lines,
7154 # and /DB=2 /DA to Microsoft Visual C++ command lines.
7155 env = Environment(CPPDEFINES=[('B', 2), 'A'])
7156
7157 If $CPPDEFINES is a dictionary, the values of the $CPPDEFPREFIX and
7158 $CPPDEFSUFFIX construction variables will be respectively prepended
7159 and appended to each item from the dictionary. The key of each
7160 dictionary item is a name being defined to the dictionary item's
7161 corresponding value; if the value is None, then the name is defined
7162 without an explicit value. Note that the resulting flags are sorted
7163 by keyword to ensure that the order of the options on the command
7164 line is consistent each time scons is run.
7165
7166 # Will add -DA -DB=2 to POSIX compiler command lines,
7167 # and /DA /DB=2 to Microsoft Visual C++ command lines.
7168 env = Environment(CPPDEFINES={'B':2, 'A':None})
7169
7170 CPPDEFPREFIX
7171 The prefix used to specify preprocessor macro definitions on the C
7172 compiler command line. This will be prepended to each definition in
7173 the $CPPDEFINES construction variable when the $_CPPDEFFLAGS
7174 variable is automatically generated.
7175
7176 CPPDEFSUFFIX
7177 The suffix used to specify preprocessor macro definitions on the C
7178 compiler command line. This will be appended to each definition in
7179 the $CPPDEFINES construction variable when the $_CPPDEFFLAGS
7180 variable is automatically generated.
7181
7182 CPPFLAGS
7183 User-specified C preprocessor options. These will be included in
7184 any command that uses the C preprocessor, including not just
7185 compilation of C and C++ source files via the $CCCOM, $SHCCCOM,
7186 $CXXCOM and $SHCXXCOM command lines, but also the $FORTRANPPCOM,
7187 $SHFORTRANPPCOM, $F77PPCOM and $SHF77PPCOM command lines used to
7188 compile a Fortran source file, and the $ASPPCOM command line used
7189 to assemble an assembly language source file, after first running
7190 each file through the C preprocessor. Note that this variable does
7191 not contain -I (or similar) include search path options that scons
7192 generates automatically from $CPPPATH. See $_CPPINCFLAGS, below,
7193 for the variable that expands to those options.
7194
7195 _CPPINCFLAGS
7196 An automatically-generated construction variable containing the C
7197 preprocessor command-line options for specifying directories to be
7198 searched for include files. The value of $_CPPINCFLAGS is created
7199 by respectively prepending and appending $INCPREFIX and $INCSUFFIX
7200 to each directory in $CPPPATH.
7201
7202 CPPPATH
7203 The list of directories that the C preprocessor will search for
7204 include directories. The C/C++ implicit dependency scanner will
7205 search these directories for include files. In general it's not
7206 advised to put include directory directives directly into $CCFLAGS
7207 or $CXXFLAGS as the result will be non-portable and the directories
7208 will not be searched by the dependency scanner. $CPPPATH should be
7209 a list of path strings, or a single string, not a pathname list
7210 joined by Python's os.sep.
7211
7212 Note: directory names in $CPPPATH will be looked-up relative to the
7213 directory of the SConscript file when they are used in a command.
7214 To force scons to look-up a directory relative to the root of the
7215 source tree use the # prefix:
7216
7217 env = Environment(CPPPATH='#/include')
7218
7219 The directory look-up can also be forced using the Dir function:
7220
7221 include = Dir('include')
7222 env = Environment(CPPPATH=include)
7223
7224 The directory list will be added to command lines through the
7225 automatically-generated $_CPPINCFLAGS construction variable, which
7226 is constructed by respectively prepending and appending the values
7227 of the $INCPREFIX and $INCSUFFIX construction variables to each
7228 directory in $CPPPATH. Any command lines you define that need the
7229 $CPPPATH directory list should include $_CPPINCFLAGS:
7230
7231 env = Environment(CCCOM="my_compiler $_CPPINCFLAGS -c -o $TARGET $SOURCE")
7232
7233 CPPSUFFIXES
7234 The list of suffixes of files that will be scanned for C
7235 preprocessor implicit dependencies (#include lines). The default
7236 list is:
7237
7238 [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
7239 ".h", ".H", ".hxx", ".hpp", ".hh",
7240 ".F", ".fpp", ".FPP",
7241 ".m", ".mm",
7242 ".S", ".spp", ".SPP"]
7243
7244 CXX
7245 The C++ compiler. See also $SHCXX for compiling to shared objects..
7246
7247 CXXCOM
7248 The command line used to compile a C++ source file to an object
7249 file. Any options specified in the $CXXFLAGS and $CPPFLAGS
7250 construction variables are included on this command line. See also
7251 $SHCXXCOM for compiling to shared objects..
7252
7253 CXXCOMSTR
7254 If set, the string displayed when a C++ source file is compiled to
7255 a (static) object file. If not set, then $CXXCOM (the command line)
7256 is displayed. See also $SHCXXCOMSTR for compiling to shared
7257 objects..
7258
7259 env = Environment(CXXCOMSTR = "Compiling static object $TARGET")
7260
7261 CXXFILESUFFIX
7262 The suffix for C++ source files. This is used by the internal
7263 CXXFile builder when generating C++ files from Lex (.ll) or YACC
7264 (.yy) input files. The default suffix is .cc. SCons also treats
7265 files with the suffixes .cpp, .cxx, .c++, and .C++ as C++ files,
7266 and files with .mm suffixes as Objective C++ files. On
7267 case-sensitive systems (Linux, UNIX, and other POSIX-alikes), SCons
7268 also treats .C (upper case) files as C++ files.
7269
7270 CXXFLAGS
7271 General options that are passed to the C++ compiler. By default,
7272 this includes the value of $CCFLAGS, so that setting $CCFLAGS
7273 affects both C and C++ compilation. If you want to add C++-specific
7274 flags, you must set or override the value of $CXXFLAGS. See also
7275 $SHCXXFLAGS for compiling to shared objects..
7276
7277 CXXVERSION
7278 The version number of the C++ compiler. This may or may not be set,
7279 depending on the specific C++ compiler being used.
7280
7281 DC
7282 The D compiler to use. See also $SHDC for compiling to shared
7283 objects.
7284
7285 DCOM
7286 The command line used to compile a D file to an object file. Any
7287 options specified in the $DFLAGS construction variable is included
7288 on this command line. See also $SHDCOM for compiling to shared
7289 objects.
7290
7291 DCOMSTR
7292 If set, the string displayed when a D source file is compiled to a
7293 (static) object file. If not set, then $DCOM (the command line) is
7294 displayed. See also $SHDCOMSTR for compiling to shared objects.
7295
7296 DDEBUG
7297 List of debug tags to enable when compiling.
7298
7299 DDEBUGPREFIX
7300 DDEBUGPREFIX.
7301
7302 DDEBUGSUFFIX
7303 DDEBUGSUFFIX.
7304
7305 DESCRIPTION
7306 A long description of the project being packaged. This is included
7307 in the relevant section of the file that controls the packaging
7308 build.
7309
7310 See the Package builder.
7311
7312 DESCRIPTION_lang
7313 A language-specific long description for the specified lang. This
7314 is used to populate a %description -l section of an RPM .spec file.
7315
7316 See the Package builder.
7317
7318 DFILESUFFIX
7319 DFILESUFFIX.
7320
7321 DFLAGPREFIX
7322 DFLAGPREFIX.
7323
7324 DFLAGS
7325 General options that are passed to the D compiler.
7326
7327 DFLAGSUFFIX
7328 DFLAGSUFFIX.
7329
7330 DINCPREFIX
7331 DINCPREFIX.
7332
7333 DINCSUFFIX
7334 DLIBFLAGSUFFIX.
7335
7336 Dir
7337 A function that converts a string into a Dir instance relative to
7338 the target being built.
7339
7340 Dirs
7341 A function that converts a list of strings into a list of Dir
7342 instances relative to the target being built.
7343
7344 DLIB
7345 Name of the lib tool to use for D codes.
7346
7347 DLIBCOM
7348 The command line to use when creating libraries.
7349
7350 DLIBDIRPREFIX
7351 DLIBLINKPREFIX.
7352
7353 DLIBDIRSUFFIX
7354 DLIBLINKSUFFIX.
7355
7356 DLIBFLAGPREFIX
7357 DLIBFLAGPREFIX.
7358
7359 DLIBFLAGSUFFIX
7360 DLIBFLAGSUFFIX.
7361
7362 DLIBLINKPREFIX
7363 DLIBLINKPREFIX.
7364
7365 DLIBLINKSUFFIX
7366 DLIBLINKSUFFIX.
7367
7368 DLINK
7369 Name of the linker to use for linking systems including D sources.
7370 See also $SHDLINK for linking shared objects.
7371
7372 DLINKCOM
7373 The command line to use when linking systems including D sources.
7374 See also $SHDLINKCOM for linking shared objects.
7375
7376 DLINKFLAGPREFIX
7377 DLINKFLAGPREFIX.
7378
7379 DLINKFLAGS
7380 List of linker flags. See also $SHDLINKFLAGS for linking shared
7381 objects.
7382
7383 DLINKFLAGSUFFIX
7384 DLINKFLAGSUFFIX.
7385
7386 DOCBOOK_DEFAULT_XSL_EPUB
7387 The default XSLT file for the DocbookEpub builder within the
7388 current environment, if no other XSLT gets specified via keyword.
7389
7390 DOCBOOK_DEFAULT_XSL_HTML
7391 The default XSLT file for the DocbookHtml builder within the
7392 current environment, if no other XSLT gets specified via keyword.
7393
7394 DOCBOOK_DEFAULT_XSL_HTMLCHUNKED
7395 The default XSLT file for the DocbookHtmlChunked builder within the
7396 current environment, if no other XSLT gets specified via keyword.
7397
7398 DOCBOOK_DEFAULT_XSL_HTMLHELP
7399 The default XSLT file for the DocbookHtmlhelp builder within the
7400 current environment, if no other XSLT gets specified via keyword.
7401
7402 DOCBOOK_DEFAULT_XSL_MAN
7403 The default XSLT file for the DocbookMan builder within the current
7404 environment, if no other XSLT gets specified via keyword.
7405
7406 DOCBOOK_DEFAULT_XSL_PDF
7407 The default XSLT file for the DocbookPdf builder within the current
7408 environment, if no other XSLT gets specified via keyword.
7409
7410 DOCBOOK_DEFAULT_XSL_SLIDESHTML
7411 The default XSLT file for the DocbookSlidesHtml builder within the
7412 current environment, if no other XSLT gets specified via keyword.
7413
7414 DOCBOOK_DEFAULT_XSL_SLIDESPDF
7415 The default XSLT file for the DocbookSlidesPdf builder within the
7416 current environment, if no other XSLT gets specified via keyword.
7417
7418 DOCBOOK_FOP
7419 The path to the PDF renderer fop or xep, if one of them is
7420 installed (fop gets checked first).
7421
7422 DOCBOOK_FOPCOM
7423 The full command-line for the PDF renderer fop or xep.
7424
7425 DOCBOOK_FOPCOMSTR
7426 The string displayed when a renderer like fop or xep is used to
7427 create PDF output from an XML file.
7428
7429 DOCBOOK_FOPFLAGS
7430 Additonal command-line flags for the PDF renderer fop or xep.
7431
7432 DOCBOOK_XMLLINT
7433 The path to the external executable xmllint, if it's installed.
7434 Note, that this is only used as last fallback for resolving
7435 XIncludes, if no lxml Python binding can be imported in the current
7436 system.
7437
7438 DOCBOOK_XMLLINTCOM
7439 The full command-line for the external executable xmllint.
7440
7441 DOCBOOK_XMLLINTCOMSTR
7442 The string displayed when xmllint is used to resolve XIncludes for
7443 a given XML file.
7444
7445 DOCBOOK_XMLLINTFLAGS
7446 Additonal command-line flags for the external executable xmllint.
7447
7448 DOCBOOK_XSLTPROC
7449 The path to the external executable xsltproc (or saxon, xalan), if
7450 one of them is installed. Note, that this is only used as last
7451 fallback for XSL transformations, if no lxml Python binding can be
7452 imported in the current system.
7453
7454 DOCBOOK_XSLTPROCCOM
7455 The full command-line for the external executable xsltproc (or
7456 saxon, xalan).
7457
7458 DOCBOOK_XSLTPROCCOMSTR
7459 The string displayed when xsltproc is used to transform an XML file
7460 via a given XSLT stylesheet.
7461
7462 DOCBOOK_XSLTPROCFLAGS
7463 Additonal command-line flags for the external executable xsltproc
7464 (or saxon, xalan).
7465
7466 DOCBOOK_XSLTPROCPARAMS
7467 Additonal parameters that are not intended for the XSLT processor
7468 executable, but the XSL processing itself. By default, they get
7469 appended at the end of the command line for saxon and saxon-xslt,
7470 respectively.
7471
7472 DPATH
7473 List of paths to search for import modules.
7474
7475 DRPATHPREFIX
7476 DRPATHPREFIX.
7477
7478 DRPATHSUFFIX
7479 DRPATHSUFFIX.
7480
7481 DSUFFIXES
7482 The list of suffixes of files that will be scanned for imported D
7483 package files. The default list is ['.d'].
7484
7485 DVERPREFIX
7486 DVERPREFIX.
7487
7488 DVERSIONS
7489 List of version tags to enable when compiling.
7490
7491 DVERSUFFIX
7492 DVERSUFFIX.
7493
7494 DVIPDF
7495 The TeX DVI file to PDF file converter.
7496
7497 DVIPDFCOM
7498 The command line used to convert TeX DVI files into a PDF file.
7499
7500 DVIPDFCOMSTR
7501 The string displayed when a TeX DVI file is converted into a PDF
7502 file. If this is not set, then $DVIPDFCOM (the command line) is
7503 displayed.
7504
7505 DVIPDFFLAGS
7506 General options passed to the TeX DVI file to PDF file converter.
7507
7508 DVIPS
7509 The TeX DVI file to PostScript converter.
7510
7511 DVIPSFLAGS
7512 General options passed to the TeX DVI file to PostScript converter.
7513
7514 ENV
7515 A dictionary of environment variables to use when invoking
7516 commands. When $ENV is used in a command all list values will be
7517 joined using the path separator and any other non-string values
7518 will simply be coerced to a string. Note that, by default, scons
7519 does not propagate the environment in effect when you execute scons
7520 to the commands used to build target files. This is so that builds
7521 will be guaranteed repeatable regardless of the environment
7522 variables set at the time scons is invoked.
7523
7524 If you want to propagate your environment variables to the commands
7525 executed to build target files, you must do so explicitly:
7526
7527 import os
7528 env = Environment(ENV=os.environ.copy())
7529
7530 Note that you can choose only to propagate certain environment
7531 variables. A common example is the system PATH environment
7532 variable, so that scons uses the same utilities as the invoking
7533 shell (or other process):
7534
7535 import os
7536 env = Environment(ENV={'PATH': os.environ['PATH']})
7537
7538 ESCAPE
7539 A function that will be called to escape shell special characters
7540 in command lines. The function should take one argument: the
7541 command line string to escape; and should return the escaped
7542 command line.
7543
7544 F03
7545 The Fortran 03 compiler. You should normally set the $FORTRAN
7546 variable, which specifies the default Fortran compiler for all
7547 Fortran versions. You only need to set $F03 if you need to use a
7548 specific compiler or compiler version for Fortran 03 files.
7549
7550 F03COM
7551 The command line used to compile a Fortran 03 source file to an
7552 object file. You only need to set $F03COM if you need to use a
7553 specific command line for Fortran 03 files. You should normally set
7554 the $FORTRANCOM variable, which specifies the default command line
7555 for all Fortran versions.
7556
7557 F03COMSTR
7558 If set, the string displayed when a Fortran 03 source file is
7559 compiled to an object file. If not set, then $F03COM or $FORTRANCOM
7560 (the command line) is displayed.
7561
7562 F03FILESUFFIXES
7563 The list of file extensions for which the F03 dialect will be used.
7564 By default, this is ['.f03']
7565
7566 F03FLAGS
7567 General user-specified options that are passed to the Fortran 03
7568 compiler. Note that this variable does not contain -I (or similar)
7569 include search path options that scons generates automatically from
7570 $F03PATH. See $_F03INCFLAGS below, for the variable that expands to
7571 those options. You only need to set $F03FLAGS if you need to define
7572 specific user options for Fortran 03 files. You should normally set
7573 the $FORTRANFLAGS variable, which specifies the user-specified
7574 options passed to the default Fortran compiler for all Fortran
7575 versions.
7576
7577 _F03INCFLAGS
7578 An automatically-generated construction variable containing the
7579 Fortran 03 compiler command-line options for specifying directories
7580 to be searched for include files. The value of $_F03INCFLAGS is
7581 created by appending $INCPREFIX and $INCSUFFIX to the beginning and
7582 end of each directory in $F03PATH.
7583
7584 F03PATH
7585 The list of directories that the Fortran 03 compiler will search
7586 for include directories. The implicit dependency scanner will
7587 search these directories for include files. Don't explicitly put
7588 include directory arguments in $F03FLAGS because the result will be
7589 non-portable and the directories will not be searched by the
7590 dependency scanner. Note: directory names in $F03PATH will be
7591 looked-up relative to the SConscript directory when they are used
7592 in a command. To force scons to look-up a directory relative to the
7593 root of the source tree use #: You only need to set $F03PATH if you
7594 need to define a specific include path for Fortran 03 files. You
7595 should normally set the $FORTRANPATH variable, which specifies the
7596 include path for the default Fortran compiler for all Fortran
7597 versions.
7598
7599 env = Environment(F03PATH='#/include')
7600
7601 The directory look-up can also be forced using the Dir() function:
7602
7603 include = Dir('include')
7604 env = Environment(F03PATH=include)
7605
7606 The directory list will be added to command lines through the
7607 automatically-generated $_F03INCFLAGS construction variable, which
7608 is constructed by appending the values of the $INCPREFIX and
7609 $INCSUFFIX construction variables to the beginning and end of each
7610 directory in $F03PATH. Any command lines you define that need the
7611 F03PATH directory list should include $_F03INCFLAGS:
7612
7613 env = Environment(F03COM="my_compiler $_F03INCFLAGS -c -o $TARGET $SOURCE")
7614
7615 F03PPCOM
7616 The command line used to compile a Fortran 03 source file to an
7617 object file after first running the file through the C
7618 preprocessor. Any options specified in the $F03FLAGS and $CPPFLAGS
7619 construction variables are included on this command line. You only
7620 need to set $F03PPCOM if you need to use a specific C-preprocessor
7621 command line for Fortran 03 files. You should normally set the
7622 $FORTRANPPCOM variable, which specifies the default C-preprocessor
7623 command line for all Fortran versions.
7624
7625 F03PPCOMSTR
7626 If set, the string displayed when a Fortran 03 source file is
7627 compiled to an object file after first running the file through the
7628 C preprocessor. If not set, then $F03PPCOM or $FORTRANPPCOM (the
7629 command line) is displayed.
7630
7631 F03PPFILESUFFIXES
7632 The list of file extensions for which the compilation +
7633 preprocessor pass for F03 dialect will be used. By default, this is
7634 empty.
7635
7636 F08
7637 The Fortran 08 compiler. You should normally set the $FORTRAN
7638 variable, which specifies the default Fortran compiler for all
7639 Fortran versions. You only need to set $F08 if you need to use a
7640 specific compiler or compiler version for Fortran 08 files.
7641
7642 F08COM
7643 The command line used to compile a Fortran 08 source file to an
7644 object file. You only need to set $F08COM if you need to use a
7645 specific command line for Fortran 08 files. You should normally set
7646 the $FORTRANCOM variable, which specifies the default command line
7647 for all Fortran versions.
7648
7649 F08COMSTR
7650 If set, the string displayed when a Fortran 08 source file is
7651 compiled to an object file. If not set, then $F08COM or $FORTRANCOM
7652 (the command line) is displayed.
7653
7654 F08FILESUFFIXES
7655 The list of file extensions for which the F08 dialect will be used.
7656 By default, this is ['.f08']
7657
7658 F08FLAGS
7659 General user-specified options that are passed to the Fortran 08
7660 compiler. Note that this variable does not contain -I (or similar)
7661 include search path options that scons generates automatically from
7662 $F08PATH. See $_F08INCFLAGS below, for the variable that expands to
7663 those options. You only need to set $F08FLAGS if you need to define
7664 specific user options for Fortran 08 files. You should normally set
7665 the $FORTRANFLAGS variable, which specifies the user-specified
7666 options passed to the default Fortran compiler for all Fortran
7667 versions.
7668
7669 _F08INCFLAGS
7670 An automatically-generated construction variable containing the
7671 Fortran 08 compiler command-line options for specifying directories
7672 to be searched for include files. The value of $_F08INCFLAGS is
7673 created by appending $INCPREFIX and $INCSUFFIX to the beginning and
7674 end of each directory in $F08PATH.
7675
7676 F08PATH
7677 The list of directories that the Fortran 08 compiler will search
7678 for include directories. The implicit dependency scanner will
7679 search these directories for include files. Don't explicitly put
7680 include directory arguments in $F08FLAGS because the result will be
7681 non-portable and the directories will not be searched by the
7682 dependency scanner. Note: directory names in $F08PATH will be
7683 looked-up relative to the SConscript directory when they are used
7684 in a command. To force scons to look-up a directory relative to the
7685 root of the source tree use #: You only need to set $F08PATH if you
7686 need to define a specific include path for Fortran 08 files. You
7687 should normally set the $FORTRANPATH variable, which specifies the
7688 include path for the default Fortran compiler for all Fortran
7689 versions.
7690
7691 env = Environment(F08PATH='#/include')
7692
7693 The directory look-up can also be forced using the Dir() function:
7694
7695 include = Dir('include')
7696 env = Environment(F08PATH=include)
7697
7698 The directory list will be added to command lines through the
7699 automatically-generated $_F08INCFLAGS construction variable, which
7700 is constructed by appending the values of the $INCPREFIX and
7701 $INCSUFFIX construction variables to the beginning and end of each
7702 directory in $F08PATH. Any command lines you define that need the
7703 F08PATH directory list should include $_F08INCFLAGS:
7704
7705 env = Environment(F08COM="my_compiler $_F08INCFLAGS -c -o $TARGET $SOURCE")
7706
7707 F08PPCOM
7708 The command line used to compile a Fortran 08 source file to an
7709 object file after first running the file through the C
7710 preprocessor. Any options specified in the $F08FLAGS and $CPPFLAGS
7711 construction variables are included on this command line. You only
7712 need to set $F08PPCOM if you need to use a specific C-preprocessor
7713 command line for Fortran 08 files. You should normally set the
7714 $FORTRANPPCOM variable, which specifies the default C-preprocessor
7715 command line for all Fortran versions.
7716
7717 F08PPCOMSTR
7718 If set, the string displayed when a Fortran 08 source file is
7719 compiled to an object file after first running the file through the
7720 C preprocessor. If not set, then $F08PPCOM or $FORTRANPPCOM (the
7721 command line) is displayed.
7722
7723 F08PPFILESUFFIXES
7724 The list of file extensions for which the compilation +
7725 preprocessor pass for F08 dialect will be used. By default, this is
7726 empty.
7727
7728 F77
7729 The Fortran 77 compiler. You should normally set the $FORTRAN
7730 variable, which specifies the default Fortran compiler for all
7731 Fortran versions. You only need to set $F77 if you need to use a
7732 specific compiler or compiler version for Fortran 77 files.
7733
7734 F77COM
7735 The command line used to compile a Fortran 77 source file to an
7736 object file. You only need to set $F77COM if you need to use a
7737 specific command line for Fortran 77 files. You should normally set
7738 the $FORTRANCOM variable, which specifies the default command line
7739 for all Fortran versions.
7740
7741 F77COMSTR
7742 If set, the string displayed when a Fortran 77 source file is
7743 compiled to an object file. If not set, then $F77COM or $FORTRANCOM
7744 (the command line) is displayed.
7745
7746 F77FILESUFFIXES
7747 The list of file extensions for which the F77 dialect will be used.
7748 By default, this is ['.f77']
7749
7750 F77FLAGS
7751 General user-specified options that are passed to the Fortran 77
7752 compiler. Note that this variable does not contain -I (or similar)
7753 include search path options that scons generates automatically from
7754 $F77PATH. See $_F77INCFLAGS below, for the variable that expands to
7755 those options. You only need to set $F77FLAGS if you need to define
7756 specific user options for Fortran 77 files. You should normally set
7757 the $FORTRANFLAGS variable, which specifies the user-specified
7758 options passed to the default Fortran compiler for all Fortran
7759 versions.
7760
7761 _F77INCFLAGS
7762 An automatically-generated construction variable containing the
7763 Fortran 77 compiler command-line options for specifying directories
7764 to be searched for include files. The value of $_F77INCFLAGS is
7765 created by appending $INCPREFIX and $INCSUFFIX to the beginning and
7766 end of each directory in $F77PATH.
7767
7768 F77PATH
7769 The list of directories that the Fortran 77 compiler will search
7770 for include directories. The implicit dependency scanner will
7771 search these directories for include files. Don't explicitly put
7772 include directory arguments in $F77FLAGS because the result will be
7773 non-portable and the directories will not be searched by the
7774 dependency scanner. Note: directory names in $F77PATH will be
7775 looked-up relative to the SConscript directory when they are used
7776 in a command. To force scons to look-up a directory relative to the
7777 root of the source tree use #: You only need to set $F77PATH if you
7778 need to define a specific include path for Fortran 77 files. You
7779 should normally set the $FORTRANPATH variable, which specifies the
7780 include path for the default Fortran compiler for all Fortran
7781 versions.
7782
7783 env = Environment(F77PATH='#/include')
7784
7785 The directory look-up can also be forced using the Dir() function:
7786
7787 include = Dir('include')
7788 env = Environment(F77PATH=include)
7789
7790 The directory list will be added to command lines through the
7791 automatically-generated $_F77INCFLAGS construction variable, which
7792 is constructed by appending the values of the $INCPREFIX and
7793 $INCSUFFIX construction variables to the beginning and end of each
7794 directory in $F77PATH. Any command lines you define that need the
7795 F77PATH directory list should include $_F77INCFLAGS:
7796
7797 env = Environment(F77COM="my_compiler $_F77INCFLAGS -c -o $TARGET $SOURCE")
7798
7799 F77PPCOM
7800 The command line used to compile a Fortran 77 source file to an
7801 object file after first running the file through the C
7802 preprocessor. Any options specified in the $F77FLAGS and $CPPFLAGS
7803 construction variables are included on this command line. You only
7804 need to set $F77PPCOM if you need to use a specific C-preprocessor
7805 command line for Fortran 77 files. You should normally set the
7806 $FORTRANPPCOM variable, which specifies the default C-preprocessor
7807 command line for all Fortran versions.
7808
7809 F77PPCOMSTR
7810 If set, the string displayed when a Fortran 77 source file is
7811 compiled to an object file after first running the file through the
7812 C preprocessor. If not set, then $F77PPCOM or $FORTRANPPCOM (the
7813 command line) is displayed.
7814
7815 F77PPFILESUFFIXES
7816 The list of file extensions for which the compilation +
7817 preprocessor pass for F77 dialect will be used. By default, this is
7818 empty.
7819
7820 F90
7821 The Fortran 90 compiler. You should normally set the $FORTRAN
7822 variable, which specifies the default Fortran compiler for all
7823 Fortran versions. You only need to set $F90 if you need to use a
7824 specific compiler or compiler version for Fortran 90 files.
7825
7826 F90COM
7827 The command line used to compile a Fortran 90 source file to an
7828 object file. You only need to set $F90COM if you need to use a
7829 specific command line for Fortran 90 files. You should normally set
7830 the $FORTRANCOM variable, which specifies the default command line
7831 for all Fortran versions.
7832
7833 F90COMSTR
7834 If set, the string displayed when a Fortran 90 source file is
7835 compiled to an object file. If not set, then $F90COM or $FORTRANCOM
7836 (the command line) is displayed.
7837
7838 F90FILESUFFIXES
7839 The list of file extensions for which the F90 dialect will be used.
7840 By default, this is ['.f90']
7841
7842 F90FLAGS
7843 General user-specified options that are passed to the Fortran 90
7844 compiler. Note that this variable does not contain -I (or similar)
7845 include search path options that scons generates automatically from
7846 $F90PATH. See $_F90INCFLAGS below, for the variable that expands to
7847 those options. You only need to set $F90FLAGS if you need to define
7848 specific user options for Fortran 90 files. You should normally set
7849 the $FORTRANFLAGS variable, which specifies the user-specified
7850 options passed to the default Fortran compiler for all Fortran
7851 versions.
7852
7853 _F90INCFLAGS
7854 An automatically-generated construction variable containing the
7855 Fortran 90 compiler command-line options for specifying directories
7856 to be searched for include files. The value of $_F90INCFLAGS is
7857 created by appending $INCPREFIX and $INCSUFFIX to the beginning and
7858 end of each directory in $F90PATH.
7859
7860 F90PATH
7861 The list of directories that the Fortran 90 compiler will search
7862 for include directories. The implicit dependency scanner will
7863 search these directories for include files. Don't explicitly put
7864 include directory arguments in $F90FLAGS because the result will be
7865 non-portable and the directories will not be searched by the
7866 dependency scanner. Note: directory names in $F90PATH will be
7867 looked-up relative to the SConscript directory when they are used
7868 in a command. To force scons to look-up a directory relative to the
7869 root of the source tree use #: You only need to set $F90PATH if you
7870 need to define a specific include path for Fortran 90 files. You
7871 should normally set the $FORTRANPATH variable, which specifies the
7872 include path for the default Fortran compiler for all Fortran
7873 versions.
7874
7875 env = Environment(F90PATH='#/include')
7876
7877 The directory look-up can also be forced using the Dir() function:
7878
7879 include = Dir('include')
7880 env = Environment(F90PATH=include)
7881
7882 The directory list will be added to command lines through the
7883 automatically-generated $_F90INCFLAGS construction variable, which
7884 is constructed by appending the values of the $INCPREFIX and
7885 $INCSUFFIX construction variables to the beginning and end of each
7886 directory in $F90PATH. Any command lines you define that need the
7887 F90PATH directory list should include $_F90INCFLAGS:
7888
7889 env = Environment(F90COM="my_compiler $_F90INCFLAGS -c -o $TARGET $SOURCE")
7890
7891 F90PPCOM
7892 The command line used to compile a Fortran 90 source file to an
7893 object file after first running the file through the C
7894 preprocessor. Any options specified in the $F90FLAGS and $CPPFLAGS
7895 construction variables are included on this command line. You only
7896 need to set $F90PPCOM if you need to use a specific C-preprocessor
7897 command line for Fortran 90 files. You should normally set the
7898 $FORTRANPPCOM variable, which specifies the default C-preprocessor
7899 command line for all Fortran versions.
7900
7901 F90PPCOMSTR
7902 If set, the string displayed when a Fortran 90 source file is
7903 compiled after first running the file through the C preprocessor.
7904 If not set, then $F90PPCOM or $FORTRANPPCOM (the command line) is
7905 displayed.
7906
7907 F90PPFILESUFFIXES
7908 The list of file extensions for which the compilation +
7909 preprocessor pass for F90 dialect will be used. By default, this is
7910 empty.
7911
7912 F95
7913 The Fortran 95 compiler. You should normally set the $FORTRAN
7914 variable, which specifies the default Fortran compiler for all
7915 Fortran versions. You only need to set $F95 if you need to use a
7916 specific compiler or compiler version for Fortran 95 files.
7917
7918 F95COM
7919 The command line used to compile a Fortran 95 source file to an
7920 object file. You only need to set $F95COM if you need to use a
7921 specific command line for Fortran 95 files. You should normally set
7922 the $FORTRANCOM variable, which specifies the default command line
7923 for all Fortran versions.
7924
7925 F95COMSTR
7926 If set, the string displayed when a Fortran 95 source file is
7927 compiled to an object file. If not set, then $F95COM or $FORTRANCOM
7928 (the command line) is displayed.
7929
7930 F95FILESUFFIXES
7931 The list of file extensions for which the F95 dialect will be used.
7932 By default, this is ['.f95']
7933
7934 F95FLAGS
7935 General user-specified options that are passed to the Fortran 95
7936 compiler. Note that this variable does not contain -I (or similar)
7937 include search path options that scons generates automatically from
7938 $F95PATH. See $_F95INCFLAGS below, for the variable that expands to
7939 those options. You only need to set $F95FLAGS if you need to define
7940 specific user options for Fortran 95 files. You should normally set
7941 the $FORTRANFLAGS variable, which specifies the user-specified
7942 options passed to the default Fortran compiler for all Fortran
7943 versions.
7944
7945 _F95INCFLAGS
7946 An automatically-generated construction variable containing the
7947 Fortran 95 compiler command-line options for specifying directories
7948 to be searched for include files. The value of $_F95INCFLAGS is
7949 created by appending $INCPREFIX and $INCSUFFIX to the beginning and
7950 end of each directory in $F95PATH.
7951
7952 F95PATH
7953 The list of directories that the Fortran 95 compiler will search
7954 for include directories. The implicit dependency scanner will
7955 search these directories for include files. Don't explicitly put
7956 include directory arguments in $F95FLAGS because the result will be
7957 non-portable and the directories will not be searched by the
7958 dependency scanner. Note: directory names in $F95PATH will be
7959 looked-up relative to the SConscript directory when they are used
7960 in a command. To force scons to look-up a directory relative to the
7961 root of the source tree use #: You only need to set $F95PATH if you
7962 need to define a specific include path for Fortran 95 files. You
7963 should normally set the $FORTRANPATH variable, which specifies the
7964 include path for the default Fortran compiler for all Fortran
7965 versions.
7966
7967 env = Environment(F95PATH='#/include')
7968
7969 The directory look-up can also be forced using the Dir() function:
7970
7971 include = Dir('include')
7972 env = Environment(F95PATH=include)
7973
7974 The directory list will be added to command lines through the
7975 automatically-generated $_F95INCFLAGS construction variable, which
7976 is constructed by appending the values of the $INCPREFIX and
7977 $INCSUFFIX construction variables to the beginning and end of each
7978 directory in $F95PATH. Any command lines you define that need the
7979 F95PATH directory list should include $_F95INCFLAGS:
7980
7981 env = Environment(F95COM="my_compiler $_F95INCFLAGS -c -o $TARGET $SOURCE")
7982
7983 F95PPCOM
7984 The command line used to compile a Fortran 95 source file to an
7985 object file after first running the file through the C
7986 preprocessor. Any options specified in the $F95FLAGS and $CPPFLAGS
7987 construction variables are included on this command line. You only
7988 need to set $F95PPCOM if you need to use a specific C-preprocessor
7989 command line for Fortran 95 files. You should normally set the
7990 $FORTRANPPCOM variable, which specifies the default C-preprocessor
7991 command line for all Fortran versions.
7992
7993 F95PPCOMSTR
7994 If set, the string displayed when a Fortran 95 source file is
7995 compiled to an object file after first running the file through the
7996 C preprocessor. If not set, then $F95PPCOM or $FORTRANPPCOM (the
7997 command line) is displayed.
7998
7999 F95PPFILESUFFIXES
8000 The list of file extensions for which the compilation +
8001 preprocessor pass for F95 dialect will be used. By default, this is
8002 empty.
8003
8004 File
8005 A function that converts a string into a File instance relative to
8006 the target being built.
8007
8008 FORTRAN
8009 The default Fortran compiler for all versions of Fortran.
8010
8011 FORTRANCOM
8012 The command line used to compile a Fortran source file to an object
8013 file. By default, any options specified in the $FORTRANFLAGS,
8014 $CPPFLAGS, $_CPPDEFFLAGS, $_FORTRANMODFLAG, and $_FORTRANINCFLAGS
8015 construction variables are included on this command line.
8016
8017 FORTRANCOMSTR
8018 If set, the string displayed when a Fortran source file is compiled
8019 to an object file. If not set, then $FORTRANCOM (the command line)
8020 is displayed.
8021
8022 FORTRANFILESUFFIXES
8023 The list of file extensions for which the FORTRAN dialect will be
8024 used. By default, this is ['.f', '.for', '.ftn']
8025
8026 FORTRANFLAGS
8027 General user-specified options that are passed to the Fortran
8028 compiler. Note that this variable does not contain -I (or similar)
8029 include or module search path options that scons generates
8030 automatically from $FORTRANPATH. See $_FORTRANINCFLAGS and
8031 $_FORTRANMODFLAG, below, for the variables that expand those
8032 options.
8033
8034 _FORTRANINCFLAGS
8035 An automatically-generated construction variable containing the
8036 Fortran compiler command-line options for specifying directories to
8037 be searched for include files and module files. The value of
8038 $_FORTRANINCFLAGS is created by respectively prepending and
8039 appending $INCPREFIX and $INCSUFFIX to the beginning and end of
8040 each directory in $FORTRANPATH.
8041
8042 FORTRANMODDIR
8043 Directory location where the Fortran compiler should place any
8044 module files it generates. This variable is empty, by default. Some
8045 Fortran compilers will internally append this directory in the
8046 search path for module files, as well.
8047
8048 FORTRANMODDIRPREFIX
8049 The prefix used to specify a module directory on the Fortran
8050 compiler command line. This will be prepended to the beginning of
8051 the directory in the $FORTRANMODDIR construction variables when the
8052 $_FORTRANMODFLAG variables is automatically generated.
8053
8054 FORTRANMODDIRSUFFIX
8055 The suffix used to specify a module directory on the Fortran
8056 compiler command line. This will be appended to the end of the
8057 directory in the $FORTRANMODDIR construction variables when the
8058 $_FORTRANMODFLAG variables is automatically generated.
8059
8060 _FORTRANMODFLAG
8061 An automatically-generated construction variable containing the
8062 Fortran compiler command-line option for specifying the directory
8063 location where the Fortran compiler should place any module files
8064 that happen to get generated during compilation. The value of
8065 $_FORTRANMODFLAG is created by respectively prepending and
8066 appending $FORTRANMODDIRPREFIX and $FORTRANMODDIRSUFFIX to the
8067 beginning and end of the directory in $FORTRANMODDIR.
8068
8069 FORTRANMODPREFIX
8070 The module file prefix used by the Fortran compiler. SCons assumes
8071 that the Fortran compiler follows the quasi-standard naming
8072 convention for module files of module_name.mod. As a result, this
8073 variable is left empty, by default. For situations in which the
8074 compiler does not necessarily follow the normal convention, the
8075 user may use this variable. Its value will be appended to every
8076 module file name as scons attempts to resolve dependencies.
8077
8078 FORTRANMODSUFFIX
8079 The module file suffix used by the Fortran compiler. SCons assumes
8080 that the Fortran compiler follows the quasi-standard naming
8081 convention for module files of module_name.mod. As a result, this
8082 variable is set to ".mod", by default. For situations in which the
8083 compiler does not necessarily follow the normal convention, the
8084 user may use this variable. Its value will be appended to every
8085 module file name as scons attempts to resolve dependencies.
8086
8087 FORTRANPATH
8088 The list of directories that the Fortran compiler will search for
8089 include files and (for some compilers) module files. The Fortran
8090 implicit dependency scanner will search these directories for
8091 include files (but not module files since they are autogenerated
8092 and, as such, may not actually exist at the time the scan takes
8093 place). Don't explicitly put include directory arguments in
8094 FORTRANFLAGS because the result will be non-portable and the
8095 directories will not be searched by the dependency scanner. Note:
8096 directory names in FORTRANPATH will be looked-up relative to the
8097 SConscript directory when they are used in a command. To force
8098 scons to look-up a directory relative to the root of the source
8099 tree use #:
8100
8101 env = Environment(FORTRANPATH='#/include')
8102
8103 The directory look-up can also be forced using the Dir() function:
8104
8105 include = Dir('include')
8106 env = Environment(FORTRANPATH=include)
8107
8108 The directory list will be added to command lines through the
8109 automatically-generated $_FORTRANINCFLAGS construction variable,
8110 which is constructed by respectively prepending and appending the
8111 values of the $INCPREFIX and $INCSUFFIX construction variables to
8112 the beginning and end of each directory in $FORTRANPATH. Any
8113 command lines you define that need the FORTRANPATH directory list
8114 should include $_FORTRANINCFLAGS:
8115
8116 env = Environment(FORTRANCOM="my_compiler $_FORTRANINCFLAGS -c -o $TARGET $SOURCE")
8117
8118 FORTRANPPCOM
8119 The command line used to compile a Fortran source file to an object
8120 file after first running the file through the C preprocessor. By
8121 default, any options specified in the $FORTRANFLAGS, $CPPFLAGS,
8122 $_CPPDEFFLAGS, $_FORTRANMODFLAG, and $_FORTRANINCFLAGS construction
8123 variables are included on this command line.
8124
8125 FORTRANPPCOMSTR
8126 If set, the string displayed when a Fortran source file is compiled
8127 to an object file after first running the file through the C
8128 preprocessor. If not set, then $FORTRANPPCOM (the command line) is
8129 displayed.
8130
8131 FORTRANPPFILESUFFIXES
8132 The list of file extensions for which the compilation +
8133 preprocessor pass for FORTRAN dialect will be used. By default,
8134 this is ['.fpp', '.FPP']
8135
8136 FORTRANSUFFIXES
8137 The list of suffixes of files that will be scanned for Fortran
8138 implicit dependencies (INCLUDE lines and USE statements). The
8139 default list is:
8140
8141 [".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
8142 ".f77", ".F77", ".f90", ".F90", ".f95", ".F95"]
8143
8144 FRAMEWORKPATH
8145 On Mac OS X with gcc, a list containing the paths to search for
8146 frameworks. Used by the compiler to find framework-style includes
8147 like #include <Fmwk/Header.h>. Used by the linker to find
8148 user-specified frameworks when linking (see $FRAMEWORKS). For
8149 example:
8150
8151 env.AppendUnique(FRAMEWORKPATH='#myframeworkdir')
8152
8153
8154 will add
8155
8156 ... -Fmyframeworkdir
8157
8158
8159 to the compiler and linker command lines.
8160
8161 _FRAMEWORKPATH
8162 On Mac OS X with gcc, an automatically-generated construction
8163 variable containing the linker command-line options corresponding
8164 to $FRAMEWORKPATH.
8165
8166 FRAMEWORKPATHPREFIX
8167 On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH
8168 entries. (see $FRAMEWORKPATH). The default value is -F.
8169
8170 FRAMEWORKPREFIX
8171 On Mac OS X with gcc, the prefix to be used for linking in
8172 frameworks (see $FRAMEWORKS). The default value is -framework.
8173
8174 FRAMEWORKS
8175 On Mac OS X with gcc, a list of the framework names to be linked
8176 into a program or shared library or bundle. The default value is
8177 the empty list. For example:
8178
8179 env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration'))
8180
8181
8182 _FRAMEWORKS
8183 On Mac OS X with gcc, an automatically-generated construction
8184 variable containing the linker command-line options for linking
8185 with FRAMEWORKS.
8186
8187 FRAMEWORKSFLAGS
8188 On Mac OS X with gcc, general user-supplied frameworks options to
8189 be added at the end of a command line building a loadable module.
8190 (This has been largely superseded by the $FRAMEWORKPATH,
8191 $FRAMEWORKPATHPREFIX, $FRAMEWORKPREFIX and $FRAMEWORKS variables
8192 described above.)
8193
8194 GS
8195 The Ghostscript program used to, for example, convert PostScript to
8196 PDF files.
8197
8198 GSCOM
8199 The full Ghostscript command line used for the conversion process.
8200 Its default value is “$GS $GSFLAGS -sOutputFile=$TARGET $SOURCES”.
8201
8202 GSCOMSTR
8203 The string displayed when Ghostscript is called for the conversion
8204 process. If this is not set (the default), then $GSCOM (the command
8205 line) is displayed.
8206
8207 GSFLAGS
8208 General options passed to the Ghostscript program, when converting
8209 PostScript to PDF files for example. Its default value is
8210 “-dNOPAUSE -dBATCH -sDEVICE=pdfwrite”
8211
8212 HOST_ARCH
8213 The name of the host hardware architecture used to create the
8214 Environment. If a platform is specified when creating the
8215 Environment, then that Platform's logic will handle setting this
8216 value. This value is immutable, and should not be changed by the
8217 user after the Environment is initialized. Currently only set for
8218 Win32.
8219
8220 Sets the host architecture for the Visual C++ compiler. If not set,
8221 default to the detected host architecture: note that this may
8222 depend on the python you are using. This variable must be passed as
8223 an argument to the Environment() constructor; setting it later has
8224 no effect.
8225
8226 Valid values are the same as for $TARGET_ARCH.
8227
8228 This is currently only used on Windows, but in the future it may be
8229 used on other OSes as well.
8230
8231 HOST_OS
8232 The name of the host operating system used to create the
8233 Environment. If a platform is specified when creating the
8234 Environment, then that Platform's logic will handle setting this
8235 value. This value is immutable, and should not be changed by the
8236 user after the Environment is initialized. Currently only set for
8237 Win32.
8238
8239 IDLSUFFIXES
8240 The list of suffixes of files that will be scanned for IDL implicit
8241 dependencies (#include or import lines). The default list is:
8242
8243 [".idl", ".IDL"]
8244
8245 IMPLIBNOVERSIONSYMLINKS
8246 Used to override $SHLIBNOVERSIONSYMLINKS/$LDMODULENOVERSIONSYMLINKS
8247 when creating versioned import library for a shared
8248 library/loadable module. If not defined, then
8249 $SHLIBNOVERSIONSYMLINKS/$LDMODULENOVERSIONSYMLINKS is used to
8250 determine whether to disable symlink generation or not.
8251
8252 IMPLIBPREFIX
8253 The prefix used for import library names. For example, cygwin uses
8254 import libraries (libfoo.dll.a) in pair with dynamic libraries
8255 (cygfoo.dll). The cyglink linker sets $IMPLIBPREFIX to 'lib' and
8256 $SHLIBPREFIX to 'cyg'.
8257
8258 IMPLIBSUFFIX
8259 The suffix used for import library names. For example, cygwin uses
8260 import libraries (libfoo.dll.a) in pair with dynamic libraries
8261 (cygfoo.dll). The cyglink linker sets $IMPLIBSUFFIX to '.dll.a' and
8262 $SHLIBSUFFIX to '.dll'.
8263
8264 IMPLIBVERSION
8265 Used to override $SHLIBVERSION/$LDMODULEVERSION when generating
8266 versioned import library for a shared library/loadable module. If
8267 undefined, the $SHLIBVERSION/$LDMODULEVERSION is used to determine
8268 the version of versioned import library.
8269
8270 IMPLICIT_COMMAND_DEPENDENCIES
8271 Controls whether or not SCons will add implicit dependencies for
8272 the commands executed to build targets.
8273
8274 By default, SCons will add to each target an implicit dependency on
8275 the command represented by the first argument of any command line
8276 it executes (which is typically the command itself). By setting
8277 such a dependency, SCons can determine that a target should be
8278 rebuilt if the command changes, such as when a compiler is upgraded
8279 to a new version. The specific file for the dependency is found by
8280 searching the PATH variable in the ENV dictionary in the
8281 construction environment used to execute the command. The default
8282 is the same as setting the construction variable
8283 $IMPLICIT_COMMAND_DEPENDENCIES to a True-like value (“true”, “yes”,
8284 or “1” - but not a number greater than one, as that has a different
8285 meaning).
8286
8287 Action strings can be segmented by the use of an AND operator, &&.
8288 In a segemented string, each segment is a separate “command line”,
8289 these are run sequentially until one fails or the entire sequence
8290 has been executed. If an action string is segmented, then the
8291 selected behavior of $IMPLICIT_COMMAND_DEPENDENCIES is applied to
8292 each segment.
8293
8294 If $IMPLICIT_COMMAND_DEPENDENCIES is set to a False-like value
8295 (“none”, “false”, “no”, “0”, etc.), then the implicit dependency
8296 will not be added to the targets built with that construction
8297 environment.
8298
8299 If $IMPLICIT_COMMAND_DEPENDENCIES is set to “2” or higher, then
8300 that number of arguments in the command line will be scanned for
8301 relative or absolute paths. If any are present, they will be added
8302 as implicit dependencies to the targets built with that
8303 construction environment. The first argument in the command line
8304 will be searched for using the PATH variable in the ENV dictionary
8305 in the construction environment used to execute the command. The
8306 other arguments will only be found if they are absolute paths or
8307 valid paths relative to the working directory.
8308
8309 If $IMPLICIT_COMMAND_DEPENDENCIES is set to “all”, then all
8310 arguments in the command line will be scanned for relative or
8311 absolute paths. If any are present, they will be added as implicit
8312 dependencies to the targets built with that construction
8313 environment. The first argument in the command line will be
8314 searched for using the PATH variable in the ENV dictionary in the
8315 construction environment used to execute the command. The other
8316 arguments will only be found if they are absolute paths or valid
8317 paths relative to the working directory.
8318
8319 env = Environment(IMPLICIT_COMMAND_DEPENDENCIES=False)
8320
8321 INCPREFIX
8322 The prefix used to specify an include directory on the C compiler
8323 command line. This will be prepended to each directory in the
8324 $CPPPATH and $FORTRANPATH construction variables when the
8325 $_CPPINCFLAGS and $_FORTRANINCFLAGS variables are automatically
8326 generated.
8327
8328 INCSUFFIX
8329 The suffix used to specify an include directory on the C compiler
8330 command line. This will be appended to each directory in the
8331 $CPPPATH and $FORTRANPATH construction variables when the
8332 $_CPPINCFLAGS and $_FORTRANINCFLAGS variables are automatically
8333 generated.
8334
8335 INSTALL
8336 A function to be called to install a file into a destination file
8337 name. The default function copies the file into the destination
8338 (and sets the destination file's mode and permission bits to match
8339 the source file's). The function takes the following arguments:
8340
8341 def install(dest, source, env):
8342
8343
8344 dest is the path name of the destination file. source is the path
8345 name of the source file. env is the construction environment (a
8346 dictionary of construction values) in force for this file
8347 installation.
8348
8349 INSTALLSTR
8350 The string displayed when a file is installed into a destination
8351 file name. The default is:
8352
8353 Install file: "$SOURCE" as "$TARGET"
8354
8355 INTEL_C_COMPILER_VERSION
8356 Set by the intelc Tool to the major version number of the Intel C
8357 compiler selected for use.
8358
8359 JAR
8360 The Java archive tool.
8361
8362 JARCHDIR
8363 The directory to which the Java archive tool should change (using
8364 the -C option).
8365
8366 JARCOM
8367 The command line used to call the Java archive tool.
8368
8369 JARCOMSTR
8370 The string displayed when the Java archive tool is called If this
8371 is not set, then $JARCOM (the command line) is displayed.
8372
8373 env = Environment(JARCOMSTR="JARchiving $SOURCES into $TARGET")
8374
8375 JARFLAGS
8376 General options passed to the Java archive tool. By default this is
8377 set to cf to create the necessary jar file.
8378
8379 JARSUFFIX
8380 The suffix for Java archives: .jar by default.
8381
8382 JAVABOOTCLASSPATH
8383 Specifies the list of directories that will be added to the javac
8384 command line via the -bootclasspath option. The individual
8385 directory names will be separated by the operating system's path
8386 separate character (: on UNIX/Linux/POSIX, ; on Windows).
8387
8388 JAVAC
8389 The Java compiler.
8390
8391 JAVACCOM
8392 The command line used to compile a directory tree containing Java
8393 source files to corresponding Java class files. Any options
8394 specified in the $JAVACFLAGS construction variable are included on
8395 this command line.
8396
8397 JAVACCOMSTR
8398 The string displayed when compiling a directory tree of Java source
8399 files to corresponding Java class files. If this is not set, then
8400 $JAVACCOM (the command line) is displayed.
8401
8402 env = Environment(JAVACCOMSTR="Compiling class files $TARGETS from $SOURCES")
8403
8404
8405 JAVACFLAGS
8406 General options that are passed to the Java compiler.
8407
8408 JAVACLASSDIR
8409 The directory in which Java class files may be found. This is
8410 stripped from the beginning of any Java .class file names supplied
8411 to the JavaH builder.
8412
8413 JAVACLASSPATH
8414 Specifies the list of directories that will be searched for Java
8415 .class file. The directories in this list will be added to the
8416 javac and javah command lines via the -classpath option. The
8417 individual directory names will be separated by the operating
8418 system's path separate character (: on UNIX/Linux/POSIX, ; on
8419 Windows).
8420
8421 Note that this currently just adds the specified directory via the
8422 -classpath option. SCons does not currently search the
8423 $JAVACLASSPATH directories for dependency .class files.
8424
8425 JAVACLASSSUFFIX
8426 The suffix for Java class files; .class by default.
8427
8428 JAVAH
8429 The Java generator for C header and stub files.
8430
8431 JAVAHCOM
8432 The command line used to generate C header and stub files from Java
8433 classes. Any options specified in the $JAVAHFLAGS construction
8434 variable are included on this command line.
8435
8436 JAVAHCOMSTR
8437 The string displayed when C header and stub files are generated
8438 from Java classes. If this is not set, then $JAVAHCOM (the command
8439 line) is displayed.
8440
8441 env = Environment(JAVAHCOMSTR="Generating header/stub file(s) $TARGETS from $SOURCES")
8442
8443 JAVAHFLAGS
8444 General options passed to the C header and stub file generator for
8445 Java classes.
8446
8447 JAVAINCLUDES
8448 Include path for Java header files (such as jni.h)
8449
8450 JAVASOURCEPATH
8451 Specifies the list of directories that will be searched for input
8452 .java file. The directories in this list will be added to the javac
8453 command line via the -sourcepath option. The individual directory
8454 names will be separated by the operating system's path separate
8455 character (: on UNIX/Linux/POSIX, ; on Windows).
8456
8457 Note that this currently just adds the specified directory via the
8458 -sourcepath option. SCons does not currently search the
8459 $JAVASOURCEPATH directories for dependency .java files.
8460
8461 JAVASUFFIX
8462 The suffix for Java files; .java by default.
8463
8464 JAVAVERSION
8465 Specifies the Java version being used by the Java builder. This is
8466 not currently used to select one version of the Java compiler vs.
8467 another. Instead, you should set this to specify the version of
8468 Java supported by your javac compiler. The default is 1.4.
8469
8470 This is sometimes necessary because Java 1.5 changed the file names
8471 that are created for nested anonymous inner classes, which can
8472 cause a mismatch with the files that SCons expects will be
8473 generated by the javac compiler. Setting $JAVAVERSION to 1.5 (or
8474 1.6, as appropriate) can make SCons realize that a Java 1.5 or 1.6
8475 build is actually up to date.
8476
8477 LATEX
8478 The LaTeX structured formatter and typesetter.
8479
8480 LATEXCOM
8481 The command line used to call the LaTeX structured formatter and
8482 typesetter.
8483
8484 LATEXCOMSTR
8485 The string displayed when calling the LaTeX structured formatter
8486 and typesetter. If this is not set, then $LATEXCOM (the command
8487 line) is displayed.
8488
8489 env = Environment(LATEXCOMSTR = "Building $TARGET from LaTeX input $SOURCES")
8490
8491 LATEXFLAGS
8492 General options passed to the LaTeX structured formatter and
8493 typesetter.
8494
8495 LATEXRETRIES
8496 The maximum number of times that LaTeX will be re-run if the .log
8497 generated by the $LATEXCOM command indicates that there are
8498 undefined references. The default is to try to resolve undefined
8499 references by re-running LaTeX up to three times.
8500
8501 LATEXSUFFIXES
8502 The list of suffixes of files that will be scanned for LaTeX
8503 implicit dependencies (\include or \import files). The default list
8504 is:
8505
8506 [".tex", ".ltx", ".latex"]
8507
8508 LDMODULE
8509 The linker for building loadable modules. By default, this is the
8510 same as $SHLINK.
8511
8512 LDMODULECOM
8513 The command line for building loadable modules. On Mac OS X, this
8514 uses the $LDMODULE, $LDMODULEFLAGS and $FRAMEWORKSFLAGS variables.
8515 On other systems, this is the same as $SHLINK.
8516
8517 LDMODULECOMSTR
8518 If set, the string displayed when building loadable modules. If not
8519 set, then $LDMODULECOM (the command line) is displayed.
8520
8521 LDMODULEEMITTER
8522 Contains the emitter specification for the LoadableModule builder.
8523 The manpage section "Builder Objects" contains general information
8524 on specifying emitters.
8525
8526 LDMODULEFLAGS
8527 General user options passed to the linker for building loadable
8528 modules.
8529
8530 LDMODULENOVERSIONSYMLINKS
8531 Instructs the LoadableModule builder to not automatically create
8532 symlinks for versioned modules. Defaults to $SHLIBNOVERSIONSYMLINKS
8533
8534 LDMODULEPREFIX
8535 The prefix used for loadable module file names. On Mac OS X, this
8536 is null; on other systems, this is the same as $SHLIBPREFIX.
8537
8538 _LDMODULESONAME
8539 A macro that automatically generates loadable module's SONAME based
8540 on $TARGET, $LDMODULEVERSION and $LDMODULESUFFIX. Used by
8541 LoadableModule builder when the linker tool supports SONAME (e.g.
8542 gnulink).
8543
8544 LDMODULESUFFIX
8545 The suffix used for loadable module file names. On Mac OS X, this
8546 is null; on other systems, this is the same as $SHLIBSUFFIX.
8547
8548 LDMODULEVERSION
8549 When this construction variable is defined, a versioned loadable
8550 module is created by LoadableModule builder. This activates the
8551 $_LDMODULEVERSIONFLAGS and thus modifies the $LDMODULECOM as
8552 required, adds the version number to the library name, and creates
8553 the symlinks that are needed. $LDMODULEVERSION versions should
8554 exist in the same format as $SHLIBVERSION.
8555
8556 _LDMODULEVERSIONFLAGS
8557 This macro automatically introduces extra flags to $LDMODULECOM
8558 when building versioned LoadableModule (that is when
8559 $LDMODULEVERSION is set). _LDMODULEVERSIONFLAGS usually adds
8560 $SHLIBVERSIONFLAGS and some extra dynamically generated options
8561 (such as -Wl,-soname=$_LDMODULESONAME). It is unused by plain
8562 (unversioned) loadable modules.
8563
8564 LDMODULEVERSIONFLAGS
8565 Extra flags added to $LDMODULECOM when building versioned
8566 LoadableModule. These flags are only used when $LDMODULEVERSION is
8567 set.
8568
8569 LEX
8570 The lexical analyzer generator.
8571
8572 LEXCOM
8573 The command line used to call the lexical analyzer generator to
8574 generate a source file.
8575
8576 LEXCOMSTR
8577 The string displayed when generating a source file using the
8578 lexical analyzer generator. If this is not set, then $LEXCOM (the
8579 command line) is displayed.
8580
8581 env = Environment(LEXCOMSTR = "Lex'ing $TARGET from $SOURCES")
8582
8583 LEXFLAGS
8584 General options passed to the lexical analyzer generator.
8585
8586 LEXUNISTD
8587 Used only on windows environments to set a lex flag to prevent
8588 'unistd.h' from being included. The default value is '--nounistd'.
8589
8590 _LIBDIRFLAGS
8591 An automatically-generated construction variable containing the
8592 linker command-line options for specifying directories to be
8593 searched for library. The value of $_LIBDIRFLAGS is created by
8594 respectively prepending and appending $LIBDIRPREFIX and
8595 $LIBDIRSUFFIX to each directory in $LIBPATH.
8596
8597 LIBDIRPREFIX
8598 The prefix used to specify a library directory on the linker
8599 command line. This will be prepended to each directory in the
8600 $LIBPATH construction variable when the $_LIBDIRFLAGS variable is
8601 automatically generated.
8602
8603 LIBDIRSUFFIX
8604 The suffix used to specify a library directory on the linker
8605 command line. This will be appended to each directory in the
8606 $LIBPATH construction variable when the $_LIBDIRFLAGS variable is
8607 automatically generated.
8608
8609 LIBEMITTER
8610 Contains the emitter specification for the StaticLibrary builder.
8611 The manpage section "Builder Objects" contains general information
8612 on specifying emitters.
8613
8614 _LIBFLAGS
8615 An automatically-generated construction variable containing the
8616 linker command-line options for specifying libraries to be linked
8617 with the resulting target. The value of $_LIBFLAGS is created by
8618 respectively prepending and appending $LIBLINKPREFIX and
8619 $LIBLINKSUFFIX to each filename in $LIBS.
8620
8621 LIBLINKPREFIX
8622 The prefix used to specify a library to link on the linker command
8623 line. This will be prepended to each library in the $LIBS
8624 construction variable when the $_LIBFLAGS variable is automatically
8625 generated.
8626
8627 LIBLINKSUFFIX
8628 The suffix used to specify a library to link on the linker command
8629 line. This will be appended to each library in the $LIBS
8630 construction variable when the $_LIBFLAGS variable is automatically
8631 generated.
8632
8633 LIBPATH
8634 The list of directories that will be searched for libraries
8635 specified by the $LIBS construction variable. $LIBPATH should be a
8636 list of path strings, or a single string, not a pathname list
8637 joined by Python's os.sep.
8638
8639 Do not put library search directives directly into $LINKFLAGS or
8640 $SHLINKFLAGS as the result will be non-portable.
8641
8642 Note: directory names in $LIBPATH will be looked-up relative to the
8643 directory of the SConscript file when they are used in a command.
8644 To force scons to look-up a directory relative to the root of the
8645 source tree use the # prefix:
8646
8647 env = Environment(LIBPATH='#/libs')
8648
8649 The directory look-up can also be forced using the Dir function:
8650
8651 libs = Dir('libs')
8652 env = Environment(LIBPATH=libs)
8653
8654 The directory list will be added to command lines through the
8655 automatically-generated $_LIBDIRFLAGS construction variable, which
8656 is constructed by respectively prepending and appending the values
8657 of the $LIBDIRPREFIX and $LIBDIRSUFFIX construction variables to
8658 each directory in $LIBPATH. Any command lines you define that need
8659 the $LIBPATH directory list should include $_LIBDIRFLAGS:
8660
8661 env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE")
8662
8663 LIBPREFIX
8664 The prefix used for (static) library file names. A default value is
8665 set for each platform (posix, win32, os2, etc.), but the value is
8666 overridden by individual tools (ar, mslib, sgiar, sunar, tlib,
8667 etc.) to reflect the names of the libraries they create.
8668
8669 LIBPREFIXES
8670 A list of all legal prefixes for library file names. When searching
8671 for library dependencies, SCons will look for files with these
8672 prefixes, the base library name, and suffixes from the $LIBSUFFIXES
8673 list.
8674
8675 LIBS
8676 A list of one or more libraries that will be added to the link line
8677 for linking with any executable program, shared library, or
8678 loadable module created by the construction environment or
8679 override.
8680
8681 String-valued library names should include only the library base
8682 names, without prefixes such as lib or suffixes such as .so or
8683 .dll. The library list will be added to command lines through the
8684 automatically-generated $_LIBFLAGS construction variable which is
8685 constructed by respectively prepending and appending the values of
8686 the $LIBLINKPREFIX and $LIBLINKSUFFIX construction variables to
8687 each library name in $LIBS. Library name strings should not include
8688 a path component, instead the compiler will be directed to look for
8689 libraries in the paths specified by $LIBPATH.
8690
8691 Any command lines you define that need the $LIBS library list
8692 should include $_LIBFLAGS:
8693
8694 env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE")
8695
8696 If you add a File object to the $LIBS list, the name of that file
8697 will be added to $_LIBFLAGS, and thus to the link line, as-is,
8698 without $LIBLINKPREFIX or $LIBLINKSUFFIX. For example:
8699
8700 env.Append(LIBS=File('/tmp/mylib.so'))
8701
8702 In all cases, scons will add dependencies from the executable
8703 program to all the libraries in this list.
8704
8705 LIBSUFFIX
8706 The suffix used for (static) library file names. A default value is
8707 set for each platform (posix, win32, os2, etc.), but the value is
8708 overridden by individual tools (ar, mslib, sgiar, sunar, tlib,
8709 etc.) to reflect the names of the libraries they create.
8710
8711 LIBSUFFIXES
8712 A list of all legal suffixes for library file names. When searching
8713 for library dependencies, SCons will look for files with prefixes
8714 from the $LIBPREFIXES list, the base library name, and these
8715 suffixes.
8716
8717 LICENSE
8718 The abbreviated name, preferably the SPDX code, of the license
8719 under which this project is released (GPL-3.0, LGPL-2.1,
8720 BSD-2-Clause etc.). See
8721 http://www.opensource.org/licenses/alphabetical[4] for a list of
8722 license names and SPDX codes.
8723
8724 See the Package builder.
8725
8726 LINESEPARATOR
8727 The separator used by the Substfile and Textfile builders. This
8728 value is used between sources when constructing the target. It
8729 defaults to the current system line separator.
8730
8731 LINGUAS_FILE
8732 The $LINGUAS_FILE defines file(s) containing list of additional
8733 linguas to be processed by POInit, POUpdate or MOFiles builders. It
8734 also affects Translate builder. If the variable contains a string,
8735 it defines name of the list file. The $LINGUAS_FILE may be a list
8736 of file names as well. If $LINGUAS_FILE is set to True (or non-zero
8737 numeric value), the list will be read from default file named
8738 LINGUAS.
8739
8740 LINK
8741 The linker. See also $SHLINK for linking shared objects.
8742
8743 On POSIX systems (those using the link tool), you should normally
8744 not change this value as it defaults to a "smart" linker tool which
8745 selects a compiler driver matching the type of source files in use.
8746 So for example, if you set $CXX to a specific compiler name, and
8747 are compiling C++ sources, the smartlink function will
8748 automatically select the same compiler for linking.
8749
8750 LINKCOM
8751 The command line used to link object files into an executable. See
8752 also $SHLINKCOM for linking shared objects.
8753
8754 LINKCOMSTR
8755 If set, the string displayed when object files are linked into an
8756 executable. If not set, then $LINKCOM (the command line) is
8757 displayed. See also $SHLINKCOMSTR. for linking shared objects.
8758
8759 env = Environment(LINKCOMSTR = "Linking $TARGET")
8760
8761 LINKFLAGS
8762 General user options passed to the linker. Note that this variable
8763 should not contain -l (or similar) options for linking with the
8764 libraries listed in $LIBS, nor -L (or similar) library search path
8765 options that scons generates automatically from $LIBPATH. See
8766 $_LIBFLAGS above, for the variable that expands to library-link
8767 options, and $_LIBDIRFLAGS above, for the variable that expands to
8768 library search path options. See also $SHLINKFLAGS. for linking
8769 shared objects.
8770
8771 M4
8772 The M4 macro preprocessor.
8773
8774 M4COM
8775 The command line used to pass files through the M4 macro
8776 preprocessor.
8777
8778 M4COMSTR
8779 The string displayed when a file is passed through the M4 macro
8780 preprocessor. If this is not set, then $M4COM (the command line) is
8781 displayed.
8782
8783 M4FLAGS
8784 General options passed to the M4 macro preprocessor.
8785
8786 MAKEINDEX
8787 The makeindex generator for the TeX formatter and typesetter and
8788 the LaTeX structured formatter and typesetter.
8789
8790 MAKEINDEXCOM
8791 The command line used to call the makeindex generator for the TeX
8792 formatter and typesetter and the LaTeX structured formatter and
8793 typesetter.
8794
8795 MAKEINDEXCOMSTR
8796 The string displayed when calling the makeindex generator for the
8797 TeX formatter and typesetter and the LaTeX structured formatter and
8798 typesetter. If this is not set, then $MAKEINDEXCOM (the command
8799 line) is displayed.
8800
8801 MAKEINDEXFLAGS
8802 General options passed to the makeindex generator for the TeX
8803 formatter and typesetter and the LaTeX structured formatter and
8804 typesetter.
8805
8806 MAXLINELENGTH
8807 The maximum number of characters allowed on an external command
8808 line. On Win32 systems, link lines longer than this many characters
8809 are linked via a temporary file name.
8810
8811 MIDL
8812 The Microsoft IDL compiler.
8813
8814 MIDLCOM
8815 The command line used to pass files to the Microsoft IDL compiler.
8816
8817 MIDLCOMSTR
8818 The string displayed when the Microsoft IDL compiler is called. If
8819 this is not set, then $MIDLCOM (the command line) is displayed.
8820
8821 MIDLFLAGS
8822 General options passed to the Microsoft IDL compiler.
8823
8824 MOSUFFIX
8825 Suffix used for MO files (default: '.mo'). See msgfmt tool and
8826 MOFiles builder.
8827
8828 MSGFMT
8829 Absolute path to msgfmt(1) binary, found by Detect(). See msgfmt
8830 tool and MOFiles builder.
8831
8832 MSGFMTCOM
8833 Complete command line to run msgfmt(1) program. See msgfmt tool and
8834 MOFiles builder.
8835
8836 MSGFMTCOMSTR
8837 String to display when msgfmt(1) is invoked (default: '', which
8838 means ``print $MSGFMTCOM''). See msgfmt tool and MOFiles builder.
8839
8840 MSGFMTFLAGS
8841 Additional flags to msgfmt(1). See msgfmt tool and MOFiles builder.
8842
8843 MSGINIT
8844 Path to msginit(1) program (found via Detect()). See msginit tool
8845 and POInit builder.
8846
8847 MSGINITCOM
8848 Complete command line to run msginit(1) program. See msginit tool
8849 and POInit builder.
8850
8851 MSGINITCOMSTR
8852 String to display when msginit(1) is invoked (default: '', which
8853 means ``print $MSGINITCOM''). See msginit tool and POInit builder.
8854
8855 MSGINITFLAGS
8856 List of additional flags to msginit(1) (default: []). See msginit
8857 tool and POInit builder.
8858
8859 _MSGINITLOCALE
8860 Internal ``macro''. Computes locale (language) name based on target
8861 filename (default: '${TARGET.filebase}').
8862
8863 See msginit tool and POInit builder.
8864
8865 MSGMERGE
8866 Absolute path to msgmerge(1) binary as found by Detect(). See
8867 msgmerge tool and POUpdate builder.
8868
8869 MSGMERGECOM
8870 Complete command line to run msgmerge(1) command. See msgmerge tool
8871 and POUpdate builder.
8872
8873 MSGMERGECOMSTR
8874 String to be displayed when msgmerge(1) is invoked (default: '',
8875 which means ``print $MSGMERGECOM''). See msgmerge tool and POUpdate
8876 builder.
8877
8878 MSGMERGEFLAGS
8879 Additional flags to msgmerge(1) command. See msgmerge tool and
8880 POUpdate builder.
8881
8882 MSSDK_DIR
8883 The directory containing the Microsoft SDK (either Platform SDK or
8884 Windows SDK) to be used for compilation.
8885
8886 MSSDK_VERSION
8887 The version string of the Microsoft SDK (either Platform SDK or
8888 Windows SDK) to be used for compilation. Supported versions include
8889 6.1, 6.0A, 6.0, 2003R2 and 2003R1.
8890
8891 MSVC_BATCH
8892 When set to any true value, specifies that SCons should batch
8893 compilation of object files when calling the Microsoft Visual C/C++
8894 compiler. All compilations of source files from the same source
8895 directory that generate target files in a same output directory and
8896 were configured in SCons using the same construction environment
8897 will be built in a single call to the compiler. Only source files
8898 that have changed since their object files were built will be
8899 passed to each compiler invocation (via the $CHANGED_SOURCES
8900 construction variable). Any compilations where the object (target)
8901 file base name (minus the .obj) does not match the source file base
8902 name will be compiled separately.
8903
8904 MSVC_USE_SCRIPT
8905 Use a batch script to set up the Microsoft Visual C++ compiler.
8906
8907 If set to the name of a Visual Studio .bat file (e.g. vcvars.bat),
8908 SCons will run that batch file instead of the auto-detected one,
8909 and extract the relevant variables from the result (typically
8910 %INCLUDE%, %LIB%, and %PATH%) for supplying to the build. This can
8911 be useful to force the use of a compiler version that SCons does
8912 not detect.
8913
8914 Setting $MSVC_USE_SCRIPT to None bypasses the Visual Studio
8915 autodetection entirely; use this if you are running SCons in a
8916 Visual Studio cmd window and importing the shell's environment
8917 variables - that is, if you are sure everything is set correctly
8918 already and you don't want SCons to change anything.
8919
8920
8921 $MSVC_USE_SCRIPT overrides $MSVC_VERSION and $TARGET_ARCH.
8922
8923 MSVC_UWP_APP
8924 Build libraries for a Universal Windows Platform (UWP) Application.
8925
8926 If $MSVC_UWP_APP is set, the Visual C++ environment will be set up
8927 to point to the Windows Store compatible libraries and Visual C++
8928 runtimes. In doing so, any libraries that are built will be able to
8929 be used in a UWP App and published to the Windows Store. This flag
8930 will only have an effect with Visual Studio 2015 or later. This
8931 variable must be passed as an argument to the Environment()
8932 constructor; setting it later has no effect.
8933
8934 Valid values are '1' or '0'
8935
8936 MSVC_VERSION
8937 Sets the preferred version of Microsoft Visual C/C++ to use.
8938
8939 If $MSVC_VERSION is not set, SCons will (by default) select the
8940 latest version of Visual C/C++ installed on your system. If the
8941 specified version isn't installed, tool initialization will fail.
8942 This variable must be passed as an argument to the Environment
8943 constructor; setting it later has no effect.
8944
8945 Valid values for Windows are 14.2, 14.1, 14.1Exp, 14.0, 14.0Exp,
8946 12.0, 12.0Exp, 11.0, 11.0Exp, 10.0, 10.0Exp, 9.0, 9.0Exp, 8.0,
8947 8.0Exp, 7.1, 7.0, and 6.0. Versions ending in Exp refer to
8948 "Express" or "Express for Desktop" editions.
8949
8950 MSVS
8951 When the Microsoft Visual Studio tools are initialized, they set up
8952 this dictionary with the following keys:
8953
8954 VERSION
8955 the version of MSVS being used (can be set via $MSVS_VERSION)
8956
8957 VERSIONS
8958 the available versions of MSVS installed
8959
8960 VCINSTALLDIR
8961 installed directory of Visual C++
8962
8963 VSINSTALLDIR
8964 installed directory of Visual Studio
8965
8966 FRAMEWORKDIR
8967 installed directory of the .NET framework
8968
8969 FRAMEWORKVERSIONS
8970 list of installed versions of the .NET framework, sorted latest
8971 to oldest.
8972
8973 FRAMEWORKVERSION
8974 latest installed version of the .NET framework
8975
8976 FRAMEWORKSDKDIR
8977 installed location of the .NET SDK.
8978
8979 PLATFORMSDKDIR
8980 installed location of the Platform SDK.
8981
8982 PLATFORMSDK_MODULES
8983 dictionary of installed Platform SDK modules, where the
8984 dictionary keys are keywords for the various modules, and the
8985 values are 2-tuples where the first is the release date, and
8986 the second is the version number.
8987
8988 If a value is not set, it was not available in the registry.
8989
8990 MSVS_ARCH
8991 Sets the architecture for which the generated project(s) should
8992 build.
8993
8994 The default value is x86. amd64 is also supported by SCons for
8995 most Visual Studio versions. Since Visual Studio 2015 arm is
8996 supported, and since Visual Studio 2017 arm64 is supported. Trying
8997 to set $MSVS_ARCH to an architecture that's not supported for a
8998 given Visual Studio version will generate an error.
8999
9000 MSVS_PROJECT_GUID
9001 The string placed in a generated Microsoft Visual Studio project
9002 file as the value of the ProjectGUID attribute. There is no default
9003 value. If not defined, a new GUID is generated.
9004
9005 MSVS_SCC_AUX_PATH
9006 The path name placed in a generated Microsoft Visual Studio project
9007 file as the value of the SccAuxPath attribute if the
9008 MSVS_SCC_PROVIDER construction variable is also set. There is no
9009 default value.
9010
9011 MSVS_SCC_CONNECTION_ROOT
9012 The root path of projects in your SCC workspace, i.e the path under
9013 which all project and solution files will be generated. It is used
9014 as a reference path from which the relative paths of the generated
9015 Microsoft Visual Studio project and solution files are computed.
9016 The relative project file path is placed as the value of the
9017 SccLocalPath attribute of the project file and as the values of the
9018 SccProjectFilePathRelativizedFromConnection[i] (where [i] ranges
9019 from 0 to the number of projects in the solution) attributes of the
9020 GlobalSection(SourceCodeControl) section of the Microsoft Visual
9021 Studio solution file. Similarly the relative solution file path is
9022 placed as the values of the SccLocalPath[i] (where [i] ranges from
9023 0 to the number of projects in the solution) attributes of the
9024 GlobalSection(SourceCodeControl) section of the Microsoft Visual
9025 Studio solution file. This is used only if the MSVS_SCC_PROVIDER
9026 construction variable is also set. The default value is the current
9027 working directory.
9028
9029 MSVS_SCC_PROJECT_NAME
9030 The project name placed in a generated Microsoft Visual Studio
9031 project file as the value of the SccProjectName attribute if the
9032 MSVS_SCC_PROVIDER construction variable is also set. In this case
9033 the string is also placed in the SccProjectName0 attribute of the
9034 GlobalSection(SourceCodeControl) section of the Microsoft Visual
9035 Studio solution file. There is no default value.
9036
9037 MSVS_SCC_PROVIDER
9038 The string placed in a generated Microsoft Visual Studio project
9039 file as the value of the SccProvider attribute. The string is also
9040 placed in the SccProvider0 attribute of the
9041 GlobalSection(SourceCodeControl) section of the Microsoft Visual
9042 Studio solution file. There is no default value.
9043
9044 MSVS_VERSION
9045 Sets the preferred version of Microsoft Visual Studio to use.
9046
9047 If $MSVS_VERSION is not set, SCons will (by default) select the
9048 latest version of Visual Studio installed on your system. So, if
9049 you have version 6 and version 7 (MSVS .NET) installed, it will
9050 prefer version 7. You can override this by specifying the
9051 MSVS_VERSION variable in the Environment initialization, setting it
9052 to the appropriate version ('6.0' or '7.0', for example). If the
9053 specified version isn't installed, tool initialization will fail.
9054
9055 This is obsolete: use $MSVC_VERSION instead. If $MSVS_VERSION is
9056 set and $MSVC_VERSION is not, $MSVC_VERSION will be set
9057 automatically to $MSVS_VERSION. If both are set to different
9058 values, scons will raise an error.
9059
9060 MSVSBUILDCOM
9061 The build command line placed in a generated Microsoft Visual
9062 Studio project file. The default is to have Visual Studio invoke
9063 SCons with any specified build targets.
9064
9065 MSVSCLEANCOM
9066 The clean command line placed in a generated Microsoft Visual
9067 Studio project file. The default is to have Visual Studio invoke
9068 SCons with the -c option to remove any specified targets.
9069
9070 MSVSENCODING
9071 The encoding string placed in a generated Microsoft Visual Studio
9072 project file. The default is encoding Windows-1252.
9073
9074 MSVSPROJECTCOM
9075 The action used to generate Microsoft Visual Studio project files.
9076
9077 MSVSPROJECTSUFFIX
9078 The suffix used for Microsoft Visual Studio project (DSP) files.
9079 The default value is .vcproj when using Visual Studio version 7.x
9080 (.NET) or later version, and .dsp when using earlier versions of
9081 Visual Studio.
9082
9083 MSVSREBUILDCOM
9084 The rebuild command line placed in a generated Microsoft Visual
9085 Studio project file. The default is to have Visual Studio invoke
9086 SCons with any specified rebuild targets.
9087
9088 MSVSSCONS
9089 The SCons used in generated Microsoft Visual Studio project files.
9090 The default is the version of SCons being used to generate the
9091 project file.
9092
9093 MSVSSCONSCOM
9094 The default SCons command used in generated Microsoft Visual Studio
9095 project files.
9096
9097 MSVSSCONSCRIPT
9098 The sconscript file (that is, SConstruct or SConscript file) that
9099 will be invoked by Visual Studio project files (through the
9100 $MSVSSCONSCOM variable). The default is the same sconscript file
9101 that contains the call to MSVSProject to build the project file.
9102
9103 MSVSSCONSFLAGS
9104 The SCons flags used in generated Microsoft Visual Studio project
9105 files.
9106
9107 MSVSSOLUTIONCOM
9108 The action used to generate Microsoft Visual Studio solution files.
9109
9110 MSVSSOLUTIONSUFFIX
9111 The suffix used for Microsoft Visual Studio solution (DSW) files.
9112 The default value is .sln when using Visual Studio version 7.x
9113 (.NET), and .dsw when using earlier versions of Visual Studio.
9114
9115 MT
9116 The program used on Windows systems to embed manifests into DLLs
9117 and EXEs. See also $WINDOWS_EMBED_MANIFEST.
9118
9119 MTEXECOM
9120 The Windows command line used to embed manifests into executables.
9121 See also $MTSHLIBCOM.
9122
9123 MTFLAGS
9124 Flags passed to the $MT manifest embedding program (Windows only).
9125
9126 MTSHLIBCOM
9127 The Windows command line used to embed manifests into shared
9128 libraries (DLLs). See also $MTEXECOM.
9129
9130 MWCW_VERSION
9131 The version number of the MetroWerks CodeWarrior C compiler to be
9132 used.
9133
9134 MWCW_VERSIONS
9135 A list of installed versions of the MetroWerks CodeWarrior C
9136 compiler on this system.
9137
9138 NAME
9139 Specfies the name of the project to package.
9140
9141 See the Package builder.
9142
9143 NINJA_ALIAS_NAME
9144 Name of the Alias() which is will cause SCons to create the
9145 ninja.build file, and then (optionally) run ninja.
9146
9147 NINJA_COMPDB_EXPAND
9148 Boolean value (True|False) to instruct ninja to expand the command
9149 line arguments normally put into response files. This prevents
9150 lines in the compilation database like “gcc @rsp_file” and instead
9151 yields “gcc -c -o myfile.o myfile.c -Ia -DXYZ”
9152
9153 Ninja's compdb tool added the “-x” flag in Ninja V1.9.0
9154
9155 NINJA_DIR
9156 This propagates directly into the generated ninja.build file. From
9157 Ninja's docs: builddir A directory for some Ninja output files. ...
9158 (You can also store other build output in this directory.)
9159
9160 NINJA_DISABLE_AUTO_RUN
9161 Boolean (True|False). Default: False When True, SCons will not run
9162 ninja automatically after creating the ninja.build file. If not
9163 set, this will be set to True if “--disable_execute_ninja” or
9164 SetOption('disable_execute_ninja', True)
9165
9166 NINJA_ENV_VAR_CACHE
9167 A string that sets the environment for any environment variables
9168 that differ between the OS environment and the SCons command ENV.
9169 It will be compatible with the default shell of the operating
9170 system. If not explicitly specified, SCons will generate this
9171 dynamically from the Environment()'s 'ENV' “env['ENV']” where those
9172 values differ from the existing shell..
9173
9174 NINJA_FILE_NAME
9175 The filename for the generated Ninja build file defaults to
9176 ninja.build
9177
9178 NINJA_GENERATED_SOURCE_SUFFIXES
9179 The list of source file suffixes which are generated by SCons build
9180 steps. All source files which match these suffixes will be added to
9181 the _generated_sources alias in the output ninja.build file. Then
9182 all other source files will be made to depend on this in the
9183 ninja.build file, forcing the generated sources to be built first.
9184
9185 NINJA_MSVC_DEPS_PREFIX
9186 This propagates directly into the generated ninja.build file. From
9187 Ninja's docs “defines the string which should be stripped from
9188 msvc’s /showIncludes output”
9189
9190 NINJA_POOL
9191 Set the “ninja_pool” for this or all targets in scope for this env
9192 var.
9193
9194 NINJA_REGENERATE_DEPS
9195 A generator function used to create a ninja depsfile which includes
9196 all the files which would require SCons to be invoked if they
9197 change. Or a list of said files.
9198
9199 _NINJA_REGENERATE_DEPS_FUNC
9200 Internal value used to specify the function to call with argument
9201 env to generate the list of files which if changed would require
9202 the ninja file to be regenerated.
9203
9204 NINJA_SYNTAX
9205 Theres also NINJA_SYNTAX which is the path to a custom
9206 ninja_syntax.py file which is used in generation. The tool
9207 currently assumes you have ninja installed through pip, and grabs
9208 the syntax file from that installation if none specified.
9209
9210 no_import_lib
9211 When set to non-zero, suppresses creation of a corresponding
9212 Windows static import lib by the SharedLibrary builder when used
9213 with MinGW, Microsoft Visual Studio or Metrowerks. This also
9214 suppresses creation of an export (.exp) file when using Microsoft
9215 Visual Studio.
9216
9217 OBJPREFIX
9218 The prefix used for (static) object file names.
9219
9220 OBJSUFFIX
9221 The suffix used for (static) object file names.
9222
9223 PACKAGEROOT
9224 Specifies the directory where all files in resulting archive will
9225 be placed if applicable. The default value is “$NAME-$VERSION”.
9226
9227 See the Package builder.
9228
9229 PACKAGETYPE
9230 Selects the package type to build when using the Package builder.
9231 May be a string or list of strings. See the docuentation for the
9232 builder for the currently supported types.
9233
9234
9235 $PACKAGETYPE may be overridden with the --package-type command line
9236 option.
9237
9238 See the Package builder.
9239
9240 PACKAGEVERSION
9241 The version of the package (not the underlying project). This is
9242 currently only used by the rpm packager and should reflect changes
9243 in the packaging, not the underlying project code itself.
9244
9245 See the Package builder.
9246
9247 PCH
9248 The Microsoft Visual C++ precompiled header that will be used when
9249 compiling object files. This variable is ignored by tools other
9250 than Microsoft Visual C++. When this variable is defined SCons will
9251 add options to the compiler command line to cause it to use the
9252 precompiled header, and will also set up the dependencies for the
9253 PCH file. Example:
9254
9255 env['PCH'] = 'StdAfx.pch'
9256
9257 PCHCOM
9258 The command line used by the PCH builder to generated a precompiled
9259 header.
9260
9261 PCHCOMSTR
9262 The string displayed when generating a precompiled header. If this
9263 is not set, then $PCHCOM (the command line) is displayed.
9264
9265 PCHPDBFLAGS
9266 A construction variable that, when expanded, adds the /yD flag to
9267 the command line only if the $PDB construction variable is set.
9268
9269 PCHSTOP
9270 This variable specifies how much of a source file is precompiled.
9271 This variable is ignored by tools other than Microsoft Visual C++,
9272 or when the PCH variable is not being used. When this variable is
9273 define it must be a string that is the name of the header that is
9274 included at the end of the precompiled portion of the source files,
9275 or the empty string if the "#pragma hrdstop" construct is being
9276 used:
9277
9278 env['PCHSTOP'] = 'StdAfx.h'
9279
9280 PDB
9281 The Microsoft Visual C++ PDB file that will store debugging
9282 information for object files, shared libraries, and programs. This
9283 variable is ignored by tools other than Microsoft Visual C++. When
9284 this variable is defined SCons will add options to the compiler and
9285 linker command line to cause them to generate external debugging
9286 information, and will also set up the dependencies for the PDB
9287 file. Example:
9288
9289 env['PDB'] = 'hello.pdb'
9290
9291 The Visual C++ compiler switch that SCons uses by default to
9292 generate PDB information is /Z7. This works correctly with parallel
9293 (-j) builds because it embeds the debug information in the
9294 intermediate object files, as opposed to sharing a single PDB file
9295 between multiple object files. This is also the only way to get
9296 debug information embedded into a static library. Using the /Zi
9297 instead may yield improved link-time performance, although parallel
9298 builds will no longer work. You can generate PDB files with the /Zi
9299 switch by overriding the default $CCPDBFLAGS variable; see the
9300 entry for that variable for specific examples.
9301
9302 PDFLATEX
9303 The pdflatex utility.
9304
9305 PDFLATEXCOM
9306 The command line used to call the pdflatex utility.
9307
9308 PDFLATEXCOMSTR
9309 The string displayed when calling the pdflatex utility. If this is
9310 not set, then $PDFLATEXCOM (the command line) is displayed.
9311
9312 env = Environment(PDFLATEX;COMSTR = "Building $TARGET from LaTeX input $SOURCES")
9313
9314 PDFLATEXFLAGS
9315 General options passed to the pdflatex utility.
9316
9317 PDFPREFIX
9318 The prefix used for PDF file names.
9319
9320 PDFSUFFIX
9321 The suffix used for PDF file names.
9322
9323 PDFTEX
9324 The pdftex utility.
9325
9326 PDFTEXCOM
9327 The command line used to call the pdftex utility.
9328
9329 PDFTEXCOMSTR
9330 The string displayed when calling the pdftex utility. If this is
9331 not set, then $PDFTEXCOM (the command line) is displayed.
9332
9333 env = Environment(PDFTEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
9334
9335 PDFTEXFLAGS
9336 General options passed to the pdftex utility.
9337
9338 PKGCHK
9339 On Solaris systems, the package-checking program that will be used
9340 (along with $PKGINFO) to look for installed versions of the Sun PRO
9341 C++ compiler. The default is /usr/sbin/pgkchk.
9342
9343 PKGINFO
9344 On Solaris systems, the package information program that will be
9345 used (along with $PKGCHK) to look for installed versions of the Sun
9346 PRO C++ compiler. The default is pkginfo.
9347
9348 PLATFORM
9349 The name of the platform used to create the Environment. If no
9350 platform is specified when the Environment is created, scons
9351 autodetects the platform.
9352
9353 env = Environment(tools = [])
9354 if env['PLATFORM'] == 'cygwin':
9355 Tool('mingw')(env)
9356 else:
9357 Tool('msvc')(env)
9358
9359 POAUTOINIT
9360 The $POAUTOINIT variable, if set to True (on non-zero numeric
9361 value), let the msginit tool to automatically initialize missing PO
9362 files with msginit(1). This applies to both, POInit and POUpdate
9363 builders (and others that use any of them).
9364
9365 POCREATE_ALIAS
9366 Common alias for all PO files created with POInit builder (default:
9367 'po-create'). See msginit tool and POInit builder.
9368
9369 POSUFFIX
9370 Suffix used for PO files (default: '.po') See msginit tool and
9371 POInit builder.
9372
9373 POTDOMAIN
9374 The $POTDOMAIN defines default domain, used to generate POT
9375 filename as $POTDOMAIN.pot when no POT file name is provided by the
9376 user. This applies to POTUpdate, POInit and POUpdate builders (and
9377 builders, that use them, e.g. Translate). Normally (if $POTDOMAIN
9378 is not defined), the builders use messages.pot as default POT file
9379 name.
9380
9381 POTSUFFIX
9382 Suffix used for PO Template files (default: '.pot'). See xgettext
9383 tool and POTUpdate builder.
9384
9385 POTUPDATE_ALIAS
9386 Name of the common phony target for all PO Templates created with
9387 POUpdate (default: 'pot-update'). See xgettext tool and POTUpdate
9388 builder.
9389
9390 POUPDATE_ALIAS
9391 Common alias for all PO files being defined with POUpdate builder
9392 (default: 'po-update'). See msgmerge tool and POUpdate builder.
9393
9394 PRINT_CMD_LINE_FUNC
9395 A Python function used to print the command lines as they are
9396 executed (assuming command printing is not disabled by the -q or -s
9397 options or their equivalents). The function should take four
9398 arguments: s, the command being executed (a string), target, the
9399 target being built (file node, list, or string name(s)), source,
9400 the source(s) used (file node, list, or string name(s)), and env,
9401 the environment being used.
9402
9403 The function must do the printing itself. The default
9404 implementation, used if this variable is not set or is None, is:
9405
9406 def print_cmd_line(s, target, source, env):
9407 sys.stdout.write(s + "\n")
9408
9409 Here's an example of a more interesting function:
9410
9411 def print_cmd_line(s, target, source, env):
9412 sys.stdout.write("Building %s -> %s...\n" %
9413 (' and '.join([str(x) for x in source]),
9414 ' and '.join([str(x) for x in target])))
9415 env=Environment(PRINT_CMD_LINE_FUNC=print_cmd_line)
9416 env.Program('foo', 'foo.c')
9417
9418 This just prints "Building targetname from sourcename..." instead
9419 of the actual commands. Such a function could also log the actual
9420 commands to a log file, for example.
9421
9422 PROGEMITTER
9423 Contains the emitter specification for the Program builder. The
9424 manpage section "Builder Objects" contains general information on
9425 specifying emitters.
9426
9427 PROGPREFIX
9428 The prefix used for executable file names.
9429
9430 PROGSUFFIX
9431 The suffix used for executable file names.
9432
9433 PSCOM
9434 The command line used to convert TeX DVI files into a PostScript
9435 file.
9436
9437 PSCOMSTR
9438 The string displayed when a TeX DVI file is converted into a
9439 PostScript file. If this is not set, then $PSCOM (the command line)
9440 is displayed.
9441
9442 PSPREFIX
9443 The prefix used for PostScript file names.
9444
9445 PSSUFFIX
9446 The prefix used for PostScript file names.
9447
9448 QT_AUTOSCAN
9449 Turn off scanning for mocable files. Use the Moc Builder to
9450 explicitly specify files to run moc on.
9451
9452 QT_BINPATH
9453 The path where the qt binaries are installed. The default value is
9454 '$QTDIR/bin'.
9455
9456 QT_CPPPATH
9457 The path where the qt header files are installed. The default value
9458 is '$QTDIR/include'. Note: If you set this variable to None, the
9459 tool won't change the $CPPPATH construction variable.
9460
9461 QT_DEBUG
9462 Prints lots of debugging information while scanning for moc files.
9463
9464 QT_LIB
9465 Default value is 'qt'. You may want to set this to 'qt-mt'. Note:
9466 If you set this variable to None, the tool won't change the $LIBS
9467 variable.
9468
9469 QT_LIBPATH
9470 The path where the qt libraries are installed. The default value is
9471 '$QTDIR/lib'. Note: If you set this variable to None, the tool
9472 won't change the $LIBPATH construction variable.
9473
9474 QT_MOC
9475 Default value is '$QT_BINPATH/moc'.
9476
9477 QT_MOCCXXPREFIX
9478 Default value is ''. Prefix for moc output files, when source is a
9479 cxx file.
9480
9481 QT_MOCCXXSUFFIX
9482 Default value is '.moc'. Suffix for moc output files, when source
9483 is a cxx file.
9484
9485 QT_MOCFROMCXXCOM
9486 Command to generate a moc file from a cpp file.
9487
9488 QT_MOCFROMCXXCOMSTR
9489 The string displayed when generating a moc file from a cpp file. If
9490 this is not set, then $QT_MOCFROMCXXCOM (the command line) is
9491 displayed.
9492
9493 QT_MOCFROMCXXFLAGS
9494 Default value is '-i'. These flags are passed to moc, when moccing
9495 a C++ file.
9496
9497 QT_MOCFROMHCOM
9498 Command to generate a moc file from a header.
9499
9500 QT_MOCFROMHCOMSTR
9501 The string displayed when generating a moc file from a cpp file. If
9502 this is not set, then $QT_MOCFROMHCOM (the command line) is
9503 displayed.
9504
9505 QT_MOCFROMHFLAGS
9506 Default value is ''. These flags are passed to moc, when moccing a
9507 header file.
9508
9509 QT_MOCHPREFIX
9510 Default value is 'moc_'. Prefix for moc output files, when source
9511 is a header.
9512
9513 QT_MOCHSUFFIX
9514 Default value is '$CXXFILESUFFIX'. Suffix for moc output files,
9515 when source is a header.
9516
9517 QT_UIC
9518 Default value is '$QT_BINPATH/uic'.
9519
9520 QT_UICCOM
9521 Command to generate header files from .ui files.
9522
9523 QT_UICCOMSTR
9524 The string displayed when generating header files from .ui files.
9525 If this is not set, then $QT_UICCOM (the command line) is
9526 displayed.
9527
9528 QT_UICDECLFLAGS
9529 Default value is ''. These flags are passed to uic, when creating a
9530 a h file from a .ui file.
9531
9532 QT_UICDECLPREFIX
9533 Default value is ''. Prefix for uic generated header files.
9534
9535 QT_UICDECLSUFFIX
9536 Default value is '.h'. Suffix for uic generated header files.
9537
9538 QT_UICIMPLFLAGS
9539 Default value is ''. These flags are passed to uic, when creating a
9540 cxx file from a .ui file.
9541
9542 QT_UICIMPLPREFIX
9543 Default value is 'uic_'. Prefix for uic generated implementation
9544 files.
9545
9546 QT_UICIMPLSUFFIX
9547 Default value is '$CXXFILESUFFIX'. Suffix for uic generated
9548 implementation files.
9549
9550 QT_UISUFFIX
9551 Default value is '.ui'. Suffix of designer input files.
9552
9553 QTDIR
9554 The qt tool tries to take this from os.environ. It also initializes
9555 all QT_* construction variables listed below. (Note that all paths
9556 are constructed with python's os.path.join() method, but are listed
9557 here with the '/' separator for easier reading.) In addition, the
9558 construction environment variables $CPPPATH, $LIBPATH and $LIBS may
9559 be modified and the variables $PROGEMITTER, $SHLIBEMITTER and
9560 $LIBEMITTER are modified. Because the build-performance is affected
9561 when using this tool, you have to explicitly specify it at
9562 Environment creation:
9563
9564 Environment(tools=['default','qt'])
9565
9566 The qt tool supports the following operations:
9567
9568
9569 Automatic moc file generation from header files. You do not have
9570 to specify moc files explicitly, the tool does it for you. However,
9571 there are a few preconditions to do so: Your header file must have
9572 the same filebase as your implementation file and must stay in the
9573 same directory. It must have one of the suffixes .h, .hpp, .H,
9574 .hxx, .hh. You can turn off automatic moc file generation by
9575 setting QT_AUTOSCAN to 0. See also the corresponding Moc() builder
9576 method.
9577
9578
9579 Automatic moc file generation from cxx files. As stated in the qt
9580 documentation, include the moc file at the end of the cxx file.
9581 Note that you have to include the file, which is generated by the
9582 transformation ${QT_MOCCXXPREFIX}<basename>${QT_MOCCXXSUFFIX}, by
9583 default <basename>.moc. A warning is generated after building the
9584 moc file, if you do not include the correct file. If you are using
9585 VariantDir, you may need to specify duplicate=1. You can turn off
9586 automatic moc file generation by setting QT_AUTOSCAN to 0. See also
9587 the corresponding Moc builder method.
9588
9589
9590 Automatic handling of .ui files. The implementation files
9591 generated from .ui files are handled much the same as yacc or lex
9592 files. Each .ui file given as a source of Program, Library or
9593 SharedLibrary will generate three files, the declaration file, the
9594 implementation file and a moc file. Because there are also
9595 generated headers, you may need to specify duplicate=1 in calls to
9596 VariantDir. See also the corresponding Uic builder method.
9597
9598 RANLIB
9599 The archive indexer.
9600
9601 RANLIBCOM
9602 The command line used to index a static library archive.
9603
9604 RANLIBCOMSTR
9605 The string displayed when a static library archive is indexed. If
9606 this is not set, then $RANLIBCOM (the command line) is displayed.
9607
9608 env = Environment(RANLIBCOMSTR = "Indexing $TARGET")
9609
9610 RANLIBFLAGS
9611 General options passed to the archive indexer.
9612
9613 RC
9614 The resource compiler used to build a Microsoft Visual C++ resource
9615 file.
9616
9617 RCCOM
9618 The command line used to build a Microsoft Visual C++ resource
9619 file.
9620
9621 RCCOMSTR
9622 The string displayed when invoking the resource compiler to build a
9623 Microsoft Visual C++ resource file. If this is not set, then $RCCOM
9624 (the command line) is displayed.
9625
9626 RCFLAGS
9627 The flags passed to the resource compiler by the RES builder.
9628
9629 RCINCFLAGS
9630 An automatically-generated construction variable containing the
9631 command-line options for specifying directories to be searched by
9632 the resource compiler. The value of $RCINCFLAGS is created by
9633 respectively prepending and appending $RCINCPREFIX and $RCINCSUFFIX
9634 to the beginning and end of each directory in $CPPPATH.
9635
9636 RCINCPREFIX
9637 The prefix (flag) used to specify an include directory on the
9638 resource compiler command line. This will be prepended to the
9639 beginning of each directory in the $CPPPATH construction variable
9640 when the $RCINCFLAGS variable is expanded.
9641
9642 RCINCSUFFIX
9643 The suffix used to specify an include directory on the resource
9644 compiler command line. This will be appended to the end of each
9645 directory in the $CPPPATH construction variable when the
9646 $RCINCFLAGS variable is expanded.
9647
9648 RDirs
9649 A function that converts a string into a list of Dir instances by
9650 searching the repositories.
9651
9652 REGSVR
9653 The program used on Windows systems to register a newly-built DLL
9654 library whenever the SharedLibrary builder is passed a keyword
9655 argument of register=True.
9656
9657 REGSVRCOM
9658 The command line used on Windows systems to register a newly-built
9659 DLL library whenever the SharedLibrary builder is passed a keyword
9660 argument of register=True.
9661
9662 REGSVRCOMSTR
9663 The string displayed when registering a newly-built DLL file. If
9664 this is not set, then $REGSVRCOM (the command line) is displayed.
9665
9666 REGSVRFLAGS
9667 Flags passed to the DLL registration program on Windows systems
9668 when a newly-built DLL library is registered. By default, this
9669 includes the /s that prevents dialog boxes from popping up and
9670 requiring user attention.
9671
9672 RMIC
9673 The Java RMI stub compiler.
9674
9675 RMICCOM
9676 The command line used to compile stub and skeleton class files from
9677 Java classes that contain RMI implementations. Any options
9678 specified in the $RMICFLAGS construction variable are included on
9679 this command line.
9680
9681 RMICCOMSTR
9682 The string displayed when compiling stub and skeleton class files
9683 from Java classes that contain RMI implementations. If this is not
9684 set, then $RMICCOM (the command line) is displayed.
9685
9686 env = Environment(RMICCOMSTR = "Generating stub/skeleton class files $TARGETS from $SOURCES")
9687
9688 RMICFLAGS
9689 General options passed to the Java RMI stub compiler.
9690
9691 RPATH
9692 A list of paths to search for shared libraries when running
9693 programs. Currently only used in the GNU (gnulink), IRIX (sgilink)
9694 and Sun (sunlink) linkers. Ignored on platforms and toolchains that
9695 don't support it. Note that the paths added to RPATH are not
9696 transformed by scons in any way: if you want an absolute path, you
9697 must make it absolute yourself.
9698
9699 _RPATH
9700 An automatically-generated construction variable containing the
9701 rpath flags to be used when linking a program with shared
9702 libraries. The value of $_RPATH is created by respectively
9703 prepending $RPATHPREFIX and appending $RPATHSUFFIX to the beginning
9704 and end of each directory in $RPATH.
9705
9706 RPATHPREFIX
9707 The prefix used to specify a directory to be searched for shared
9708 libraries when running programs. This will be prepended to the
9709 beginning of each directory in the $RPATH construction variable
9710 when the $_RPATH variable is automatically generated.
9711
9712 RPATHSUFFIX
9713 The suffix used to specify a directory to be searched for shared
9714 libraries when running programs. This will be appended to the end
9715 of each directory in the $RPATH construction variable when the
9716 $_RPATH variable is automatically generated.
9717
9718 RPCGEN
9719 The RPC protocol compiler.
9720
9721 RPCGENCLIENTFLAGS
9722 Options passed to the RPC protocol compiler when generating client
9723 side stubs. These are in addition to any flags specified in the
9724 $RPCGENFLAGS construction variable.
9725
9726 RPCGENFLAGS
9727 General options passed to the RPC protocol compiler.
9728
9729 RPCGENHEADERFLAGS
9730 Options passed to the RPC protocol compiler when generating a
9731 header file. These are in addition to any flags specified in the
9732 $RPCGENFLAGS construction variable.
9733
9734 RPCGENSERVICEFLAGS
9735 Options passed to the RPC protocol compiler when generating server
9736 side stubs. These are in addition to any flags specified in the
9737 $RPCGENFLAGS construction variable.
9738
9739 RPCGENXDRFLAGS
9740 Options passed to the RPC protocol compiler when generating XDR
9741 routines. These are in addition to any flags specified in the
9742 $RPCGENFLAGS construction variable.
9743
9744 SCANNERS
9745 A list of the available implicit dependency scanners. New file
9746 scanners may be added by appending to this list, although the more
9747 flexible approach is to associate scanners with a specific Builder.
9748 See the manpage sections "Builder Objects" and "Scanner Objects"
9749 for more information.
9750
9751 SCONS_HOME
9752 The (optional) path to the SCons library directory, initialized
9753 from the external environment. If set, this is used to construct a
9754 shorter and more efficient search path in the $MSVSSCONS command
9755 line executed from Microsoft Visual Studio project files.
9756
9757 SHCC
9758 The C compiler used for generating shared-library objects. See also
9759 $CC for compiling to static objects.
9760
9761 SHCCCOM
9762 The command line used to compile a C source file to a
9763 shared-library object file. Any options specified in the $SHCFLAGS,
9764 $SHCCFLAGS and $CPPFLAGS construction variables are included on
9765 this command line. See also $CCCOM for compiling to static objects.
9766
9767 SHCCCOMSTR
9768 If set, the string displayed when a C source file is compiled to a
9769 shared object file. If not set, then $SHCCCOM (the command line) is
9770 displayed. See also $CCCOMSTR for compiling to static objects.
9771
9772 env = Environment(SHCCCOMSTR = "Compiling shared object $TARGET")
9773
9774 SHCCFLAGS
9775 Options that are passed to the C and C++ compilers to generate
9776 shared-library objects. See also $CCFLAGS for compiling to static
9777 objects.
9778
9779 SHCFLAGS
9780 Options that are passed to the C compiler (only; not C++) to
9781 generate shared-library objects. See also $CFLAGS for compiling to
9782 static objects.
9783
9784 SHCXX
9785 The C++ compiler used for generating shared-library objects. See
9786 also $CXX for compiling to static objects.
9787
9788 SHCXXCOM
9789 The command line used to compile a C++ source file to a
9790 shared-library object file. Any options specified in the
9791 $SHCXXFLAGS and $CPPFLAGS construction variables are included on
9792 this command line. See also $CXXCOM for compiling to static
9793 objects.
9794
9795 SHCXXCOMSTR
9796 If set, the string displayed when a C++ source file is compiled to
9797 a shared object file. If not set, then $SHCXXCOM (the command line)
9798 is displayed. See also $CXXCOMSTR for compiling to static objects.
9799
9800 env = Environment(SHCXXCOMSTR = "Compiling shared object $TARGET")
9801
9802 SHCXXFLAGS
9803 Options that are passed to the C++ compiler to generate
9804 shared-library objects. See also $CXXFLAGS for compiling to static
9805 objects.
9806
9807 SHDC
9808 The name of the compiler to use when compiling D source destined to
9809 be in a shared objects. See also $DC for compiling to static
9810 objects.
9811
9812 SHDCOM
9813 The command line to use when compiling code to be part of shared
9814 objects. See also $DCOM for compiling to static objects.
9815
9816 SHDCOMSTR
9817 If set, the string displayed when a D source file is compiled to a
9818 (shared) object file. If not set, then $SHDCOM (the command line)
9819 is displayed. See also $DCOMSTR for compiling to static objects.
9820
9821 SHDLIBVERSIONFLAGS
9822 Extra flags added to $SHDLINKCOM when building versioned
9823 SharedLibrary. These flags are only used when $SHLIBVERSION is set.
9824
9825 SHDLINK
9826 The linker to use when creating shared objects for code bases
9827 include D sources. See also $DLINK for linking static objects.
9828
9829 SHDLINKCOM
9830 The command line to use when generating shared objects. See also
9831 $DLINKCOM for linking static objects.
9832
9833 SHDLINKFLAGS
9834 The list of flags to use when generating a shared object. See also
9835 $DLINKFLAGS for linking static objects.
9836
9837 SHELL
9838 A string naming the shell program that will be passed to the $SPAWN
9839 function. See the $SPAWN construction variable for more
9840 information.
9841
9842 SHF03
9843 The Fortran 03 compiler used for generating shared-library objects.
9844 You should normally set the $SHFORTRAN variable, which specifies
9845 the default Fortran compiler for all Fortran versions. You only
9846 need to set $SHF03 if you need to use a specific compiler or
9847 compiler version for Fortran 03 files.
9848
9849 SHF03COM
9850 The command line used to compile a Fortran 03 source file to a
9851 shared-library object file. You only need to set $SHF03COM if you
9852 need to use a specific command line for Fortran 03 files. You
9853 should normally set the $SHFORTRANCOM variable, which specifies the
9854 default command line for all Fortran versions.
9855
9856 SHF03COMSTR
9857 If set, the string displayed when a Fortran 03 source file is
9858 compiled to a shared-library object file. If not set, then
9859 $SHF03COM or $SHFORTRANCOM (the command line) is displayed.
9860
9861 SHF03FLAGS
9862 Options that are passed to the Fortran 03 compiler to generated
9863 shared-library objects. You only need to set $SHF03FLAGS if you
9864 need to define specific user options for Fortran 03 files. You
9865 should normally set the $SHFORTRANFLAGS variable, which specifies
9866 the user-specified options passed to the default Fortran compiler
9867 for all Fortran versions.
9868
9869 SHF03PPCOM
9870 The command line used to compile a Fortran 03 source file to a
9871 shared-library object file after first running the file through the
9872 C preprocessor. Any options specified in the $SHF03FLAGS and
9873 $CPPFLAGS construction variables are included on this command line.
9874 You only need to set $SHF03PPCOM if you need to use a specific
9875 C-preprocessor command line for Fortran 03 files. You should
9876 normally set the $SHFORTRANPPCOM variable, which specifies the
9877 default C-preprocessor command line for all Fortran versions.
9878
9879 SHF03PPCOMSTR
9880 If set, the string displayed when a Fortran 03 source file is
9881 compiled to a shared-library object file after first running the
9882 file through the C preprocessor. If not set, then $SHF03PPCOM or
9883 $SHFORTRANPPCOM (the command line) is displayed.
9884
9885 SHF08
9886 The Fortran 08 compiler used for generating shared-library objects.
9887 You should normally set the $SHFORTRAN variable, which specifies
9888 the default Fortran compiler for all Fortran versions. You only
9889 need to set $SHF08 if you need to use a specific compiler or
9890 compiler version for Fortran 08 files.
9891
9892 SHF08COM
9893 The command line used to compile a Fortran 08 source file to a
9894 shared-library object file. You only need to set $SHF08COM if you
9895 need to use a specific command line for Fortran 08 files. You
9896 should normally set the $SHFORTRANCOM variable, which specifies the
9897 default command line for all Fortran versions.
9898
9899 SHF08COMSTR
9900 If set, the string displayed when a Fortran 08 source file is
9901 compiled to a shared-library object file. If not set, then
9902 $SHF08COM or $SHFORTRANCOM (the command line) is displayed.
9903
9904 SHF08FLAGS
9905 Options that are passed to the Fortran 08 compiler to generated
9906 shared-library objects. You only need to set $SHF08FLAGS if you
9907 need to define specific user options for Fortran 08 files. You
9908 should normally set the $SHFORTRANFLAGS variable, which specifies
9909 the user-specified options passed to the default Fortran compiler
9910 for all Fortran versions.
9911
9912 SHF08PPCOM
9913 The command line used to compile a Fortran 08 source file to a
9914 shared-library object file after first running the file through the
9915 C preprocessor. Any options specified in the $SHF08FLAGS and
9916 $CPPFLAGS construction variables are included on this command line.
9917 You only need to set $SHF08PPCOM if you need to use a specific
9918 C-preprocessor command line for Fortran 08 files. You should
9919 normally set the $SHFORTRANPPCOM variable, which specifies the
9920 default C-preprocessor command line for all Fortran versions.
9921
9922 SHF08PPCOMSTR
9923 If set, the string displayed when a Fortran 08 source file is
9924 compiled to a shared-library object file after first running the
9925 file through the C preprocessor. If not set, then $SHF08PPCOM or
9926 $SHFORTRANPPCOM (the command line) is displayed.
9927
9928 SHF77
9929 The Fortran 77 compiler used for generating shared-library objects.
9930 You should normally set the $SHFORTRAN variable, which specifies
9931 the default Fortran compiler for all Fortran versions. You only
9932 need to set $SHF77 if you need to use a specific compiler or
9933 compiler version for Fortran 77 files.
9934
9935 SHF77COM
9936 The command line used to compile a Fortran 77 source file to a
9937 shared-library object file. You only need to set $SHF77COM if you
9938 need to use a specific command line for Fortran 77 files. You
9939 should normally set the $SHFORTRANCOM variable, which specifies the
9940 default command line for all Fortran versions.
9941
9942 SHF77COMSTR
9943 If set, the string displayed when a Fortran 77 source file is
9944 compiled to a shared-library object file. If not set, then
9945 $SHF77COM or $SHFORTRANCOM (the command line) is displayed.
9946
9947 SHF77FLAGS
9948 Options that are passed to the Fortran 77 compiler to generated
9949 shared-library objects. You only need to set $SHF77FLAGS if you
9950 need to define specific user options for Fortran 77 files. You
9951 should normally set the $SHFORTRANFLAGS variable, which specifies
9952 the user-specified options passed to the default Fortran compiler
9953 for all Fortran versions.
9954
9955 SHF77PPCOM
9956 The command line used to compile a Fortran 77 source file to a
9957 shared-library object file after first running the file through the
9958 C preprocessor. Any options specified in the $SHF77FLAGS and
9959 $CPPFLAGS construction variables are included on this command line.
9960 You only need to set $SHF77PPCOM if you need to use a specific
9961 C-preprocessor command line for Fortran 77 files. You should
9962 normally set the $SHFORTRANPPCOM variable, which specifies the
9963 default C-preprocessor command line for all Fortran versions.
9964
9965 SHF77PPCOMSTR
9966 If set, the string displayed when a Fortran 77 source file is
9967 compiled to a shared-library object file after first running the
9968 file through the C preprocessor. If not set, then $SHF77PPCOM or
9969 $SHFORTRANPPCOM (the command line) is displayed.
9970
9971 SHF90
9972 The Fortran 90 compiler used for generating shared-library objects.
9973 You should normally set the $SHFORTRAN variable, which specifies
9974 the default Fortran compiler for all Fortran versions. You only
9975 need to set $SHF90 if you need to use a specific compiler or
9976 compiler version for Fortran 90 files.
9977
9978 SHF90COM
9979 The command line used to compile a Fortran 90 source file to a
9980 shared-library object file. You only need to set $SHF90COM if you
9981 need to use a specific command line for Fortran 90 files. You
9982 should normally set the $SHFORTRANCOM variable, which specifies the
9983 default command line for all Fortran versions.
9984
9985 SHF90COMSTR
9986 If set, the string displayed when a Fortran 90 source file is
9987 compiled to a shared-library object file. If not set, then
9988 $SHF90COM or $SHFORTRANCOM (the command line) is displayed.
9989
9990 SHF90FLAGS
9991 Options that are passed to the Fortran 90 compiler to generated
9992 shared-library objects. You only need to set $SHF90FLAGS if you
9993 need to define specific user options for Fortran 90 files. You
9994 should normally set the $SHFORTRANFLAGS variable, which specifies
9995 the user-specified options passed to the default Fortran compiler
9996 for all Fortran versions.
9997
9998 SHF90PPCOM
9999 The command line used to compile a Fortran 90 source file to a
10000 shared-library object file after first running the file through the
10001 C preprocessor. Any options specified in the $SHF90FLAGS and
10002 $CPPFLAGS construction variables are included on this command line.
10003 You only need to set $SHF90PPCOM if you need to use a specific
10004 C-preprocessor command line for Fortran 90 files. You should
10005 normally set the $SHFORTRANPPCOM variable, which specifies the
10006 default C-preprocessor command line for all Fortran versions.
10007
10008 SHF90PPCOMSTR
10009 If set, the string displayed when a Fortran 90 source file is
10010 compiled to a shared-library object file after first running the
10011 file through the C preprocessor. If not set, then $SHF90PPCOM or
10012 $SHFORTRANPPCOM (the command line) is displayed.
10013
10014 SHF95
10015 The Fortran 95 compiler used for generating shared-library objects.
10016 You should normally set the $SHFORTRAN variable, which specifies
10017 the default Fortran compiler for all Fortran versions. You only
10018 need to set $SHF95 if you need to use a specific compiler or
10019 compiler version for Fortran 95 files.
10020
10021 SHF95COM
10022 The command line used to compile a Fortran 95 source file to a
10023 shared-library object file. You only need to set $SHF95COM if you
10024 need to use a specific command line for Fortran 95 files. You
10025 should normally set the $SHFORTRANCOM variable, which specifies the
10026 default command line for all Fortran versions.
10027
10028 SHF95COMSTR
10029 If set, the string displayed when a Fortran 95 source file is
10030 compiled to a shared-library object file. If not set, then
10031 $SHF95COM or $SHFORTRANCOM (the command line) is displayed.
10032
10033 SHF95FLAGS
10034 Options that are passed to the Fortran 95 compiler to generated
10035 shared-library objects. You only need to set $SHF95FLAGS if you
10036 need to define specific user options for Fortran 95 files. You
10037 should normally set the $SHFORTRANFLAGS variable, which specifies
10038 the user-specified options passed to the default Fortran compiler
10039 for all Fortran versions.
10040
10041 SHF95PPCOM
10042 The command line used to compile a Fortran 95 source file to a
10043 shared-library object file after first running the file through the
10044 C preprocessor. Any options specified in the $SHF95FLAGS and
10045 $CPPFLAGS construction variables are included on this command line.
10046 You only need to set $SHF95PPCOM if you need to use a specific
10047 C-preprocessor command line for Fortran 95 files. You should
10048 normally set the $SHFORTRANPPCOM variable, which specifies the
10049 default C-preprocessor command line for all Fortran versions.
10050
10051 SHF95PPCOMSTR
10052 If set, the string displayed when a Fortran 95 source file is
10053 compiled to a shared-library object file after first running the
10054 file through the C preprocessor. If not set, then $SHF95PPCOM or
10055 $SHFORTRANPPCOM (the command line) is displayed.
10056
10057 SHFORTRAN
10058 The default Fortran compiler used for generating shared-library
10059 objects.
10060
10061 SHFORTRANCOM
10062 The command line used to compile a Fortran source file to a
10063 shared-library object file.
10064
10065 SHFORTRANCOMSTR
10066 If set, the string displayed when a Fortran source file is compiled
10067 to a shared-library object file. If not set, then $SHFORTRANCOM
10068 (the command line) is displayed.
10069
10070 SHFORTRANFLAGS
10071 Options that are passed to the Fortran compiler to generate
10072 shared-library objects.
10073
10074 SHFORTRANPPCOM
10075 The command line used to compile a Fortran source file to a
10076 shared-library object file after first running the file through the
10077 C preprocessor. Any options specified in the $SHFORTRANFLAGS and
10078 $CPPFLAGS construction variables are included on this command line.
10079
10080 SHFORTRANPPCOMSTR
10081 If set, the string displayed when a Fortran source file is compiled
10082 to a shared-library object file after first running the file
10083 through the C preprocessor. If not set, then $SHFORTRANPPCOM (the
10084 command line) is displayed.
10085
10086 SHLIBEMITTER
10087 Contains the emitter specification for the SharedLibrary builder.
10088 The manpage section "Builder Objects" contains general information
10089 on specifying emitters.
10090
10091 SHLIBNOVERSIONSYMLINKS
10092 Instructs the SharedLibrary builder to not create symlinks for
10093 versioned shared libraries.
10094
10095 SHLIBPREFIX
10096 The prefix used for shared library file names.
10097
10098 _SHLIBSONAME
10099 A macro that automatically generates shared library's SONAME based
10100 on $TARGET, $SHLIBVERSION and $SHLIBSUFFIX. Used by SharedLibrary
10101 builder when the linker tool supports SONAME (e.g. gnulink).
10102
10103 SHLIBSUFFIX
10104 The suffix used for shared library file names.
10105
10106 SHLIBVERSION
10107 When this construction variable is defined, a versioned shared
10108 library is created by the SharedLibrary builder. This activates the
10109 $_SHLIBVERSIONFLAGS and thus modifies the $SHLINKCOM as required,
10110 adds the version number to the library name, and creates the
10111 symlinks that are needed. $SHLIBVERSION versions should exist as
10112 alpha-numeric, decimal-delimited values as defined by the regular
10113 expression "\w+[\.\w+]*". Example $SHLIBVERSION values include '1',
10114 '1.2.3', and '1.2.gitaa412c8b'.
10115
10116 _SHLIBVERSIONFLAGS
10117 This macro automatically introduces extra flags to $SHLINKCOM when
10118 building versioned SharedLibrary (that is when $SHLIBVERSION is
10119 set). _SHLIBVERSIONFLAGS usually adds $SHLIBVERSIONFLAGS and some
10120 extra dynamically generated options (such as
10121 -Wl,-soname=$_SHLIBSONAME. It is unused by "plain" (unversioned)
10122 shared libraries.
10123
10124 SHLIBVERSIONFLAGS
10125 Extra flags added to $SHLINKCOM when building versioned
10126 SharedLibrary. These flags are only used when $SHLIBVERSION is set.
10127
10128 SHLINK
10129 The linker for programs that use shared libraries. See also $LINK
10130 for linking static objects.
10131
10132 On POSIX systems (those using the link tool), you should normally
10133 not change this value as it defaults to a "smart" linker tool which
10134 selects a compiler driver matching the type of source files in use.
10135 So for example, if you set $SHCXX to a specific compiler name, and
10136 are compiling C++ sources, the smartlink function will
10137 automatically select the same compiler for linking.
10138
10139 SHLINKCOM
10140 The command line used to link programs using shared libraries. See
10141 also $LINKCOM for linking static objects.
10142
10143 SHLINKCOMSTR
10144 The string displayed when programs using shared libraries are
10145 linked. If this is not set, then $SHLINKCOM (the command line) is
10146 displayed. See also $LINKCOMSTR for linking static objects.
10147
10148 env = Environment(SHLINKCOMSTR = "Linking shared $TARGET")
10149
10150 SHLINKFLAGS
10151 General user options passed to the linker for programs using shared
10152 libraries. Note that this variable should not contain -l (or
10153 similar) options for linking with the libraries listed in $LIBS,
10154 nor -L (or similar) include search path options that scons
10155 generates automatically from $LIBPATH. See $_LIBFLAGS above, for
10156 the variable that expands to library-link options, and
10157 $_LIBDIRFLAGS above, for the variable that expands to library
10158 search path options. See also $LINKFLAGS for linking static
10159 objects.
10160
10161 SHOBJPREFIX
10162 The prefix used for shared object file names.
10163
10164 SHOBJSUFFIX
10165 The suffix used for shared object file names.
10166
10167 SONAME
10168 Variable used to hard-code SONAME for versioned shared
10169 library/loadable module.
10170
10171 env.SharedLibrary('test', 'test.c', SHLIBVERSION='0.1.2', SONAME='libtest.so.2')
10172
10173 The variable is used, for example, by gnulink linker tool.
10174
10175 SOURCE
10176 A reserved variable name that may not be set or used in a
10177 construction environment. (See the manpage section "Variable
10178 Substitution" for more information).
10179
10180 SOURCE_URL
10181 The URL (web address) of the location from which the project was
10182 retrieved. This is used to fill in the Source: field in the
10183 controlling information for Ipkg and RPM packages.
10184
10185 See the Package builder.
10186
10187 SOURCES
10188 A reserved variable name that may not be set or used in a
10189 construction environment. (See the manpage section "Variable
10190 Substitution" for more information).
10191
10192 SOVERSION
10193 This will construct the SONAME using on the base library name (test
10194 in the example below) and use specified SOVERSION to create SONAME.
10195
10196 env.SharedLibrary('test', 'test.c', SHLIBVERSION='0.1.2', SOVERSION='2')
10197
10198 The variable is used, for example, by gnulink linker tool.
10199
10200 In the example above SONAME would be libtest.so.2 which would be a
10201 symlink and point to libtest.so.0.1.2
10202
10203 SPAWN
10204 A command interpreter function that will be called to execute
10205 command line strings. The function must expect the following
10206 arguments:
10207
10208 def spawn(shell, escape, cmd, args, env):
10209
10210
10211 sh is a string naming the shell program to use. escape is a
10212 function that can be called to escape shell special characters in
10213 the command line. cmd is the path to the command to be executed.
10214 args is the arguments to the command. env is a dictionary of the
10215 environment variables in which the command should be executed.
10216
10217 STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME
10218 When this variable is true, static objects and shared objects are
10219 assumed to be the same; that is, SCons does not check for linking
10220 static objects into a shared library.
10221
10222 SUBST_DICT
10223 The dictionary used by the Substfile or Textfile builders for
10224 substitution values. It can be anything acceptable to the dict()
10225 constructor, so in addition to a dictionary, lists of tuples are
10226 also acceptable.
10227
10228 SUBSTFILEPREFIX
10229 The prefix used for Substfile file names, an empty string by
10230 default.
10231
10232 SUBSTFILESUFFIX
10233 The suffix used for Substfile file names, an empty string by
10234 default.
10235
10236 SUMMARY
10237 A short summary of what the project is about. This is used to fill
10238 in the Summary: field in the controlling information for Ipkg and
10239 RPM packages, and as the Description: field in MSI packages.
10240
10241 See the Package builder.
10242
10243 SWIG
10244 The scripting language wrapper and interface generator.
10245
10246 SWIGCFILESUFFIX
10247 The suffix that will be used for intermediate C source files
10248 generated by the scripting language wrapper and interface
10249 generator. The default value is _wrap$CFILESUFFIX. By default, this
10250 value is used whenever the -c++ option is not specified as part of
10251 the $SWIGFLAGS construction variable.
10252
10253 SWIGCOM
10254 The command line used to call the scripting language wrapper and
10255 interface generator.
10256
10257 SWIGCOMSTR
10258 The string displayed when calling the scripting language wrapper
10259 and interface generator. If this is not set, then $SWIGCOM (the
10260 command line) is displayed.
10261
10262 SWIGCXXFILESUFFIX
10263 The suffix that will be used for intermediate C++ source files
10264 generated by the scripting language wrapper and interface
10265 generator. The default value is _wrap$CFILESUFFIX. By default, this
10266 value is used whenever the -c++ option is specified as part of the
10267 $SWIGFLAGS construction variable.
10268
10269 SWIGDIRECTORSUFFIX
10270 The suffix that will be used for intermediate C++ header files
10271 generated by the scripting language wrapper and interface
10272 generator. These are only generated for C++ code when the SWIG
10273 'directors' feature is turned on. The default value is _wrap.h.
10274
10275 SWIGFLAGS
10276 General options passed to the scripting language wrapper and
10277 interface generator. This is where you should set -python, -perl5,
10278 -tcl, or whatever other options you want to specify to SWIG. If you
10279 set the -c++ option in this variable, scons will, by default,
10280 generate a C++ intermediate source file with the extension that is
10281 specified as the $CXXFILESUFFIX variable.
10282
10283 _SWIGINCFLAGS
10284 An automatically-generated construction variable containing the
10285 SWIG command-line options for specifying directories to be searched
10286 for included files. The value of $_SWIGINCFLAGS is created by
10287 respectively prepending and appending $SWIGINCPREFIX and
10288 $SWIGINCSUFFIX to the beginning and end of each directory in
10289 $SWIGPATH.
10290
10291 SWIGINCPREFIX
10292 The prefix used to specify an include directory on the SWIG command
10293 line. This will be prepended to the beginning of each directory in
10294 the $SWIGPATH construction variable when the $_SWIGINCFLAGS
10295 variable is automatically generated.
10296
10297 SWIGINCSUFFIX
10298 The suffix used to specify an include directory on the SWIG command
10299 line. This will be appended to the end of each directory in the
10300 $SWIGPATH construction variable when the $_SWIGINCFLAGS variable is
10301 automatically generated.
10302
10303 SWIGOUTDIR
10304 Specifies the output directory in which the scripting language
10305 wrapper and interface generator should place generated
10306 language-specific files. This will be used by SCons to identify the
10307 files that will be generated by the swig call, and translated into
10308 the swig -outdir option on the command line.
10309
10310 SWIGPATH
10311 The list of directories that the scripting language wrapper and
10312 interface generate will search for included files. The SWIG
10313 implicit dependency scanner will search these directories for
10314 include files. The default value is an empty list.
10315
10316 Don't explicitly put include directory arguments in SWIGFLAGS; the
10317 result will be non-portable and the directories will not be
10318 searched by the dependency scanner. Note: directory names in
10319 SWIGPATH will be looked-up relative to the SConscript directory
10320 when they are used in a command. To force scons to look-up a
10321 directory relative to the root of the source tree use #:
10322
10323 env = Environment(SWIGPATH='#/include')
10324
10325 The directory look-up can also be forced using the Dir() function:
10326
10327 include = Dir('include')
10328 env = Environment(SWIGPATH=include)
10329
10330 The directory list will be added to command lines through the
10331 automatically-generated $_SWIGINCFLAGS construction variable, which
10332 is constructed by respectively prepending and appending the values
10333 of the $SWIGINCPREFIX and $SWIGINCSUFFIX construction variables to
10334 the beginning and end of each directory in $SWIGPATH. Any command
10335 lines you define that need the SWIGPATH directory list should
10336 include $_SWIGINCFLAGS:
10337
10338 env = Environment(SWIGCOM="my_swig -o $TARGET $_SWIGINCFLAGS $SOURCES")
10339
10340 SWIGVERSION
10341 The version number of the SWIG tool.
10342
10343 TAR
10344 The tar archiver.
10345
10346 TARCOM
10347 The command line used to call the tar archiver.
10348
10349 TARCOMSTR
10350 The string displayed when archiving files using the tar archiver.
10351 If this is not set, then $TARCOM (the command line) is displayed.
10352
10353 env = Environment(TARCOMSTR = "Archiving $TARGET")
10354
10355 TARFLAGS
10356 General options passed to the tar archiver.
10357
10358 TARGET
10359 A reserved variable name that may not be set or used in a
10360 construction environment. (See the manpage section "Variable
10361 Substitution" for more information).
10362
10363 TARGET_ARCH
10364 The name of the target hardware architecture for the compiled
10365 objects created by this Environment. This defaults to the value of
10366 HOST_ARCH, and the user can override it. Currently only set for
10367 Win32.
10368
10369 Sets the target architecture for the Visual C++ compiler (i.e. the
10370 arch of the binaries generated by the compiler). If not set,
10371 default to $HOST_ARCH, or, if that is unset, to the architecture of
10372 the running machine's OS (note that the python build or
10373 architecture has no effect). This variable must be passed as an
10374 argument to the Environment() constructor; setting it later has no
10375 effect. This is currently only used on Windows, but in the future
10376 it will be used on other OSes as well. If this is set and
10377 $MSVC_VERSION is not set, this will search for all installed MSVC's
10378 that support the $TARGET_ARCH, selecting the latest version for
10379 use.
10380
10381 On Windows, valid target values are x86, arm, i386 for 32-bit
10382 targets and amd64, arm64, em64t, x86_64 and ia64 (Itanium) for
10383 64-bit targets. Note that not all target architectures are
10384 supported for all Visual Studio / MSVC versions. Check the relevant
10385 Microsoft documentation.
10386
10387 For example, if you want to compile 64-bit binaries, you would set
10388 TARGET_ARCH='x86_64' in your SCons environment.
10389
10390 TARGET_OS
10391 The name of the target operating system for the compiled objects
10392 created by this Environment. This defaults to the value of HOST_OS,
10393 and the user can override it. Currently only set for Win32.
10394
10395 TARGETS
10396 A reserved variable name that may not be set or used in a
10397 construction environment. (See the manpage section "Variable
10398 Substitution" for more information).
10399
10400 TARSUFFIX
10401 The suffix used for tar file names.
10402
10403 TEMPFILEARGESCFUNC
10404 A default argument escape function is ``SCons.Subst.quote_spaces``.
10405 If you need to apply extra operations on a command argument before
10406 writing to a temporary file(fix Windows slashes, normalize paths,
10407 etc.), please set `TEMPFILEARGESCFUNC` variable to a custom
10408 function. Example::
10409
10410 import sys
10411 import re
10412 from SCons.Subst import quote_spaces
10413
10414 WINPATHSEP_RE = re.compile(r"\\([^\"'\\]|$)")
10415
10416 def tempfile_arg_esc_func(arg):
10417 arg = quote_spaces(arg)
10418 if sys.platform != "win32":
10419 return arg
10420 # GCC requires double Windows slashes, let's use UNIX separator
10421 return WINPATHSEP_RE.sub(r"/\1", arg)
10422
10423 env["TEMPFILEARGESCFUNC"] = tempfile_arg_esc_func
10424
10425 TEMPFILEARGJOIN
10426 The string (or character) to be used to join the arguments passed
10427 to TEMPFILE when command line exceeds the limit set by
10428 $MAXLINELENGTH. The default value is a space. However for MSVC,
10429 MSLINK the default is a line seperator characters as defined by
10430 os.linesep. Note this value is used literally and not expanded by
10431 the subst logic.
10432
10433 TEMPFILEDIR
10434 The directory to create the tempfile in.
10435
10436 TEMPFILEPREFIX
10437 The prefix for a temporary file used to store lines lines longer
10438 than $MAXLINELENGTH as operations which call out to a shell will
10439 fail if the line is too long, which particularly impacts linking.
10440 The default is '@', which works for the Microsoft and GNU
10441 toolchains on Windows. Set this appropriately for other toolchains,
10442 for example '-@' for the diab compiler or '-via' for ARM toolchain.
10443
10444 TEMPFILESUFFIX
10445 The suffix used for the temporary file name used for long command
10446 lines. The name should include the dot ('.') if one is wanted as it
10447 will not be added automatically. The default is '.lnk'.
10448
10449 TEX
10450 The TeX formatter and typesetter.
10451
10452 TEXCOM
10453 The command line used to call the TeX formatter and typesetter.
10454
10455 TEXCOMSTR
10456 The string displayed when calling the TeX formatter and typesetter.
10457 If this is not set, then $TEXCOM (the command line) is displayed.
10458
10459 env = Environment(TEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
10460
10461 TEXFLAGS
10462 General options passed to the TeX formatter and typesetter.
10463
10464 TEXINPUTS
10465 List of directories that the LaTeX program will search for include
10466 directories. The LaTeX implicit dependency scanner will search
10467 these directories for \include and \import files.
10468
10469 TEXTFILEPREFIX
10470 The prefix used for Textfile file names, an empty string by
10471 default.
10472
10473 TEXTFILESUFFIX
10474 The suffix used for Textfile file names; .txt by default.
10475
10476 TOOLS
10477 A list of the names of the Tool specifications that are part of
10478 this construction environment.
10479
10480 UNCHANGED_SOURCES
10481 A reserved variable name that may not be set or used in a
10482 construction environment. (See the manpage section "Variable
10483 Substitution" for more information).
10484
10485 UNCHANGED_TARGETS
10486 A reserved variable name that may not be set or used in a
10487 construction environment. (See the manpage section "Variable
10488 Substitution" for more information).
10489
10490 VENDOR
10491 The person or organization who supply the packaged software. This
10492 is used to fill in the Vendor: field in the controlling information
10493 for RPM packages, and the Manufacturer: field in the controlling
10494 information for MSI packages.
10495
10496 See the Package builder.
10497
10498 VERSION
10499 The version of the project, specified as a string.
10500
10501 See the Package builder.
10502
10503 VSWHERE
10504 Specify the location of vswhere.exe.
10505
10506 The vswhere.exe executable is distributed with Microsoft Visual
10507 Studio and Build Tools since the 2017 edition, but is also
10508 available standalone. It provides full information about
10509 installations of 2017 and later editions. With the -legacy
10510 argument, vswhere.exe can detect installations of the 2010 through
10511 2015 editions with limited data returned. If VSWHERE is set, SCons
10512 will use that location.
10513
10514 Otherwise SCons will look in the following locations and set
10515 VSWHERE to the path of the first vswhere.exe located.
10516
10517 • %ProgramFiles(x86)%\Microsoft Visual Studio\Installer
10518
10519 • %ProgramFiles%\Microsoft Visual Studio\Installer
10520
10521 • %ChocolateyInstall%\bin
10522
10523 Note that VSWHERE must be set at the same time or prior to any of
10524 msvc, msvs , and/or mslink Tool being initialized. Either set it as
10525 follows
10526
10527 env = Environment(VSWHERE='c:/my/path/to/vswhere')
10528
10529 or if your construction environment is created specifying an empty
10530 tools list (or a list of tools which omits all of default, msvs,
10531 msvc, and mslink), and also before env.Tool is called to
10532 ininitialize any of those tools:
10533
10534 env = Environment(tools=[])
10535 env['VSWHERE'] = r'c:/my/vswhere/install/location/vswhere.exe'
10536 env.Tool('msvc')
10537 env.Tool('mslink')
10538 env.Tool('msvs')
10539
10540
10541
10542 WINDOWS_EMBED_MANIFEST
10543 Set to True to embed the compiler-generated manifest (normally
10544 ${TARGET}.manifest) into all Windows executables and DLLs built
10545 with this environment, as a resource during their link step. This
10546 is done using $MT and $MTEXECOM and $MTSHLIBCOM. See also
10547 $WINDOWS_INSERT_MANIFEST.
10548
10549 WINDOWS_INSERT_DEF
10550 If set to true, a library build of a Windows shared library (.dll
10551 file) will include a reference to the corresponding
10552 module-definition file at the same time, if a module-definition
10553 file is not already listed as a build target. The name of the
10554 module-definition file will be constructed from the base name of
10555 the library and the construction variables $WINDOWSDEFSUFFIX and
10556 $WINDOWSDEFPREFIX. The default is to not add a module-definition
10557 file. The module-definition file is not created by this directive,
10558 and must be supplied by the developer.
10559
10560 WINDOWS_INSERT_MANIFEST
10561 If set to true, scons will add the manifest file generated by
10562 Microsoft Visual C++ 8.0 and later to the target list so SCons will
10563 be aware they were generated. In the case of an executable, the
10564 manifest file name is constructed using $WINDOWSPROGMANIFESTSUFFIX
10565 and $WINDOWSPROGMANIFESTPREFIX. In the case of a shared library,
10566 the manifest file name is constructed using
10567 $WINDOWSSHLIBMANIFESTSUFFIX and $WINDOWSSHLIBMANIFESTPREFIX. See
10568 also $WINDOWS_EMBED_MANIFEST.
10569
10570 WINDOWSDEFPREFIX
10571 The prefix used for a Windows linker module-definition file name.
10572 Defaults to empty.
10573
10574 WINDOWSDEFSUFFIX
10575 The suffix used for a Windows linker module-definition file name.
10576 Defaults to .def.
10577
10578 WINDOWSEXPPREFIX
10579 The prefix used for Windows linker exports file names. Defaults to
10580 empty.
10581
10582 WINDOWSEXPSUFFIX
10583 The suffix used for Windows linker exports file names. Defaults to
10584 .exp.
10585
10586 WINDOWSPROGMANIFESTPREFIX
10587 The prefix used for executable program manifest files generated by
10588 Microsoft Visual C/C++. Defaults to empty.
10589
10590 WINDOWSPROGMANIFESTSUFFIX
10591 The suffix used for executable program manifest files generated by
10592 Microsoft Visual C/C++. Defaults to .manifest.
10593
10594 WINDOWSSHLIBMANIFESTPREFIX
10595 The prefix used for shared library manifest files generated by
10596 Microsoft Visual C/C++. Defaults to empty.
10597
10598 WINDOWSSHLIBMANIFESTSUFFIX
10599 The suffix used for shared library manifest files generated by
10600 Microsoft Visual C/C++. Defaults to .manifest.
10601
10602 X_IPK_DEPENDS
10603 This is used to fill in the Depends: field in the controlling
10604 information for Ipkg packages.
10605
10606 See the Package builder.
10607
10608 X_IPK_DESCRIPTION
10609 This is used to fill in the Description: field in the controlling
10610 information for Ipkg packages. The default value is
10611 “$SUMMARY\n$DESCRIPTION”
10612
10613 X_IPK_MAINTAINER
10614 This is used to fill in the Maintainer: field in the controlling
10615 information for Ipkg packages.
10616
10617 X_IPK_PRIORITY
10618 This is used to fill in the Priority: field in the controlling
10619 information for Ipkg packages.
10620
10621 X_IPK_SECTION
10622 This is used to fill in the Section: field in the controlling
10623 information for Ipkg packages.
10624
10625 X_MSI_LANGUAGE
10626 This is used to fill in the Language: attribute in the controlling
10627 information for MSI packages.
10628
10629 See the Package builder.
10630
10631 X_MSI_LICENSE_TEXT
10632 The text of the software license in RTF format. Carriage return
10633 characters will be replaced with the RTF equivalent \\par.
10634
10635 See the Package builder.
10636
10637 X_MSI_UPGRADE_CODE
10638 TODO
10639
10640 X_RPM_AUTOREQPROV
10641 This is used to fill in the AutoReqProv: field in the RPM .spec
10642 file.
10643
10644 See the Package builder.
10645
10646 X_RPM_BUILD
10647 internal, but overridable
10648
10649 X_RPM_BUILDREQUIRES
10650 This is used to fill in the BuildRequires: field in the RPM .spec
10651 file. Note this should only be used on a host managed by rpm as the
10652 dependencies will not be resolvable at build time otherwise.
10653
10654 X_RPM_BUILDROOT
10655 internal, but overridable
10656
10657 X_RPM_CLEAN
10658 internal, but overridable
10659
10660 X_RPM_CONFLICTS
10661 This is used to fill in the Conflicts: field in the RPM .spec file.
10662
10663 X_RPM_DEFATTR
10664 This value is used as the default attributes for the files in the
10665 RPM package. The default value is “(-,root,root)”.
10666
10667 X_RPM_DISTRIBUTION
10668 This is used to fill in the Distribution: field in the RPM .spec
10669 file.
10670
10671 X_RPM_EPOCH
10672 This is used to fill in the Epoch: field in the RPM .spec file.
10673
10674 X_RPM_EXCLUDEARCH
10675 This is used to fill in the ExcludeArch: field in the RPM .spec
10676 file.
10677
10678 X_RPM_EXLUSIVEARCH
10679 This is used to fill in the ExclusiveArch: field in the RPM .spec
10680 file.
10681
10682 X_RPM_EXTRADEFS
10683 A list used to supply extra defintions or flags to be added to the
10684 RPM .spec file. Each item is added as-is with a carriage return
10685 appended. This is useful if some specific RPM feature not otherwise
10686 anticipated by SCons needs to be turned on or off. Note if this
10687 variable is omitted, SCons will by default supply the value
10688 '%global debug_package %{nil}' to disable debug package generation.
10689 To enable debug package generation, include this variable set
10690 either to None, or to a custom list that does not include the
10691 default line. Added in version 3.1.
10692
10693 env.Package(
10694 NAME="foo",
10695 ...
10696 X_RPM_EXTRADEFS=[
10697 "%define _unpackaged_files_terminate_build 0"
10698 "%define _missing_doc_files_terminate_build 0"
10699 ],
10700 ...
10701 )
10702
10703 X_RPM_GROUP
10704 This is used to fill in the Group: field in the RPM .spec file.
10705
10706 X_RPM_GROUP_lang
10707 This is used to fill in the Group(lang): field in the RPM .spec
10708 file. Note that lang is not literal and should be replaced by the
10709 appropriate language code.
10710
10711 X_RPM_ICON
10712 This is used to fill in the Icon: field in the RPM .spec file.
10713
10714 X_RPM_INSTALL
10715 internal, but overridable
10716
10717 X_RPM_PACKAGER
10718 This is used to fill in the Packager: field in the RPM .spec file.
10719
10720 X_RPM_POSTINSTALL
10721 This is used to fill in the %post: section in the RPM .spec file.
10722
10723 X_RPM_POSTUNINSTALL
10724 This is used to fill in the %postun: section in the RPM .spec file.
10725
10726 X_RPM_PREFIX
10727 This is used to fill in the Prefix: field in the RPM .spec file.
10728
10729 X_RPM_PREINSTALL
10730 This is used to fill in the %pre: section in the RPM .spec file.
10731
10732 X_RPM_PREP
10733 internal, but overridable
10734
10735 X_RPM_PREUNINSTALL
10736 This is used to fill in the %preun: section in the RPM .spec file.
10737
10738 X_RPM_PROVIDES
10739 This is used to fill in the Provides: field in the RPM .spec file.
10740
10741 X_RPM_REQUIRES
10742 This is used to fill in the Requires: field in the RPM .spec file.
10743
10744 X_RPM_SERIAL
10745 This is used to fill in the Serial: field in the RPM .spec file.
10746
10747 X_RPM_URL
10748 This is used to fill in the Url: field in the RPM .spec file.
10749
10750 XGETTEXT
10751 Path to xgettext(1) program (found via Detect()). See xgettext tool
10752 and POTUpdate builder.
10753
10754 XGETTEXTCOM
10755 Complete xgettext command line. See xgettext tool and POTUpdate
10756 builder.
10757
10758 XGETTEXTCOMSTR
10759 A string that is shown when xgettext(1) command is invoked
10760 (default: '', which means "print $XGETTEXTCOM"). See xgettext tool
10761 and POTUpdate builder.
10762
10763 _XGETTEXTDOMAIN
10764 Internal "macro". Generates xgettext domain name form source and
10765 target (default: '${TARGET.filebase}').
10766
10767 XGETTEXTFLAGS
10768 Additional flags to xgettext(1). See xgettext tool and POTUpdate
10769 builder.
10770
10771 XGETTEXTFROM
10772 Name of file containing list of xgettext(1)'s source files.
10773 Autotools' users know this as POTFILES.in so they will in most
10774 cases set XGETTEXTFROM="POTFILES.in" here. The $XGETTEXTFROM files
10775 have same syntax and semantics as the well known GNU POTFILES.in.
10776 See xgettext tool and POTUpdate builder.
10777
10778 _XGETTEXTFROMFLAGS
10779 Internal "macro". Genrates list of -D<dir> flags from the
10780 $XGETTEXTPATH list.
10781
10782 XGETTEXTFROMPREFIX
10783 This flag is used to add single $XGETTEXTFROM file to xgettext(1)'s
10784 commandline (default: '-f').
10785
10786 XGETTEXTFROMSUFFIX
10787 (default: '')
10788
10789 XGETTEXTPATH
10790 List of directories, there xgettext(1) will look for source files
10791 (default: []).
10792
10793 Note
10794 This variable works only together with $XGETTEXTFROM
10795 See also xgettext tool and POTUpdate builder.
10796
10797 _XGETTEXTPATHFLAGS
10798 Internal "macro". Generates list of -f<file> flags from
10799 $XGETTEXTFROM.
10800
10801 XGETTEXTPATHPREFIX
10802 This flag is used to add single search path to xgettext(1)'s
10803 commandline (default: '-D').
10804
10805 XGETTEXTPATHSUFFIX
10806 (default: '')
10807
10808 YACC
10809 The parser generator.
10810
10811 YACCCOM
10812 The command line used to call the parser generator to generate a
10813 source file.
10814
10815 YACCCOMSTR
10816 The string displayed when generating a source file using the parser
10817 generator. If this is not set, then $YACCCOM (the command line) is
10818 displayed.
10819
10820 env = Environment(YACCCOMSTR = "Yacc'ing $TARGET from $SOURCES")
10821
10822 YACCFLAGS
10823 General options passed to the parser generator. If $YACCFLAGS
10824 contains a -d option, SCons assumes that the call will also create
10825 a .h file (if the yacc source file ends in a .y suffix) or a .hpp
10826 file (if the yacc source file ends in a .yy suffix)
10827
10828 YACCHFILESUFFIX
10829 The suffix of the C header file generated by the parser generator
10830 when the -d option is used. Note that setting this variable does
10831 not cause the parser generator to generate a header file with the
10832 specified suffix, it exists to allow you to specify what suffix the
10833 parser generator will use of its own accord. The default value is
10834 .h.
10835
10836 YACCHXXFILESUFFIX
10837 The suffix of the C++ header file generated by the parser generator
10838 when the -d option is used. Note that setting this variable does
10839 not cause the parser generator to generate a header file with the
10840 specified suffix, it exists to allow you to specify what suffix the
10841 parser generator will use of its own accord. The default value is
10842 .hpp, except on Mac OS X, where the default is ${TARGET.suffix}.h.
10843 because the default bison parser generator just appends .h to the
10844 name of the generated C++ file.
10845
10846 YACCVCGFILESUFFIX
10847 The suffix of the file containing the VCG grammar automaton
10848 definition when the --graph= option is used. Note that setting this
10849 variable does not cause the parser generator to generate a VCG file
10850 with the specified suffix, it exists to allow you to specify what
10851 suffix the parser generator will use of its own accord. The default
10852 value is .vcg.
10853
10854 ZIP
10855 The zip compression and file packaging utility.
10856
10857 ZIP_OVERRIDE_TIMESTAMP
10858 An optional timestamp which overrides the last modification time of
10859 the file when stored inside the Zip archive. This is a tuple of six
10860 values: Year (>= 1980) Month (one-based) Day of month (one-based)
10861 Hours (zero-based) Minutes (zero-based) Seconds (zero-based)
10862
10863 ZIPCOM
10864 The command line used to call the zip utility, or the internal
10865 Python function used to create a zip archive.
10866
10867 ZIPCOMPRESSION
10868 The compression flag from the Python zipfile module used by the
10869 internal Python function to control whether the zip archive is
10870 compressed or not. The default value is zipfile.ZIP_DEFLATED, which
10871 creates a compressed zip archive. This value has no effect if the
10872 zipfile module is unavailable.
10873
10874 ZIPCOMSTR
10875 The string displayed when archiving files using the zip utility. If
10876 this is not set, then $ZIPCOM (the command line or internal Python
10877 function) is displayed.
10878
10879 env = Environment(ZIPCOMSTR = "Zipping $TARGET")
10880
10881 ZIPFLAGS
10882 General options passed to the zip utility.
10883
10884 ZIPROOT
10885 An optional zip root directory (default empty). The filenames
10886 stored in the zip file will be relative to this directory, if
10887 given. Otherwise the filenames are relative to the current
10888 directory of the command. For instance:
10889
10890 env = Environment()
10891 env.Zip('foo.zip', 'subdir1/subdir2/file1', ZIPROOT='subdir1')
10892
10893 will produce a zip file foo.zip containing a file with the name
10894 subdir2/file1 rather than subdir1/subdir2/file1.
10895
10896 ZIPSUFFIX
10897 The suffix used for zip file names.
10898
10899 Configure Contexts
10900 SCons supports a configure context, an integrated mechanism similar to
10901 the various AC_CHECK macros in GNU Autoconf for testing the existence
10902 of external items needed for the build, such as C header files,
10903 libraries, etc. The mechanism is portable across platforms.
10904
10905 scons does not maintain an explicit cache of the tested values (this is
10906 different than Autoconf), but uses its normal dependency tracking to
10907 keep the checked values up to date. However, users may override this
10908 behaviour with the --config command line option.
10909
10910 Configure(env, [custom_tests, conf_dir, log_file, config_h, clean,
10911 help]), env.Configure([custom_tests, conf_dir, log_file, config_h,
10912 clean, help])
10913 Create a configure context, which tracks information discovered
10914 while running tests. The context includes a local construction
10915 environment (available as context.env) which is used when running
10916 the tests and which can be updated with the check results. Only one
10917 context may be active at a time (since 4.0, scons will raise an
10918 exception on an attempt to create a new context when there is an
10919 active context), but a new context can be created after the active
10920 one is completed. For the global function form, the required env
10921 describes the initial values for the context's local construction
10922 environment; for the construction environment method form the
10923 instance provides the values.
10924
10925 custom_tests specifies a dictionary containing custom tests (see
10926 the section on custom tests below). The default value is None,
10927 meaning no custom tests are added to the configure context.
10928
10929
10930 conf_dir specifies a directory where the test cases are built. This
10931 directory is not used for building normal targets. The default
10932 value is “#/.sconf_temp”.
10933
10934
10935 log_file specifies a file which collects the output from commands
10936 that are executed to check for the existence of header files,
10937 libraries, etc. The default is “#/config.log”. If you are using the
10938 VariantDir function, you may want to specify a subdirectory under
10939 your variant directory.
10940
10941
10942 config_h specifies a C header file where the results of tests will
10943 be written. The results will consist of lines like #define
10944 HAVE_STDIO_H, #define HAVE_LIBM, etc. Customarily, the name chosen
10945 is “config.h”. The default is to not write a config_h file. You can
10946 specify the same config_h file in multiple calls to Configure, in
10947 which case SCons will concatenate all results in the specified
10948 file. Note that SCons uses its normal dependency checking to decide
10949 if it's necessary to rebuild the specified config_h file. This
10950 means that the file is not necessarily re-built each time scons is
10951 run, but is only rebuilt if its contents will have changed and some
10952 target that depends on the config_h file is being built.
10953
10954 The clean and help arguments can be used to suppress execution of
10955 the configuration tests when the -c/--clean or -H/-h/--help options
10956 are used, respectively. The default behavior is always to execute
10957 configure context tests, since the results of the tests may affect
10958 the list of targets to be cleaned or the help text. If the
10959 configure tests do not affect these, then you may add the
10960 clean=False or help=False arguments (or both) to avoid unnecessary
10961 test execution.
10962
10963 SConf.Finish(context), context.Finish()
10964 This method must be called after configuration is done. Though
10965 required, this is not enforced except if Configure is called again
10966 while there is still an active context, in which case an exception
10967 is raised. Finish returns the environment as modified during the
10968 course of running the configuration checks. After this method is
10969 called, no further checks can be performed with this configuration
10970 context. However, you can create a new configure context to perform
10971 additional checks.
10972
10973 Example of a typical Configure usage:
10974
10975 env = Environment()
10976 conf = Configure(env)
10977 if not conf.CheckCHeader("math.h"):
10978 print("We really need math.h!")
10979 Exit(1)
10980 if conf.CheckLibWithHeader("qt", "qapp.h", "c++", "QApplication qapp(0,0);"):
10981 # do stuff for qt - usage, e.g.
10982 conf.env.Append(CPPDEFINES="WITH_QT")
10983 env = conf.Finish()
10984
10985 A configure context has the following predefined methods which can be
10986 used to perform checks. Where language is a required or optional
10987 parameter, the choice can currently be C or C++. The spellings accepted
10988 for C are “C” or “c”; for C++ the value can be “CXX”, “cxx”, “C++” or
10989 “c++”.
10990
10991 SConf.CheckHeader(context, header, [include_quotes, language]),
10992 context.CheckHeader(header, [include_quotes, language])
10993 Checks if header is usable in the specified language. header may
10994 be a list, in which case the last item in the list is the header
10995 file to be checked, and the previous list items are header files
10996 whose #include lines should precede the header line being checked
10997 for. The optional argument include_quotes must be a two character
10998 string, where the first character denotes the opening quote and the
10999 second character denotes the closing quote. By default, both
11000 characters are " (double quote). The optional argument language
11001 should be either C or C++ and selects the compiler to be used for
11002 the check. Returns a boolean indicating success or failure.
11003
11004 SConf.CheckCHeader(context, header, [include_quotes]),
11005 context.CheckCHeader(header, [include_quotes])
11006 This is a wrapper around SConf.CheckHeader which checks if header
11007 is usable in the C language. header may be a list, in which case
11008 the last item in the list is the header file to be checked, and the
11009 previous list items are header files whose #include lines should
11010 precede the header line being checked for. The optional argument
11011 include_quotes must be a two character string, where the first
11012 character denotes the opening quote and the second character
11013 denotes the closing quote. By default, both characters are "
11014 (double quote). Returns a boolean indicating success or failure.
11015
11016 SConf.CheckCXXHeader(context, header, [include_quotes]),
11017 context.CheckCXXHeader(header, [include_quotes])
11018 This is a wrapper around SConf.CheckHeader which checks if header
11019 is usable in the C++ language. header may be a list, in which case
11020 the last item in the list is the header file to be checked, and the
11021 previous list items are header files whose #include lines should
11022 precede the header line being checked for. The optional argument
11023 include_quotes must be a two character string, where the first
11024 character denotes the opening quote and the second character
11025 denotes the closing quote. By default, both characters are "
11026 (double quote). Returns a boolean indicating success or failure.
11027
11028 SConf.CheckFunc(context, function_name, [header, language]),
11029 context.CheckFunc(function_name, [header, language])
11030 Checks if the specified C or C++ library function is available
11031 based on the context's local environment settings (that is, using
11032 the values of CFLAGS, CPPFLAGS, LIBS or other relevant construction
11033 variables).
11034
11035
11036 function_name is the name of the function to check for. The
11037 optional header argument is a string that will be placed at the top
11038 of the test file that will be compiled to check if the function
11039 exists; the default is:
11040
11041 #ifdef __cplusplus
11042 extern "C"
11043 #endif
11044 char function_name();
11045
11046 Returns an empty string on success, a string containing an error
11047 message on failure.
11048
11049 SConf.CheckLib(context, [library, symbol, header, language,
11050 autoadd=True]), context.CheckLib([library, symbol, header, language,
11051 autoadd=True])
11052 Checks if library provides symbol. If autoadd is true (the default)
11053 and the library provides the specified symbol, appends the library
11054 to the LIBS construction variable library may also be None (the
11055 default), in which case symbol is checked with the current LIBS
11056 variable, or a list of library names, in which case each library in
11057 the list will be checked for symbol. If symbol is not set or is
11058 None, then SConf.CheckLib just checks if you can link against the
11059 specified library. Note though it is legal syntax, it would not be
11060 very useful to call this method with library and symbol both
11061 omitted or None. Returns a boolean indicating success or failure.
11062
11063 SConf.CheckLibWithHeader(context, library, header, language, [call,
11064 autoadd=True]), context.CheckLibWithHeader(library, header, language,
11065 [call, autoadd=True])
11066 Provides a more sophisticated way to check against libraries then
11067 the SConf.CheckLib call. library specifies the library or a list
11068 of libraries to check. header specifies a header to check for.
11069 header may be a list, in which case the last item in the list is
11070 the header file to be checked, and the previous list items are
11071 header files whose #include lines should precede the header line
11072 being checked for. call can be any valid expression (with a
11073 trailing ';'). If call is not set, the default simply checks that
11074 you can link against the specified library. autoadd (default true)
11075 specifies whether to add the library to the environment if the
11076 check succeeds. Returns a boolean indicating success or failure.
11077
11078 SConf.CheckType(context, type_name, [includes, language]),
11079 context.CheckType(type_name, [includes, language])
11080 Checks for the existence of a type defined by typedef. type_name
11081 specifies the typedef name to check for. includes is a string
11082 containing one or more #include lines that will be inserted into
11083 the program that will be run to test for the existence of the type.
11084 Example:
11085
11086 sconf.CheckType('foo_type', '#include "my_types.h"', 'C++')
11087
11088 Returns an empty string on success, a string containing an error
11089 message on failure.
11090
11091 SConf.CheckCC(context), context.CheckCC()
11092 Checks whether the C compiler (as defined by the CC construction
11093 variable) works by trying to compile a small source file. Returns a
11094 boolean indicating success or failure.
11095
11096 By default, SCons only detects if there is a program with the
11097 correct name, not if it is a functioning compiler.
11098
11099 This uses the exact same command as the one used by the object
11100 builder for C source files, so it can be used to detect if a
11101 particular compiler flag works or not.
11102
11103 SConf.CheckCXX(context), context.CheckCXX()
11104 Checks whether the C++ compiler (as defined by the CXX construction
11105 variable) works by trying to compile a small source file. By
11106 default, SCons only detects if there is a program with the correct
11107 name, not if it is a functioning compiler. Returns a boolean
11108 indicating success or failure.
11109
11110 This uses the exact same command as the one used by the object
11111 builder for C++ source files, so it can be used to detect if a
11112 particular compiler flag works or not.
11113
11114 SConf.CheckSHCC(context), context.CheckSHCC()
11115 Checks whether the shared-object C compiler (as defined by the SHCC
11116 construction variable) works by trying to compile a small source
11117 file. By default, SCons only detects if there is a program with the
11118 correct name, not if it is a functioning compiler. Returns a
11119 boolean indicating success or failure.
11120
11121 This uses the exact same command as the one used by the object
11122 builder for C source file, so it can be used to detect if a
11123 particular compiler flag works or not. This does not check whether
11124 the object code can be used to build a shared library, only that
11125 the compilation (not link) succeeds.
11126
11127 SConf.CheckSHCXX(context), context.CheckSHCXX()
11128 Checks whether the shared-object C++ compiler (as defined by the
11129 SHCXX construction variable) works by trying to compile a small
11130 source file. By default, SCons only detects if there is a program
11131 with the correct name, not if it is a functioning compiler. Returns
11132 a boolean indicating success or failure.
11133
11134 This uses the exact same command as the one used by the object
11135 builder for C++ source files, so it can be used to detect if a
11136 particular compiler flag works or not. This does not check whether
11137 the object code can be used to build a shared library, only that
11138 the compilation (not link) succeeds.
11139
11140 SConf.CheckTypeSize(context, type_name, [header, language, expect]),
11141 context.CheckTypeSize(type_name, [header, language, expect])
11142 Checks for the size of a type defined by typedef. type_name
11143 specifies the typedef name to check for. The optional header
11144 argument is a string that will be placed at the top of the test
11145 file that will be compiled to check if the type exists; the default
11146 is empty. If the optional expect, is supplied, it should be an
11147 integer size; CheckTypeSize will fail unless type_name is actually
11148 that size. Returns the size in bytes, or zero if the type was not
11149 found (or if the size did not match expect).
11150
11151 For example,
11152
11153 CheckTypeSize('short', expect=2)
11154
11155 will return the size 2 only if short is actually two bytes.
11156
11157 SConf.CheckDeclaration(context, symbol, [includes, language]),
11158 context.CheckDeclaration(symbol, [includes, language])
11159 Checks if the specified symbol is declared. includes is a string
11160 containing one or more #include lines that will be inserted into
11161 the program that will be run to test for the existence of the
11162 symbol. Returns a boolean indicating success or failure.
11163
11164 SConf.Define(context, symbol, [value, comment]), context.Define(symbol,
11165 [value, comment])
11166 This function does not check for anything, but defines a
11167 preprocessor symbol that will be added to the configuration header
11168 file. It is the equivalent of AC_DEFINE, and defines the symbol
11169 name with the optional value and the optional comment comment.
11170
11171 Define Examples:
11172
11173 env = Environment()
11174 conf = Configure(env)
11175
11176 # Puts the following line in the config header file:
11177 # #define A_SYMBOL
11178 conf.Define("A_SYMBOL")
11179
11180 # Puts the following line in the config header file:
11181 # #define A_SYMBOL 1
11182 conf.Define("A_SYMBOL", 1)
11183
11184 Be careful about quoting string values, though:
11185
11186 env = Environment()
11187 conf = Configure(env)
11188
11189 # Puts the following line in the config header file:
11190 # #define A_SYMBOL YA
11191 conf.Define("A_SYMBOL", "YA")
11192
11193 # Puts the following line in the config header file:
11194 # #define A_SYMBOL "YA"
11195 conf.Define("A_SYMBOL", '"YA"')
11196
11197 For comment:
11198
11199 env = Environment()
11200 conf = Configure(env)
11201
11202 # Puts the following lines in the config header file:
11203 # /* Set to 1 if you have a symbol */
11204 # #define A_SYMBOL 1
11205 conf.Define("A_SYMBOL", 1, "Set to 1 if you have a symbol")
11206
11207 You can define your own custom checks in addition to the predefined
11208 checks. You pass a dictionary of these to the Configure function as the
11209 custom_tests argument. This dictionary maps the names of the checks to
11210 the user defined Python callables (either Python functions or class
11211 instances implementing a __call__ method). Each custom check will be
11212 called with a first argument of a CheckContext, instance followed by
11213 the arguments, which must be supplied by the user of the check. A
11214 CheckContext instance defines the following methods:
11215
11216 context.Message(text)
11217 Displays a message, as an indicator of progess. text will be
11218 displayed, e.g. Checking for library X.... Usually called before
11219 the check is started.
11220
11221 context.Result(res)
11222 Displays a “result” message, as an indicator of progress. res can
11223 be either an integer or a string. If an integer, displays yes (if
11224 res evaluates True) or no (if res evaluates False). If a string, it
11225 is displayed as-is. Usually called after the check has completed.
11226
11227 context.TryCompile(text, extension='')
11228 Checks if a file with the specified extension (e.g. '.c')
11229 containing text can be compiled using the environment's Object
11230 builder. Returns a boolean indicating success or failure.
11231
11232 context.TryLink(text, extension='')
11233 Checks, if a file with the specified extension (e.g. '.c')
11234 containing text can be compiled using the environment's Program
11235 builder. Returns a boolean indicating success or failure.
11236
11237 context.TryRun(text, extension='')
11238 Checks if a file with the specified extension (e.g. '.c')
11239 containing text can be compiled using the environment's Program
11240 builder. On success, the program is run. If the program executes
11241 successfully (that is, its return status is 0), a tuple (1,
11242 outputStr) is returned, where outputStr is the standard output of
11243 the program. If the program fails execution (its return status is
11244 non-zero), then (0, '') is returned.
11245
11246 context.TryAction(action, [text, extension=''])
11247 Checks if the specified action with an optional source file
11248 (contents text, extension extension) can be executed. action may
11249 be anything which can be converted to a scons Action. On success,
11250 (1, outputStr) is returned, where outputStr is the content of the
11251 target file. On failure (0, '') is returned.
11252
11253 context.TryBuild(builder[, text, extension=''])
11254 Low level implementation for testing specific builds; the methods
11255 above are based on this method. Given the Builder instance builder
11256 and the optional text of a source file with optional extension,
11257 returns a boolean indicating success or failure. In addition,
11258 context.lastTarget is set to the build target node if the build was
11259 successful.
11260
11261 Example of implementing and using custom tests:
11262
11263 def CheckQt(context, qtdir):
11264 context.Message( 'Checking for qt ...' )
11265 lastLIBS = context.env['LIBS']
11266 lastLIBPATH = context.env['LIBPATH']
11267 lastCPPPATH= context.env['CPPPATH']
11268 context.env.Append(LIBS='qt', LIBPATH=qtdir + '/lib', CPPPATH=qtdir + '/include')
11269 ret = context.TryLink("""
11270 #include <qapp.h>
11271 int main(int argc, char **argv) {
11272 QApplication qapp(argc, argv);
11273 return 0;
11274 }
11275 """)
11276 if not ret:
11277 context.env.Replace(LIBS=lastLIBS, LIBPATH=lastLIBPATH, CPPPATH=lastCPPPATH)
11278 context.Result( ret )
11279 return ret
11280
11281 env = Environment()
11282 conf = Configure(env, custom_tests={'CheckQt': CheckQt})
11283 if not conf.CheckQt('/usr/lib/qt'):
11284 print('We really need qt!')
11285 Exit(1)
11286 env = conf.Finish()
11287
11288 Command-Line Construction Variables
11289 Often when building software, some variables need to be specified at
11290 build time. For example, libraries needed for the build may be in
11291 non-standard locations, or site-specific compiler options may need to
11292 be passed to the compiler. SCons provides a Variables object to
11293 support overriding construction variables with values obtained from
11294 various sources, often from the command line:
11295
11296 scons VARIABLE=foo
11297
11298 The variable values can also be specified in a configuration file or an
11299 SConscript file.
11300
11301 To obtain the object for manipulating values, call the Variables
11302 function:
11303
11304 Variables([files, [args]])
11305 If files is a file or list of files, those are executed as Python
11306 scripts, and the values of (global) Python variables set in those
11307 files are added as construction variables in the Default
11308 Environment. If no files are specified, or the files argument is
11309 None, then no files will be read (supplying None is necessary if
11310 there are no files but you want to specify args as a positional
11311 argument).
11312
11313 The following example file contents could be used to set an
11314 alternative C compiler:
11315
11316 CC = 'my_cc'
11317
11318 If args is specified, it is a dictionary of values that will
11319 override anything read from files. This is primarily intended to
11320 pass the ARGUMENTS dictionary that holds variables specified on the
11321 command line. Example:
11322
11323 vars = Variables('custom.py')
11324 vars = Variables('overrides.py', ARGUMENTS)
11325 vars = Variables(None, {FOO:'expansion', BAR:7})
11326
11327 Calling Variables with no arguments is equivalent to:
11328
11329 vars = Variables(files=None, args=ARGUMENTS)
11330
11331 Note that since the variables are eventually added as construction
11332 variables, you should choose variable names which do not
11333 unintentionally change pre-defined construction variables that your
11334 project will make use of (see the section called “Construction
11335 Variables”).
11336
11337 Variables objects have the following methods:
11338
11339 vars.Add(key, [help, default, validator, converter])
11340 Add a customizable construction variable to the Variables object.
11341 key is the name of the variable. help is the help text for the
11342 variable. default is the default value of the variable; if the
11343 default value is None and there is no explicit value specified, the
11344 construction variable will not be added to the construction
11345 environment. If set, validator is called to validate the value of
11346 the variable. A function supplied as a validator shall accept
11347 arguments: key, value, and env. The recommended way to handle an
11348 invalid value is to raise an exception (see example below). If set,
11349 converter is called to convert the value before putting it in the
11350 environment, and should take either a value, or the value and
11351 environment, as parameters. The converter function must return a
11352 value, which will be converted into a string before being validated
11353 by the validator (if any) and then added to the construction
11354 environment.
11355
11356 Examples:
11357
11358 vars.Add('CC', help='The C compiler')
11359
11360 def valid_color(key, val, env):
11361 if not val in ['red', 'blue', 'yellow']:
11362 raise Exception("Invalid color value '%s'" % val)
11363
11364 vars.Add('COLOR', validator=valid_color)
11365
11366 vars.AddVariables(args)
11367 A convenience method that adds multiple customizable construction
11368 variables to a Variables object in one call; equivalent to calling
11369 Add multiple times. The args are tuples (or lists) that contain the
11370 arguments for an individual call to the Add method. Since tuples
11371 are not Python mappings, the arguments cannot use the keyword form,
11372 but rather are positional arguments as documented for Add: a
11373 required name, the rest optional but must be in the specified in
11374 order if used.
11375
11376 opt.AddVariables(
11377 ("debug", "", 0),
11378 ("CC", "The C compiler"),
11379 ("VALIDATE", "An option for testing validation", "notset", validator, None),
11380 )
11381
11382 vars.Update(env, [args])
11383 Update a construction environment env with the customized
11384 construction variables . Any specified variables that are not
11385 configured for the Variables object will be saved and may be
11386 retrieved using the UnknownVariables method, below.
11387
11388 Normally this method is not called directly, but rather invoked
11389 indirectly by passing the Variables object to the Environment
11390 function:
11391
11392 env = Environment(variables=vars)
11393
11394 vars.UnknownVariables()
11395 Returns a dictionary containing any variables that were specified
11396 either in the files or the dictionary with which the Variables
11397 object was initialized, but for which the Variables object was not
11398 configured.
11399
11400 env = Environment(variables=vars)
11401 for key, value in vars.UnknownVariables():
11402 print("unknown variable: %s=%s" % (key, value))
11403
11404 vars.Save(filename, env)
11405 Save the currently set variables into a script file named by
11406 filename that can be used on the next invocation to automatically
11407 load the current settings. This method combined with the Variables
11408 method can be used to support caching of variables between runs.
11409
11410 env = Environment()
11411 vars = Variables(['variables.cache', 'custom.py'])
11412 vars.Add(...)
11413 vars.Update(env)
11414 vars.Save('variables.cache', env)
11415
11416 vars.GenerateHelpText(env, [sort])
11417 Generate help text documenting the customizable construction
11418 variables, suitable for passing in to the Help function. env is
11419 the construction environment that will be used to get the actual
11420 values of the customizable variables. If the (optional) value of
11421 sort is callable, it is used as a comparison function to determine
11422 how to sort the added variables. This function must accept two
11423 arguments, compare them, and return a negative integer if the first
11424 is less-than the second, zero for equality, or a positive integer
11425 for greater-than. Optionally a Boolean value of True for sort will
11426 cause a standard alphabetical sort to be performed.
11427
11428 Help(vars.GenerateHelpText(env))
11429
11430 def cmp(a, b):
11431 return (a > b) - (a < b)
11432
11433 Help(vars.GenerateHelpText(env, sort=cmp))
11434
11435 vars.FormatVariableHelpText(env, opt, help, default, actual)
11436 Returns a formatted string containing the printable help text for
11437 one option. It is normally not called directly, but is called by
11438 the GenerateHelpText method to create the returned help text. It
11439 may be overridden with your own function that takes the arguments
11440 specified above and returns a string of help text formatted to your
11441 liking. Note that GenerateHelpText will not put any blank lines or
11442 extra characters in between the entries, so you must add those
11443 characters to the returned string if you want the entries
11444 separated.
11445
11446 def my_format(env, opt, help, default, actual):
11447 fmt = "\n%s: default=%s actual=%s (%s)\n"
11448 return fmt % (opt, default, actual, help)
11449 vars.FormatVariableHelpText = my_format
11450
11451 To make it more convenient to work with customizable Variables, scons
11452 provides a number of functions that make it easy to set up various
11453 types of Variables. Each of these return a tuple ready to be passed to
11454 the Add or AddVariables method:
11455
11456 BoolVariable(key, help, default)
11457 Returns a tuple of arguments to set up a Boolean option. The option
11458 will use the specified name key, have a default value of default,
11459 and help will form the descriptive part of the help text. The
11460 option will interpret the values y, yes, t, true, 1, on and all as
11461 true, and the values n, no, f, false, 0, off and none as false.
11462
11463 EnumVariable(key, help, default, allowed_values, [map, ignorecase])
11464 Returns a tuple of arguments to set up an option whose value may be
11465 one of a specified list of legal enumerated values. The option will
11466 use the specified name key, have a default value of default, and
11467 help will form the descriptive part of the help text. The option
11468 will only support those values in the allowed_values list. The
11469 optional map argument is a dictionary that can be used to convert
11470 input values into specific legal values in the allowed_values list.
11471 If the value of ignore_case is 0 (the default), then the values are
11472 case-sensitive. If the value of ignore_case is 1, then values will
11473 be matched case-insensitively. If the value of ignore_case is 2,
11474 then values will be matched case-insensitively, and all input
11475 values will be converted to lower case.
11476
11477 ListVariable(key, help, default, names, [map])
11478 Returns a tuple of arguments to set up an option whose value may be
11479 one or more of a specified list of legal enumerated values. The
11480 option will use the specified name key, have a default value of
11481 default, and help will form the descriptive part of the help text.
11482 The option will only accept the values “all”, “none”, or the values
11483 in the names list. More than one value may be specified, separated
11484 by commas. The default may be a string of comma-separated default
11485 values, or a list of the default values. The optional map argument
11486 is a dictionary that can be used to convert input values into
11487 specific legal values in the names list. (Note that the additional
11488 values accepted through the use of a map are not reflected in the
11489 generated help message).
11490
11491 PackageVariable(key, help, default)
11492 Returns a tuple of arguments to set up an option whose value is a
11493 path name of a package that may be enabled, disabled or given an
11494 explicit path name. The option will use the specified name key,
11495 have a default value of default, and help will form the descriptive
11496 part of the help text. The option will support the values yes,
11497 true, on, enable or search, in which case the specified default
11498 will be used, or the option may be set to an arbitrary string
11499 (typically the path name to a package that is being enabled). The
11500 option will also support the values no, false, off or disable to
11501 disable use of the specified option.
11502
11503 PathVariable(key, help, default, [validator])
11504 Returns a tuple of arguments to set up an option whose value is
11505 expected to be a path name. The option will use the specified name
11506 key, have a default value of default, and help will form the
11507 descriptive part of the help text. An additional validator may be
11508 specified that will be called to verify that the specified path is
11509 acceptable. SCons supplies the following ready-made validators:
11510
11511 PathVariable.PathExists
11512 Verify that the specified path exists (this the default
11513 behavior if no validator is supplied).
11514
11515 PathVariable.PathIsFile
11516 Verify that the specified path exists and is a regular file.
11517
11518 PathVariable.PathIsDir
11519 Verify that the specified path exists and is a directory.
11520
11521 PathVariable.PathIsDirCreate
11522 Verify that the specified path exists and is a directory; if it
11523 does not exist, create the directory.
11524
11525 PathVariable.PathAccept
11526 Accept the specific path name argument without validation,
11527 suitable for when you want your users to be able to specify a
11528 directory path that will be created as part of the build
11529 process, for example.
11530
11531 You may supply your own validator function, which must accept three
11532 arguments (key, the name of the variable to be set; val, the
11533 specified value being checked; and env, the construction
11534 environment) and should raise an exception if the specified value
11535 is not acceptable.
11536
11537 These functions make it convenient to create a number of variables with
11538 consistent behavior in a single call to the AddVariables method:
11539
11540 vars.AddVariables(
11541 BoolVariable(
11542 "warnings",
11543 help="compilation with -Wall and similar",
11544 default=1,
11545 ),
11546 EnumVariable(
11547 "debug",
11548 help="debug output and symbols",
11549 default="no",
11550 allowed_values=("yes", "no", "full"),
11551 map={},
11552 ignorecase=0, # case sensitive
11553 ),
11554 ListVariable(
11555 "shared",
11556 help="libraries to build as shared libraries",
11557 default="all",
11558 names=list_of_libs,
11559 ),
11560 PackageVariable(
11561 "x11",
11562 help="use X11 installed here (yes = search some places)",
11563 default="yes",
11564 ),
11565 PathVariable(
11566 "qtdir",
11567 help="where the root of Qt is installed",
11568 default=qtdir),
11569 PathVariable(
11570 "foopath",
11571 help="where the foo library is installed",
11572 default=foopath,
11573 validator=PathVariable.PathIsDir,
11574 ),
11575 )
11576
11577 File and Directory Nodes
11578 The File and Dir functions/methods return File and Directory Nodes,
11579 respectively. Such nodes are Python objects with several user-visible
11580 attributes and methods that are often useful to access in SConscript
11581 files:
11582
11583 n.path
11584 The build path of the given file or directory. This path is
11585 relative to the top-level directory (where the SConstruct file is
11586 found). The build path is the same as the source path if
11587 variant_dir is not being used.
11588
11589 n.abspath
11590 The absolute build path of the given file or directory.
11591
11592 n.relpath
11593 The build path of the given file or directory relative to the root
11594 SConstruct file's directory.
11595
11596 n.srcnode()
11597 The srcnode method returns another File or Directory Node
11598 representing the source path of the given File or Directory Node.
11599
11600 For example:
11601
11602 # Get the current build dir's path, relative to top.
11603 Dir('.').path
11604 # Current dir's absolute path
11605 Dir('.').abspath
11606 # Current dir's path relative to the root SConstruct file's directory
11607 Dir('.').relpath
11608 # Next line is always '.', because it is the top dir's path relative to itself.
11609 Dir('#.').path
11610 File('foo.c').srcnode().path # source path of the given source file.
11611
11612 # Builders also return File objects:
11613 foo = env.Program('foo.c')
11614 print("foo will be built in", foo.path)
11615
11616 File and Directory Node objects have methods to create File and
11617 Directory Nodes relative to the original Node.
11618
11619 If the object is a Directory Node, these methods will place the the new
11620 Node within the directory the Node represents:
11621
11622 d.Dir(name)
11623 Returns a directory Node for a subdirectory of d named name.
11624
11625 d.File(name)
11626 Returns a file Node for a file within d named name.
11627
11628 d.Entry(name)
11629 Returns an unresolved Node within d named name.
11630
11631 If the object is a File Node, these methods will place the the new Node
11632 in the same directory as the one the Node represents:
11633
11634 f.Dir(name)
11635 Returns a directory named name within the parent directory of f.
11636
11637 f.File(name)
11638 Returns a file named name within the parent directory of f.
11639
11640 f.Entry(name)
11641 Returns an unresolved Node named name within the parent directory
11642 of f.
11643
11644 For example:
11645
11646 # Get a Node for a file within a directory
11647 incl = Dir('include')
11648 f = incl.File('header.h')
11649
11650 # Get a Node for a subdirectory within a directory
11651 dist = Dir('project-3.2.1')
11652 src = dist.Dir('src')
11653
11654 # Get a Node for a file in the same directory
11655 cfile = File('sample.c')
11656 hfile = cfile.File('sample.h')
11657
11658 # Combined example
11659 docs = Dir('docs')
11660 html = docs.Dir('html')
11661 index = html.File('index.html')
11662 css = index.File('app.css')
11663
11665 Builder Objects
11666 scons can be extended to build different types of targets by adding new
11667 Builder objects to a construction environment. In general, you should
11668 only need to add a new Builder object when you want to build a new type
11669 of file or other external target. For output file types scons already
11670 knows about, you can usually modify the behavior of premade Builders
11671 such as Program, Object or Library by changing the construction
11672 variables they use ($CC, $LINK, etc.). In this manner you can, for
11673 example, change the compiler to use, which is simpler and less
11674 error-prone than writing a new builder. The documentation for each
11675 Builder lists which construction variables it uses.
11676
11677 Builder objects are created using the Builder factory function. Once
11678 created, a builder is added to an environment by entering it in the
11679 $BUILDERS dictionary in that environment (some of the examples in this
11680 section illustrate that).
11681
11682 The Builder function accepts the following keyword arguments:
11683
11684 action
11685 The command used to build the target from the source. action may
11686 be a string representing a template command line to execute, a list
11687 of strings representing the command to execute with its arguments
11688 (suitable for enclosing white space in an argument), a dictionary
11689 mapping source file name suffixes to any combination of command
11690 line strings (if the builder should accept multiple source file
11691 extensions), a Python function, an Action object (see the section
11692 called “Action Objects”) or a list of any of the above.
11693
11694 An action function must accept three arguments: source, target and
11695 env. source is a list of source nodes; target is a list of target
11696 nodes; env is the construction environment to use for context.
11697
11698 The action and generator arguments must not both be used for the
11699 same Builder.
11700
11701 prefix
11702 The prefix to prepend to the target file name. prefix may be a
11703 string, a function (or other callable) that takes two arguments (a
11704 construction environment and a list of sources) and returns a
11705 prefix string, or a dictionary specifying a mapping from a specific
11706 source suffix (of the first source specified) to a corresponding
11707 target prefix string. For the dictionary form, both the source
11708 suffix (key) and target prefix (value) specifications may use
11709 environment variable substitution, and the target prefix may also
11710 be a callable object. The default target prefix may be indicated by
11711 a dictionary entry with a key of None.
11712
11713 b = Builder("build_it < $SOURCE > $TARGET",
11714 prefix="file-")
11715
11716 def gen_prefix(env, sources):
11717 return "file-" + env['PLATFORM'] + '-'
11718
11719 b = Builder("build_it < $SOURCE > $TARGET",
11720 prefix=gen_prefix)
11721
11722 b = Builder("build_it < $SOURCE > $TARGET",
11723 suffix={None: "file-", "$SRC_SFX_A": gen_prefix})
11724
11725 suffix
11726 The suffix to append to the target file name. Specified in the same
11727 manner as for prefix above. If the suffix is a string, then scons
11728 prepends a '.' to the suffix if it's not already there. The string
11729 returned by the callable object or obtained from the dictionary is
11730 untouched and you need to manually prepend a '.' if one is
11731 required.
11732
11733 b = Builder("build_it < $SOURCE > $TARGET"
11734 suffix="-file")
11735
11736 def gen_suffix(env, sources):
11737 return "." + env['PLATFORM'] + "-file"
11738
11739 b = Builder("build_it < $SOURCE > $TARGET",
11740 suffix=gen_suffix)
11741
11742 b = Builder("build_it < $SOURCE > $TARGET",
11743 suffix={None: ".sfx1", "$SRC_SFX_A": gen_suffix})
11744
11745 ensure_suffix
11746 If set to a true value, ensures that targets will end in suffix.
11747 Thus, the suffix will also be added to any target strings that have
11748 a suffix that is not already suffix. The default behavior (also
11749 indicated by a false value) is to leave unchanged any target string
11750 that looks like it already has a suffix.
11751
11752 b1 = Builder("build_it < $SOURCE > $TARGET"
11753 suffix = ".out")
11754 b2 = Builder("build_it < $SOURCE > $TARGET"
11755 suffix = ".out",
11756 ensure_suffix=True)
11757 env = Environment()
11758 env['BUILDERS']['B1'] = b1
11759 env['BUILDERS']['B2'] = b2
11760
11761 # Builds "foo.txt" because ensure_suffix is not set.
11762 env.B1('foo.txt', 'foo.in')
11763
11764 # Builds "bar.txt.out" because ensure_suffix is set.
11765 env.B2('bar.txt', 'bar.in')
11766
11767 src_suffix
11768 The expected source file name suffix. src_suffix may be a string
11769 or a list of strings.
11770
11771 target_scanner
11772 A Scanner object that will be invoked to find implicit dependencies
11773 for this target file. This keyword argument should be used for
11774 Scanner objects that find implicit dependencies based only on the
11775 target file and the construction environment, not for implicit
11776 dependencies based on source files. See the section called “Scanner
11777 Objects” for information about creating Scanner objects.
11778
11779 source_scanner
11780 A Scanner object that will be invoked to find implicit dependencies
11781 in any source files used to build this target file. This is where
11782 you would specify a scanner to find things like #include lines in
11783 source files. The pre-built DirScanner Scanner object may be used
11784 to indicate that this Builder should scan directory trees for
11785 on-disk changes to files that scons does not know about from other
11786 Builder or function calls. See the section called “Scanner Objects”
11787 for information about creating your own Scanner objects.
11788
11789 target_factory
11790 A factory function that the Builder will use to turn any targets
11791 specified as strings into SCons Nodes. By default, SCons assumes
11792 that all targets are files. Other useful target_factory values
11793 include Dir, for when a Builder creates a directory target, and
11794 Entry, for when a Builder can create either a file or directory
11795 target.
11796
11797 Example:
11798
11799 MakeDirectoryBuilder = Builder(action=my_mkdir, target_factory=Dir)
11800 env = Environment()
11801 env.Append(BUILDERS={'MakeDirectory': MakeDirectoryBuilder})
11802 env.MakeDirectory('new_directory', [])
11803
11804 Note that the call to this MakeDirectory Builder needs to specify
11805 an empty source list to make the string represent the builder's
11806 target; without that, it would assume the argument is the source,
11807 and would try to deduce the target name from it, which in the
11808 absence of an automatically-added prefix or suffix would lead to a
11809 matching target and source name and a circular dependency.
11810
11811 source_factory
11812 A factory function that the Builder will use to turn any sources
11813 specified as strings into SCons Nodes. By default, SCons assumes
11814 that all source are files. Other useful source_factory values
11815 include Dir, for when a Builder uses a directory as a source, and
11816 Entry, for when a Builder can use files or directories (or both) as
11817 sources.
11818
11819 Example:
11820
11821 CollectBuilder = Builder(action=my_mkdir, source_factory=Entry)
11822 env = Environment()
11823 env.Append(BUILDERS={'Collect': CollectBuilder})
11824 env.Collect('archive', ['directory_name', 'file_name'])
11825
11826 emitter
11827 A function or list of functions to manipulate the target and source
11828 lists before dependencies are established and the target(s) are
11829 actually built. emitter can also be a string containing a
11830 construction variable to expand to an emitter function or list of
11831 functions, or a dictionary mapping source file suffixes to emitter
11832 functions. (Only the suffix of the first source file is used to
11833 select the actual emitter function from an emitter dictionary.)
11834
11835 A function passed as emitter must accept three arguments: source,
11836 target and env. source is a list of source nodes, target is a list
11837 of target nodes, env is the construction environment to use for
11838 context.
11839
11840 An emitter must return a tuple containing two lists, the list of
11841 targets to be built by this builder, and the list of sources for
11842 this builder.
11843
11844 Example:
11845
11846 def e(target, source, env):
11847 return (target + ['foo.foo'], source + ['foo.src'])
11848
11849 # Simple association of an emitter function with a Builder.
11850 b = Builder("my_build < $TARGET > $SOURCE",
11851 emitter = e)
11852
11853 def e2(target, source, env):
11854 return (target + ['bar.foo'], source + ['bar.src'])
11855
11856 # Simple association of a list of emitter functions with a Builder.
11857 b = Builder("my_build < $TARGET > $SOURCE",
11858 emitter = [e, e2])
11859
11860 # Calling an emitter function through a construction variable.
11861 env = Environment(MY_EMITTER=e)
11862 b = Builder("my_build < $TARGET > $SOURCE",
11863 emitter='$MY_EMITTER')
11864
11865 # Calling a list of emitter functions through a construction variable.
11866 env = Environment(EMITTER_LIST=[e, e2])
11867 b = Builder("my_build < $TARGET > $SOURCE",
11868 emitter='$EMITTER_LIST')
11869
11870 # Associating multiple emitters with different file
11871 # suffixes using a dictionary.
11872 def e_suf1(target, source, env):
11873 return (target + ['another_target_file'], source)
11874 def e_suf2(target, source, env):
11875 return (target, source + ['another_source_file'])
11876 b = Builder("my_build < $TARGET > $SOURCE",
11877 emitter={'.suf1' : e_suf1,
11878 '.suf2' : e_suf2})
11879
11880 multi
11881 Specifies whether this builder is allowed to be called multiple
11882 times for the same target file(s). The default is False, which
11883 means the builder can not be called multiple times for the same
11884 target file(s). Calling a builder multiple times for the same
11885 target simply adds additional source files to the target; it is not
11886 allowed to change the environment associated with the target,
11887 specify additional environment overrides, or associate a different
11888 builder with the target.
11889
11890 env
11891 A construction environment that can be used to fetch source code
11892 using this Builder. (Note that this environment is not used for
11893 normal builds of normal target files, which use the environment
11894 that was used to call the Builder for the target file.)
11895
11896 generator
11897 A function that returns a list of actions that will be executed to
11898 build the target(s) from the source(s). The returned action(s) may
11899 be an Action object, or anything that can be converted into an
11900 Action object (see the next section).
11901
11902 A function passed as generator must accept four arguments: source,
11903 target, env and for_signature. source is a list of source nodes,
11904 target is a list of target nodes, env is the construction
11905 environment to use for context, for_signature is a Boolean value
11906 that specifies whether the generator is being called for generating
11907 a build signature (as opposed to actually executing the command).
11908
11909 Example:
11910
11911 def g(source, target, env, for_signature):
11912 return [["gcc", "-c", "-o"] + target + source]
11913
11914 b = Builder(generator=g)
11915
11916 The generator and action arguments must not both be used for the
11917 same Builder.
11918
11919 src_builder
11920 Specifies a builder to use when a source file name suffix does not
11921 match any of the suffixes of the builder. Using this argument
11922 produces a multi-stage builder.
11923
11924 single_source
11925 Specifies that this builder expects exactly one source file per
11926 call. Giving more than one source file without target files results
11927 in implicitly calling the builder multiple times (once for each
11928 source given). Giving multiple source files together with target
11929 files results in a UserError exception.
11930
11931 source_ext_match
11932 When the specified action argument is a dictionary, the default
11933 behavior when a builder is passed multiple source files is to make
11934 sure that the extensions of all the source files match. If it is
11935 legal for this builder to be called with a list of source files
11936 with different extensions, this check can be suppressed by setting
11937 source_ext_match to False or some other non-true value. In this
11938 case, scons will use the suffix of the first specified source file
11939 to select the appropriate action from the action dictionary.
11940
11941 In the following example, the setting of source_ext_match prevents
11942 scons from exiting with an error due to the mismatched suffixes of
11943 foo.in and foo.extra.
11944
11945 b = Builder(action={'.in' : 'build $SOURCES > $TARGET'},
11946 source_ext_match=False)
11947
11948 env = Environment(BUILDERS={'MyBuild':b})
11949 env.MyBuild('foo.out', ['foo.in', 'foo.extra'])
11950
11951 env
11952 A construction environment that can be used to fetch source code
11953 using this Builder. (Note that this environment is not used for
11954 normal builds of normal target files, which use the environment
11955 that was used to call the Builder for the target file.)
11956
11957 b = Builder(action="build < $SOURCE > $TARGET")
11958 env = Environment(BUILDERS={'MyBuild' : b})
11959 env.MyBuild('foo.out', 'foo.in', my_arg='xyzzy')
11960
11961 chdir
11962 A directory from which scons will execute the action(s) specified
11963 for this Builder. If the chdir argument is a string or a directory
11964 Node, scons will change to the specified directory. If the chdir is
11965 not a string or Node and is non-zero, then scons will change to the
11966 target file's directory.
11967
11968 Note that scons will not automatically modify its expansion of
11969 construction variables like $TARGET and $SOURCE when using the
11970 chdir keyword argument--that is, the expanded file names will still
11971 be relative to the top-level directory containing the SConstruct
11972 file, and consequently incorrect relative to the chdir directory.
11973 Builders created using chdir keyword argument, will need to use
11974 construction variable expansions like ${TARGET.file} and
11975 ${SOURCE.file} to use just the filename portion of the targets and
11976 source.
11977
11978 b = Builder(action="build < ${SOURCE.file} > ${TARGET.file}",
11979 chdir=1)
11980 env = Environment(BUILDERS={'MyBuild' : b})
11981 env.MyBuild('sub/dir/foo.out', 'sub/dir/foo.in')
11982
11983 Warning
11984 Python only keeps one current directory location even if there
11985 are multiple threads. This means that use of the chdir argument
11986 will not work with the SCons -j option, because individual
11987 worker threads spawned by SCons interfere with each other when
11988 they start changing directory.
11989
11990 Any additional keyword arguments supplied when a Builder object is
11991 created (that is, when the Builder function is called) will be set in
11992 the executing construction environment when the Builder object is
11993 called. The canonical example here would be to set a construction
11994 variable to the repository of a source code system.
11995
11996 Any additional keyword arguments supplied when a Builder object is
11997 called will only be associated with the target created by that
11998 particular Builder call (and any other files built as a result of the
11999 call).
12000
12001 These extra keyword arguments are passed to the following functions:
12002 command generator functions, function Actions, and emitter functions.
12003
12004 Action Objects
12005 The Builder factory function will turn its action keyword argument into
12006 an appropriate internal Action object, as will the Command function.
12007 You can also explicitly create Action objects for passing to Builder,
12008 or other functions that take actions as arguments, by calling the
12009 Action factory function. This may more efficient when multiple Builder
12010 objects need to do the same thing rather than letting each of those
12011 Builder objects create a separate Action object. It also allows more
12012 flexible configuration of an Action object. For example, to control the
12013 message printed when the action is taken you need to create the action
12014 object using Action.
12015
12016 The Action factory function returns an appropriate object for the
12017 action represented by the type of the action argument (the first
12018 positional parmeter):
12019
12020 • If action is already an Action object, the object is simply
12021 returned.
12022
12023 • If action is a string, a command-line Action is returned. If such a
12024 string begins with @, the command line is not printed. If the
12025 string begins with hyphen (-), the exit status from the specified
12026 command is ignored, allowing execution to continue even if the
12027 command reports failure:
12028
12029 Action('$CC -c -o $TARGET $SOURCES')
12030
12031 # Doesn't print the line being executed.
12032 Action('@build $TARGET $SOURCES')
12033
12034 # Ignores return value
12035 Action('-build $TARGET $SOURCES')
12036
12037 • If action is a list, then a list of Action objects is returned. An
12038 Action object is created as necessary for each element in the list.
12039 If an element within the list is itself a list, the embedded list
12040 is taken as the command and arguments to be executed via the
12041 command line. This allows white space to be enclosed in an argument
12042 rather than taken as a separator by defining a command in a list
12043 within a list:
12044
12045 Action([['cc', '-c', '-DWHITE SPACE', '-o', '$TARGET', '$SOURCES']])
12046
12047 • If action is a callable object, a Function Action is returned. The
12048 callable must accept three keyword arguments: target, source and
12049 env. target is a Node object representing the target file, source
12050 is a Node object representing the source file and env is the
12051 construction environment used for building the target file.
12052
12053 The target and source arguments may be lists of Node objects if
12054 there is more than one target file or source file. The actual
12055 target and source file name(s) may be retrieved from their Node
12056 objects via the built-in Python str function:
12057
12058 target_file_name = str(target)
12059 source_file_names = [str(x) for x in source]
12060
12061 The function should return 0 or None to indicate a successful build
12062 of the target file(s). The function may raise an exception or
12063 return a non-zero exit status to indicate an unsuccessful build.
12064
12065 def build_it(target=None, source=None, env=None):
12066 # build the target from the source
12067 return 0
12068
12069 a = Action(build_it)
12070
12071 • If action is not one of the above types, no action object is
12072 generated and Action returns None.
12073
12074 The environment method form env.Action will expand construction
12075 variables in any argument strings, including action, at the time it is
12076 called, using the construction variables in the construction
12077 environment through which it was called. The global function form
12078 Action delays variable expansion until the Action object is actually
12079 used.
12080
12081 The optional second argument to Action is used to control the output
12082 which is printed when the Action is actually performed. If this
12083 parameter is omitted, or if the value is an empty string, a default
12084 output depending on the type of the action is used. For example, a
12085 command-line action will print the executed command. The following
12086 argument types are accepted:
12087
12088 • If output is a string, substitution is performed on the string
12089 before it is printed. The string typically contains variables,
12090 notably $TARGET(S) and $SOURCE(S), or consists of just a single
12091 variable, which is optionally defined somewhere else. SCons itself
12092 heavily uses the latter variant.
12093
12094 • If output is a function, the function will be called to obtain a
12095 string describing the action being executed. The function must
12096 accept three keyword arguments: target, source and env, with the
12097 same interpretation as for a callable action argument above.
12098
12099 • If outputis None, output is suppressed entirely.
12100
12101 Instead of using a positional argument, the cmdstr keyword argument may
12102 be used to specify the output string, or the strfunction keyword
12103 argument may be used to specify a function to return the output string.
12104 cmdstr=None suppresses output entirely.
12105
12106 Examples:
12107
12108 def build_it(target, source, env):
12109 # build the target from the source
12110 return 0
12111
12112 def string_it(target, source, env):
12113 return "building '%s' from '%s'" % (target[0], source[0])
12114
12115 # Use a positional argument.
12116 f = Action(build_it, string_it)
12117 s = Action(build_it, "building '$TARGET' from '$SOURCE'")
12118
12119 # Alternatively, use a keyword argument.
12120 f = Action(build_it, strfunction=string_it)
12121 s = Action(build_it, cmdstr="building '$TARGET' from '$SOURCE'")
12122
12123 # You can provide a configurable variable.
12124 l = Action(build_it, '$STRINGIT')
12125
12126 Any additional positional arguments, if present, may either be
12127 construction variables or lists of construction variables whose values
12128 will be included in the signature of the Action when deciding whether a
12129 target should be rebuilt because the action changed. Such variables may
12130 also be specified using the varlist keyword parameter; both positional
12131 and keyword forms may be present, and will be combined. This is
12132 necessary whenever you want a target to be rebuilt when a specific
12133 construction variable changes. This is not often needed for a string
12134 action, as the expanded variables will normally be part of the command
12135 line, but may be needed if a Python function action uses the value of a
12136 construction variable when generating the command line.
12137
12138 def build_it(target, source, env):
12139 # build the target from the 'XXX' construction variable
12140 with open(target[0], 'w') as f:
12141 f.write(env['XXX'])
12142 return 0
12143
12144 # Use positional arguments.
12145 a = Action(build_it, '$STRINGIT', ['XXX'])
12146
12147 # Alternatively, use a keyword argument.
12148 a = Action(build_it, varlist=['XXX'])
12149
12150 The Action factory function can be passed the following optional
12151 keyword arguments to modify the Action object's behavior:
12152
12153 chdir
12154 If chdir is true (the default is False), SCons will change
12155 directories before executing the action. If the value of chdir is a
12156 string or a directory Node, SCons will change to the specified
12157 directory. Otherwise, if chdir evaluates true, SCons will change to
12158 the target file's directory.
12159
12160 Note that SCons will not automatically modify its expansion of
12161 construction variables like $TARGET and $SOURCE when using the
12162 chdir parameter - that is, the expanded file names will still be
12163 relative to the top-level directory containing the SConstruct file,
12164 and consequently incorrect relative to the chdir directory.
12165 Builders created using chdir keyword argument, will need to use
12166 construction variable expansions like ${TARGET.file} and
12167 ${SOURCE.file} to use just the filename portion of the targets and
12168 source. Example:
12169
12170 a = Action("build < ${SOURCE.file} > ${TARGET.file}", chdir=True)
12171
12172 exitstatfunc
12173 If provided, must be a callable which accepts a single parameter,
12174 the exit status (or return value) from the specified action, and
12175 which returns an arbitrary or modified value. This can be used, for
12176 example, to specify that an Action object's return value should be
12177 ignored under special conditions and SCons should, therefore,
12178 consider that the action always succeeds. Example:
12179
12180 def always_succeed(s):
12181 # Always return 0, which indicates success.
12182 return 0
12183
12184 a = Action("build < ${SOURCE.file} > ${TARGET.file}",
12185 exitstatfunc=always_succeed)
12186
12187 batch_key
12188 If provided, indicates that the Action can create multiple target
12189 files by processing multiple independent source files
12190 simultaneously. (The canonical example is "batch compilation" of
12191 multiple object files by passing multiple source files to a single
12192 invocation of a compiler such as Microsoft's Visual C / C++
12193 compiler.) If the batch_key argument evaluates True and is not a
12194 callable object, the configured Action object will cause scons to
12195 collect all targets built with the Action object and configured
12196 with the same construction environment into single invocations of
12197 the Action object's command line or function. Command lines will
12198 typically want to use the $CHANGED_SOURCES construction variable
12199 (and possibly $CHANGED_TARGETS as well) to only pass to the command
12200 line those sources that have actually changed since their targets
12201 were built. Example:
12202
12203 a = Action('build $CHANGED_SOURCES', batch_key=True)
12204
12205 The batch_key argument may also be a callable function that returns
12206 a key that will be used to identify different "batches" of target
12207 files to be collected for batch building. A batch_key function must
12208 accept four parameters: action, env, target and source. The first
12209 parameter, action, is the active action object. The second
12210 parameter, env, is the construction environment configured for the
12211 target. The target and source parameters are the lists of targets
12212 and sources for the configured action.
12213
12214 The returned key should typically be a tuple of values derived from
12215 the arguments, using any appropriate logic to decide how multiple
12216 invocations should be batched. For example, a batch_key function
12217 may decide to return the value of a specific construction variable
12218 from env which will cause scons to batch-build targets with
12219 matching values of that construction variable, or perhaps return
12220 the Python id() of the entire construction environment, in which
12221 case scons will batch-build all targets configured with the same
12222 construction environment. Returning None indicates that the
12223 particular target should not be part of any batched build, but
12224 instead will be built by a separate invocation of action's command
12225 or function. Example:
12226
12227 def batch_key(action, env, target, source):
12228 tdir = target[0].dir
12229 if tdir.name == 'special':
12230 # Don't batch-build any target
12231 # in the special/ subdirectory.
12232 return None
12233 return (id(action), id(env), tdir)
12234 a = Action('build $CHANGED_SOURCES', batch_key=batch_key)
12235
12236 Miscellaneous Action Functions
12237 SCons supplies Action functions that arrange for various common file
12238 and directory manipulations to be performed. These are similar in
12239 concept to "tasks" in the Ant build tool, although the implementation
12240 is slightly different. These functions do not actually perform the
12241 specified action at the time the function is called, but rather are
12242 factory functions which return an Action object that can be executed at
12243 the appropriate time.
12244
12245 There are two natural ways that these Action Functions are intended to
12246 be used.
12247
12248 First, if you need to perform the action at the time the SConscript
12249 file is being read, you can use the Execute global function:
12250
12251 Execute(Touch('file'))
12252
12253 Second, you can use these functions to supply Actions in a list for use
12254 by the env.Command method. This can allow you to perform more
12255 complicated sequences of file manipulation without relying on
12256 platform-specific external commands:
12257
12258 env = Environment(TMPBUILD='/tmp/builddir')
12259 env.Command(
12260 target='foo.out',
12261 source='foo.in',
12262 action=[
12263 Mkdir('$TMPBUILD'),
12264 Copy('$TMPBUILD', '${SOURCE.dir}'),
12265 "cd $TMPBUILD && make",
12266 Delete('$TMPBUILD'),
12267 ],
12268 )
12269
12270 Chmod(dest, mode)
12271 Returns an Action object that changes the permissions on the
12272 specified dest file or directory to the specified mode which can be
12273 octal or string, similar to the bash command. Examples:
12274
12275 Execute(Chmod('file', 0o755))
12276
12277 env.Command('foo.out', 'foo.in',
12278 [Copy('$TARGET', '$SOURCE'),
12279 Chmod('$TARGET', 0o755)])
12280
12281 Execute(Chmod('file', "ugo+w"))
12282
12283 env.Command('foo.out', 'foo.in',
12284 [Copy('$TARGET', '$SOURCE'),
12285 Chmod('$TARGET', "ugo+w")])
12286
12287 The behavior of Chmod is limited on Windows, see the notes in the
12288 Python documentation for os.chmod, which is the underlying
12289 function.
12290
12291 Copy(dest, src)
12292 Returns an Action object that will copy the src source file or
12293 directory to the dest destination file or directory. Examples:
12294
12295 Execute(Copy('foo.output', 'foo.input'))
12296
12297 env.Command('bar.out', 'bar.in', Copy('$TARGET', '$SOURCE'))
12298
12299 Delete(entry, [must_exist])
12300 Returns an Action that deletes the specified entry, which may be a
12301 file or a directory tree. If a directory is specified, the entire
12302 directory tree will be removed. If the must_exist flag is set to a
12303 true value, then a Python error will be raised if the specified
12304 entry does not exist; the default is false, that is, the Action
12305 will silently do nothing if the entry does not exist. Examples:
12306
12307 Execute(Delete('/tmp/buildroot'))
12308
12309 env.Command(
12310 'foo.out',
12311 'foo.in',
12312 action=[
12313 Delete('${TARGET.dir}'),
12314 MyBuildAction,
12315 ],
12316 )
12317
12318 Execute(Delete('file_that_must_exist', must_exist=True))
12319
12320 Mkdir(name)
12321 Returns an Action that creates the directory name and all needed
12322 intermediate directories. name may also be a list of directories
12323 to create. Examples:
12324
12325 Execute(Mkdir('/tmp/outputdir'))
12326
12327 env.Command(
12328 'foo.out',
12329 'foo.in',
12330 action=[
12331 Mkdir('/tmp/builddir'),
12332 Copy('/tmp/builddir/foo.in', '$SOURCE'),
12333 "cd /tmp/builddir && make",
12334 Copy('$TARGET', '/tmp/builddir/foo.out'),
12335 ],
12336 )
12337
12338 Move(dest, src)
12339 Returns an Action that moves the specified src file or directory to
12340 the specified dest file or directory. Examples:
12341
12342 Execute(Move('file.destination', 'file.source'))
12343
12344 env.Command(
12345 'output_file',
12346 'input_file',
12347 action=[MyBuildAction, Move('$TARGET', 'file_created_by_MyBuildAction')],
12348 )
12349
12350 Touch(file)
12351 Returns an Action that updates the modification time on the
12352 specified file. Examples:
12353
12354 Execute(Touch('file_to_be_touched'))
12355
12356 env.Command('marker', 'input_file', action=[MyBuildAction, Touch('$TARGET')])
12357
12358 Variable Substitution
12359 Before executing a command, scons performs variable substitution on the
12360 string that makes up the action part of the builder. Variables to be
12361 interpolated are indicated in the string with a leading $, to
12362 distinguish them from plain text which is not to be substituted. The
12363 name may be surrounded by curly braces (${}) to separate the name from
12364 surrounding characters if necessary. Curly braces are required when you
12365 use Python list subscripting/slicing notation on a variable to select
12366 one or more items from a list, or access a variable's special
12367 attributes, or use Python expression substitution.
12368
12369 Besides regular construction variables, scons provides the following
12370 special variables for use in expanding commands:
12371
12372 $CHANGED_SOURCES
12373 The file names of all sources of the build command that have
12374 changed since the target was last built.
12375
12376 $CHANGED_TARGETS
12377 The file names of all targets that would be built from sources that
12378 have changed since the target was last built.
12379
12380 $SOURCE
12381 The file name of the source of the build command, or the file name
12382 of the first source if multiple sources are being built.
12383
12384 $SOURCES
12385 The file names of the sources of the build command.
12386
12387 $TARGET
12388 The file name of the target being built, or the file name of the
12389 first target if multiple targets are being built.
12390
12391 $TARGETS
12392 The file names of all targets being built.
12393
12394 $UNCHANGED_SOURCES
12395 The file names of all sources of the build command that have not
12396 changed since the target was last built.
12397
12398 $UNCHANGED_TARGETS
12399 The file names of all targets that would be built from sources that
12400 have not changed since the target was last built.
12401
12402 These names are reserved and may not be assigned to or used as
12403 construction variables.
12404
12405 For example, the following builder call:
12406
12407 env = Environment(CC='cc')
12408 env.Command(
12409 target=['foo'],
12410 source=['foo.c', 'bar.c'],
12411 action='@echo $CC -c -o $TARGET $SOURCES'
12412 )
12413
12414 would produce the following output:
12415
12416 cc -c -o foo foo.c bar.c
12417
12418 In the previous example, a string ${SOURCES[1]} would expand to: bar.c.
12419
12420 A variable name may have the following modifiers appended within the
12421 enclosing curly braces to access properties of the interpolated string.
12422 These are known as special attributes.
12423 base -
12424 The base path of the file name,
12425 including the directory path
12426 but excluding any suffix.
12427
12428 dir - The name of the directory in which the file exists.
12429 file - The file name, minus any directory portion.
12430 filebase - Like file but minus its suffix.
12431 suffix - Just the file suffix.
12432 abspath - The absolute path name of the file.
12433 relpath - The path name of the file relative to the root SConstruct
12434 file's directory.
12435 posix -
12436 The path with directories separated by forward slashes
12437 (/).
12438 Sometimes necessary on Windows systems
12439 when a path references a file on other (POSIX) systems.
12440
12441 windows -
12442 The path with directories separated by backslashes
12443 (\\).
12444 Sometimes necessary on POSIX-style systems
12445 when a path references a file on other (Windows) systems.
12446 win32 is a (deprecated) synonym for
12447 windows.
12448
12449 srcpath -
12450 The directory and file name to the source file linked to this
12451 file through
12452 VariantDir().
12453 If this file isn't linked,
12454 it just returns the directory and filename unchanged.
12455
12456 srcdir -
12457 The directory containing the source file linked to this file
12458 through
12459 VariantDir().
12460 If this file isn't linked,
12461 it just returns the directory part of the filename.
12462
12463 rsrcpath -
12464 The directory and file name to the source file linked to this
12465 file through
12466 VariantDir().
12467 If the file does not exist locally but exists in a Repository,
12468 the path in the Repository is returned.
12469 If this file isn't linked, it just returns the
12470 directory and filename unchanged.
12471
12472 rsrcdir -
12473 The Repository directory containing the source file linked to
12474 this file through
12475 VariantDir().
12476 If this file isn't linked,
12477 it just returns the directory part of the filename.
12478
12479
12480 For example, the specified target will expand as follows for the
12481 corresponding modifiers:
12482
12483 $TARGET => sub/dir/file.x
12484 ${TARGET.base} => sub/dir/file
12485 ${TARGET.dir} => sub/dir
12486 ${TARGET.file} => file.x
12487 ${TARGET.filebase} => file
12488 ${TARGET.suffix} => .x
12489 ${TARGET.abspath} => /top/dir/sub/dir/file.x
12490 ${TARGET.relpath} => sub/dir/file.x
12491
12492 $TARGET => ../dir2/file.x
12493 ${TARGET.abspath} => /top/dir2/file.x
12494 ${TARGET.relpath} => ../dir2/file.x
12495
12496 SConscript('src/SConscript', variant_dir='sub/dir')
12497 $SOURCE => sub/dir/file.x
12498 ${SOURCE.srcpath} => src/file.x
12499 ${SOURCE.srcdir} => src
12500
12501 Repository('/usr/repository')
12502 $SOURCE => sub/dir/file.x
12503 ${SOURCE.rsrcpath} => /usr/repository/src/file.x
12504 ${SOURCE.rsrcdir} => /usr/repository/src
12505
12506 Some modifiers can be combined, like ${TARGET.srcpath.base),
12507 ${TARGET.file.suffix}, etc.
12508
12509 The curly brace notation may also be used to enclose a Python
12510 expression to be evaluated. See the section called “Python Code
12511 Substitution” below for a description.
12512
12513 A variable name may also be a Python function associated with a
12514 construction variable in the environment. The function should accept
12515 four arguments:
12516 target - a list of target nodes
12517 source - a list of source nodes
12518 env - the construction environment
12519 for_signature -
12520 a Boolean value that specifies
12521 whether the function is being called
12522 for generating a build signature.
12523
12524
12525 SCons will insert whatever the called function returns into the
12526 expanded string:
12527
12528 def foo(target, source, env, for_signature):
12529 return "bar"
12530
12531 # Will expand $BAR to "bar baz"
12532 env=Environment(FOO=foo, BAR="$FOO baz")
12533
12534 As a reminder, this evaluation happens when $BAR is actually used in a
12535 builder action. The value of env['BAR'] will be exactly as it was set:
12536 "$FOO baz".
12537
12538 You can use this feature to pass arguments to a Python function by
12539 creating a callable class that stores one or more arguments in an
12540 object, and then uses them when the __call__() method is called. Note
12541 that in this case, the entire variable expansion must be enclosed by
12542 curly braces so that the arguments will be associated with the
12543 instantiation of the class:
12544
12545 class foo:
12546 def __init__(self, arg):
12547 self.arg = arg
12548
12549 def __call__(self, target, source, env, for_signature):
12550 return self.arg + " bar"
12551
12552 # Will expand $BAR to "my argument bar baz"
12553 env=Environment(FOO=foo, BAR="${FOO('my argument')} baz")
12554
12555 The special pseudo-variables $( and $) may be used to surround parts of
12556 a command line that may change without causing a rebuild--that is,
12557 which are not included in the signature of target files built with this
12558 command. All text between $( and $) will be removed from the command
12559 line before it is added to file signatures, and the $( and $) will be
12560 removed before the command is executed. For example, the command line:
12561
12562 echo Last build occurred $( $TODAY $). > $TARGET
12563
12564 would execute the command:
12565
12566 echo Last build occurred $TODAY. > $TARGET
12567
12568 but the command signature added to any target files would be:
12569
12570 echo Last build occurred . > $TARGET
12571
12572 Python Code Substitution
12573 If a substitutable expression using the notation ${something} does not
12574 appear to match one of the other substitution patterns, it is evaluated
12575 as a Python expression. This uses Python's eval function, with the
12576 globals parameter set to the current environment's set of construction
12577 variables, and the result substituted in. So in the following case:
12578
12579 env.Command(
12580 'foo.out', 'foo.in', "echo ${COND==1 and 'FOO' or 'BAR'} > $TARGET"
12581 )
12582
12583 the command executed will be either
12584
12585 echo FOO > foo.out
12586
12587 or
12588
12589 echo BAR > foo.out
12590
12591 according to the current value of env['COND'] when the command is
12592 executed. The evaluation takes place when the target is being built,
12593 not when the SConscript is being read. So if env['COND'] is changed
12594 later in the SConscript, the final value will be used.
12595
12596 Here's a more complete example. Note that all of COND, FOO, and BAR are
12597 construction variables, and their values are substituted into the final
12598 command. FOO is a list, so its elements are interpolated separated by
12599 spaces.
12600
12601 env=Environment()
12602 env['COND'] = 1
12603 env['FOO'] = ['foo1', 'foo2']
12604 env['BAR'] = 'barbar'
12605 env.Command(
12606 'foo.out', 'foo.in', "echo ${COND==1 and FOO or BAR} > $TARGET"
12607 )
12608
12609 will execute:
12610
12611 echo foo1 foo2 > foo.out
12612
12613 In point of fact, Python expression evaluation is how the special
12614 attributes are substituted: they are simply attributes of the Python
12615 objects that represent $TARGET, $SOURCES, etc., which SCons passes to
12616 eval which returns the value.
12617
12618 SCons uses the following rules when converting construction variables
12619 into command lines:
12620
12621 string
12622 When the value is a string it is interpreted as a space delimited
12623 list of command line arguments.
12624
12625 list
12626 When the value is a list it is interpreted as a list of command
12627 line arguments. Each element of the list is converted to a string.
12628
12629 other
12630 Anything that is not a list or string is converted to a string and
12631 interpreted as a single command line argument.
12632
12633 newline
12634 Newline characters (\n) delimit lines. The newline parsing is done
12635 after all other parsing, so it is not possible for arguments (e.g.
12636 file names) to contain embedded newline characters.
12637
12638 Note
12639 Use of the Python eval function is considered to have security
12640 implications, since, depending on input sources, arbitrary
12641 unchecked strings of code can be executed by the Python
12642 interpreter. Although SCons makes use of it in a somewhat
12643 restricted context, you should be aware of this issue when using
12644 the ${python-expression-for-subst} form.
12645
12646 Scanner Objects
12647 You can use the Scanner function to define objects to scan new file
12648 types for implicit dependencies. The Scanner function accepts the
12649 following arguments:
12650
12651 function
12652 This can be either:
12653
12654 • a Python function that will process the Node (file) and return
12655 a list of File Nodes representing the implicit dependencies
12656 (file names) found in the contents.
12657
12658 • a dictionary that maps keys (typically the file suffix, but see
12659 below for more discussion) to other Scanners that should be
12660 called.
12661
12662 If the argument is a Python function, the function must accept
12663 three required arguments and an optional fourth:
12664 node -
12665 The internal SCons node representing the file.
12666 Use str(node)
12667 to fetch the name of the file, and
12668 node.get_contents()
12669 to fetch the contents of the file as bytes or
12670 node.get_text_contents()
12671 to fetch the contents as text.
12672 Note that the file is
12673 not
12674 guaranteed to exist before the scanner is called,
12675 so the scanner function should check that
12676 if there's any chance that the scanned file
12677 might not exist
12678 (for example, if it's built from other files).
12679
12680 env - The construction environment for the scan.
12681 path -
12682 A tuple (or list)
12683 of directories that can be searched
12684 for files.
12685 This will usually be the tuple returned by the
12686 path_function
12687 argument (see below).
12688
12689 arg -
12690 The argument supplied when the scanner was created, if any
12691 (default None.
12692
12693
12694 name
12695 The name of the Scanner. This is mainly used to identify the
12696 Scanner internally. The default value is "NONE".
12697
12698 argument
12699 An optional argument that, if specified, will be passed to the
12700 scanner function (described above) and the path function (specified
12701 below).
12702
12703 skeys
12704 An optional list that can be used to determine which scanner should
12705 be used for a given Node. In the usual case of scanning for file
12706 names, this argument will be a list of suffixes for the different
12707 file types that this Scanner knows how to scan. If the argument is
12708 a string, then it will be expanded into a list by the current
12709 environment.
12710
12711 path_function
12712 A Python function that takes four or five arguments: a construction
12713 environment, a Node for the directory containing the SConscript
12714 file in which the first target was defined, a list of target nodes,
12715 a list of source nodes, and an optional argument supplied when the
12716 scanner was created. The path_function returns a tuple of
12717 directories that can be searched for files to be returned by this
12718 Scanner object. (Note that the FindPathDirs function can be used to
12719 return a ready-made path_function for a given construction variable
12720 name, instead of having to write your own function from scratch.)
12721
12722 node_class
12723 The class of Node that should be returned by this Scanner object.
12724 Any strings or other objects returned by the scanner function that
12725 are not of this class will be run through the function supplied by
12726 the node_factory argument.
12727
12728 node_factory
12729 A Python function that will take a string or other object and turn
12730 it into the appropriate class of Node to be returned by this
12731 Scanner object.
12732
12733 scan_check
12734 An optional Python function that takes two arguments, a Node (file)
12735 and a construction environment, and returns whether the Node
12736 should, in fact, be scanned for dependencies. This check can be
12737 used to eliminate unnecessary calls to the scanner function when,
12738 for example, the underlying file represented by a Node does not yet
12739 exist.
12740
12741 recursive
12742 An optional flag that specifies whether this scanner should be
12743 re-invoked on the dependency files returned by the scanner. When
12744 this flag is not set, the Node subsystem will only invoke the
12745 scanner on the file being scanned, and not (for example) also on
12746 the files specified by the #include lines in the file being
12747 scanned. recursive may be a callable function, in which case it
12748 will be called with a list of Nodes found and should return a list
12749 of Nodes that should be scanned recursively; this can be used to
12750 select a specific subset of Nodes for additional scanning.
12751
12752 Note that scons has a global SourceFileScanner object that is used by
12753 the Object, SharedObject and StaticObject builders to decide which
12754 scanner should be used for different file extensions. You can use the
12755 SourceFileScanner.add_scanner() method to add your own Scanner object
12756 to the SCons infrastructure that builds target programs or libraries
12757 from a list of source files of different types:
12758
12759 def xyz_scan(node, env, path):
12760 contents = node.get_text_contents()
12761 # Scan the contents and return the included files.
12762
12763 XYZScanner = Scanner(xyz_scan)
12764
12765 SourceFileScanner.add_scanner('.xyz', XYZScanner)
12766
12767 env.Program('my_prog', ['file1.c', 'file2.f', 'file3.xyz'])
12768
12770 scons and its configuration files are very portable, due largely to its
12771 implementation in Python. There are, however, a few portability issues
12772 waiting to trap the unwary.
12773
12774 .C file suffix
12775 scons handles the upper-case .C file suffix differently, depending on
12776 the capabilities of the underlying system. On a case-sensitive system
12777 such as Linux or UNIX, scons treats a file with a .C suffix as a C++
12778 source file. On a case-insensitive system such as Windows, scons treats
12779 a file with a .C suffix as a C source file.
12780
12781 Fortran file suffixes
12782 scons handles upper-case Fortran file suffixes differently depending on
12783 the capabilities of the underlying system. On a case-sensitive system
12784 such as Linux or UNIX, scons treats a file with a .F as a Fortran
12785 source file that is to be first run through the standard C
12786 preprocessor, while the lower-case version is not. This matches the
12787 convention of gfortran, which may also be followed by other Fortran
12788 compilers. This also applies to other naming variants, .FOR, .FTN,
12789 .F90, .F95, .F03 and .F08; files suffixed with .FPP and .fpp are both
12790 run through the preprocessor, as indicated by the pp part of the name.
12791 On a case-insensitive system such as Windows, scons treats a file with
12792 a .F suffix as a Fortran source file that should not be run through the
12793 C preprocessor.
12794
12795 Run through the C preprocessor here means that a different set of
12796 construction variables will be applied in constructed commands, for
12797 example $FORTRANPPCOM and $FORTRANPPCOMSTR instead of $FORTRANCOM and
12798 $FORTRANCOMSTR. See the Fortran-related construction variables for more
12799 details.
12800
12801 Windows: Cygwin Tools and Cygwin Python vs. Windows Pythons
12802 Cygwin supplies a set of tools and utilities that let users work on a
12803 Windows system using a more POSIX-like environment. The Cygwin tools,
12804 including Cygwin Python, do this, in part, by sharing an ability to
12805 interpret UNIX-like path names. For example, the Cygwin tools will
12806 internally translate a Cygwin path name like /cygdrive/c/mydir to an
12807 equivalent Windows pathname of C:/mydir (equivalent to C:\mydir).
12808
12809 Versions of Python that are built for native Windows execution, such as
12810 the python.org and ActiveState versions, do not have the Cygwin path
12811 name semantics. This means that using a native Windows version of
12812 Python to build compiled programs using Cygwin tools (such as gcc,
12813 bison and flex) may yield unpredictable results. "Mixing and matching"
12814 in this way can be made to work, but it requires careful attention to
12815 the use of path names in your SConscript files.
12816
12817 In practice, users can sidestep the issue by adopting the following
12818 rules: When using gcc, use the Cygwin-supplied Python interpreter to
12819 run scons; when using Microsoft Visual C/C++ (or some other Windows
12820 compiler) use the python.org or Microsoft Store or ActiveState version
12821 of Python to run scons.
12822
12823 Windows: scons.bat file
12824 On Windows systems, scons is executed via a wrapper scons.bat file.
12825 This has (at least) two ramifications:
12826
12827 First, Windows command-line users that want to use variable assignment
12828 on the command line may have to put double quotes around the
12829 assignments:
12830
12831 scons "FOO=BAR" "BAZ=BLEH"
12832
12833 Second, the Cygwin shell does not recognize this file as being the same
12834 as an scons command issued at the command-line prompt. You can work
12835 around this either by executing scons.bat from the Cygwin command line,
12836 or by creating a wrapper shell script named scons.
12837
12838 MinGW
12839 The MinGW bin directory must be in your PATH environment variable or
12840 the ['ENV']['PATH'] construction variable for scons to detect and use
12841 the MinGW tools. When running under the native Windows Python
12842 interpreter, scons will prefer the MinGW tools over the Cygwin tools,
12843 if they are both installed, regardless of the order of the bin
12844 directories in the PATH variable. If you have both MSVC and MinGW
12845 installed and you want to use MinGW instead of MSVC, then you must
12846 explicitly tell scons to use MinGW by passing tools=['mingw'] to the
12847 Environment function, because scons will prefer the MSVC tools over the
12848 MinGW tools.
12849
12851 In general, scons is not controlled by environment variables set in the
12852 shell used to invoke it, leaving it up to the SConscript file author to
12853 import those if desired. However the following variables are imported
12854 by scons itself if set:
12855
12856 SCONS_LIB_DIR
12857 Specifies the directory that contains the scons Python module
12858 directory. Normally scons can deduce this, but in some
12859 circumstances, such as working with a source release, it may be
12860 necessary to specify (for example,
12861 /home/aroach/scons-src-0.01/src/engine).
12862
12863 SCONSFLAGS
12864 A string containing options that will be used by scons in addition
12865 to those passed on the command line. Can be used to reduce frequent
12866 retyping of common options. The contents of SCONSFLAGS are
12867 considered before any passed command line options, so the command
12868 line can be used to override SCONSFLAGS options if necessary.
12869
12870 SCONS_CACHE_MSVC_CONFIG
12871 (Windows only). If set, save the shell environment variables
12872 generated when setting up the Microsoft Visual C++ compiler (and/or
12873 Build Tools) to a cache file, to give these settings, which are
12874 relatively expensive to generate, persistence across scons
12875 invocations. Use of this option is primarily intended to aid
12876 performance in tightly controlled Continuous Integration setups.
12877
12878 If set to a True-like value ("1", "true" or "True") will cache to a
12879 file named .scons_msvc_cache in the user's home directory. If set
12880 to a pathname, will use that pathname for the cache.
12881
12882 Note: use this cache with caution as it might be somewhat fragile:
12883 while each major toolset version (e.g. Visual Studio 2017 vs 2019)
12884 and architecture pair will get separate cache entries, if toolset
12885 updates cause a change to settings within a given release series,
12886 scons will not detect the change and will reuse old settings.
12887 Remove the cache file in case of problems with this. scons will
12888 ignore failures reading or writing the file and will silently
12889 revert to non-cached behavior in such cases.
12890
12891 Available since scons 3.1 (experimental).
12892
12894 The SCons User Guide at
12895 https://scons.org/doc/production/HTML/scons-user.html
12896
12897 The SCons Design Document (old)
12898
12899 The SCons Cookbook at
12900 https://scons-cookbook.readthedocs.io
12901 for examples of how to solve various problems with SCons.
12902
12903
12904 SCons source code
12905 on GitHub[5]
12906
12907
12908 The SCons API Reference
12909 https://scons.org/doc/production/HTML/scons-api/index.html
12910 (for internal details)
12911
12912
12914 Originally: Steven Knight knight@baldmt.com and Anthony Roach
12915 aroach@electriceyeball.com.
12916
12917 Since 2010: The SCons Development Team scons-dev@scons.org.
12918
12920 The SCons Development Team
12921
12923 Copyright © 2001 - 2021 The SCons Foundation
12924
12926 1. LLVM specification
12927 https://clang.llvm.org/docs/JSONCompilationDatabase.html
12928
12929 2. ninja package
12930 https://pypi.org/project/ninja/
12931
12932 3. If no_progress is set via SetOption in an SConscript file (but not
12933 if set in a site_init.py file) there will still be an initial
12934 status message about reading SConscript files since SCons has to
12935 start reading them before it can see the SetOption.
12936
12937 4. http://www.opensource.org/licenses/alphabetical
12938 http://www.opensource.org/licenses/alphabetical
12939
12940 5. on GitHub
12941 https://github.com/SCons/scons
12942
12943
12944
12945SCons 4.2.0<pVuebrdsaitoen>R4e.l2e.a0sed Mon, 09 Aug 2021 10:31:08 +0000</pubdate> SCONS(1)