Add %SYSTEMDRIVE% to the list of Windows variables preserved. (Chris Prince)
[scons.git] / doc / man / scons.1
1 .\" __COPYRIGHT__
2 .\"
3 .\" Permission is hereby granted, free of charge, to any person obtaining
4 .\" a copy of this software and associated documentation files (the
5 .\" "Software"), to deal in the Software without restriction, including
6 .\" without limitation the rights to use, copy, modify, merge, publish,
7 .\" distribute, sublicense, and/or sell copies of the Software, and to
8 .\" permit persons to whom the Software is furnished to do so, subject to
9 .\" the following conditions:
10 .\"
11 .\" The above copyright notice and this permission notice shall be included
12 .\" in all copies or substantial portions of the Software.
13 .\"
14 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
15 .\" KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
16 .\" WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 .\" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 .\" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 .\" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 .\" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 .\"
22 .\" __FILE__ __REVISION__ __DATE__ __DEVELOPER__
23 .\"
24 .\" ES - Example Start - indents and turns off line fill
25 .de ES
26 .RS
27 .nf
28 ..
29 .\" EE - Example End - ends indent and turns line fill back on
30 .de EE
31 .fi
32 .RE
33 ..
34 .TH SCONS 1 "January 2005"
35 .SH NAME
36 scons \- a software construction tool
37 .SH SYNOPSIS
38 .B scons
39 [
40 .IR options ...
41 ]
42 [
43 .IR name = val ...
44 ]
45 [
46 .IR targets ...
47 ]
48 .SH DESCRIPTION
49
50 The 
51 .B scons 
52 utility builds software (or other files) by determining which
53 component pieces must be rebuilt and executing the necessary commands to
54 rebuild them.
55
56 By default, 
57 .B scons 
58 searches for a file named 
59 .IR SConstruct ,
60 .IR Sconstruct ,
61 or
62 .I sconstruct
63 (in that order) in the current directory and reads its
64 configuration from the first file found.
65 An alternate file name may be
66 specified via the 
67 .B -f
68 option.
69
70 The
71 .I SConstruct
72 file can specify subsidiary
73 configuration files using the
74 .B SConscript()
75 function.
76 By convention,
77 these subsidiary files are named
78 .IR SConscript ,
79 although any name may be used.
80 (Because of this naming convention,
81 the term "SConscript files"
82 is sometimes used to refer
83 generically to all
84 .B scons
85 configuration files,
86 regardless of actual file name.)
87
88 The configuration files
89 specify the target files to be built, and
90 (optionally) the rules to build those targets.  Reasonable default
91 rules exist for building common software components (executable
92 programs, object files, libraries), so that for most software
93 projects, only the target and input files need be specified.
94
95 .B scons
96 reads and executes the SConscript files as Python scripts,
97 so you may use normal Python scripting capabilities
98 (such as flow control, data manipulation, and imported Python libraries)
99 to handle complicated build situations.
100 .BR scons ,
101 however, reads and executes all of the SConscript files
102 .I before
103 it begins building any targets.
104 To make this obvious,
105 .B scons
106 prints the following messages about what it is doing:
107
108 .ES
109 $ scons foo.out
110 scons: Reading SConscript files ...
111 scons: done reading SConscript files.
112 scons: Building targets  ...
113 cp foo.in foo.out
114 scons: done building targets.
115 $
116 .EE
117
118 The status messages
119 (everything except the line that reads "cp foo.in foo.out")
120 may be suppressed using the
121 .B -Q
122 option.
123
124 .B scons
125 does not automatically propagate
126 the external environment used to execute
127 .B scons
128 to the commands used to build target files.
129 This is so that builds will be guaranteed
130 repeatable regardless of the environment
131 variables set at the time
132 .B scons
133 is invoked.
134 This also means that if the compiler or other commands
135 that you want to use to build your target files
136 are not in standard system locations,
137 .B scons
138 will not find them unless
139 you explicitly set the PATH
140 to include those locations.
141 Whenever you create an
142 .B scons
143 construction environment,
144 you can propagate the value of PATH
145 from your external environment as follows:
146
147 .ES
148 import os
149 env = Environment(ENV = {'PATH' : os.environ['PATH']})
150 .EE
151
152 .B scons
153 can scan known input files automatically for dependency
154 information (for example, #include statements
155 in C or C++ files) and will rebuild dependent files appropriately
156 whenever any "included" input file changes. 
157 .B scons
158 supports the
159 ability to define new scanners for unknown input file types.
160
161 .B scons
162 knows how to fetch files automatically from
163 SCCS or RCS subdirectories
164 using SCCS, RCS or BitKeeper.
165
166 .B scons
167 is normally executed in a top-level directory containing a
168 .I SConstruct
169 file, optionally specifying
170 as command-line arguments
171 the target file or files to be built.
172
173 By default, the command
174
175 .ES
176 scons
177 .EE
178
179 will build all target files in or below the current directory.
180 Explicit default targets
181 (to be built when no targets are specified on the command line)
182 may be defined the SConscript file(s)
183 using the
184 .B Default()
185 function, described below.
186
187 Even when
188 .B Default()
189 targets are specified in the SConscript file(s),
190 all target files in or below the current directory
191 may be built by explicitly specifying
192 the current directory (.)
193 as a command-line target:
194
195 .ES
196 scons .
197 .EE
198
199 Building all target files,
200 including any files outside of the current directory,
201 may be specified by supplying a command-line target
202 of the root directory (on POSIX systems):
203
204 .ES
205 scons /
206 .EE
207
208 or the path name(s) of the volume(s) in which all the targets
209 should be built (on Windows systems):
210
211 .ES
212 scons C:\\ D:\\
213 .EE
214
215 To build only specific targets,
216 supply them as command-line arguments:
217
218 .ES
219 scons foo bar
220 .EE
221
222 in which case only the specified targets will be built
223 (along with any derived files on which they depend).
224
225 Specifying "cleanup" targets in SConscript files is not
226 necessary.  The 
227 .B -c
228 flag removes all files
229 necessary to build the specified target:
230
231 .ES
232 scons -c .
233 .EE
234
235 to remove all target files, or:
236
237 .ES
238 scons -c build export
239 .EE
240
241 to remove target files under build and export.
242 Additional files or directories to remove can be specified using the
243 Clean() function.
244
245 A subset of a hierarchical tree may be built by
246 remaining at the top-level directory (where the 
247 .I SConstruct
248 file lives) and specifying the subdirectory as the target to be
249 built:
250
251 .ES
252 scons src/subdir
253 .EE
254
255 or by changing directory and invoking scons with the
256 .B -u
257 option, which traverses up the directory
258 hierarchy until it finds the 
259 .I SConstruct
260 file, and then builds
261 targets relatively to the current subdirectory:
262
263 .ES
264 cd src/subdir
265 scons -u .
266 .EE
267
268 .B scons
269 supports building multiple targets in parallel via a
270 .B -j
271 option that takes, as its argument, the number
272 of simultaneous tasks that may be spawned:
273
274 .ES
275 scons -j 4
276 .EE
277
278 builds four targets in parallel, for example.
279
280 .B scons
281 can maintain a cache of target (derived) files that can
282 be shared between multiple builds.  When caching is enabled in a
283 SConscript file, any target files built by 
284 .B scons
285 will be copied
286 to the cache.  If an up-to-date target file is found in the cache, it
287 will be retrieved from the cache instead of being rebuilt locally.
288 Caching behavior may be disabled and controlled in other ways by the
289 .BR --cache-force , 
290 .BR --cache-disable ,
291 and
292 .B --cache-show
293 command-line options.  The
294 .B --random
295 option is useful to prevent multiple builds
296 from trying to update the cache simultaneously.
297
298 Values of variables to be passed to the SConscript file(s)
299 may be specified on the command line:
300
301 .ES
302 scons debug=1 .
303 .EE
304
305 These variables are available in SConscript files
306 through the ARGUMENTS dictionary,
307 and can be used in the SConscript file(s) to modify
308 the build in any way:
309
310 .ES
311 if ARGUMENTS.get('debug', 0):
312     env = Environment(CCFLAGS = '-g')
313 else:
314     env = Environment()
315 .EE
316
317 The command-line variable arguments are also available
318 in the ARGLIST list,
319 indexed by their order on the command line.
320 This allows you to process them in order rather than by name,
321 if necessary.
322 ARGLIST[0] returns a tuple
323 containing (argname, argvalue).
324 A Python exception is thrown if you
325 try to access a list member that
326 does not exist.
327
328 .B scons
329 requires Python version 1.5.2 or later.
330 There should be no other dependencies or requirements to run
331 .B scons.
332
333 .\" The following paragraph reflects the default tool search orders
334 .\" currently in SCons/Tool/__init__.py.  If any of those search orders
335 .\" change, this documentation should change, too.
336 By default,
337 .B scons
338 knows how to search for available programming tools
339 on various systems.
340 On WIN32 systems,
341 .B scons
342 searches in order for the
343 Microsoft Visual C++ tools,
344 the MinGW tool chain,
345 the Intel compiler tools,
346 and the PharLap ETS compiler.
347 On OS/2 systems,
348 .B scons
349 searches in order for the 
350 OS/2 compiler,
351 the GCC tool chain,
352 and the Microsoft Visual C++ tools,
353 On SGI IRIX, IBM AIX, Hewlett Packard HP-UX, and Sun Solaris systems,
354 .B scons
355 searches for the native compiler tools
356 (MIPSpro, Visual Age, aCC, and Forte tools respectively)
357 and the GCC tool chain.
358 On all other platforms,
359 including POSIX (Linux and UNIX) platforms,
360 .B scons
361 searches in order
362 for the GCC tool chain,
363 the Microsoft Visual C++ tools,
364 and the Intel compiler tools.
365 You may, of course, override these default values
366 by appropriate configuration of
367 Environment construction variables.
368
369 .SH OPTIONS
370 In general, 
371 .B scons 
372 supports the same command-line options as GNU
373 .BR make , 
374 and many of those supported by 
375 .BR cons .
376
377 .TP
378 -b
379 Ignored for compatibility with non-GNU versions of
380 .BR make.
381
382 .TP
383 -c, --clean, --remove
384 Clean up by removing all target files for which a construction
385 command is specified.
386 Also remove any files or directories associated to the construction command
387 using the Clean() function.
388
389 .TP
390 --cache-disable, --no-cache
391 Disable the derived-file caching specified by
392 .BR CacheDir ().
393 .B scons
394 will neither retrieve files from the cache
395 nor copy files to the cache.
396
397 .TP
398 --cache-force, --cache-populate
399 When using
400 .BR CacheDir (),
401 populate a cache by copying any already-existing, up-to-date
402 derived files to the cache,
403 in addition to files built by this invocation.
404 This is useful to populate a new cache with
405 all the current derived files,
406 or to add to the cache any derived files
407 recently built with caching disabled via the
408 .B --cache-disable
409 option.
410
411 .TP
412 --cache-show
413 When using
414 .BR CacheDir ()
415 and retrieving a derived file from the cache,
416 show the command
417 that would have been executed to build the file,
418 instead of the usual report,
419 "Retrieved `file' from cache."
420 This will produce consistent output for build logs,
421 regardless of whether a target
422 file was rebuilt or retrieved from the cache.
423
424 .TP
425 .RI --config= mode
426 This specifies how the
427 .B Configure
428 call should use or generate the
429 results of configuration tests.
430 The option should be specified from
431 among the following choices:
432
433 .TP
434 --config=auto
435 scons will use its normal dependency mechanisms
436 to decide if a test must be rebuilt or not.
437 This saves time by not running the same configuration tests
438 every time you invoke scons,
439 but will overlook changes in system header files
440 or external commands (such as compilers)
441 if you don't specify those dependecies explicitly.
442 This is the default behavior.
443
444 .TP
445 --config=force
446 If this option is specified,
447 all configuration tests will be re-run
448 regardless of whether the
449 cached results are out of date.
450 This can be used to explicitly
451 force the configuration tests to be updated
452 in response to an otherwise unconfigured change
453 in a system header file or compiler.
454
455 .TP
456 --config=cache
457 If this option is specified,
458 no configuration tests will be rerun
459 and all results will be taken from cache.
460 Note that scons will still consider it an error
461 if --config=cache is specified
462 and a necessary test does not
463 yet have any results in the cache.
464
465 .TP 
466 .RI "-C" " directory" ",  --directory=" directory
467 Change to the specified 
468 .I directory
469 before searching for the 
470 .IR SConstruct ,
471 .IR Sconstruct ,
472 or
473 .I sconstruct
474 file, or doing anything
475 else.  Multiple 
476 .B -C
477 options are interpreted
478 relative to the previous one, and the right-most
479 .B -C
480 option wins. (This option is nearly
481 equivalent to 
482 .BR "-f directory/SConstruct" ,
483 except that it will search for
484 .IR SConstruct ,
485 .IR Sconstruct , 
486 or
487 .I sconstruct
488 in the specified directory.)
489
490 .\" .TP
491 .\" -d
492 .\" Display dependencies while building target files.  Useful for
493 .\" figuring out why a specific file is being rebuilt, as well as
494 .\" general debugging of the build process.
495
496 .TP
497 -D
498 Works exactly the same way as the
499 .B -u
500 option except for the way default targets are handled.
501 When this option is used and no targets are specified on the command line,
502 all default targets are built, whether or not they are below the current
503 directory.
504
505 .TP
506 .RI --debug= type
507 Debug the build process.
508 .I type
509 specifies what type of debugging:
510
511 .TP
512 --debug=count
513 Print how many objects are created
514 of the various classes used internally by SCons
515 before and after reading the SConscript files
516 and before and after building targets.
517 This only works when run under Python 2.1 or later.
518
519 .TP
520 --debug=dtree
521 Print the dependency tree
522 after each top-level target is built. This prints out only derived files.
523
524 .TP
525 --debug=findlibs
526 Instruct the scanner that searches for libraries
527 to print a message about each potential library
528 name it is searching for,
529 and about the actual libraries it finds.
530
531 .TP
532 --debug=includes
533 Print the include tree after each top-level target is built. 
534 This is generally used to find out what files are included by the sources
535 of a given derived file:
536
537 .ES
538 $ scons --debug=includes foo.o
539 .EE
540
541 .TP
542 --debug=memoizer
543 Prints a summary of hits and misses in the Memoizer,
544 the internal SCons subsystem for caching
545 various values in memory instead of
546 recomputing them each time they're needed.
547
548 .TP
549 --debug=memory
550 Prints how much memory SCons uses
551 before and after reading the SConscript files
552 and before and after building targets.
553
554 .TP
555 --debug=nomemoizer
556 Disables use of the Memoizer,
557 the internal SCons subsystem for caching
558 various values in memory instead of
559 recomputing them each time they're needed.
560 This provides more accurate counts of the
561 underlying function calls in the 
562 Python profiler output when using the
563 .R --profile=
564 option.
565 (When the Memoizer is used,
566 the profiler counts all
567 memoized functions as being executed
568 by the Memoizer's wrapper calls.)
569
570 .TP
571 --debug=objects
572 Prints a list of the various objects
573 of the various classes used internally by SCons.
574 This only works when run under Python 2.1 or later.
575
576 .TP
577 --debug=pdb
578 Re-run SCons under the control of the
579 .RI pdb
580 Python debugger.
581
582 .TP
583 --debug=presub
584 Print the raw command line used to build each target
585 before the construction environment variables are substituted.
586 Also shows which targets are being built by this command.
587 Output looks something like this:
588 .ES
589 $ scons --debug=presub
590 Building myprog.o with action(s):
591   $SHCC $SHCCFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
592 ...
593 .EE
594
595 .TP
596 --debug=stacktrace
597 Prints an internal Python stack trace
598 when encountering an otherwise unexplained error.
599
600 .TP
601 --debug=stree
602 Print the dependency tree along with status information.  This is the
603 same as the debug=tree option, but additional status information is
604 provided for each node in the tree.
605
606 .TP
607 --debug=time
608 Prints various time profiling information: the time spent
609 executing each build command, the total build time, the total time spent
610 executing build commands, the total time spent executing SConstruct and
611 SConscript files, and the total time spent executing SCons itself.
612
613 .TP
614 --debug=tree
615 Print the dependency tree
616 after each top-level target is built. This prints out the complete
617 dependency tree including implicit dependencies and ignored
618 dependencies.
619
620 .TP
621 .RI --diskcheck= types
622 Enable specific checks for
623 whether or not there is a file on disk
624 where the SCons configuration expects a directory
625 (or vice versa),
626 and whether or not RCS or SCCS sources exist
627 when searching for source and include files.
628 The
629 .I types
630 argument can be set to:
631 .BR all ,
632 to enable all checks explicitly
633 (the default behavior);
634 .BR none ,
635 to disable all such checks;
636 .BR match ,
637 to check that files and directories on disk
638 match SCons' expected configuration;
639 .BR rcs ,
640 to check for the existence of an RCS source
641 for any missing source or include files;
642 .BR sccs ,
643 to check for the existence of an SCCS source
644 for any missing source or include files.
645 Multiple checks can be specified separated by commas;
646 for example,
647 .B --diskcheck=sccs,rcs
648 would still check for SCCS and RCS sources,
649 but disable the check for on-disk matches of files and directories.
650 Disabling some or all of these checks
651 can provide a performance boost for large configurations,
652 or when the configuration will check for files and/or directories
653 across networked or shared file systems,
654 at the slight increased risk of an incorrect build
655 or of not handling errors gracefully
656 (if include files really should be
657 found in SCCS or RCS, for example,
658 or if a file really does exist
659 where the SCons configuration expects a directory).
660
661 .\" .TP
662 .\" -e, --environment-overrides
663 .\" Variables from the execution environment override construction
664 .\" variables from the SConscript files.
665
666 .TP
667 .RI -f " file" ", --file=" file ", --makefile=" file ", --sconstruct=" file
668 Use 
669 .I file 
670 as the initial SConscript file.
671
672 .TP 
673 -h, --help
674 Print a local help message for this build, if one is defined in
675 the SConscript file(s), plus a line that describes the 
676 .B -H
677 option for command-line option help.  If no local help message
678 is defined, prints the standard help message about command-line
679 options.  Exits after displaying the appropriate message.
680
681 .TP
682 -H, --help-options
683 Print the standard help message about command-line options and
684 exit.
685
686 .TP
687 -i, --ignore-errors
688 Ignore all errors from commands executed to rebuild files.
689
690 .TP 
691 .RI -I " directory" ", --include-dir=" directory
692 Specifies a 
693 .I directory
694 to search for
695 imported Python modules.  If several 
696 .B -I
697 options
698 are used, the directories are searched in the order specified.
699
700 .TP
701 --implicit-cache
702 Cache implicit dependencies. This can cause 
703 .B scons
704 to miss changes in the implicit dependencies in cases where a new implicit
705 dependency is added earlier in the implicit dependency search path
706 (e.g. CPPPATH) than a current implicit dependency with the same name.
707
708 .TP
709 --implicit-deps-changed
710 Force SCons to ignore the cached implicit dependencies. This causes the
711 implicit dependencies to be rescanned and recached. This implies
712 .BR --implicit-cache .
713
714 .TP
715 --implicit-deps-unchanged
716 Force SCons to ignore changes in the implicit dependencies.
717 This causes cached implicit dependencies to always be used.
718 This implies 
719 .BR --implicit-cache .
720
721 .TP
722 .RI -j " N" ", --jobs=" N
723 Specifies the number of jobs (commands) to run simultaneously.
724 If there is more than one 
725 .B -j 
726 option, the last one is effective.
727 .\" ??? If the 
728 .\" .B -j 
729 .\" option
730 .\" is specified without an argument,
731 .\" .B scons 
732 .\" will not limit the number of
733 .\" simultaneous jobs.
734
735 .TP
736 -k, --keep-going
737 Continue as much as possible after an error.  The target that
738 failed and those that depend on it will not be remade, but other
739 targets specified on the command line will still be processed.
740
741 .\" .TP
742 .\" .RI  -l " N" ", --load-average=" N ", --max-load=" N
743 .\" No new jobs (commands) will be started if
744 .\" there are other jobs running and the system load
745 .\" average is at least 
746 .\" .I N
747 .\" (a floating-point number).
748
749 .TP
750 .RI --duplicate= ORDER
751 There are three ways to duplicate files in a build tree: hard links,
752 soft (symbolic) links and copies. The default behaviour of SCons is to 
753 prefer hard links to soft links to copies. You can specify different
754 behaviours with this option.
755 .IR ORDER 
756 must be one of 
757 .IR hard-soft-copy
758 (the default),
759 .IR soft-hard-copy ,
760 .IR hard-copy ,
761 .IR soft-copy
762 or
763 .IR copy .
764 SCons will attempt to duplicate files using
765 the mechanisms in the specified order.
766
767 .\"
768 .\" .TP
769 .\" --list-derived
770 .\" List derived files (targets, dependencies) that would be built,
771 .\" but do not build them.
772 .\" [XXX This can probably go away with the right
773 .\" combination of other options.  Revisit this issue.]
774 .\"
775 .\" .TP
776 .\" --list-actions
777 .\" List derived files that would be built, with the actions
778 .\" (commands) that build them.  Does not build the files.
779 .\" [XXX This can probably go away with the right
780 .\" combination of other options.  Revisit this issue.]
781 .\"
782 .\" .TP
783 .\" --list-where
784 .\" List derived files that would be built, plus where the file is
785 .\" defined (file name and line number).  Does not build the files.
786 .\" [XXX This can probably go away with the right
787 .\" combination of other options.  Revisit this issue.]
788
789 .TP
790 -m
791 Ignored for compatibility with non-GNU versions of
792 .BR make .
793
794 .TP
795 .RI --max-drift= SECONDS
796 Set the maximum expected drift in the modification time of files to 
797 .IR SECONDS .
798 This value determines how long a file must be unmodified
799 before its cached content signature
800 will be used instead of
801 calculating a new content signature (MD5 checksum)
802 of the file's contents.
803 The default value is 2 days, which means a file must have a
804 modification time of at least two days ago in order to have its
805 cached content signature used.
806 A negative value means to never cache the content
807 signature and to ignore the cached value if there already is one. A value
808 of 0 means to always use the cached signature,
809 no matter how old the file is.
810
811 .TP
812 -n, --just-print, --dry-run, --recon
813 No execute.  Print the commands that would be executed to build
814 any out-of-date target files, but do not execute the commands.
815
816 .\" .TP
817 .\" .RI -o " file" ", --old-file=" file ", --assume-old=" file
818 .\" Do not rebuild 
819 .\" .IR file ,
820 .\" and do
821 .\" not rebuild anything due to changes in the contents of
822 .\" .IR file .
823 .\" .TP 
824 .\" .RI --override " file"
825 .\" Read values to override specific build environment variables
826 .\" from the specified 
827 .\" .IR file .
828 .\" .TP
829 .\" -p
830 .\" Print the data base (construction environments,
831 .\" Builder and Scanner objects) that are defined
832 .\" after reading the SConscript files.
833 .\" After printing, a normal build is performed
834 .\" as usual, as specified by other command-line options.
835 .\" This also prints version information
836 .\" printed by the 
837 .\" .B -v
838 .\" option.
839 .\"
840 .\" To print the database without performing a build do:
841 .\"
842 .\" .ES
843 .\" scons -p -q
844 .\" .EE
845
846 .TP
847 .RI --profile= file
848 Run SCons under the Python profiler
849 and save the results in the specified
850 .IR file .
851 The results may be analyzed using the Python
852 pstats module.
853 .TP
854 -q, --question
855 Do not run any commands, or print anything.  Just return an exit
856 status that is zero if the specified targets are already up to
857 date, non-zero otherwise.
858 .TP
859 -Q
860 Quiets SCons status messages about
861 reading SConscript files,
862 building targets
863 and entering directories.
864 Commands that are executed
865 to rebuild target files are still printed.
866
867 .\" .TP
868 .\" -r, -R, --no-builtin-rules, --no-builtin-variables
869 .\" Clear the default construction variables.  Construction
870 .\" environments that are created will be completely empty.
871
872 .TP
873 --random
874 Build dependencies in a random order.  This is useful when
875 building multiple trees simultaneously with caching enabled,
876 to prevent multiple builds from simultaneously trying to build
877 or retrieve the same target files.
878
879 .TP
880 -s, --silent, --quiet
881 Silent.  Do not print commands that are executed to rebuild
882 target files.
883 Also suppresses SCons status messages.
884
885 .TP
886 -S, --no-keep-going, --stop
887 Ignored for compatibility with GNU 
888 .BR make .
889
890 .TP
891 -t, --touch
892 Ignored for compatibility with GNU
893 .BR make .  
894 (Touching a file to make it
895 appear up-to-date is unnecessary when using 
896 .BR scons .)
897
898 .TP
899 -u, --up, --search-up
900 Walks up the directory structure until an 
901 .I SConstruct ,
902 .I Sconstruct
903 or 
904 .I sconstruct
905 file is found, and uses that
906 as the top of the directory tree.
907 If no targets are specified on the command line,
908 only targets at or below the
909 current directory will be built.
910
911 .TP
912 -U
913 Works exactly the same way as the
914 .B -u
915 option except for the way default targets are handled.
916 When this option is used and no targets are specified on the command line,
917 all default targets that are defined in the SConscript(s) in the current
918 directory are built, regardless of what directory the resultant targets end
919 up in.
920
921 .TP
922 -v, --version
923 Print the 
924 .B scons
925 version, copyright information,
926 list of authors, and any other relevant information.
927 Then exit.
928
929 .TP
930 -w, --print-directory
931 Print a message containing the working directory before and
932 after other processing.
933
934 .TP
935 .RI --warn= type ", --warn=no-" type
936 Enable or disable warnings.
937 .I type
938 specifies the type of warnings to be enabled or disabled:
939
940 .TP
941 --warn=all, --warn=no-all
942 Enables or disables all warnings.
943
944 .TP
945 --warn=dependency, --warn=no-dependency
946 Enables or disables warnings about dependencies.
947 These warnings are disabled by default.
948
949 .TP
950 --warn=deprecated, --warn=no-deprecated
951 Enables or disables warnings about use of deprecated features.
952 These warnings are enabled by default.
953
954 .TP
955 --warn=missing-sconscript, --warn=no-missing-sconscript
956 Enables or disables warnings about missing SConscript files.
957 These warnings are enabled by default.
958
959 .TP
960 --no-print-directory
961 Turn off -w, even if it was turned on implicitly.
962
963 .\" .TP
964 .\" .RI --write-filenames= file
965 .\" Write all filenames considered into
966 .\" .IR file .
967 .\"
968 .\" .TP
969 .\" .RI -W " file" ", --what-if=" file ", --new-file=" file ", --assume-new=" file
970 .\" Pretend that the target 
971 .\" .I file 
972 .\" has been
973 .\" modified.  When used with the 
974 .\" .B -n
975 .\" option, this
976 .\" show you what would be rebuilt if you were to modify that file.
977 .\" Without 
978 .\" .B -n
979 .\" ... what? XXX
980 .\"
981 .\" .TP
982 .\" --warn-undefined-variables
983 .\" Warn when an undefined variable is referenced.
984
985 .TP 
986 .RI -Y " repository" ", --repository=" repository
987 Search the specified repository for any input and target
988 files not found in the local directory hierarchy.  Multiple
989 .B -Y
990 options may specified, in which case the
991 repositories are searched in the order specified.
992
993 .SH CONFIGURATION FILE REFERENCE
994 .\" .SS Python Basics
995 .\" XXX Adding this in the future would be a help.
996 .SS Construction Environments
997 A construction environment is the basic means by which the SConscript
998 files communicate build information to 
999 .BR scons .
1000 A new construction environment is created using the 
1001 .B Environment 
1002 function:
1003
1004 .ES
1005 env = Environment()
1006 .EE
1007
1008 By default, a new construction environment is
1009 initialized with a set of builder methods
1010 and construction variables that are appropriate
1011 for the current platform.
1012 An optional platform keyword argument may be
1013 used to specify that an environment should
1014 be initialized for a different platform:
1015
1016 .ES
1017 env = Environment(platform = 'cygwin')
1018 env = Environment(platform = 'os2')
1019 env = Environment(platform = 'posix')
1020 env = Environment(platform = 'win32')
1021 .EE
1022
1023 Specifying a platform initializes the appropriate
1024 construction variables in the environment
1025 to use and generate file names with prefixes
1026 and suffixes appropriate for the platform.
1027
1028 Note that the
1029 .B win32
1030 platform adds the
1031 .B SYSTEMDRIVE
1032 and
1033 .B SYSTEMROOT
1034 variables from the user's external environment
1035 to the construction environment's
1036 .B ENV
1037 dictionary.
1038 This is so that any executed commands
1039 that use sockets to connect with other systems
1040 (such as fetching source files from
1041 external CVS repository specifications like 
1042 .BR :pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons )
1043 will work on Win32 systems.
1044
1045 The platform argument may be function or callable object,
1046 in which case the Environment() method
1047 will call the specified argument to update
1048 the new construction environment:
1049
1050 .ES
1051 def my_platform(env):
1052     env['VAR'] = 'xyzzy'
1053
1054 env = Environment(platform = my_platform)
1055 .EE
1056
1057 Additionally, a specific set of tools
1058 with which to initialize the environment
1059 may specified as an optional keyword argument:
1060
1061 .ES
1062 env = Environment(tools = ['msvc', 'lex'])
1063 .EE
1064
1065 Non-built-in tools may be specified using the toolpath argument:
1066
1067 .ES
1068 env = Environment(tools = ['default', 'foo'], toolpath = ['tools'])
1069 .EE
1070
1071 This looks for a tool specification in tools/foo.py (as well as
1072 using the ordinary default tools for the platform).  foo.py should
1073 have two functions: generate(env, **kw) and exists(env).
1074 The
1075 .B generate()
1076 function
1077 modifies the passed-in environment
1078 to set up variables so that the tool
1079 can be executed;
1080 it may use any keyword arguments
1081 that the user supplies (see below)
1082 to vary its initialization.
1083 The
1084 .B exists()
1085 function should return a true
1086 value if the tool is available.
1087 Tools in the toolpath are used before
1088 any of the built-in ones.  For example, adding gcc.py to the toolpath
1089 would override the built-in gcc tool.
1090 Also note that the toolpath is
1091 stored in the environment for use
1092 by later calls to
1093 .BR Copy ()
1094 and
1095 .BR Tool ()
1096 methods:
1097
1098 .ES
1099 base = Environment(toolpath=['custom_path'])
1100 derived = base.Copy(tools=['custom_tool'])
1101 derived.CustomBuilder()
1102 .EE
1103
1104 The elements of the tools list may also
1105 be functions or callable objects,
1106 in which case the Environment() method
1107 will call the specified elements
1108 to update the new construction environment:
1109
1110 .ES
1111 def my_tool(env):
1112     env['XYZZY'] = 'xyzzy'
1113
1114 env = Environment(tools = [my_tool])
1115 .EE
1116
1117 The individual elements of the tools list
1118 may also themselves be two-element lists of the form
1119 .RI ( toolname ", " kw_dict ).
1120 SCons searches for the
1121 .I toolname
1122 specification file as described above, and
1123 passes
1124 .IR kw_dict ,
1125 which must be a dictionary, as keyword arguments to the tool's
1126 .B generate
1127 function.
1128 The
1129 .B generate
1130 function can use the arguments to modify the tool's behavior
1131 by setting up the environment in different ways
1132 or otherwise changing its initialization.
1133
1134 .ES
1135 # in tools/my_tool.py:
1136 def generate(env, **kw):
1137   # Sets MY_TOOL to the value of keyword argument 'arg1' or 1.
1138   env['MY_TOOL'] = kw.get('arg1', '1')
1139 def exists(env):
1140   return 1
1141
1142 # in SConstruct:
1143 env = Environment(tools = ['default', ('my_tool', {'arg1': 'abc'})],
1144                   toolpath=['tools'])
1145 .EE
1146
1147 The tool definition (i.e. my_tool()) can use the PLATFORM variable from
1148 the environment it receives to customize the tool for different platforms.
1149
1150 If no tool list is specified, then SCons will auto-detect the installed
1151 tools using the PATH variable in the ENV construction variable and the
1152 platform name when the Environment is constructed. Changing the PATH
1153 variable after the Environment is constructed will not cause the tools to
1154 be redetected.
1155
1156 SCons supports the following tool specifications out of the box:
1157
1158 .ES
1159 386asm
1160 aixc++
1161 aixcc
1162 aixf77
1163 aixlink
1164 ar
1165 as
1166 bcc32
1167 c++
1168 cc
1169 cvf
1170 dmd
1171 dvipdf
1172 dvips
1173 f77
1174 f90
1175 f95
1176 fortran
1177 g++
1178 g77
1179 gas
1180 gcc
1181 gnulink
1182 gs
1183 hpc++
1184 hpcc
1185 hplink
1186 icc
1187 icl
1188 ifl
1189 ifort
1190 ilink
1191 ilink32
1192 intelc
1193 jar
1194 javac
1195 javah
1196 latex
1197 lex
1198 link
1199 linkloc
1200 m4
1201 masm
1202 midl
1203 mingw
1204 mslib
1205 mslink
1206 msvc
1207 msvs
1208 mwcc
1209 mwld
1210 nasm
1211 pdflatex
1212 pdftex
1213 qt
1214 rmic
1215 rpcgen
1216 sgiar
1217 sgic++
1218 sgicc
1219 sgilink
1220 sunar
1221 sunc++
1222 suncc
1223 sunlink
1224 swig
1225 tar
1226 tex
1227 tlib
1228 yacc
1229 zip
1230 .EE
1231
1232 Additionally, there is a "tool" named
1233 .B default
1234 which configures the
1235 environment with a default set of tools for the current platform.
1236
1237 On posix and cygwin platforms
1238 the GNU tools (e.g. gcc) are preferred by SCons,
1239 on win32 the Microsoft tools (e.g. msvc)
1240 followed by MinGW are preferred by SCons,
1241 and in OS/2 the IBM tools (e.g. icc) are preferred by SCons.
1242
1243 .SS Builder Methods
1244
1245 Build rules are specified by calling a construction
1246 environment's builder methods.
1247 The arguments to the builder methods are
1248 .B target
1249 (a list of target files)
1250 and
1251 .B source
1252 (a list of source files).
1253
1254 Because long lists of file names
1255 can lead to a lot of quoting,
1256 .B scons
1257 supplies a
1258 .B Split()
1259 global function
1260 and a same-named environment method
1261 that split a single string
1262 into a list, separated on
1263 strings of white-space characters.
1264 (These are similar to the
1265 string.split() method
1266 from the standard Python library,
1267 but work even if the input isn't a string.)
1268
1269 Like all Python arguments,
1270 the target and source arguments to a builder method
1271 can be specified either with or without
1272 the "target" and "source" keywords.
1273 When the keywords are omitted,
1274 the target is first,
1275 followed by the source.
1276 The following are equivalent examples of calling the Program builder method:
1277
1278 .ES
1279 env.Program('bar', ['bar.c', 'foo.c'])
1280 env.Program('bar', Split('bar.c foo.c'))
1281 env.Program('bar', env.Split('bar.c foo.c'))
1282 env.Program(source =  ['bar.c', 'foo.c'], target = 'bar')
1283 env.Program(target = 'bar', Split('bar.c foo.c'))
1284 env.Program(target = 'bar', env.Split('bar.c foo.c'))
1285 env.Program('bar', source = string.split('bar.c foo.c'))
1286 .EE
1287
1288 When the target shares the same base name
1289 as the source and only the suffix varies,
1290 and if the builder method has a suffix defined for the target file type,
1291 then the target argument may be omitted completely,
1292 and
1293 .B scons
1294 will deduce the target file name from
1295 the source file name.
1296 The following examples all build the
1297 executable program
1298 .B bar
1299 (on POSIX systems)
1300 or 
1301 .B bar.exe
1302 (on Windows systems)
1303 from the bar.c source file:
1304
1305 .ES
1306 env.Program(target = 'bar', source = 'bar.c')
1307 env.Program('bar', source = 'bar.c')
1308 env.Program(source = 'bar.c')
1309 env.Program('bar.c')
1310 .EE
1311
1312 It is possible to override or add construction variables when calling a
1313 builder method by passing additional keyword arguments.
1314 These overridden or added
1315 variables will only be in effect when building the target, so they will not
1316 affect other parts of the build. For example, if you want to add additional
1317 libraries for just one program:
1318
1319 .ES
1320 env.Program('hello', 'hello.c', LIBS=['gl', 'glut'])
1321 .EE
1322
1323 or generate a shared library with a nonstandard suffix:
1324
1325 .ES
1326 env.SharedLibrary('word', 'word.cpp', SHLIBSUFFIX='.ocx')
1327 .EE
1328
1329 Although the builder methods defined by
1330 .B scons
1331 are, in fact,
1332 methods of a construction environment object,
1333 they may also be called without an explicit environment:
1334
1335 .ES
1336 Program('hello', 'hello.c')
1337 SharedLibrary('word', 'word.cpp')
1338 .EE
1339
1340 In this case,
1341 the methods are called internally using a default construction
1342 environment that consists of the tools and values that
1343 .B scons
1344 has determined are appropriate for the local system.
1345
1346 Builder methods that can be called without an explicit
1347 environment may be called from custom Python modules that you
1348 import into an SConscript file by adding the following
1349 to the Python module:
1350
1351 .ES
1352 from SCons.Script import *
1353 .EE
1354
1355 All builder methods return a list of Nodes
1356 that represent the target or targets that will be built.
1357 A
1358 .I Node
1359 is an internal SCons object
1360 which represents
1361 build targets or sources.
1362
1363 The returned Node(s)
1364 can be passed to other builder methods as source(s)
1365 or passed to any SCons function or method
1366 where a filename would normally be accepted.
1367 For example, if it were necessary
1368 to add a specific
1369 .B -D
1370 flag when compiling one specific object file:
1371
1372 .ES
1373 bar_obj_list = env.StaticObject('bar.c', CPPDEFINES='-DBAR')
1374 env.Program(source = ['foo.c', bar_obj_list, 'main.c'])
1375 .EE
1376
1377 Using a Node in this way
1378 makes for a more portable build
1379 by avoiding having to specify
1380 a platform-specific object suffix
1381 when calling the Program() builder method.
1382
1383 Note that Builder calls will automatically "flatten"
1384 the source and target file lists,
1385 so it's all right to have the bar_obj list
1386 return by the StaticObject() call
1387 in the middle of the source file list.
1388 If you need to manipulate a list of lists returned by Builders
1389 directly using Python,
1390 you can either build the list by hand:
1391
1392 .ES
1393 foo = Object('foo.c')
1394 bar = Object('bar.c')
1395 objects = ['begin.o'] + foo + ['middle.o'] + bar + ['end.o']
1396 for object in objects:
1397     print str(object)
1398 .EE
1399
1400 Or you can use the
1401 .BR Flatten ()
1402 supplied by scons
1403 to create a list containing just the Nodes,
1404 which may be more convenient:
1405
1406 .ES
1407 foo = Object('foo.c')
1408 bar = Object('bar.c')
1409 objects = Flatten(['begin.o', foo, 'middle.o', bar, 'end.o'])
1410 for object in objects:
1411     print str(object)
1412 .EE
1413
1414 The path name for a Node's file may be used
1415 by passing the Node to the Python-builtin
1416 .B str()
1417 function:
1418
1419 .ES
1420 bar_obj_list = env.StaticObject('bar.c', CPPDEFINES='-DBAR')
1421 print "The path to bar_obj is:", str(bar_obj_list[0])
1422 .EE
1423
1424 Note again that because the Builder call returns a list,
1425 we have to access the first element in the list
1426 .B (bar_obj_list[0])
1427 to get at the Node that actually represents
1428 the object file.
1429
1430 Builder calls support a
1431 .B chdir
1432 keyword argument that
1433 specifies that the Builder's action(s)
1434 should be executed
1435 after changing directory.
1436 If the
1437 .B chdir
1438 argument is
1439 a string or a directory Node,
1440 scons will change to the specified directory.
1441 If the
1442 .B chdir
1443 is not a string or Node
1444 and is non-zero,
1445 then scons will change to the
1446 target file's directory.
1447
1448 .ES
1449 # scons will change to the "sub" subdirectory
1450 # before executing the "cp" command.
1451 env.Command('sub/dir/foo.out', 'sub/dir/foo.in',
1452             "cp dir/foo.in dir/foo.out",
1453             chdir='sub')
1454
1455 # Because chdir is not a string, scons will change to the
1456 # target's directory ("sub/dir") before executing the
1457 # "cp" command.
1458 env.Command('sub/dir/foo.out', 'sub/dir/foo.in',
1459             "cp foo.in foo.out",
1460             chdir=1)
1461 .EE
1462
1463 Note that scons will
1464 .I not
1465 automatically modify
1466 its expansion of
1467 construction variables like
1468 .B $TARGET
1469 and
1470 .B $SOURCE
1471 when using the chdir
1472 keyword argument--that is,
1473 the expanded file names
1474 will still be relative to
1475 the top-level SConstruct directory,
1476 and consequently incorrect
1477 relative to the chdir directory.
1478 If you use the chdir keyword argument,
1479 you will typically need to supply a different
1480 command line using
1481 expansions like
1482 .B ${TARGET.file}
1483 and
1484 .B ${SOURCE.file}
1485 to use just the filename portion of the
1486 targets and source.
1487
1488 .B scons
1489 provides the following builder methods:
1490
1491 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1492 .IP CFile()
1493 .IP env.CFile()
1494 Builds a C source file given a lex (.l) or yacc (.y) input file.
1495 The suffix specified by the $CFILESUFFIX construction variable
1496 (.c by default)
1497 is automatically added to the target
1498 if it is not already present. Example:
1499
1500 .ES
1501 # builds foo.c
1502 env.CFile(target = 'foo.c', source = 'foo.l')
1503 # builds bar.c
1504 env.CFile(target = 'bar', source = 'bar.y')
1505 .EE
1506
1507 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1508 .IP CXXFile()
1509 .IP env.CXXFile()
1510 Builds a C++ source file given a lex (.ll) or yacc (.yy)
1511 input file.
1512 The suffix specified by the $CXXFILESUFFIX construction variable
1513 (.cc by default)
1514 is automatically added to the target
1515 if it is not already present. Example:
1516
1517 .ES
1518 # builds foo.cc
1519 env.CXXFile(target = 'foo.cc', source = 'foo.ll')
1520 # builds bar.cc
1521 env.CXXFile(target = 'bar', source = 'bar.yy')
1522 .EE
1523
1524 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1525 .IP DVI()
1526 .IP env.DVI()
1527 Builds a .dvi file from a .tex, .ltx or .latex input file.
1528 If the source file suffix is .tex,
1529 .B scons
1530 will examine the contents of the file;
1531 if the string
1532 .B \\documentclass
1533 or
1534 .B \\documentstyle
1535 is found, the file is assumed to be a LaTeX file and
1536 the target is built by invoking the $LATEXCOM command line;
1537 otherwise, the $TEXCOM command line is used.
1538 If the file is a LaTeX file,
1539 the
1540 .B DVI
1541 builder method will also examine the contents
1542 of the
1543 .B .aux file
1544 and invoke the $BIBTEX command line
1545 if the string
1546 .B bibdata
1547 is found,
1548 and will examine the contents
1549 .B .log
1550 file and re-run the $LATEXCOM command
1551 if the log file says it is necessary.
1552
1553 The suffix .dvi
1554 (hard-coded within TeX itself)
1555 is automatically added to the target
1556 if it is not already present. Examples:
1557
1558 .ES
1559 # builds from aaa.tex
1560 env.DVI(target = 'aaa.dvi', source = 'aaa.tex')
1561 # builds bbb.dvi
1562 env.DVI(target = 'bbb', source = 'bbb.ltx')
1563 # builds from ccc.latex
1564 env.DVI(target = 'ccc.dvi', source = 'ccc.latex')
1565 .EE
1566
1567 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1568 .IP Jar()
1569 .IP env.Jar()
1570 Builds a Java archive (.jar) file
1571 from a source tree of .class files.
1572 If the $JARCHDIR value is set, the
1573 .B jar
1574 command will change to the specified directory using the
1575 .B \-C
1576 option.
1577 If the contents any of the source files begin with the string
1578 .BR Manifest-Version ,
1579 the file is assumed to be a manifest
1580 and is passed to the
1581 .B jar
1582 command with the
1583 .B m
1584 option set.
1585
1586 .ES
1587 env.Jar(target = 'foo.jar', source = 'classes')
1588 .EE
1589
1590 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1591 .IP Java()
1592 .IP env.Java()
1593 Builds one or more Java class files
1594 from one or more source trees of .java files.
1595 The class files will be placed underneath
1596 the specified target directory.
1597 SCons will parse each source .java file
1598 to find the classes
1599 (including inner classes)
1600 defined within that file,
1601 and from that figure out the
1602 target .class files that will be created.
1603 SCons will also search each Java file
1604 for the Java package name,
1605 which it assumes can be found on a line
1606 beginning with the string
1607 .B package
1608 in the first column;
1609 the resulting .class files
1610 will be placed in a directory reflecting
1611 the specified package name.
1612 For example,
1613 the file
1614 .I Foo.java
1615 defining a single public
1616 .I Foo
1617 class and
1618 containing a package name of
1619 .I sub.dir
1620 will generate a corresponding
1621 .IR sub/dir/Foo.class
1622 class file.
1623
1624 Example:
1625
1626 .ES
1627 env.Java(target = 'classes', source = 'src')
1628 env.Java(target = 'classes', source = ['src1', 'src2'])
1629 .EE
1630
1631 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1632 .IP JavaH()
1633 .IP env.JavaH()
1634 Builds C header and source files for
1635 implementing Java native methods.
1636 The target can be either a directory
1637 in which the header files will be written,
1638 or a header file name which
1639 will contain all of the definitions.
1640 The source can be either the names of .class files,
1641 or the objects returned from the
1642 .B Java
1643 builder method.
1644
1645 If the construction variable
1646 .B JAVACLASSDIR
1647 is set, either in the environment
1648 or in the call to the
1649 .B JavaH
1650 builder method itself,
1651 then the value of the variable
1652 will be stripped from the
1653 beginning of any .class file names.
1654
1655 Examples:
1656
1657 .ES
1658 # builds java_native.h
1659 classes = env.Java(target = 'classdir', source = 'src')
1660 env.JavaH(target = 'java_native.h', source = classes)
1661
1662 # builds include/package_foo.h and include/package_bar.h
1663 env.JavaH(target = 'include',
1664           source = ['package/foo.class', 'package/bar.class'])
1665
1666 # builds export/foo.h and export/bar.h
1667 env.JavaH(target = 'export',
1668           source = ['classes/foo.class', 'classes/bar.class'],
1669           JAVACLASSDIR = 'classes')
1670 .EE
1671
1672 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1673 .IP Library()
1674 .IP env.Library()
1675 A synonym for the
1676 .B StaticLibrary
1677 builder method.
1678
1679 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1680 .IP LoadableModule()
1681 .IP env.LoadableModule()
1682 On most systems,
1683 this is the same as
1684 .BR SharedLibrary ().
1685 On Mac OS X (Darwin) platforms,
1686 this creates a loadable module bundle.
1687
1688
1689 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1690 .IP M4()
1691 .IP env.M4()
1692 Builds an output file from an M4 input file.
1693 This uses a default $M4FLAGS value of
1694 .BR -E ,
1695 which considers all warnings to be fatal
1696 and stops on the first warning
1697 when using the GNU version of m4.
1698 Example:
1699
1700 .ES
1701 env.M4(target = 'foo.c', source = 'foo.c.m4')
1702 .EE
1703
1704 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1705 .IP Moc()
1706 .IP env.Moc()
1707 Builds an output file from a moc input file. Moc input files are either 
1708 header files or cxx files. This builder is only available after using the 
1709 tool 'qt'. See the QTDIR variable for more information.
1710 Example:
1711
1712 .ES
1713 env.Moc('foo.h') # generates moc_foo.cc
1714 env.Moc('foo.cpp') # generates foo.moc
1715 .EE
1716
1717 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1718 .IP MSVSProject()
1719 .IP env.MSVSProject()
1720 Builds Microsoft Visual Studio project files.
1721 This builds a Visual Studio project file, based on the version of
1722 Visual Studio that is configured (either the latest installed version,
1723 or the version set by 
1724 .B MSVS_VERSION
1725 in the Environment constructor).
1726 For VS 6, it will generate 
1727 .B .dsp
1728 and
1729 .B .dsw
1730 files, for VS 7, it will
1731 generate
1732 .B .vcproj
1733 and
1734 .B .sln
1735 files.
1736
1737 It takes several lists of filenames to be placed into the project
1738 file, currently these are limited to 
1739 .B srcs, incs, localincs, resources,
1740 and
1741 .B misc.
1742 These are pretty self explanatory, but it
1743 should be noted that the 'srcs' list is NOT added to the $SOURCES
1744 environment variable.  This is because it represents a list of files
1745 to be added to the project file, not the source used to build the
1746 project file (in this case, the 'source' is the SConscript file used
1747 to call MSVSProject).
1748
1749 In addition to these values (which are all optional, although not
1750 specifying any of them results in an empty project file), the
1751 following values must be specified:
1752
1753 target: The name of the target .dsp or .vcproj file.  The correct
1754 suffix for the version of Visual Studio must be used, but the value
1755
1756 env['MSVSPROJECTSUFFIX']
1757
1758 will be defined to the correct value (see example below).
1759
1760 variant: The name of this particular variant.  These are typically
1761 things like "Debug" or "Release", but really can be anything you want.
1762 Multiple calls to MSVSProject with different variants are allowed: all
1763 variants will be added to the project file with their appropriate
1764 build targets and sources.
1765
1766 buildtarget: A list of SCons.Node.FS objects which is returned from
1767 the command which builds the target.  This is used to tell SCons what
1768 to build when the 'build' button is pressed inside of the IDE.
1769
1770 Example Usage:
1771
1772 .ES
1773         barsrcs = ['bar.cpp'],
1774         barincs = ['bar.h'],
1775         barlocalincs = ['StdAfx.h']
1776         barresources = ['bar.rc','resource.h']
1777         barmisc = ['bar_readme.txt']
1778
1779         dll = local.SharedLibrary(target = 'bar.dll',
1780                                   source = barsrcs)
1781
1782         local.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'],
1783                           srcs = barsrcs,
1784                           incs = barincs,
1785                           localincs = barlocalincs,
1786                           resources = barresources,
1787                           misc = barmisc,
1788                           buildtarget = dll,
1789                           variant = 'Release')
1790 .EE
1791
1792 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1793 .IP Object()
1794 .IP env.Object()
1795 A synonym for the
1796 .B StaticObject
1797 builder method.
1798
1799 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1800 .IP PCH()
1801 .IP env.PCH()
1802 Builds a Microsoft Visual C++ precompiled header.
1803 Calling this builder method
1804 returns a list of two targets: the PCH as the first element, and the object
1805 file as the second element. Normally the object file is ignored.
1806 This builder method is only
1807 provided when Microsoft Visual C++ is being used as the compiler. 
1808 The PCH builder method is generally used in
1809 conjuction with the PCH construction variable to force object files to use
1810 the precompiled header:
1811
1812 .ES
1813 env['PCH'] = env.PCH('StdAfx.cpp')[0]
1814 .EE
1815
1816 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1817 .IP PDF()
1818 .IP env.PDF()
1819 Builds a .pdf file from a .dvi input file
1820 (or, by extension, a .tex, .ltx, or .latex input file).
1821 The suffix specified by the $PDFSUFFIX construction variable
1822 (.pdf by default)
1823 is added automatically to the target
1824 if it is not already present.  Example:
1825
1826 .ES
1827 # builds from aaa.tex
1828 env.PDF(target = 'aaa.pdf', source = 'aaa.tex')
1829 # builds bbb.pdf from bbb.dvi
1830 env.PDF(target = 'bbb', source = 'bbb.dvi')
1831 .EE
1832
1833 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1834 .IP PostScript()
1835 .IP env.PostScript()
1836 Builds a .ps file from a .dvi input file
1837 (or, by extension, a .tex, .ltx, or .latex input file).
1838 The suffix specified by the $PSSUFFIX construction variable
1839 (.ps by default)
1840 is added automatically to the target
1841 if it is not already present.  Example:
1842
1843 .ES
1844 # builds from aaa.tex
1845 env.PostScript(target = 'aaa.ps', source = 'aaa.tex')
1846 # builds bbb.ps from bbb.dvi
1847 env.PostScript(target = 'bbb', source = 'bbb.dvi')
1848 .EE
1849
1850 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1851 .IP Program()
1852 .IP env.Program()
1853 Builds an executable given one or more object files
1854 or C, C++, D, or Fortran source files.
1855 If any C, C++, D or Fortran source files are specified,
1856 then they will be automatically
1857 compiled to object files using the
1858 .B Object
1859 builder method;
1860 see that builder method's description for
1861 a list of legal source file suffixes
1862 and how they are interpreted.
1863 The target executable file prefix
1864 (specified by the $PROGPREFIX construction variable; nothing by default)
1865 and suffix
1866 (specified by the $PROGSUFFIX construction variable;
1867 by default, .exe on Windows systems, nothing on POSIX systems)
1868 are automatically added to the target if not already present.
1869 Example:
1870
1871 .ES
1872 env.Program(target = 'foo', source = ['foo.o', 'bar.c', 'baz.f'])
1873 .EE
1874
1875 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1876 .IP RES()
1877 .IP env.RES()
1878 Builds a Microsoft Visual C++ resource file.
1879 This builder method is only provided
1880 when Microsoft Visual C++ or MinGW is being used as the compiler. The
1881 .I .res
1882 (or 
1883 .I .o 
1884 for MinGW) suffix is added to the target name if no other suffix is given. The source
1885 file is scanned for implicit dependencies as though it were a C file. Example:
1886
1887 .ES
1888 env.RES('resource.rc')
1889 .EE
1890
1891 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1892 .IP RMIC()
1893 .IP env.RMIC()
1894 Builds stub and skeleton class files
1895 for remote objects
1896 from Java .class files.
1897 The target is a directory
1898 relative to which the stub
1899 and skeleton class files will be written.
1900 The source can be the names of .class files,
1901 or the objects return from the
1902 .B Java
1903 builder method.
1904
1905 If the construction variable
1906 .B JAVACLASSDIR
1907 is set, either in the environment
1908 or in the call to the
1909 .B RMIC
1910 builder method itself,
1911 then the value of the variable
1912 will be stripped from the
1913 beginning of any .class file names.
1914
1915 .ES
1916 classes = env.Java(target = 'classdir', source = 'src')
1917 env.RMIC(target = 'outdir1', source = classes)
1918
1919 env.RMIC(target = 'outdir2',
1920          source = ['package/foo.class', 'package/bar.class'])
1921
1922 env.RMIC(target = 'outdir3',
1923          source = ['classes/foo.class', 'classes/bar.class'],
1924          JAVACLASSDIR = 'classes')
1925 .EE
1926
1927 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1928 .IP RPCGenClient()
1929 .IP env.RPCGenClient()
1930 Generates an RPC client stub (_clnt.c) file
1931 from a specified RPC (.x) source file.
1932 Because rpcgen only builds output files
1933 in the local directory,
1934 the command will be executed
1935 in the source file's directory by default.
1936
1937 .ES
1938 # Builds src/rpcif_clnt.c
1939 env.RPCGenClient('src/rpcif.x')
1940 .EE
1941
1942 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1943 .IP RPCGenHeader()
1944 .IP env.RPCGenHeader()
1945 Generates an RPC header (.h) file
1946 from a specified RPC (.x) source file.
1947 Because rpcgen only builds output files
1948 in the local directory,
1949 the command will be executed
1950 in the source file's directory by default.
1951
1952 .ES
1953 # Builds src/rpcif.h
1954 env.RPCGenHeader('src/rpcif.x')
1955 .EE
1956
1957 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1958 .IP RPCGenService()
1959 .IP env.RPCGenService()
1960 Generates an RPC server-skeleton (_svc.c) file
1961 from a specified RPC (.x) source file.
1962 Because rpcgen only builds output files
1963 in the local directory,
1964 the command will be executed
1965 in the source file's directory by default.
1966
1967 .ES
1968 # Builds src/rpcif_svc.c
1969 env.RPCGenClient('src/rpcif.x')
1970 .EE
1971
1972 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1973 .IP RPCGenXDR()
1974 .IP env.RPCGenXDR()
1975 Generates an RPC XDR routine (_xdr.c) file
1976 from a specified RPC (.x) source file.
1977 Because rpcgen only builds output files
1978 in the local directory,
1979 the command will be executed
1980 in the source file's directory by default.
1981
1982 .ES
1983 # Builds src/rpcif_xdr.c
1984 env.RPCGenClient('src/rpcif.x')
1985 .EE
1986
1987 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1988 .IP SharedLibrary()
1989 .IP env.SharedLibrary()
1990 Builds a shared library
1991 (.so on a POSIX system, .dll on WIN32)
1992 given one or more object files
1993 or C, C++, D or Fortran source files.
1994 If any source files are given,
1995 then they will be automatically
1996 compiled to object files.
1997 The static library prefix and suffix (if any)
1998 are automatically added to the target.
1999 The target library file prefix
2000 (specified by the $SHLIBPREFIX construction variable;
2001 by default, lib on POSIX systems, nothing on Windows systems)
2002 and suffix
2003 (specified by the $SHLIBSUFFIX construction variable;
2004 by default, .dll on Windows systems, .so on POSIX systems)
2005 are automatically added to the target if not already present.
2006 Example:
2007
2008 .ES
2009 env.SharedLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
2010 .EE
2011 .IP
2012 On WIN32 systems, the
2013 .B SharedLibrary
2014 builder method will always build an import (.lib) library
2015 in addition to the shared (.dll) library,
2016 adding a .lib library with the same basename
2017 if there is not already a .lib file explicitly
2018 listed in the targets.
2019
2020 Any object files listed in the
2021 .B source
2022 must have been built for a shared library
2023 (that is, using the
2024 .B SharedObject
2025 builder method).
2026 .B scons
2027 will raise an error if there is any mismatch.
2028 .IP
2029 On WIN32 systems, specifying "register=1" will cause the dll to be
2030 registered after it is built using REGSVR32.  The command that is run
2031 ("regsvr32" by default) is determined by $REGSVR construction
2032 variable, and the flags passed are determined by $REGSVRFLAGS.  By
2033 default, $REGSVRFLAGS includes "/s", to prevent dialogs from popping
2034 up and requiring user attention when it is run.  If you change
2035 $REGSVRFLAGS, be sure to include "/s".  For example,
2036
2037 .ES
2038 env.SharedLibrary(target = 'bar',
2039                   source = ['bar.cxx', 'foo.obj'],
2040                   register=1)
2041 .EE
2042
2043 .IP
2044 will register "bar.dll" as a COM object when it is done linking it.
2045
2046 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2047 .IP SharedObject()
2048 .IP env.SharedObject()
2049 Builds an object file for
2050 inclusion in a shared library.
2051 Source files must have one of the same set of extensions
2052 specified above for the
2053 .B StaticObject
2054 builder method.
2055 On some platforms building a shared object requires additional
2056 compiler options (e.g. -fPIC for gcc) in addition to those needed to build a
2057 normal (static) object, but on some platforms there is no difference between a
2058 shared object and a normal (static) one. When there is a difference, SCons
2059 will only allow shared objects to be linked into a shared library, and will
2060 use a different suffix for shared objects. On platforms where there is no
2061 difference, SCons will allow both normal (static)
2062 and shared objects to be linked into a
2063 shared library, and will use the same suffix for shared and normal
2064 (static) objects.
2065 The target object file prefix
2066 (specified by the $SHOBJPREFIX construction variable;
2067 by default, the same as $OBJPREFIX)
2068 and suffix
2069 (specified by the $SHOBJSUFFIX construction variable)
2070 are automatically added to the target if not already present. 
2071 Examples:
2072
2073 .ES
2074 env.SharedObject(target = 'ddd', source = 'ddd.c')
2075 env.SharedObject(target = 'eee.o', source = 'eee.cpp')
2076 env.SharedObject(target = 'fff.obj', source = 'fff.for')
2077 .EE
2078
2079 Note that the source files will be scanned
2080 according to the suffix mappings in
2081 .B SourceFileScanner
2082 object.
2083 See the section "Scanner Objects,"
2084 below, for a more information.
2085
2086 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2087 .IP StaticLibrary()
2088 .IP env.StaticLibrary()
2089 Builds a static library given one or more object files
2090 or C, C++, D or Fortran source files.
2091 If any source files are given,
2092 then they will be automatically
2093 compiled to object files.
2094 The static library prefix and suffix (if any)
2095 are automatically added to the target.
2096 The target library file prefix
2097 (specified by the $LIBPREFIX construction variable;
2098 by default, lib on POSIX systems, nothing on Windows systems)
2099 and suffix
2100 (specified by the $LIBSUFFIX construction variable;
2101 by default, .lib on Windows systems, .a on POSIX systems)
2102 are automatically added to the target if not already present.
2103 Example:
2104
2105 .ES
2106 env.StaticLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
2107 .EE
2108
2109 .IP
2110 Any object files listed in the
2111 .B source
2112 must have been built for a static library
2113 (that is, using the
2114 .B StaticObject
2115 builder method).
2116 .B scons
2117 will raise an error if there is any mismatch.
2118
2119 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2120 .IP StaticObject()
2121 .IP env.StaticObject()
2122 Builds a static object file
2123 from one or more C, C++, D, or Fortran source files.
2124 Source files must have one of the following extensions:
2125
2126 .ES
2127   .asm    assembly language file
2128   .ASM    assembly language file
2129   .c      C file
2130   .C      WIN32:  C file
2131           POSIX:  C++ file
2132   .cc     C++ file
2133   .cpp    C++ file
2134   .cxx    C++ file
2135   .cxx    C++ file
2136   .c++    C++ file
2137   .C++    C++ file
2138   .d      D file
2139   .f      Fortran file
2140   .F      WIN32:  Fortran file
2141           POSIX:  Fortran file + C pre-processor
2142   .for    Fortran file
2143   .FOR    Fortran file
2144   .fpp    Fortran file + C pre-processor
2145   .FPP    Fortran file + C pre-processor
2146   .m      Objective C file
2147   .mm     Objective C++ file
2148   .s      assembly language file
2149   .S      WIN32:  assembly language file
2150           POSIX:  assembly language file + C pre-processor
2151   .spp    assembly language file + C pre-processor
2152   .SPP    assembly language file + C pre-processor
2153 .EE
2154 .IP
2155 The target object file prefix
2156 (specified by the $OBJPREFIX construction variable; nothing by default)
2157 and suffix
2158 (specified by the $OBJSUFFIX construction variable;
2159 \.obj on Windows systems, .o on POSIX systems)
2160 are automatically added to the target if not already present.
2161 Examples:
2162
2163 .ES
2164 env.StaticObject(target = 'aaa', source = 'aaa.c')
2165 env.StaticObject(target = 'bbb.o', source = 'bbb.c++')
2166 env.StaticObject(target = 'ccc.obj', source = 'ccc.f')
2167 .EE
2168
2169 Note that the source files will be scanned
2170 according to the suffix mappings in
2171 .B SourceFileScanner
2172 object.
2173 See the section "Scanner Objects,"
2174 below, for a more information.
2175
2176 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2177 .IP Tar()
2178 .IP env.Tar()
2179 Builds a tar archive of the specified files
2180 and/or directories.
2181 Unlike most builder methods,
2182 the
2183 .B Tar
2184 builder method may be called multiple times
2185 for a given target;
2186 each additional call
2187 adds to the list of entries
2188 that will be built into the archive.
2189 Any source directories will
2190 be scanned for changes to
2191 any on-disk files,
2192 regardless of whether or not
2193 .B scons
2194 knows about them from other Builder or function calls.
2195
2196 .ES
2197 env.Tar('src.tar', 'src')
2198
2199 # Create the stuff.tar file.
2200 env.Tar('stuff', ['subdir1', 'subdir2'])
2201 # Also add "another" to the stuff.tar file.
2202 env.Tar('stuff', 'another')
2203
2204 # Set TARFLAGS to create a gzip-filtered archive.
2205 env = Environment(TARFLAGS = '-c -z')
2206 env.Tar('foo.tar.gz', 'foo')
2207
2208 # Also set the suffix to .tgz.
2209 env = Environment(TARFLAGS = '-c -z',
2210                   TARSUFFIX = '.tgz')
2211 env.Tar('foo')
2212 .EE
2213
2214 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2215 .IP TypeLibrary()
2216 .IP env.TypeLibrary()
2217 Builds a Windows type library (.tlb) file from and input IDL file
2218 (.idl).  In addition, it will build the associated inteface stub and
2219 proxy source files.  It names them according to the base name of the .idl file.
2220 .IP
2221 For example,
2222
2223 .ES
2224 env.TypeLibrary(source="foo.idl")
2225 .EE
2226 .IP
2227 Will create foo.tlb, foo.h, foo_i.c, foo_p.c, and foo_data.c.
2228
2229 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2230 .IP Uic()
2231 .IP env.Uic()
2232 Builds a header file, an implementation file and a moc file from an ui file.
2233 and returns the corresponding nodes in the above order.
2234 This builder is only available after using the tool 'qt'. Note: you can 
2235 specify .ui files directly as inputs for Program, Library and SharedLibrary
2236 without using this builder. Using the builder lets you override the standard
2237 naming conventions (be careful: prefixes are always prepended to names of
2238 built files; if you don't want prefixes, you may set them to ``).
2239 See the QTDIR variable for more information.
2240 Example:
2241
2242 .ES
2243 env.Uic('foo.ui') # -> ['foo.h', 'uic_foo.cc', 'moc_foo.cc']
2244 env.Uic(target = Split('include/foo.h gen/uicfoo.cc gen/mocfoo.cc'),
2245         source = 'foo.ui') # -> ['include/foo.h', 'gen/uicfoo.cc', 'gen/mocfoo.cc']
2246 .EE
2247
2248 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2249 .IP Zip()
2250 .IP env.Zip()
2251 Builds a zip archive of the specified files
2252 and/or directories.
2253 Unlike most builder methods,
2254 the
2255 .B Zip
2256 builder method may be called multiple times
2257 for a given target;
2258 each additional call
2259 adds to the list of entries
2260 that will be built into the archive.
2261 Any source directories will
2262 be scanned for changes to
2263 any on-disk files,
2264 regardless of whether or not
2265 .B scons
2266 knows about them from other Builder or function calls.
2267
2268 .ES
2269 env.Zip('src.zip', 'src')
2270
2271 # Create the stuff.zip file.
2272 env.Zip('stuff', ['subdir1', 'subdir2'])
2273 # Also add "another" to the stuff.tar file.
2274 env.Zip('stuff', 'another')
2275 .EE
2276
2277 All
2278 targets of builder methods automatically depend on their sources.
2279 An explicit dependency can
2280 be specified using the 
2281 .B Depends 
2282 method of a construction environment (see below).
2283
2284 In addition,
2285 .B scons
2286 automatically scans
2287 source files for various programming languages,
2288 so the dependencies do not need to be specified explicitly.
2289 By default, SCons can
2290 C source files,
2291 C++ source files,
2292 Fortran source files with
2293 .B .F
2294 (POSIX systems only),
2295 .B .fpp,
2296 or
2297 .B .FPP
2298 file extensions,
2299 and assembly language files with
2300 .B .S
2301 (POSIX systems only),
2302 .B .spp,
2303 or
2304 .B .SPP
2305 files extensions
2306 for C preprocessor dependencies.
2307 SCons also has default support
2308 for scanning D source files,
2309 You can also write your own Scanners
2310 to add support for additional source file types.
2311 These can be added to the default
2312 Scanner object used by
2313 the
2314 .BR Object ()
2315 .BR StaticObject ()
2316 and
2317 .BR SharedObject ()
2318 Builders by adding them
2319 to the
2320 .B SourceFileScanner
2321 object as follows:
2322
2323 See the section "Scanner Objects,"
2324 below, for a more information about
2325 defining your own Scanner objects.
2326
2327 .SS Methods and Functions to Do Things
2328 In addition to Builder methods,
2329 .B scons
2330 provides a number of other construction environment methods
2331 and global functions to
2332 manipulate the build configuration.
2333
2334 Usually, a construction environment method
2335 and global function with the same name both exist
2336 so that you don't have to remember whether
2337 to a specific bit of functionality
2338 must be called with or without a construction environment.
2339 In the following list,
2340 if you call something as a global function
2341 it looks like:
2342 .ES
2343 .RI Function( arguments )
2344 .EE
2345 and if you call something through a construction
2346 environment it looks like:
2347 .ES
2348 .RI env.Function( arguments )
2349 .EE
2350 If you can call the functionality in both ways,
2351 then both forms are listed.
2352
2353 Global functions may be called from custom Python modules that you
2354 import into an SConscript file by adding the following
2355 to the Python module:
2356
2357 .ES
2358 from SCons.Script import *
2359 .EE
2360
2361 Except where otherwise noted,
2362 the same-named
2363 construction environment method
2364 and global function 
2365 provide the exact same functionality.
2366 The only difference is that,
2367 where appropriate,
2368 calling the functionality through a construction environment will
2369 substitute construction variables into
2370 any supplied strings.
2371 For example:
2372 .ES
2373 env = Environment(FOO = 'foo')
2374 Default('$FOO')
2375 env.Default('$FOO')
2376 .EE
2377 the first call to the global
2378 .B Default()
2379 function will actually add a target named
2380 .B $FOO
2381 to the list of default targets,
2382 while the second call to the
2383 .B env.Default()
2384 construction environment method
2385 will expand the value
2386 and add a target named
2387 .B foo
2388 to the list of default targets.
2389 For more on construction variable expansion,
2390 see the next section on
2391 construction variables.
2392
2393 Construction environment methods
2394 and global functions supported by
2395 .B scons
2396 include:
2397
2398 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2399 .TP 
2400 .RI Action( action ", [" strfunction ", " varlist ])
2401 .TP
2402 .RI env.Action( action ", [" strfunction ", " varlist ])
2403 Creates an Action object for
2404 the specified
2405 .IR action .
2406 See the section "Action Objects,"
2407 below, for a complete explanation of the arguments and behavior.
2408
2409 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2410 .TP 
2411 .RI AddPostAction( target ", " action )
2412 .TP
2413 .RI env.AddPostAction( target ", " action )
2414 Arranges for the specified
2415 .I action
2416 to be performed
2417 after the specified
2418 .I target
2419 has been built.
2420 The specified action(s) may be
2421 an Action object, or anything that
2422 can be converted into an Action object
2423 (see below).
2424
2425 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2426 .TP 
2427 .RI AddPreAction( target ", " action )
2428 .TP
2429 .RI env.AddPreAction( target ", " action )
2430 Arranges for the specified
2431 .I action
2432 to be performed
2433 before the specified
2434 .I target
2435 is built.
2436 The specified action(s) may be
2437 an Action object, or anything that
2438 can be converted into an Action object
2439 (see below).
2440
2441 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2442 .TP
2443 .RI Alias( alias ", [" targets ", [" action ]])
2444 .TP
2445 .RI env.Alias( alias ", [" targets ", [" action ]])
2446 Creates one or more phony targets that
2447 expand to one or more other targets.
2448 An optional
2449 .I action
2450 (command)
2451 or list of actions
2452 can be specified that will be executed
2453 whenever the any of the alias targets are out-of-date.
2454 Returns the Node object representing the alias,
2455 which exists outside of any file system.
2456 This Node object, or the alias name,
2457 may be used as a dependency of any other target,
2458 including another alias.
2459 .B Alias
2460 can be called multiple times for the same
2461 alias to add additional targets to the alias,
2462 or additional actions to the list for this alias.
2463
2464 .ES
2465 Alias('install')
2466 Alias('install', '/usr/bin')
2467 Alias(['install', 'install-lib'], '/usr/local/lib')
2468
2469 env.Alias('install', ['/usr/local/bin', '/usr/local/lib'])
2470 env.Alias('install', ['/usr/local/man'])
2471
2472 env.Alias('update', ['file1', 'file2'], "update_database $SOURCES")
2473 .EE
2474
2475 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2476 .TP
2477 .RI AlwaysBuild( target ", ...)"
2478 .TP
2479 .RI env.AlwaysBuild( target ", ...)"
2480 Marks each given
2481 .I target
2482 so that it is always assumed to be out of date,
2483 and will always be rebuilt if needed.
2484 Note, however, that
2485 .BR AlwaysBuild ()
2486 does not add its target(s) to the default target list,
2487 so the targets will only be built
2488 if they are specified on the command line,
2489 or are a dependent of a target specified on the command line--but
2490 they will
2491 .I always
2492 be built if so specified.
2493 Multiple targets can be passed in to a single call to
2494 .BR AlwaysBuild ().
2495
2496 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2497 .TP
2498 .RI env.Append( key = val ", [...])"
2499 Appends the specified keyword arguments
2500 to the end of construction variables in the environment.
2501 If the Environment does not have
2502 the specified construction variable,
2503 it is simply added to the environment.
2504 If the values of the construction variable
2505 and the keyword argument are the same type,
2506 then the two values will be simply added together.
2507 Otherwise, the construction variable
2508 and the value of the keyword argument
2509 are both coerced to lists,
2510 and the lists are added together.
2511 (See also the Prepend method, below.)
2512
2513 .ES
2514 env.Append(CCFLAGS = ' -g', FOO = ['foo.yyy'])
2515 .EE
2516
2517 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2518 .TP
2519 .RI env.AppendENVPath( name ", " newpath ", [" envname ", " sep ])
2520 This appends new path elements to the given path in the
2521 specified external environment
2522 .RB ( ENV
2523 by default).
2524 This will only add
2525 any particular path once (leaving the last one it encounters and
2526 ignoring the rest, to preserve path order),
2527 and to help assure this,
2528 will normalize all paths (using
2529 .B os.path.normpath
2530 and
2531 .BR os.path.normcase ).
2532 This can also handle the
2533 case where the given old path variable is a list instead of a
2534 string, in which case a list will be returned instead of a string.
2535 Example:
2536
2537 .ES
2538 print 'before:',env['ENV']['INCLUDE']
2539 include_path = '/foo/bar:/foo'
2540 env.PrependENVPath('INCLUDE', include_path)
2541 print 'after:',env['ENV']['INCLUDE']
2542
2543 yields:
2544 before: /foo:/biz
2545 after: /biz:/foo/bar:/foo
2546 .EE
2547
2548 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2549 .TP
2550 .RI env.AppendUnique( key = val ", [...])"
2551 Appends the specified keyword arguments
2552 to the end of construction variables in the environment.
2553 If the Environment does not have
2554 the specified construction variable,
2555 it is simply added to the environment.
2556 If the construction variable being appended to is a list,
2557 then any value(s) that already exist in the
2558 construction variable will
2559 .I not
2560 be added again to the list.
2561
2562 .ES
2563 env.AppendUnique(CCFLAGS = '-g', FOO = ['foo.yyy'])
2564 .EE
2565
2566 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2567 .TP
2568 env.BitKeeper()
2569 A factory function that
2570 returns a Builder object
2571 to be used to fetch source files
2572 using BitKeeper.
2573 The returned Builder
2574 is intended to be passed to the
2575 .B SourceCode
2576 function.
2577
2578 .ES
2579 env.SourceCode('.', env.BitKeeper())
2580 .EE
2581
2582 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2583 .TP
2584 .RI BuildDir( build_dir ", " src_dir ", [" duplicate ])
2585 .TP
2586 .RI env.BuildDir( build_dir ", " src_dir ", [" duplicate ])
2587 This specifies a build directory
2588 .I build_dir
2589 in which to build all derived files
2590 that would normally be built under
2591 .IR src_dir .
2592 Multiple build directories can be set up for multiple build variants, for
2593 example. 
2594 .I src_dir
2595 must be underneath the SConstruct file's directory,
2596 and
2597 .I build_dir
2598 may not be underneath the
2599 .I src_dir .
2600
2601 The default behavior is for
2602 .B scons
2603 to duplicate all of the files in the tree underneath
2604 .I src_dir
2605 into
2606 .IR build_dir ,
2607 and then build the derived files within the copied tree.
2608 (The duplication is performed by
2609 linking or copying,
2610 depending on the platform; see also the
2611 .IR --duplicate
2612 option.)
2613 This guarantees correct builds
2614 regardless of whether intermediate source files
2615 are generated during the build,
2616 where preprocessors or other scanners search
2617 for included files,
2618 or whether individual compilers or other invoked tools
2619 are hard-coded to put derived files in the same directory as source files.
2620
2621 This behavior of making a complete copy of the source tree
2622 may be disabled by setting
2623 .I duplicate
2624 to 0.
2625 This will cause
2626 .B scons
2627 to invoke Builders using the
2628 path names of source files in
2629 .I src_dir
2630 and the path names of derived files within
2631 .IR build_dir .
2632 This is always more efficient than
2633 .IR duplicate =1,
2634 and is usually safe for most builds.
2635 Specifying
2636 .IR duplicate =0,
2637 however,
2638 may cause build problems
2639 if source files are generated during the build,
2640 if any invoked tools are hard-coded to
2641 put derived files in the same directory as the source files.
2642
2643 Note that specifying a
2644 .B BuildDir
2645 works most naturally
2646 with a subsidiary SConscript file
2647 in the source directory.
2648 However,
2649 you would then call the subsidiary SConscript file
2650 not in the source directory,
2651 but in the
2652 .I build_dir ,
2653 as if
2654 .B scons
2655 had made a virtual copy of the source tree
2656 regardless of the value of 
2657 .IR duplicate .
2658 This is how you tell
2659 .B scons
2660 which variant of a source tree to build.
2661 For example:
2662
2663 .ES
2664 BuildDir('build-variant1', 'src')
2665 SConscript('build-variant1/SConscript')
2666 BuildDir('build-variant2', 'src')
2667 SConscript('build-variant2/SConscript')
2668 .EE
2669
2670 .IP
2671 See also the
2672 .BR SConscript ()
2673 function, described below,
2674 for another way to 
2675 specify a build directory
2676 in conjunction with calling a subsidiary
2677 SConscript file.)
2678
2679 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2680 .TP 
2681 .RI Builder( action ", [" arguments ])
2682 .TP 
2683 .RI env.Builder( action ", [" arguments ])
2684 Creates a Builder object for
2685 the specified
2686 .IR action .
2687 See the section "Builder Objects,"
2688 below, for a complete explanation of the arguments and behavior.
2689
2690 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2691 .TP 
2692 .RI CacheDir( cache_dir )
2693 .TP 
2694 .RI env.CacheDir( cache_dir )
2695 Specifies that
2696 .B scons
2697 will maintain a cache of derived files in
2698 .I cache_dir .
2699 The derived files in the cache will be shared
2700 among all the builds using the same
2701 .BR CacheDir ()
2702 call.
2703
2704 When a
2705 .BR CacheDir ()
2706 is being used and
2707 .B scons
2708 finds a derived file that needs to be rebuilt,
2709 it will first look in the cache to see if a
2710 derived file has already been built
2711 from identical input files and an identical build action
2712 (as incorporated into the MD5 build signature).
2713 If so,
2714 .B scons
2715 will retrieve the file from the cache.
2716 If the derived file is not present in the cache,
2717 .B scons
2718 will rebuild it and
2719 then place a copy of the built file in the cache
2720 (identified by its MD5 build signature),
2721 so that it may be retrieved by other
2722 builds that need to build the same derived file
2723 from identical inputs.
2724
2725 Use of a specified
2726 .BR CacheDir()
2727 may be disabled for any invocation
2728 by using the
2729 .B --cache-disable
2730 option.
2731
2732 If the
2733 .B --cache-force
2734 option is used,
2735 .B scons
2736 will place a copy of
2737 .I all
2738 derived files in the cache,
2739 even if they already existed
2740 and were not built by this invocation.
2741 This is useful to populate a cache
2742 the first time
2743 .BR CacheDir ()
2744 is added to a build,
2745 or after using the
2746 .B --cache-disable
2747 option.
2748
2749 When using
2750 .BR CacheDir (),
2751 .B scons
2752 will report,
2753 "Retrieved `file' from cache,"
2754 unless the
2755 .B --cache-show
2756 option is being used.
2757 When the
2758 .B --cache-show
2759 option is used,
2760 .B scons
2761 will print the action that
2762 .I would
2763 have been used to build the file,
2764 without any indication that
2765 the file was actually retrieved from the cache.
2766 This is useful to generate build logs
2767 that are equivalent regardless of whether
2768 a given derived file has been built in-place
2769 or retrieved from the cache.
2770
2771 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2772 .TP 
2773 .RI Clean( targets ", " files_or_dirs )
2774 .TP 
2775 .RI env.Clean( targets ", " files_or_dirs )
2776 This specifies a list of files or directories which should be removed
2777 whenever the targets are specified with the
2778 .B -c
2779 command line option.
2780 The specified targets may be a list
2781 or an individual target.
2782 Multiple calls to
2783 .BR Clean ()
2784 are legal,
2785 and create new targets or add files and directories to the
2786 clean list for the specified targets.
2787
2788 Multiple files or directories should be specified
2789 either as separate arguments to the
2790 .BR Clean ()
2791 method, or as a list.
2792 .BR Clean ()
2793 will also accept the return value of any of the construction environment
2794 Builder methods.
2795 Examples:
2796
2797 .ES
2798 Clean('foo', ['bar', 'baz'])
2799 Clean('dist', env.Program('hello', 'hello.c'))
2800 Clean(['foo', 'bar'], 'something_else_to_clean')
2801 .EE
2802
2803 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2804 .TP
2805 .RI Command( target ", " source ", " action ", [" key = val ", ...])"
2806 .TP
2807 .RI env.Command( target ", " source ", " action ", [" key = val ", ...])"
2808 Executes a specific action
2809 (or list of actions)
2810 to build a target file or files.
2811 This is more convenient
2812 than defining a separate Builder object
2813 for a single special-case build.
2814
2815 As a special case, the
2816 .B source_scanner
2817 keyword argument can
2818 be used to specify
2819 a Scanner object
2820 that will be used to scan the sources.
2821 (The global
2822 .B DirScanner
2823 object can be used
2824 if any of the sources will be directories
2825 that must be scanned on-disk for
2826 changes to files that aren't
2827 already specified in other Builder of function calls.)
2828
2829 Any other keyword arguments specified override any
2830 same-named existing construction variables.
2831
2832 An action can be an external command,
2833 specified as a string,
2834 or a callable Python object;
2835 see "Action Objects," below,
2836 for more complete information.
2837 Also note that a string specifying an external command
2838 may be preceded by an
2839 .B @
2840 (at-sign)
2841 to suppress printing the command in question,
2842 or by a
2843 .B \-
2844 (hyphen)
2845 to ignore the exit status of the external command.
2846 Examples:
2847
2848 .ES
2849 env.Command('foo.out', 'foo.in',
2850             "$FOO_BUILD < $SOURCES > $TARGET")
2851
2852 env.Command('bar.out', 'bar.in',
2853             ["rm -f $TARGET",
2854              "$BAR_BUILD < $SOURCES > $TARGET"],
2855             ENV = {'PATH' : '/usr/local/bin/'})
2856
2857 def rename(env, target, source):
2858     import os
2859     os.rename('.tmp', str(target[0]))
2860
2861 env.Command('baz.out', 'baz.in',
2862             ["$BAZ_BUILD < $SOURCES > .tmp",
2863              rename ])
2864 .EE
2865
2866 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2867 .TP
2868 .RI Configure( env ", [" custom_tests ", " conf_dir ", " log_file ", " config_h ])
2869 .TP
2870 .RI env.Configure([ custom_tests ", " conf_dir ", " log_file ", " config_h ])
2871 Creates a Configure object for integrated
2872 functionality similar to GNU autoconf.
2873 See the section "Configure Contexts,"
2874 below, for a complete explanation of the arguments and behavior.
2875
2876 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2877 .TP
2878 .RI env.Copy([ key = val ", ...])"
2879 Return a separate copy of a construction environment.
2880 If there are any keyword arguments specified,
2881 they are added to the returned copy,
2882 overwriting any existing values
2883 for the keywords.
2884
2885 .ES
2886 env2 = env.Copy()
2887 env3 = env.Copy(CCFLAGS = '-g')
2888 .EE
2889 .IP
2890 Additionally, a list of tools and a toolpath may be specified, as in
2891 the Environment constructor:
2892
2893 .ES
2894 def MyTool(env): env['FOO'] = 'bar'
2895 env4 = env.Copy(tools = ['msvc', MyTool])
2896 .EE
2897
2898 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2899 .TP
2900 .RI env.CVS( repository ", " module )
2901 A factory function that
2902 returns a Builder object
2903 to be used to fetch source files
2904 from the specified
2905 CVS
2906 .IR repository .
2907 The returned Builder
2908 is intended to be passed to the
2909 .B SourceCode
2910 function.
2911
2912 The optional specified
2913 .I module
2914 will be added to the beginning
2915 of all repository path names;
2916 this can be used, in essence,
2917 to strip initial directory names
2918 from the repository path names,
2919 so that you only have to
2920 replicate part of the repository
2921 directory hierarchy in your
2922 local build directory:
2923
2924 .ES
2925 # Will fetch foo/bar/src.c
2926 # from /usr/local/CVSROOT/foo/bar/src.c.
2927 env.SourceCode('.', env.CVS('/usr/local/CVSROOT'))
2928
2929 # Will fetch bar/src.c
2930 # from /usr/local/CVSROOT/foo/bar/src.c.
2931 env.SourceCode('.', env.CVS('/usr/local/CVSROOT', 'foo'))
2932
2933 # Will fetch src.c
2934 # from /usr/local/CVSROOT/foo/bar/src.c.
2935 env.SourceCode('.', env.CVS('/usr/local/CVSROOT', 'foo/bar'))
2936 .EE
2937
2938 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2939 .TP 
2940 .RI Default( targets )
2941 .TP
2942 .RI env.Default( targets )
2943 This specifies a list of default targets,
2944 which will be built by
2945 .B scons
2946 if no explicit targets are given on the command line.
2947 Multiple calls to
2948 .BR Default ()
2949 are legal,
2950 and add to the list of default targets.
2951
2952 Multiple targets should be specified as
2953 separate arguments to the
2954 .BR Default ()
2955 method, or as a list.
2956 .BR Default ()
2957 will also accept the Node returned by any
2958 of a construction environment's
2959 builder methods.
2960 Examples:
2961
2962 .ES
2963 Default('foo', 'bar', 'baz')
2964 env.Default(['a', 'b', 'c'])
2965 hello = env.Program('hello', 'hello.c')
2966 env.Default(hello)
2967 .EE
2968 .IP
2969 An argument to
2970 .BR Default ()
2971 of
2972 .B None
2973 will clear all default targets.
2974 Later calls to
2975 .BR Default ()
2976 will add to the (now empty) default-target list
2977 like normal.
2978
2979 The current list of targets added using the
2980 .BR Default ()
2981 function or method is available in the
2982 .B DEFAULT_TARGETS
2983 list;
2984 see below.
2985
2986 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2987 .TP
2988 .RI DefaultEnvironment([ args ])
2989 Creates and returns a default construction environment object.
2990 This construction environment is used internally by SCons
2991 in order to execute many of the global functions in this list,
2992 and to fetch source files transparently
2993 from source code management systems.
2994
2995 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2996 .TP
2997 .RI Depends( target ", " dependency )
2998 .TP
2999 .RI env.Depends( target ", " dependency )
3000 Specifies an explicit dependency;
3001 the target file(s) will be rebuilt
3002 whenever the dependency file(s) has changed.
3003 This should only be necessary
3004 for cases where the dependency
3005 is not caught by a Scanner
3006 for the file.
3007
3008 .ES
3009 env.Depends('foo', 'other-input-file-for-foo')
3010 .EE
3011
3012 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3013 .TP
3014 .RI env.Dictionary([ vars ])
3015 Returns a dictionary object
3016 containing copies of all of the
3017 construction variables in the environment.
3018 If there are any variable names specified,
3019 only the specified construction
3020 variables are returned in the dictionary.
3021
3022 .ES
3023 dict = env.Dictionary()
3024 cc_dict = env.Dictionary('CC', 'CCFLAGS', 'CCCOM')
3025 .EE
3026
3027 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3028 .TP
3029 .RI Dir( name ", [" directory ])
3030 .TP
3031 .RI env.Dir( name ", [" directory ])
3032 This returns a Directory Node,
3033 an object that represents the specified directory
3034 .IR name . 
3035 .I name
3036 can be a relative or absolute path. 
3037 .I directory
3038 is an optional directory that will be used as the parent directory. 
3039 If no
3040 .I directory
3041 is specified, the current script's directory is used as the parent.
3042
3043 Directory Nodes can be used anywhere you
3044 would supply a string as a directory name
3045 to a Builder method or function.
3046 Directory Nodes have attributes and methods
3047 that are useful in many situations;
3048 see "File and Directory Nodes," below.
3049
3050 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3051 .TP
3052 .RI env.Dump([ key ])
3053 Returns a pretty printable representation of the environment.
3054 .IR key ,
3055 if not
3056 .IR None ,
3057 should be a string containing the name of the variable of interest.
3058
3059 This SConstruct:
3060 .ES
3061 env=Environment()
3062 print env.Dump('CCCOM')
3063 .EE
3064 will print:
3065 .ES
3066 '$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
3067 .EE
3068
3069 .ES
3070 env=Environment()
3071 print env.Dump()
3072 .EE
3073 will print:
3074 .ES
3075 { 'AR': 'ar',
3076   'ARCOM': '$AR $ARFLAGS $TARGET $SOURCES\n$RANLIB $RANLIBFLAGS $TARGET',
3077   'ARFLAGS': ['r'],
3078   'AS': 'as',
3079   'ASCOM': '$AS $ASFLAGS -o $TARGET $SOURCES',
3080   'ASFLAGS': [],
3081   ...
3082 .EE
3083
3084 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3085 .TP
3086 .RI EnsurePythonVersion( major ", " minor )
3087 .TP
3088 .RI env.EnsurePythonVersion( major ", " minor )
3089 Ensure that the Python version is at least 
3090 .IR major . minor . 
3091 This function will
3092 print out an error message and exit SCons with a non-zero exit code if the
3093 actual Python version is not late enough.
3094
3095 .ES
3096 EnsurePythonVersion(2,2)
3097 .EE
3098
3099 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3100 .TP
3101 .RI EnsureSConsVersion( major ", " minor ", [" revision ])
3102 .TP
3103 .RI env.EnsureSConsVersion( major ", " minor ", [" revision ])
3104 Ensure that the SCons version is at least 
3105 .IR major.minor ,
3106 or
3107 .IR major.minor.revision . 
3108 if
3109 .I revision
3110 is specified.
3111 This function will
3112 print out an error message and exit SCons with a non-zero exit code if the
3113 actual SCons version is not late enough.
3114
3115 .ES
3116 EnsureSConsVersion(0,14)
3117
3118 EnsureSConsVersion(0,96,90)
3119 .EE
3120
3121 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3122 .TP
3123 .RI Environment([ key = value ", ...])"
3124 .TP
3125 .RI env.Environment([ key = value ", ...])"
3126 Return a new construction environment
3127 initialized with the specified
3128 .IR key = value
3129 pairs.
3130
3131 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3132 .TP 
3133 .RI Execute( action ", [" strfunction ", " varlist ])
3134 .TP
3135 .RI env.Execute( action ", [" strfunction ", " varlist ])
3136 Executes an Action object.
3137 The specified
3138 .IR action
3139 may be an Action object
3140 (see the section "Action Objects,"
3141 below, for a complete explanation of the arguments and behavior),
3142 or it may be a command-line string,
3143 list of commands,
3144 or executable Python function,
3145 each of which will be converted
3146 into an Action object
3147 and then executed.
3148 The exit value of the command
3149 or return value of the Python function
3150 will be returned.
3151
3152 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3153 .TP
3154 .RI Exit([ value ])
3155 .TP
3156 .RI env.Exit([ value ])
3157 This tells
3158 .B scons
3159 to exit immediately
3160 with the specified
3161 .IR value .
3162 A default exit value of
3163 .B 0
3164 (zero)
3165 is used if no value is specified.
3166
3167 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3168 .TP
3169 .RI Export( vars )
3170 .TP
3171 .RI env.Export( vars )
3172 This tells 
3173 .B scons
3174 to export a list of variables from the current
3175 SConscript file to all other SConscript files.
3176 The exported variables are kept in a global collection,
3177 so subsequent calls to
3178 .BR Export ()
3179 will over-write previous exports that have the same name. 
3180 Multiple variable names can be passed to
3181 .BR Export ()
3182 as separate arguments or as a list. A dictionary can be used to map
3183 variables to a different name when exported. Both local variables and
3184 global variables can be exported.
3185 Examples:
3186
3187 .ES
3188 env = Environment()
3189 # Make env available for all SConscript files to Import().
3190 Export("env")
3191
3192 package = 'my_name'
3193 # Make env and package available for all SConscript files:.
3194 Export("env", "package")
3195
3196 # Make env and package available for all SConscript files:
3197 Export(["env", "package"])
3198
3199 # Make env available using the name debug:.
3200 Export({"debug":env})
3201 .EE
3202
3203 .IP
3204 Note that the
3205 .BR SConscript ()
3206 function supports an
3207 .I exports
3208 argument that makes it easier to to export a variable or
3209 set of variables to a single SConscript file.
3210 See the description of the
3211 .BR SConscript ()
3212 function, below.
3213
3214 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3215 .TP 
3216 .RI File( name ", [" directory ])
3217 .TP 
3218 .RI env.File( name ", [" directory ])
3219 This returns a
3220 File Node,
3221 an object that represents the specified file
3222 .IR name . 
3223 .I name
3224 can be a relative or absolute path. 
3225 .I directory
3226 is an optional directory that will be used as the parent directory. 
3227
3228 File Nodes can be used anywhere you
3229 would supply a string as a file name
3230 to a Builder method or function.
3231 File Nodes have attributes and methods
3232 that are useful in many situations;
3233 see "File and Directory Nodes," below.
3234
3235 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3236 .TP
3237 .RI FindFile( file ", " dirs )
3238 .TP
3239 .RI env.FindFile( file ", " dirs )
3240 Search for 
3241 .I file 
3242 in the path specified by 
3243 .IR dirs .
3244 .I file
3245 may be a list of file names or a single file name. In addition to searching
3246 for files that exist in the filesytem, this function also searches for
3247 derived files that have not yet been built.
3248
3249 .ES
3250 foo = env.FindFile('foo', ['dir1', 'dir2'])
3251 .EE
3252
3253 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3254 .TP
3255 .RI Flatten( sequence )
3256 .TP
3257 .RI env.Flatten( sequence )
3258 Takes a sequence (that is, a Python list or tuple)
3259 that may contain nested sequences
3260 and returns a flattened list containing
3261 all of the individual elements in any sequence.
3262 This can be helpful for collecting
3263 the lists returned by calls to Builders;
3264 other Builders will automatically
3265 flatten lists specified as input,
3266 but direct Python manipulation of
3267 these lists does not:
3268
3269 .ES
3270 foo = Object('foo.c')
3271 bar = Object('bar.c')
3272
3273 # Because `foo' and `bar' are lists returned by the Object() Builder,
3274 # `objects' will be a list containing nested lists:
3275 objects = ['f1.o', foo, 'f2.o', bar, 'f3.o']
3276
3277 # Passing such a list to another Builder is all right because
3278 # the Builder will flatten the list automatically:
3279 Program(source = objects)
3280
3281 # If you need to manipulate the list directly using Python, you need to
3282 # call Flatten() yourself, or otherwise handle nested lists:
3283 for object in Flatten(objects):
3284     print str(object)
3285 .EE
3286
3287 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3288 .TP
3289 .RI GetBuildPath( file ", [" ... ])
3290 .TP
3291 .RI env.GetBuildPath( file ", [" ... ])
3292 Returns the
3293 .B scons
3294 path name (or names) for the specified
3295 .I file
3296 (or files).
3297 The specified
3298 .I file
3299 or files
3300 may be
3301 .B scons
3302 Nodes or strings representing path names.
3303
3304 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3305 .TP
3306 .RI GetLaunchDir()
3307 .TP
3308 .RI env.GetLaunchDir()
3309 Returns the absolute path name of the directory from which
3310 .B
3311 scons
3312 was initially invoked.
3313 This can be useful when using the
3314 .BR \-u ,
3315 .BR \-U
3316 or
3317 .BR \-D
3318 options, which internally
3319 change to the directory in which the
3320 .B SConstruct
3321 file is found.
3322
3323 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3324 .TP
3325 .RI GetOption( name )
3326 .TP
3327 .RI env.GetOption( name )
3328 This function provides a way to query a select subset of the scons command line
3329 options from a SConscript file. See 
3330 .IR SetOption () 
3331 for a description of the options available.
3332
3333 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3334 '\".TP
3335 '\".RI GlobalBuilders( flag )
3336 '\"When
3337 '\".B flag
3338 '\"is non-zero,
3339 '\"adds the names of the default builders
3340 '\"(Program, Library, etc.)
3341 '\"to the global name space
3342 '\"so they can be called without an explicit construction environment.
3343 '\"(This is the default.)
3344 '\"When
3345 '\".B
3346 '\"flag is zero,
3347 '\"the names of the default builders are removed
3348 '\"from the global name space
3349 '\"so that an explicit construction environment is required
3350 '\"to call all builders.
3351
3352 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3353 .TP
3354 .RI Help( text )
3355 .TP
3356 .RI env.Help( text )
3357 This specifies help text to be printed if the 
3358 .B -h 
3359 argument is given to
3360 .BR scons .
3361 If
3362 .BR Help
3363 is called multiple times, the text is appended together in the order
3364 that
3365 .BR Help
3366 is called.
3367
3368 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3369 .TP
3370 .RI Ignore( target ", " dependency )
3371 .TP
3372 .RI env.Ignore( target ", " dependency )
3373 The specified dependency file(s)
3374 will be ignored when deciding if
3375 the target file(s) need to be rebuilt.
3376
3377 .ES
3378 env.Ignore('foo', 'foo.c')
3379 env.Ignore('bar', ['bar1.h', 'bar2.h'])
3380 .EE
3381
3382 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3383 .TP 
3384 .RI Import( vars )
3385 .TP 
3386 .RI env.Import( vars )
3387 This tells 
3388 .B scons
3389 to import a list of variables into the current SConscript file. This
3390 will import variables that were exported with
3391 .BR Export ()
3392 or in the 
3393 .I exports
3394 argument to 
3395 .BR SConscript ().
3396 Variables exported by 
3397 .BR SConscript ()
3398 have precedence.
3399 Multiple variable names can be passed to 
3400 .BR Import ()
3401 as separate arguments or as a list. The variable "*" can be used
3402 to import all variables.
3403 Examples:
3404
3405 .ES
3406 Import("env")
3407 Import("env", "variable")
3408 Import(["env", "variable"])
3409 Import("*")
3410 .EE
3411
3412 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3413 .TP
3414 .RI Install( dir ", " source )
3415 .TP
3416 .RI env.Install( dir ", " source )
3417 Installs one or more files in a destination directory.
3418 The file names remain the same.
3419
3420 .ES
3421 env.Install(dir = '/usr/local/bin', source = ['foo', 'bar'])
3422 .EE
3423
3424 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3425 .TP
3426 .RI InstallAs( target ", " source )
3427 .TP
3428 .RI env.InstallAs( target ", " source )
3429 Installs one or more files as specific file names,
3430 allowing changing a file name as part of the
3431 installation.
3432 It is an error if the target and source
3433 list different numbers of files.
3434
3435 .ES
3436 env.InstallAs(target = '/usr/local/bin/foo',
3437               source = 'foo_debug')
3438 env.InstallAs(target = ['../lib/libfoo.a', '../lib/libbar.a'],
3439               source = ['libFOO.a', 'libBAR.a'])
3440 .EE
3441
3442 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3443 .TP
3444 .RI Literal( string )
3445 .TP
3446 .RI env.Literal( string )
3447 The specified
3448 .I string
3449 will be preserved as-is
3450 and not have construction variables expanded.
3451
3452 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3453 .TP
3454 .RI Local( targets )
3455 .TP
3456 .RI env.Local( targets )
3457 The specified
3458 .I targets
3459 will have copies made in the local tree,
3460 even if an already up-to-date copy
3461 exists in a repository.
3462 Returns a list of the target Node or Nodes.
3463
3464 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3465 .TP
3466 .RI env.ParseConfig( command ", [" function ", " unique ])
3467 Calls the specified
3468 .I function
3469 to modify the environment as specified by the output of
3470 .I command .
3471 The default
3472 .I function
3473 expects the output of a typical
3474 .I *-config command
3475 (for example,
3476 .BR gtk-config )
3477 and adds the options
3478 to the appropriate construction variables.
3479 By default, 
3480 duplicate values are not
3481 added to any construction variables;
3482 you can specify
3483 .B unique=0
3484 to allow duplicate
3485 values to be added.
3486
3487 By default,
3488 .BR -L ,
3489 .BR -l ,
3490 .BR -Wa ,
3491 .BR -Wl ,
3492 .BR -Wp ,
3493 .B -I
3494 and other options,
3495 are add to the
3496 .BR LIBPATH ,
3497 .BR LIBS ,
3498 .BR ASFLAGS ,
3499 .BR LINKFLAGS ,
3500 .BR CPPFLAGS ,
3501 .B CPPPATH
3502 and
3503 .B CCFLAGS
3504 construction variables,
3505 respectively.
3506 A returned
3507 .B -pthread
3508 option gets added to both the
3509 .B CCFLAGS
3510 and
3511 .B LINKFLAGS
3512 variables.
3513 A returned
3514 .B -framework
3515 option gets added to the
3516 .B LINKFLAGS
3517 variable.
3518 Any other strings not associated with options
3519 are assumed to be the names of libraries
3520 and added to the
3521 .B LIBS 
3522 construction variable.
3523
3524 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3525 .TP
3526 .RI ParseDepends( filename ", [" must_exist ])
3527 .TP
3528 .RI env.ParseDepends( filename ", [" must_exist " " only_one ])
3529 Parses the contents of the specified
3530 .I filename
3531 as a list of dependencies in the style of
3532 .BR Make
3533 or
3534 .BR mkdep ,
3535 and explicitly establishes all of the listed dependencies.
3536
3537 By default,
3538 it is not an error
3539 if the specified
3540 .I filename
3541 does not exist.
3542 The optional
3543 .I must_exit
3544 argument may be set to a non-zero
3545 value to have
3546 scons
3547 throw an exception and
3548 generate an error if the file does not exist,
3549 or is otherwise inaccessible.
3550
3551 The optional
3552 .I only_one
3553 argument may be set to a non-zero
3554 value to have
3555 scons
3556 thrown an exception and
3557 generate an error
3558 if the file contains dependency
3559 information for more than one target.
3560 This can provide a small sanity check
3561 for files intended to be generated
3562 by, for example, the
3563 .B gcc -M
3564 flag,
3565 which should typically only
3566 write dependency information for
3567 one output file into a corresponding
3568 .B .d
3569 file.
3570
3571 The
3572 .I filename
3573 and all of the files listed therein
3574 will be interpreted relative to
3575 the directory of the
3576 .I SConscript
3577 file which calls the
3578 .B ParseDepends
3579 function.
3580
3581 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3582 .TP
3583 env.Perforce()
3584 A factory function that
3585 returns a Builder object
3586 to be used to fetch source files
3587 from the Perforce source code management system.
3588 The returned Builder
3589 is intended to be passed to the
3590 .B SourceCode
3591 function:
3592
3593 .ES
3594 env.SourceCode('.', env.Perforce())
3595 .EE
3596 .IP
3597 Perforce uses a number of external
3598 environment variables for its operation.
3599 Consequently, this function adds the
3600 following variables from the user's external environment
3601 to the construction environment's
3602 ENV dictionary:
3603 P4CHARSET,
3604 P4CLIENT,
3605 P4LANGUAGE,
3606 P4PASSWD,
3607 P4PORT,
3608 P4USER,
3609 SYSTEMROOT,
3610 USER,
3611 and
3612 USERNAME.
3613
3614 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3615 .TP
3616 .RI Platform( string )
3617 Returns a callable object
3618 that can be used to initialize
3619 a construction environment using the
3620 platform keyword of the Environment() method:
3621
3622 .ES
3623 env = Environment(platform = Platform('win32'))
3624 .EE
3625 .TP
3626 .RI env.Platform( string )
3627 Applies the callable object for the specified platform
3628 .I string
3629 to the environment through which the method was called.
3630
3631 .ES
3632 env.Platform('posix')
3633 .EE
3634 .IP
3635 Note that the
3636 .B win32
3637 platform adds the
3638 .B SYSTEMDRIVE
3639 and
3640 .B SYSTEMROOT
3641 variables from the user's external environment
3642 to the construction environment's
3643 .B ENV
3644 dictionary.
3645 This is so that any executed commands
3646 that use sockets to connect with other systems
3647 (such as fetching source files from
3648 external CVS repository specifications like 
3649 .BR :pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons )
3650 will work on Win32 systems.
3651
3652 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3653 .TP
3654 .RI Precious( target ", ...)"
3655 .TP
3656 .RI env.Precious( target ", ...)"
3657 Marks each given
3658 .I target
3659 as precious so it is not deleted before it is rebuilt. Normally
3660 .B scons
3661 deletes a target before building it.
3662 Multiple targets can be passed in to a single call to
3663 .BR Precious ().
3664
3665 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3666 .TP
3667 .RI env.Prepend( key = val ", [...])"
3668 Appends the specified keyword arguments
3669 to the beginning of construction variables in the environment.
3670 If the Environment does not have
3671 the specified construction variable,
3672 it is simply added to the environment.
3673 If the values of the construction variable
3674 and the keyword argument are the same type,
3675 then the two values will be simply added together.
3676 Otherwise, the construction variable
3677 and the value of the keyword argument
3678 are both coerced to lists,
3679 and the lists are added together.
3680 (See also the Append method, above.)
3681
3682 .ES
3683 env.Prepend(CCFLAGS = '-g ', FOO = ['foo.yyy'])
3684 .EE
3685
3686 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3687 .TP
3688 .RI env.PrependENVPath( name ", " newpath ", [" envname ", " sep ])
3689 This appends new path elements to the given path in the
3690 specified external environment
3691 .RB ( ENV
3692 by default).
3693 This will only add
3694 any particular path once (leaving the first one it encounters and
3695 ignoring the rest, to preserve path order),
3696 and to help assure this,
3697 will normalize all paths (using
3698 .B os.path.normpath
3699 and
3700 .BR os.path.normcase ).
3701 This can also handle the
3702 case where the given old path variable is a list instead of a
3703 string, in which case a list will be returned instead of a string.
3704 Example:
3705
3706 .ES
3707 print 'before:',env['ENV']['INCLUDE']
3708 include_path = '/foo/bar:/foo'
3709 env.PrependENVPath('INCLUDE', include_path)
3710 print 'after:',env['ENV']['INCLUDE']
3711
3712 yields:
3713 before: /biz:/foo
3714 after: /foo/bar:/foo:/biz
3715 .EE
3716
3717 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3718 .TP
3719 .RI env.AppendUnique( key = val ", [...])"
3720 Appends the specified keyword arguments
3721 to the beginning of construction variables in the environment.
3722 If the Environment does not have
3723 the specified construction variable,
3724 it is simply added to the environment.
3725 If the construction variable being appended to is a list,
3726 then any value(s) that already exist in the
3727 construction variable will
3728 .I not
3729 be added again to the list.
3730
3731 .ES
3732 env.PrependUnique(CCFLAGS = '-g', FOO = ['foo.yyy'])
3733 .EE
3734
3735 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3736 .TP
3737 env.RCS()
3738 A factory function that
3739 returns a Builder object
3740 to be used to fetch source files
3741 from RCS.
3742 The returned Builder
3743 is intended to be passed to the
3744 .B SourceCode
3745 function:
3746
3747 .ES
3748 env.SourceCode('.', env.RCS())
3749 .EE
3750 .IP
3751 Note that
3752 .B scons
3753 will fetch source files
3754 from RCS subdirectories automatically,
3755 so configuring RCS
3756 as demonstrated in the above example
3757 should only be necessary if
3758 you are fetching from
3759 RCS,v
3760 files in the same
3761 directory as the source files,
3762 or if you need to explicitly specify RCS
3763 for a specific subdirectory.
3764
3765 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3766 .TP
3767 .RI env.Replace( key = val ", [...])"
3768 Replaces construction variables in the Environment
3769 with the specified keyword arguments.
3770
3771 .ES
3772 env.Replace(CCFLAGS = '-g', FOO = 'foo.xxx')
3773 .EE
3774
3775 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3776 .TP
3777 .RI Repository( directory )
3778 .TP
3779 .RI env.Repository( directory )
3780 Specifies that
3781 .I directory
3782 is a repository to be searched for files.
3783 Multiple calls to
3784 .BR Repository ()
3785 are legal,
3786 and each one adds to the list of
3787 repositories that will be searched.
3788
3789 To
3790 .BR scons ,
3791 a repository is a copy of the source tree,
3792 from the top-level directory on down,
3793 which may contain
3794 both source files and derived files
3795 that can be used to build targets in
3796 the local source tree.
3797 The canonical example would be an
3798 official source tree maintained by an integrator.
3799 If the repository contains derived files,
3800 then the derived files should have been built using
3801 .BR scons ,
3802 so that the repository contains the necessary
3803 signature information to allow
3804 .B scons
3805 to figure out when it is appropriate to
3806 use the repository copy of a derived file,
3807 instead of building one locally.
3808
3809 Note that if an up-to-date derived file
3810 already exists in a repository,
3811 .B scons
3812 will
3813 .I not
3814 make a copy in the local directory tree.
3815 In order to guarantee that a local copy
3816 will be made,
3817 use the
3818 .B Local()
3819 method.
3820
3821 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3822 .TP
3823 .RI Return( vars )
3824 This tells
3825 .B scons
3826 what variable(s) to use as the return value(s) of the current SConscript
3827 file. These variables will be returned to the "calling" SConscript file
3828 as the return value(s) of 
3829 .BR SConscript ().
3830 Multiple variable names should be passed to 
3831 .BR Return ()
3832 as a list. Example:
3833
3834 .ES
3835 Return("foo")
3836 Return(["foo", "bar"])
3837 .EE
3838
3839 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3840 .TP 
3841 .RI Scanner( function ", [" argument ", " keys ", " path_function ", " node_class ", " node_factory ", " scan_check ", " recursive ])
3842 .TP 
3843 .RI env.Scanner( function ", [" argument ", " keys ", " path_function ", " node_class ", " node_factory ", " scan_check ", " recursive ])
3844 Creates a Scanner object for
3845 the specified
3846 .IR function .
3847 See the section "Scanner Objects,"
3848 below, for a complete explanation of the arguments and behavior.
3849
3850 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3851 .TP
3852 env.SCCS()
3853 A factory function that
3854 returns a Builder object
3855 to be used to fetch source files
3856 from SCCS.
3857 The returned Builder
3858 is intended to be passed to the
3859 .B SourceCode
3860 function:
3861
3862 .ES
3863 env.SourceCode('.', env.SCCS())
3864 .EE
3865 .IP
3866 Note that
3867 .B scons
3868 will fetch source files
3869 from SCCS subdirectories automatically,
3870 so configuring SCCS
3871 as demonstrated in the above example
3872 should only be necessary if
3873 you are fetching from
3874 .I s.SCCS
3875 files in the same
3876 directory as the source files,
3877 or if you need to explicitly specify SCCS
3878 for a specific subdirectory.
3879
3880 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3881 .TP
3882 .RI SConscript( scripts ", [" exports ", " build_dir ", " src_dir ", " duplicate ])
3883 .TP
3884 .RI env.SConscript( scripts ", [" exports ", " build_dir ", " src_dir ", " duplicate ])
3885 .TP
3886 .RI SConscript(dirs= subdirs ", [name=" script ", " exports ", " build_dir ", " src_dir ", " duplicate ])
3887 .TP
3888 .RI env.SConscript(dirs= subdirs ", [name=" script ", " exports ", " build_dir ", " src_dir ", " duplicate ])
3889 This tells
3890 .B scons
3891 to execute
3892 one or more subsidiary SConscript (configuration) files.
3893 There are two ways to call the
3894 .BR SConscript ()
3895 function.
3896
3897 The first way you can call
3898 .BR SConscript ()
3899 is to explicitly specify one or more
3900 .I scripts
3901 as the first argument.
3902 A single script may be specified as a string;
3903 multiple scripts must be specified as a list
3904 (either explicitly or as created by
3905 a function like
3906 .BR Split ()).
3907
3908 The second way you can call
3909 .BR SConscript ()
3910 is to specify a list of (sub)directory names
3911 as a
3912 .RI dirs= subdirs
3913 keyword argument.
3914 In this case,
3915 .B scons
3916 will, by default,
3917 execute a subsidiary configuration file named
3918 .B SConscript
3919 in each of the specified directories.
3920 You may specify a name other than
3921 .B SConscript
3922 by supplying an optional
3923 .RI name= script
3924 keyword argument.
3925
3926 The optional 
3927 .I exports
3928 argument provides a list of variable names or a dictionary of
3929 named values to export to the
3930 .IR script(s) ". "
3931 These variables are locally exported only to the specified
3932 .IR script(s) ,
3933 and do not affect the
3934 global pool of variables used by
3935 the
3936 .BR Export ()
3937 function.
3938 '\"If multiple dirs are provided,
3939 '\"each script gets a fresh export.
3940 The subsidiary
3941 .I script(s)
3942 must use the
3943 .BR Import ()
3944 function to import the variables.
3945
3946 The optional
3947 .I build_dir
3948 argument specifies that all of the target files
3949 (for example, object files and executables)
3950 that would normally be built in the subdirectory in which
3951 .I script
3952 resides should actually
3953 be built in
3954 .IR build_dir .
3955 .I build_dir
3956 is interpreted relative to the directory
3957 of the calling SConscript file.
3958
3959 The optional
3960 .I src_dir
3961 argument specifies that the
3962 source files from which
3963 the target files should be built
3964 can be found in
3965 .IR src_dir .
3966 .I src_dir
3967 is interpreted relative to the directory
3968 of the calling SConscript file.
3969
3970 By default,
3971 .B scons
3972 will link or copy (depending on the platform)
3973 all the source files into the build directory.
3974 This behavior may be disabled by
3975 setting the optional
3976 .I duplicate
3977 argument to 0
3978 (it is set to 1 by default),
3979 in which case
3980 .B scons
3981 will refer directly to
3982 the source files in their source directory
3983 when building target files.
3984 (Setting
3985 .IR duplicate =0
3986 is usually safe, and always more efficient
3987 than the default of
3988 .IR duplicate =1,
3989 but it may cause build problems in certain end-cases,
3990 such as compiling from source files that
3991 are generated by the build.)
3992
3993 Any variables returned by 
3994 .I script 
3995 using 
3996 .BR Return ()
3997 will be returned by the call to
3998 .BR SConscript (). 
3999
4000 Examples:
4001
4002 .ES
4003 SConscript('subdir/SConscript')
4004 foo = SConscript('sub/SConscript', exports='env')
4005 SConscript('dir/SConscript', exports=['env', 'variable'])
4006 SConscript('src/SConscript', build_dir='build', duplicate=0)
4007 SConscript('bld/SConscript', src_dir='src', exports='env variable')
4008 SConscript(dirs=['sub1', 'sub2'])
4009 SConscript(dirs=['sub3', 'sub4'], name='MySConscript')
4010 .EE
4011
4012 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4013 .TP
4014 .RI SConscriptChdir( value )
4015 .TP
4016 .RI env.SConscriptChdir( value )
4017 By default,
4018 .B scons
4019 changes its working directory
4020 to the directory in which each
4021 subsidiary SConscript file lives.
4022 This behavior may be disabled
4023 by specifying either:
4024
4025 .ES
4026 SConscriptChdir(0)
4027 env.SConscriptChdir(0)
4028 .EE
4029 .IP
4030 in which case
4031 .B scons
4032 will stay in the top-level directory
4033 while reading all SConscript files.
4034 (This may be necessary when building from repositories,
4035 when all the directories in which SConscript files may be found
4036 don't necessarily exist locally.)
4037
4038 You may enable and disable
4039 this ability by calling
4040 SConscriptChdir()
4041 multiple times:
4042
4043 .ES
4044 env = Environment()
4045 SConscriptChdir(0)
4046 SConscript('foo/SConscript')    # will not chdir to foo
4047 env.SConscriptChdir(1)
4048 SConscript('bar/SConscript')    # will chdir to bar
4049 .EE
4050
4051 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4052 .TP
4053 .RI SConsignFile([ file , dbm_module ])
4054 .TP
4055 .RI env.SConsignFile([ file , dbm_module ])
4056 This tells
4057 .B scons
4058 to store all file signatures
4059 in the specified database
4060 .IR file .
4061 If the
4062 .I file
4063 name is omitted,
4064 .B .sconsign
4065 is used by default.
4066 (The actual file name(s) stored on disk
4067 may have an appropriated suffix appended
4068 by the
4069 .IR  dbm_module .)
4070 If
4071 .I file
4072 is not an absolute path name,
4073 the file is placed in the same directory as the top-level
4074 .B SConstruct
4075 file.
4076
4077 If
4078 .I file
4079 is
4080 .BR None ,
4081 then
4082 .B scons
4083 will store file signatures
4084 in a separate
4085 .B .sconsign
4086 file in each directory,
4087 not in one global database file.
4088 (This was the default behavior
4089 prior to SCons 0.96.91 and 0.97.)
4090
4091 The optional
4092 .I dbm_module
4093 argument can be used to specify
4094 which Python database module
4095 The default is to use a custom
4096 .B SCons.dblite
4097 module that uses pickled
4098 Python data structures,
4099 and which works on all Python versions from 1.5.2 on.
4100
4101 Examples:
4102
4103 .ES
4104 # Explicitly stores signatures in ".sconsign.dblite"
4105 # in the top-level SConstruct directory (the
4106 # default behavior).
4107 SConsignFile()
4108
4109 # Stores signatures in the file "etc/scons-signatures"
4110 # relative to the top-level SConstruct directory.
4111 SConsignFile("etc/scons-signatures")
4112
4113 # Stores signatures in the specified absolute file name.
4114 SConsignFile("/home/me/SCons/signatures")
4115
4116 # Stores signatures in a separate .sconsign file
4117 # in each directory.
4118 SConsignFile(None)
4119 .EE
4120
4121 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4122 .TP
4123 .RI env.SetDefault(key = val ", [...])"
4124 Sets construction variables to default values specified with the keyword
4125 arguments if (and only if) the variables are not already set.
4126 The following statements are equivalent:
4127
4128 .ES
4129 env.SetDefault(FOO = 'foo')
4130
4131 if not env.has_key('FOO'): env['FOO'] = 'foo'
4132 .EE
4133
4134 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4135 .TP
4136 .RI SetOption( name ", " value )
4137 .TP
4138 .RI env.SetOption( name ", " value )
4139 This function provides a way to set a select subset of the scons command
4140 line options from a SConscript file. The options supported are:
4141 .B clean
4142 which corresponds to -c, --clean, and --remove;
4143 .B duplicate
4144 which 
4145 corresponds to --duplicate;
4146 .B implicit_cache
4147 which corresponds to --implicit-cache;
4148 .B max_drift
4149 which corresponds to --max-drift;
4150 .B num_jobs
4151 which corresponds to -j and --jobs.
4152 See the documentation for the
4153 corresponding command line object for information about each specific
4154 option. Example:
4155
4156 .ES
4157 SetOption('max_drift', 1)
4158 .EE
4159
4160 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4161 .TP
4162 .RI SideEffect( side_effect ", " target )
4163 .TP
4164 .RI env.SideEffect( side_effect ", " target )
4165 Declares
4166 .I side_effect
4167 as a side effect of building
4168 .IR target . 
4169 Both 
4170 .I side_effect 
4171 and
4172 .I target
4173 can be a list, a file name, or a node.
4174 A side effect is a target that is created
4175 as a side effect of building other targets.
4176 For example, a Windows PDB
4177 file is created as a side effect of building the .obj
4178 files for a static library.
4179 If a target is a side effect of multiple build commands,
4180 .B scons
4181 will ensure that only one set of commands
4182 is executed at a time.
4183 Consequently, you only need to use this method
4184 for side-effect targets that are built as a result of
4185 multiple build commands.
4186
4187 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4188 .TP
4189 .RI SourceCode( entries ", " builder )
4190 .TP
4191 .RI env.SourceCode( entries ", " builder )
4192 Arrange for non-existent source files to
4193 be fetched from a source code management system
4194 using the specified
4195 .IR builder .
4196 The specified
4197 .I entries
4198 may be a Node, string or list of both,
4199 and may represent either individual
4200 source files or directories in which
4201 source files can be found.
4202
4203 For any non-existent source files,
4204 .B scons
4205 will search up the directory tree
4206 and use the first
4207 .B SourceCode
4208 builder it finds.
4209 The specified
4210 .I builder
4211 may be
4212 .BR None ,
4213 in which case
4214 .B scons
4215 will not use a builder to fetch
4216 source files for the specified
4217 .IR entries ,
4218 even if a
4219 .B SourceCode
4220 builder has been specified
4221 for a directory higher up the tree.
4222
4223 .B scons
4224 will, by default,
4225 fetch files from SCCS or RCS subdirectories
4226 without explicit configuration.
4227 This takes some extra processing time
4228 to search for the necessary
4229 source code management files on disk.
4230 You can avoid these extra searches
4231 and speed up your build a little
4232 by disabling these searches as follows:
4233
4234 .ES
4235 env.SourceCode('.', None)
4236 .EE
4237
4238 .IP
4239 Note that if the specified
4240 .I builder
4241 is one you create by hand,
4242 it must have an associated
4243 construction environment to use
4244 when fetching a source file.
4245
4246 .B scons
4247 provides a set of canned factory
4248 functions that return appropriate
4249 Builders for various popular
4250 source code management systems.
4251 Canonical examples of invocation include:
4252
4253 .ES
4254 env.SourceCode('.', env.BitKeeper('/usr/local/BKsources'))
4255 env.SourceCode('src', env.CVS('/usr/local/CVSROOT'))
4256 env.SourceCode('/', env.RCS())
4257 env.SourceCode(['f1.c', 'f2.c'], env.SCCS())
4258 env.SourceCode('no_source.c', None)
4259 .EE
4260 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion'))
4261
4262 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4263 .TP
4264 .RI env.subst( string )
4265 Performs construction variable interpolation
4266 on the specified string argument.
4267
4268 .ES
4269 print env.subst("The C compiler is: $CC")
4270
4271 def compile(target, source, env):
4272     sourceDir = env.subst("${SOURCE.srcdir}")
4273 .EE
4274
4275 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4276 '\".TP
4277 '\".RI Subversion( repository ", " module )
4278 '\"A factory function that
4279 '\"returns a Builder object
4280 '\"to be used to fetch source files
4281 '\"from the specified Subversion
4282 '\".IR repository .
4283 '\"The returned Builder
4284 '\"is intended to be passed to the
4285 '\".B SourceCode
4286 '\"function.
4287 '\"
4288 '\"The optional specified
4289 '\".I module
4290 '\"will be added to the beginning
4291 '\"of all repository path names;
4292 '\"this can be used, in essence,
4293 '\"to strip initial directory names
4294 '\"from the repository path names,
4295 '\"so that you only have to
4296 '\"replicate part of the repository
4297 '\"directory hierarchy in your
4298 '\"local build directory:
4299 '\"
4300 '\".ES
4301 '\"# Will fetch foo/bar/src.c
4302 '\"# from /usr/local/Subversion/foo/bar/src.c.
4303 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion'))
4304 '\"
4305 '\"# Will fetch bar/src.c
4306 '\"# from /usr/local/Subversion/foo/bar/src.c.
4307 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion', 'foo'))
4308 '\"
4309 '\"# Will fetch src.c
4310 '\"# from /usr/local/Subversion/foo/bar/src.c.
4311 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion', 'foo/bar'))
4312 '\".EE
4313
4314 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4315 .TP
4316 .RI SourceSignatures( type )
4317 .TP
4318 .RI env.SourceSignatures( type )
4319 This function tells SCons what type of signature to use for source files:
4320 .B "MD5"
4321 or
4322 .BR "timestamp" .
4323 If the environment method is used,
4324 the specified type of source signature
4325 is only used when deciding whether targets
4326 built with that environment are up-to-date or must be rebuilt.
4327 If the global function is used,
4328 the specified type of source signature becomes the default
4329 used for all decisions
4330 about whether targets are up-to-date.
4331
4332 "MD5" means the signature of a source file
4333 is the MD5 checksum of its contents.
4334 "timestamp" means the signature of a source file
4335 is its timestamp (modification time).
4336 There is no different between the two behaviors
4337 for Python
4338 .BR Value ()
4339 node objects.
4340 "MD5" signatures take longer to compute,
4341 but are more accurate than "timestamp" signatures.
4342 The default is "MD5".
4343
4344 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4345 .TP
4346 .RI Split( arg )
4347 .TP
4348 .RI env.Split( arg )
4349 Returns a list of file names or other objects.
4350 If arg is a string,
4351 it will be split on strings of white-space characters
4352 within the string,
4353 making it easier to write long lists of file names.
4354 If arg is already a list,
4355 the list will be returned untouched.
4356 If arg is any other type of object,
4357 it will be returned as a list
4358 containing just the object.
4359
4360 .ES
4361 files = Split("f1.c f2.c f3.c")
4362 files = env.Split("f4.c f5.c f6.c")
4363 files = Split("""
4364         f7.c
4365         f8.c
4366         f9.c
4367 """)
4368 .EE
4369
4370 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4371 .TP
4372 .RI TargetSignatures( type )
4373 .TP
4374 .RI env.TargetSignatures( type )
4375 This function tells SCons what type of signatures to use
4376 for target files:
4377 .B "build"
4378 or
4379 .BR "content" .
4380 If the environment method is used,
4381 the specified type of signature is only used
4382 for targets built with that environment.
4383 If the global function is used,
4384 the specified type of signature becomes the default
4385 used for all target files that
4386 don't have an explicit target signature type
4387 specified for their environments.
4388
4389 "build" means the signature of a target file
4390 is made by concatenating all of the
4391 signatures of all its source files.
4392 "content" means the signature of a target
4393 file is an MD5 checksum of its contents.
4394 "build" signatures are usually faster to compute,
4395 but "content" signatures can prevent unnecessary rebuilds
4396 when a target file is rebuilt to the exact same contents
4397 as the previous build.
4398 The default is "build".
4399
4400 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4401 .TP
4402 .RI Tool( string [, toolpath ", " **kw ])
4403 Returns a callable object
4404 that can be used to initialize
4405 a construction environment using the
4406 tools keyword of the Environment() method.
4407 The object may be called with a construction
4408 environment as an argument,
4409 in which case the object will
4410 add the necessary variables
4411 to the construction environment
4412 and the name of the tool will be added to the
4413 .B $TOOLS
4414 construction variable.
4415
4416 Additional keyword arguments are passed to the tool's
4417 .B generate()
4418 method.
4419
4420 .ES
4421 env = Environment(tools = [ Tool('msvc') ])
4422
4423 env = Environment()
4424 t = Tool('msvc')
4425 t(env)  # adds 'msvc' to the TOOLS variable
4426 u = Tool('opengl', toolpath = ['tools'])
4427 u(env)  # adds 'opengl' to the TOOLS variable
4428 .EE
4429 .TP
4430 .RI env.Tool( string [, toolpath ", " **kw ])
4431 Applies the callable object for the specified tool
4432 .I string
4433 to the environment through which the method was called.
4434
4435 Additional keyword arguments are passed to the tool's
4436 .B generate()
4437 method.
4438
4439 .ES
4440 env.Tool('gcc')
4441 env.Tool('opengl', toolpath = ['build/tools'])
4442 .EE
4443
4444 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4445 .TP
4446 .RI Value( value )
4447 .TP
4448 .RI env.Value( value )
4449 Returns a Node object representing the specified Python value.  Value
4450 nodes can be used as dependencies of targets.  If the result of
4451 calling
4452 .BR str( value )
4453 changes between SCons runs, any targets depending on
4454 .BR Value( value )
4455 will be rebuilt.  When using timestamp source signatures, Value nodes'
4456 timestamps are equal to the system time when the node is created.
4457
4458 .ES
4459 def create(target, source, env):
4460     f = open(str(target[0]), 'wb')
4461     f.write('prefix=' + source[0].get_contents())
4462     
4463 prefix = ARGUMENTS.get('prefix', '/usr/local')
4464 env = Environment()
4465 env['BUILDERS']['Config'] = Builder(action = create)
4466 env.Config(target = 'package-config', source = Value(prefix))
4467 .EE
4468
4469 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4470 .TP
4471 .RI WhereIs( program ", [" path  ", " pathext ", " reject ])
4472 .TP
4473 .RI env.WhereIs( program ", [" path  ", " pathext ", " reject ])
4474
4475 Searches for the specified executable
4476 .I program,
4477 returning the full path name to the program
4478 if it is found,
4479 and returning None if not.
4480 Searches the specified
4481 .I path,
4482 the value of the calling environment's PATH
4483 (env['ENV']['PATH']),
4484 or the user's current external PATH
4485 (os.environ['PATH'])
4486 by default.
4487 On Win32 systems, searches for executable
4488 programs with any of the file extensions
4489 listed in the specified
4490 .I pathext,
4491 the calling environment's PATHEXT
4492 (env['ENV']['PATHEXT'])
4493 or the user's current PATHEXT
4494 (os.environ['PATHEXT'])
4495 by default.
4496 Will not select any
4497 path name or names
4498 in the specified
4499 .I reject
4500 list, if any.
4501
4502 .SS SConscript Variables
4503 In addition to the global functions and methods,
4504 .B scons
4505 supports a number of Python variables
4506 that can be used in SConscript files
4507 to affect how you want the build to be performed.
4508 These variables may be accessed from custom Python modules that you
4509 import into an SConscript file by adding the following
4510 to the Python module:
4511
4512 .ES
4513 from SCons.Script import *
4514 .EE
4515
4516 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4517 .TP
4518 ARGLIST
4519 A list
4520 .IR keyword = value
4521 arguments specified on the command line.
4522 Each element in the list is a tuple
4523 containing the
4524 .RI ( keyword , value )
4525 of the argument.
4526 The separate
4527 .I keyword
4528 and
4529 .I value
4530 elements of the tuple
4531 can be accessed by
4532 subscripting for element
4533 .B [0]
4534 and
4535 .B [1]
4536 of the tuple, respectively.
4537
4538 .ES
4539 print "first keyword, value =", ARGLIST[0][0], ARGLIST[0][1]
4540 print "second keyword, value =", ARGLIST[1][0], ARGLIST[1][1]
4541 third_tuple = ARGLIST[2]
4542 print "third keyword, value =", third_tuple[0], third_tuple[1]
4543 for key, value in ARGLIST:
4544     # process key and value
4545 .EE
4546
4547 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4548 .TP
4549 ARGUMENTS
4550 A dictionary of all the
4551 .IR keyword = value
4552 arguments specified on the command line.
4553 The dictionary is not in order,
4554 and if a given keyword has
4555 more than one value assigned to it
4556 on the command line,
4557 the last (right-most) value is
4558 the one in the
4559 .B ARGUMENTS
4560 dictionary.
4561
4562 .ES
4563 if ARGUMENTS.get('debug', 0):
4564     env = Environment(CCFLAGS = '-g')
4565 else:
4566     env = Environment()
4567 .EE
4568
4569 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4570 .TP
4571 BUILD_TARGETS
4572 A list of the targets which
4573 .B scons
4574 will actually try to build,
4575 regardless of whether they were specified on
4576 the command line or via the
4577 .BR Default ()
4578 function or method.
4579 The elements of this list may be strings
4580 .I or
4581 nodes, so you should run the list through the Python
4582 .B str
4583 function to make sure any Node path names
4584 are converted to strings.
4585
4586 Because this list may be taken from the
4587 list of targets specified using the
4588 .BR Default ()
4589 function or method,
4590 the contents of the list may change
4591 on each successive call to
4592 .BR Default ().
4593 See the
4594 .B DEFAULT_TARGETS
4595 list, below,
4596 for additional information.
4597
4598 .ES
4599 if 'foo' in BUILD_TARGETS:
4600     print "Don't forget to test the `foo' program!"
4601 if 'special/program' in BUILD_TARGETS:
4602     SConscript('special')
4603 .EE
4604 .IP
4605 Note that the
4606 .B BUILD_TARGETS
4607 list only contains targets expected listed
4608 on the command line or via calls to the
4609 .BR Default ()
4610 function or method.
4611 It does
4612 .I not
4613 contain all dependent targets that will be built as
4614 a result of making the sure the explicitly-specified
4615 targets are up to date.
4616
4617 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4618 .TP
4619 COMMAND_LINE_TARGETS
4620 A list of the targets explicitly specified on
4621 the command line.
4622 If there are no targets specified on the command line,
4623 the list is empty.
4624 This can be used, for example,
4625 to take specific actions only
4626 when a certain target or targets
4627 is explicitly being built:
4628
4629 .ES
4630 if 'foo' in COMMAND_LINE_TARGETS:
4631     print "Don't forget to test the `foo' program!"
4632 if 'special/program' in COMMAND_LINE_TARGETS:
4633     SConscript('special')
4634 .EE
4635
4636 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4637 .TP
4638 DEFAULT_TARGETS
4639 A list of the target
4640 .I nodes
4641 that have been specified using the
4642 .BR Default ()
4643 function or method.
4644 The elements of the list are nodes,
4645 so you need to run them through the Python
4646 .B str
4647 function to get at the path name for each Node.
4648
4649 .ES
4650 print str(DEFAULT_TARGETS[0])
4651 if 'foo' in map(str, DEFAULT_TARGETS):
4652     print "Don't forget to test the `foo' program!"
4653 .EE
4654 .IP
4655 The contents of the
4656 .B DEFAULT_TARGETS
4657 list change on on each successive call to the
4658 .BR Default ()
4659 function:
4660
4661 .ES
4662 print map(str, DEFAULT_TARGETS)   # originally []
4663 Default('foo')
4664 print map(str, DEFAULT_TARGETS)   # now a node ['foo']
4665 Default('bar')
4666 print map(str, DEFAULT_TARGETS)   # now a node ['foo', 'bar']
4667 Default(None)
4668 print map(str, DEFAULT_TARGETS)   # back to []
4669 .EE
4670 .IP
4671 Consequently, be sure to use
4672 .B DEFAULT_TARGETS
4673 only after you've made all of your
4674 .BR Default ()
4675 calls,
4676 or else simply be careful of the order
4677 of these statements in your SConscript files
4678 so that you don't look for a specific
4679 default target before it's actually been added to the list.
4680
4681 .SS Construction Variables
4682 .\" XXX From Gary Ruben, 23 April 2002:
4683 .\" I think it would be good to have an example with each construction
4684 .\" variable description in the documentation.
4685 .\" eg.
4686 .\" CC     The C compiler
4687 .\"    Example: env["CC"] = "c68x"
4688 .\"    Default: env["CC"] = "cc"
4689 .\" 
4690 .\" CCCOM  The command line ...
4691 .\"    Example:
4692 .\"        To generate the compiler line c68x -ps -qq -mr -o $TARGET $SOURCES
4693 .\"        env["CC"] = "c68x"
4694 .\"        env["CFLAGS"] = "-ps -qq -mr"
4695 .\"        env["CCCOM"] = "$CC $CFLAGS -o $TARGET $SOURCES
4696 .\"    Default:
4697 .\"        (I dunno what this is ;-)
4698 A construction environment has an associated dictionary of
4699 .I construction variables
4700 that are used by built-in or user-supplied build rules.
4701 Construction variables must follow the same rules for
4702 Python identifiers:
4703 the initial character must be an underscore or letter,
4704 followed by any number of underscores, letters, or digits.
4705
4706 A number of useful construction variables are automatically defined by
4707 scons for each supported platform, and additional construction variables
4708 can be defined by the user. The following is a list of the automatically
4709 defined construction variables:
4710
4711 .IP AR
4712 The static library archiver.
4713
4714 .IP ARCOM
4715 The command line used to generate a static library from object files.
4716
4717 .IP ARCOMSTR
4718 The string displayed when an object file
4719 is generated from an assembly-language source file.
4720 If this is not set, then $ARCOM (the command line) is displayed.
4721
4722 .ES
4723 env = Environment(ARCOMSTR = "Archiving $TARGET")
4724 .EE
4725
4726 .IP ARFLAGS
4727 General options passed to the static library archiver.
4728
4729 .IP AS
4730 The assembler.
4731
4732 .IP ASCOM
4733 The command line used to generate an object file
4734 from an assembly-language source file.
4735
4736 .IP ASCOMSTR
4737 The string displayed when an object file
4738 is generated from an assembly-language source file.
4739 If this is not set, then $ASCOM (the command line) is displayed.
4740
4741 .ES
4742 env = Environment(ASCOMSTR = "Assembling $TARGET")
4743 .EE
4744
4745 .IP ASFLAGS
4746 General options passed to the assembler.
4747
4748 .IP ASPPCOM
4749 The command line used to assemble an assembly-language
4750 source file into an object file
4751 after first running the file through the C preprocessor.
4752 Any options specified in the $ASFLAGS and $CPPFLAGS construction variables
4753 are included on this command line.
4754
4755 .IP ASPPCOMSTR
4756 The string displayed when an object file
4757 is generated from an assembly-language source file
4758 after first running the file through the C preprocessor.
4759 If this is not set, then $ASPPCOM (the command line) is displayed.
4760
4761 .ES
4762 env = Environment(ASPPCOMSTR = "Assembling $TARGET")
4763 .EE
4764
4765 .IP ASPPFLAGS
4766 General options when an assembling an assembly-language
4767 source file into an object file
4768 after first running the file through the C preprocessor.
4769 The default is to use the value of $ASFLAGS.
4770
4771 .IP BIBTEX
4772 The bibliography generator for the TeX formatter and typesetter and the
4773 LaTeX structured formatter and typesetter.
4774
4775 .IP BIBTEXCOM
4776 The command line used to call the bibliography generator for the
4777 TeX formatter and typesetter and the LaTeX structured formatter and
4778 typesetter.
4779
4780 .IP BIBTEXCOMSTR
4781 The string displayed when generating a bibliography
4782 for TeX or LaTeX.
4783 If this is not set, then $BIBTEXCOM (the command line) is displayed.
4784
4785 .ES
4786 env = Environment(BIBTEXCOMSTR = "Generating bibliography $TARGET")
4787 .EE
4788
4789
4790 .IP BIBTEXFLAGS
4791 General options passed to the bibliography generator for the TeX formatter
4792 and typesetter and the LaTeX structured formatter and typesetter.
4793
4794 .IP BITKEEPER
4795 The BitKeeper executable.
4796
4797 .IP BITKEEPERCOM
4798 The command line for
4799 fetching source files using BitKeeper.
4800
4801 .IP BITKEEPERCOMSTR
4802 The string displayed when fetching
4803 a source file using BitKeeper.
4804 If this is not set, then $BITKEEPERCOM
4805 (the command line) is displayed.
4806
4807 .IP BITKEEPERGET
4808 The command ($BITKEEPER) and subcommand
4809 for fetching source files using BitKeeper.
4810
4811 .IP BITKEEPERGETFLAGS
4812 Options that are passed to the BitKeeper
4813 .B get
4814 subcommand.
4815
4816 .IP BUILDERS
4817 A dictionary mapping the names of the builders
4818 available through this environment
4819 to underlying Builder objects.
4820 Builders named
4821 Alias, CFile, CXXFile, DVI, Library, Object, PDF, PostScript, and Program
4822 are available by default.
4823 If you initialize this variable when an
4824 Environment is created:
4825
4826 .ES
4827 env = Environment(BUILDERS = {'NewBuilder' : foo})
4828 .EE
4829 .IP
4830 the default Builders will no longer be available.
4831 To use a new Builder object in addition to the default Builders,
4832 add your new Builder object like this:
4833
4834 .ES
4835 env = Environment()
4836 env.Append(BUILDERS = {'NewBuilder' : foo})
4837 .EE
4838 .IP
4839 or this:
4840
4841 .ES
4842 env = Environment()
4843 env['BUILDERS]['NewBuilder'] = foo
4844 .EE
4845
4846 .IP CC 
4847 The C compiler.
4848
4849 .IP CCCOM 
4850 The command line used to compile a C source file to a (static) object file.
4851 Any options specified in the $CCFLAGS and $CPPFLAGS construction variables
4852 are included on this command line.
4853
4854 .IP CCCOMSTR
4855 The string displayed when a C source file
4856 is compiled to a (static) object file.
4857 If this is not set, then $CCCOM (the command line) is displayed.
4858
4859 .ES
4860 env = Environment(CCCOMSTR = "Compiling static object $TARGET")
4861 .EE
4862
4863 .IP CCFLAGS 
4864 General options that are passed to the C compiler.
4865
4866 .IP CFILESUFFIX
4867 The suffix for C source files.
4868 This is used by the internal CFile builder
4869 when generating C files from Lex (.l) or YACC (.y) input files.
4870 The default suffix, of course, is
4871 .I .c
4872 (lower case).
4873 On case-insensitive systems (like Win32),
4874 SCons also treats
4875 .I .C
4876 (upper case) files
4877 as C files.
4878
4879 .IP CCVERSION
4880 The version number of the C compiler.
4881 This may or may not be set,
4882 depending on the specific C compiler being used.
4883
4884 .IP _concat
4885 A function used to produce variables like $_CPPINCFLAGS. It takes
4886 four or five
4887 arguments: a prefix to concatenate onto each element, a list of
4888 elements, a suffix to concatenate onto each element, an environment
4889 for variable interpolation, and an optional function that will be
4890 called to transform the list before concatenation.
4891
4892 .ES
4893 env['_CPPINCFLAGS'] = '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs)} $)',
4894 .EE
4895
4896 .IP CPPDEFINES
4897 A platform independent specification of C preprocessor definitions.
4898 The definitions will be added to command lines
4899 through the automatically-generated
4900 $_CPPDEFFLAGS construction variable (see below),
4901 which is constructed according to
4902 the type of value of $CPPDEFINES:
4903
4904 .IP
4905 If $CPPDEFINES is a string,
4906 the values of the
4907 $CPPDEFPREFIX and $CPPDEFSUFFIX
4908 construction variables
4909 will be added to the beginning and end.
4910
4911 .ES
4912 # Will add -Dxyz to POSIX compiler command lines,
4913 # and /Dxyz to Microsoft Visual C++ command lines.
4914 env = Environment(CPPDEFINES='xyz')
4915 .EE
4916
4917 .IP
4918 If $CPPDEFINES is a list,
4919 the values of the
4920 $CPPDEFPREFIX and $CPPDEFSUFFIX
4921 construction variables
4922 will be appended to the beginning and end
4923 of each element in the list.
4924 If any element is a list or tuple,
4925 then the first item is the name being
4926 defined and the second item is its value:
4927
4928 .ES
4929 # Will add -DB=2 -DA to POSIX compiler command lines,
4930 # and /DB=2 /DA to Microsoft Visual C++ command lines.
4931 env = Environment(CPPDEFINES=[('B', 2), 'A'])
4932 .EE
4933
4934 .IP
4935 If $CPPDEFINES is a dictionary,
4936 the values of the
4937 $CPPDEFPREFIX and $CPPDEFSUFFIX
4938 construction variables
4939 will be appended to the beginning and end
4940 of each item from the dictionary.
4941 The key of each dictionary item
4942 is a name being defined
4943 to the dictionary item's corresponding value;
4944 if the value is
4945 .BR None ,
4946 then the name is defined without an explicit value.
4947 Note that the resulting flags are sorted by keyword
4948 to ensure that the order of the options on the
4949 command line is consistent each time
4950 .B scons
4951  is run.
4952
4953 .ES
4954 # Will add -DA -DB=2 to POSIX compiler command lines,
4955 # and /DA /DB=2 to Microsoft Visual C++ command lines.
4956 env = Environment(CPPDEFINES={'B':2, 'A':None})
4957 .EE
4958
4959 .IP _CPPDEFFLAGS
4960 An automatically-generated construction variable
4961 containing the C preprocessor command-line options
4962 to define values.
4963 The value of $_CPPDEFFLAGS is created
4964 by appending $CPPDEFPREFIX and $CPPDEFSUFFIX
4965 to the beginning and end
4966 of each directory in $CPPDEFINES.
4967
4968 .IP CPPDEFPREFIX
4969 The prefix used to specify preprocessor definitions
4970 on the C compiler command line.
4971 This will be appended to the beginning of each definition
4972 in the $CPPDEFINES construction variable
4973 when the $_CPPDEFFLAGS variable is automatically generated.
4974
4975 .IP CPPDEFSUFFIX
4976 The suffix used to specify preprocessor definitions
4977 on the C compiler command line.
4978 This will be appended to the end of each definition
4979 in the $CPPDEFINES construction variable
4980 when the $_CPPDEFFLAGS variable is automatically generated.
4981
4982 .IP CPPFLAGS
4983 User-specified C preprocessor options.
4984 These will be included in any command that uses the C preprocessor,
4985 including not just compilation of C and C++ source files
4986 via the $CCCOM, $SHCCCOM, $CXXCOM and $SHCXXCOM command lines,
4987 but also the $FORTRANPPCOM, $SHFORTRANPPCOM,
4988 $F77PPCOM and $SHF77PPCOM command lines
4989 used to compile a Fortran source file,
4990 and the $ASPPCOM command line
4991 used to assemble an assembly language source file,
4992 after first running each file through the C preprocessor.
4993 Note that this variable does
4994 .I not
4995 contain
4996 .B -I
4997 (or similar) include search path options
4998 that scons generates automatically from $CPPPATH.
4999 See
5000 .BR _CPPINCFLAGS ,
5001 below,
5002 for the variable that expands to those options.
5003
5004 .IP _CPPINCFLAGS
5005 An automatically-generated construction variable
5006 containing the C preprocessor command-line options
5007 for specifying directories to be searched for include files.
5008 The value of $_CPPINCFLAGS is created
5009 by appending $INCPREFIX and $INCSUFFIX
5010 to the beginning and end
5011 of each directory in $CPPPATH.
5012
5013 .IP CPPPATH
5014 The list of directories that the C preprocessor will search for include
5015 directories. The C/C++ implicit dependency scanner will search these
5016 directories for include files. Don't explicitly put include directory
5017 arguments in CCFLAGS or CXXFLAGS because the result will be non-portable
5018 and the directories will not be searched by the dependency scanner. Note:
5019 directory names in CPPPATH will be looked-up relative to the SConscript
5020 directory when they are used in a command. To force 
5021 .B scons
5022 to look-up a directory relative to the root of the source tree use #:
5023
5024 .ES
5025 env = Environment(CPPPATH='#/include')
5026 .EE
5027
5028 .IP
5029 The directory look-up can also be forced using the 
5030 .BR Dir ()
5031 function:
5032
5033 .ES
5034 include = Dir('include')
5035 env = Environment(CPPPATH=include)
5036 .EE
5037
5038 .IP
5039 The directory list will be added to command lines
5040 through the automatically-generated
5041 $_CPPINCFLAGS
5042 construction variable,
5043 which is constructed by
5044 appending the values of the
5045 $INCPREFIX and $INCSUFFIX
5046 construction variables
5047 to the beginning and end
5048 of each directory in $CPPPATH.
5049 Any command lines you define that need
5050 the CPPPATH directory list should
5051 include $_CPPINCFLAGS:
5052
5053 .ES
5054 env = Environment(CCCOM="my_compiler $_CPPINCFLAGS -c -o $TARGET $SOURCE")
5055 .EE
5056
5057 .IP CPPSUFFIXES
5058 The list of suffixes of files that will be scanned
5059 for C preprocessor implicit dependencies
5060 (#include lines).
5061 The default list is:
5062
5063 .ES
5064 [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
5065  ".h", ".H", ".hxx", ".hpp", ".hh",
5066  ".F", ".fpp", ".FPP",
5067  ".m", ".mm",
5068  ".S", ".spp", ".SPP"]
5069 .EE
5070
5071 .IP CVS
5072 The CVS executable.
5073
5074 .IP CVSCOFLAGS
5075 Options that are passed to the CVS checkout subcommand.
5076
5077 .IP CVSCOM
5078 The command line used to
5079 fetch source files from a CVS repository.
5080
5081 .IP CVSCOMSTR
5082 The string displayed when fetching
5083 a source file from a CVS repository.
5084 If this is not set, then $CVSCOM
5085 (the command line) is displayed.
5086
5087 .IP CVSFLAGS
5088 General options that are passed to CVS.
5089 By default, this is set to
5090 "-d $CVSREPOSITORY"
5091 to specify from where the files must be fetched.
5092
5093 .IP CVSREPOSITORY
5094 The path to the CVS repository.
5095 This is referenced in the default
5096 $CVSFLAGS value.
5097
5098 .IP CXX
5099 The C++ compiler.
5100
5101 .IP CXXFILESUFFIX
5102 The suffix for C++ source files.
5103 This is used by the internal CXXFile builder
5104 when generating C++ files from Lex (.ll) or YACC (.yy) input files.
5105 The default suffix is
5106 .IR .cc .
5107 SCons also treats files with the suffixes
5108 .IR .cpp ,
5109 .IR .cxx ,
5110 .IR .c++ ,
5111 and
5112 .I .C++
5113 as C++ files,
5114 and files with
5115 .I .mm
5116 suffixes as Objective C++ files.
5117 On case-sensitive systems (Linux, UNIX, and other POSIX-alikes),
5118 SCons also treats
5119 .I .C
5120 (upper case) files
5121 as C++ files.
5122
5123 .IP CXXCOM
5124 The command line used to compile a C++ source file to an object file.
5125 Any options specified in the $CXXFLAGS and $CPPFLAGS construction variables
5126 are included on this command line.
5127
5128 .IP CXXCOMSTR
5129 The string displayed when a C++ source file
5130 is compiled to a (static) object file.
5131 If this is not set, then $CXXCOM (the command line) is displayed.
5132
5133 .ES
5134 env = Environment(CXXCOMSTR = "Compiling static object $TARGET")
5135 .EE
5136
5137 .IP CXXFLAGS 
5138 General options that are passed to the C++ compiler.
5139 By default, this includes the value of $CCFLAGS,
5140 so that setting $CCFLAGS affects both C and C++ compilation.
5141 If you want to add C++-specific flags,
5142 you must set or override the value of $CXXFLAGS.
5143
5144 .IP CXXVERSION
5145 The version number of the C++ compiler.
5146 This may or may not be set,
5147 depending on the specific C++ compiler being used.
5148
5149 .IP Dir
5150 A function that converts a file name into a Dir instance relative to the
5151 target being built. 
5152
5153 .IP DSUFFIXES
5154 The list of suffixes of files that will be scanned
5155 for imported D package files.
5156 The default list is:
5157
5158 .ES
5159 ['.d']
5160 .EE
5161
5162 .IP DVIPDF
5163 The TeX DVI file to PDF file converter.
5164
5165 .IP DVIPDFFLAGS
5166 General options passed to the TeX DVI file to PDF file converter.
5167
5168 .IP DVIPDFCOM
5169 The command line used to convert TeX DVI files into a PDF file.
5170
5171 .IP DVIPDFCOMSTR
5172 The string displayed when a TeX DVI file
5173 is converted into a PDF file.
5174 If this is not set, then $DVIPDFCOM (the command line) is displayed.
5175
5176 .IP DVIPS
5177 The TeX DVI file to PostScript converter.
5178
5179 .IP DVIPSFLAGS
5180 General options passed to the TeX DVI file to PostScript converter.
5181
5182 .IP ENV
5183 A dictionary of environment variables
5184 to use when invoking commands. When ENV is used in a command all list
5185 values will be joined using the path separator and any other non-string
5186 values will simply be coerced to a string.
5187 Note that, by default,
5188 .B scons
5189 does
5190 .I not
5191 propagate the environment in force when you
5192 execute
5193 .B scons
5194 to the commands used to build target files.
5195 This is so that builds will be guaranteed
5196 repeatable regardless of the environment
5197 variables set at the time
5198 .B scons
5199 is invoked.
5200
5201 If you want to propagate your
5202 environment variables
5203 to the commands executed
5204 to build target files,
5205 you must do so explicitly:
5206
5207 .ES
5208 import os
5209 env = Environment(ENV = os.environ)
5210 .EE
5211
5212 .RS
5213 Note that you can choose only to propagate
5214 certain environment variables.
5215 A common example is
5216 the system
5217 .B PATH
5218 environment variable,
5219 so that
5220 .B scons
5221 uses the same utilities
5222 as the invoking shell (or other process):
5223 .RE
5224
5225 .ES
5226 import os
5227 env = Environment(ENV = {'PATH' : os.environ['PATH']})
5228 .EE
5229
5230 .IP ESCAPE
5231 A function that will be called to escape shell special characters in
5232 command lines. The function should take one argument: the command line
5233 string to escape; and should return the escaped command line.
5234
5235 .IP F77
5236 The Fortran 77 compiler.
5237 You should normally set the $FORTRAN variable,
5238 which specifies the default Fortran compiler
5239 for all Fortran versions.
5240 You only need to set $F77 if you need to use a specific compiler
5241 or compiler version for Fortran 77 files.
5242
5243 .IP F77COM
5244 The command line used to compile a Fortran 77 source file to an object file.
5245 You only need to set $F77COM if you need to use a specific
5246 command line for Fortran 77 files.
5247 You should normally set the $FORTRANCOM variable,
5248 which specifies the default command line
5249 for all Fortran versions.
5250
5251 .IP F77COMSTR
5252 The string displayed when a Fortran 77 source file
5253 is compiled to an object file.
5254 If this is not set, then $F77COM or $FORTRANCOM (the command line) is displayed.
5255
5256 .IP F77FLAGS
5257 General user-specified options that are passed to the Fortran 77 compiler.
5258 Note that this variable does
5259 .I not
5260 contain
5261 .B -I
5262 (or similar) include search path options
5263 that scons generates automatically from $F77PATH.
5264 See
5265 .BR _F77INCFLAGS ,
5266 below,
5267 for the variable that expands to those options.
5268 You only need to set $F77FLAGS if you need to define specific
5269 user options for Fortran 77 files.
5270 You should normally set the $FORTRANFLAGS variable,
5271 which specifies the user-specified options
5272 passed to the default Fortran compiler
5273 for all Fortran versions.
5274
5275 .IP _F77INCFLAGS
5276 An automatically-generated construction variable
5277 containing the Fortran 77 compiler command-line options
5278 for specifying directories to be searched for include files.
5279 The value of $_F77INCFLAGS is created
5280 by appending $INCPREFIX and $INCSUFFIX
5281 to the beginning and end
5282 of each directory in $F77PATH.
5283
5284 .IP F77PATH
5285 The list of directories that the Fortran 77 compiler will search for include
5286 directories. The implicit dependency scanner will search these
5287 directories for include files. Don't explicitly put include directory
5288 arguments in $F77FLAGS because the result will be non-portable
5289 and the directories will not be searched by the dependency scanner. Note:
5290 directory names in $F77PATH will be looked-up relative to the SConscript
5291 directory when they are used in a command. To force
5292 .B scons
5293 to look-up a directory relative to the root of the source tree use #:
5294 You only need to set $F77PATH if you need to define a specific
5295 include path for Fortran 77 files.
5296 You should normally set the $FORTRANPATH variable,
5297 which specifies the include path
5298 for the default Fortran compiler
5299 for all Fortran versions.
5300
5301 .ES
5302 env = Environment(F77PATH='#/include')
5303 .EE
5304
5305 .IP
5306 The directory look-up can also be forced using the
5307 .BR Dir ()
5308 function:
5309
5310 .ES
5311 include = Dir('include')
5312 env = Environment(F77PATH=include)
5313 .EE
5314
5315 .IP
5316 The directory list will be added to command lines
5317 through the automatically-generated
5318 $_F77INCFLAGS
5319 construction variable,
5320 which is constructed by
5321 appending the values of the
5322 $INCPREFIX and $INCSUFFIX
5323 construction variables
5324 to the beginning and end
5325 of each directory in $F77PATH.
5326 Any command lines you define that need
5327 the F77PATH directory list should
5328 include $_F77INCFLAGS:
5329
5330 .ES
5331 env = Environment(F77COM="my_compiler $_F77INCFLAGS -c -o $TARGET $SOURCE")
5332 .EE
5333
5334 .IP F77PPCOM
5335 The command line used to compile a Fortran 77 source file to an object file
5336 after first running the file through the C preprocessor.
5337 Any options specified in the $F77FLAGS and $CPPFLAGS construction variables
5338 are included on this command line.
5339 You only need to set $F77PPCOM if you need to use a specific
5340 C-preprocessor command line for Fortran 77 files.
5341 You should normally set the $FORTRANPPCOM variable,
5342 which specifies the default C-preprocessor command line
5343 for all Fortran versions.
5344
5345 .IP F90
5346 The Fortran 90 compiler.
5347 You should normally set the $FORTRAN variable,
5348 which specifies the default Fortran compiler
5349 for all Fortran versions.
5350 You only need to set $F90 if you need to use a specific compiler
5351 or compiler version for Fortran 90 files.
5352
5353 .IP F90COM
5354 The command line used to compile a Fortran 90 source file to an object file.
5355 You only need to set $F90COM if you need to use a specific
5356 command line for Fortran 90 files.
5357 You should normally set the $FORTRANCOM variable,
5358 which specifies the default command line
5359 for all Fortran versions.
5360
5361 .IP F90COMSTR
5362 The string displayed when a Fortran 90 source file
5363 is compiled to an object file.
5364 If this is not set, then $F90COM or $FORTRANCOM
5365 (the command line) is displayed.
5366
5367 .IP F90FLAGS
5368 General user-specified options that are passed to the Fortran 90 compiler.
5369 Note that this variable does
5370 .I not
5371 contain
5372 .B -I
5373 (or similar) include search path options
5374 that scons generates automatically from $F90PATH.
5375 See
5376 .BR _F90INCFLAGS ,
5377 below,
5378 for the variable that expands to those options.
5379 You only need to set $F90FLAGS if you need to define specific
5380 user options for Fortran 90 files.
5381 You should normally set the $FORTRANFLAGS variable,
5382 which specifies the user-specified options
5383 passed to the default Fortran compiler
5384 for all Fortran versions.
5385
5386 .IP _F90INCFLAGS
5387 An automatically-generated construction variable
5388 containing the Fortran 90 compiler command-line options
5389 for specifying directories to be searched for include files.
5390 The value of $_F90INCFLAGS is created
5391 by appending $INCPREFIX and $INCSUFFIX
5392 to the beginning and end
5393 of each directory in $F90PATH.
5394
5395 .IP F90PATH
5396 The list of directories that the Fortran 90 compiler will search for include
5397 directories. The implicit dependency scanner will search these
5398 directories for include files. Don't explicitly put include directory
5399 arguments in $F90FLAGS because the result will be non-portable
5400 and the directories will not be searched by the dependency scanner. Note:
5401 directory names in $F90PATH will be looked-up relative to the SConscript
5402 directory when they are used in a command. To force
5403 .B scons
5404 to look-up a directory relative to the root of the source tree use #:
5405 You only need to set $F90PATH if you need to define a specific
5406 include path for Fortran 90 files.
5407 You should normally set the $FORTRANPATH variable,
5408 which specifies the include path
5409 for the default Fortran compiler
5410 for all Fortran versions.
5411
5412 .ES
5413 env = Environment(F90PATH='#/include')
5414 .EE
5415
5416 .IP
5417 The directory look-up can also be forced using the
5418 .BR Dir ()
5419 function:
5420
5421 .ES
5422 include = Dir('include')
5423 env = Environment(F90PATH=include)
5424 .EE
5425
5426 .IP
5427 The directory list will be added to command lines
5428 through the automatically-generated
5429 $_F90INCFLAGS
5430 construction variable,
5431 which is constructed by
5432 appending the values of the
5433 $INCPREFIX and $INCSUFFIX
5434 construction variables
5435 to the beginning and end
5436 of each directory in $F90PATH.
5437 Any command lines you define that need
5438 the F90PATH directory list should
5439 include $_F90INCFLAGS:
5440
5441 .ES
5442 env = Environment(F90COM="my_compiler $_F90INCFLAGS -c -o $TARGET $SOURCE")
5443 .EE
5444
5445 .IP F90PPCOM
5446 The command line used to compile a Fortran 90 source file to an object file
5447 after first running the file through the C preprocessor.
5448 Any options specified in the $F90FLAGS and $CPPFLAGS construction variables
5449 are included on this command line.
5450 You only need to set $F90PPCOM if you need to use a specific
5451 C-preprocessor command line for Fortran 90 files.
5452 You should normally set the $FORTRANPPCOM variable,
5453 which specifies the default C-preprocessor command line
5454 for all Fortran versions.
5455
5456 .IP F95
5457 The Fortran 95 compiler.
5458 You should normally set the $FORTRAN variable,
5459 which specifies the default Fortran compiler
5460 for all Fortran versions.
5461 You only need to set $F95 if you need to use a specific compiler
5462 or compiler version for Fortran 95 files.
5463
5464 .IP F95COM
5465 The command line used to compile a Fortran 95 source file to an object file.
5466 You only need to set $F95COM if you need to use a specific
5467 command line for Fortran 95 files.
5468 You should normally set the $FORTRANCOM variable,
5469 which specifies the default command line
5470 for all Fortran versions.
5471
5472 .IP F95COMSTR
5473 The string displayed when a Fortran 95 source file
5474 is compiled to an object file.
5475 If this is not set, then $F95COM or $FORTRANCOM
5476 (the command line) is displayed.
5477
5478 .IP F95FLAGS
5479 General user-specified options that are passed to the Fortran 95 compiler.
5480 Note that this variable does
5481 .I not
5482 contain
5483 .B -I
5484 (or similar) include search path options
5485 that scons generates automatically from $F95PATH.
5486 See
5487 .BR _F95INCFLAGS ,
5488 below,
5489 for the variable that expands to those options.
5490 You only need to set $F95FLAGS if you need to define specific
5491 user options for Fortran 95 files.
5492 You should normally set the $FORTRANFLAGS variable,
5493 which specifies the user-specified options
5494 passed to the default Fortran compiler
5495 for all Fortran versions.
5496
5497 .IP _F95INCFLAGS
5498 An automatically-generated construction variable
5499 containing the Fortran 95 compiler command-line options
5500 for specifying directories to be searched for include files.
5501 The value of $_F95INCFLAGS is created
5502 by appending $INCPREFIX and $INCSUFFIX
5503 to the beginning and end
5504 of each directory in $F95PATH.
5505
5506 .IP F95PATH
5507 The list of directories that the Fortran 95 compiler will search for include
5508 directories. The implicit dependency scanner will search these
5509 directories for include files. Don't explicitly put include directory
5510 arguments in $F95FLAGS because the result will be non-portable
5511 and the directories will not be searched by the dependency scanner. Note:
5512 directory names in $F95PATH will be looked-up relative to the SConscript
5513 directory when they are used in a command. To force
5514 .B scons
5515 to look-up a directory relative to the root of the source tree use #:
5516 You only need to set $F95PATH if you need to define a specific
5517 include path for Fortran 95 files.
5518 You should normally set the $FORTRANPATH variable,
5519 which specifies the include path
5520 for the default Fortran compiler
5521 for all Fortran versions.
5522
5523 .ES
5524 env = Environment(F95PATH='#/include')
5525 .EE
5526
5527 .IP
5528 The directory look-up can also be forced using the
5529 .BR Dir ()
5530 function:
5531
5532 .ES
5533 include = Dir('include')
5534 env = Environment(F95PATH=include)
5535 .EE
5536
5537 .IP
5538 The directory list will be added to command lines
5539 through the automatically-generated
5540 $_F95INCFLAGS
5541 construction variable,
5542 which is constructed by
5543 appending the values of the
5544 $INCPREFIX and $INCSUFFIX
5545 construction variables
5546 to the beginning and end
5547 of each directory in $F95PATH.
5548 Any command lines you define that need
5549 the F95PATH directory list should
5550 include $_F95INCFLAGS:
5551
5552 .ES
5553 env = Environment(F95COM="my_compiler $_F95INCFLAGS -c -o $TARGET $SOURCE")
5554 .EE
5555
5556 .IP F95PPCOM
5557 The command line used to compile a Fortran 95 source file to an object file
5558 after first running the file through the C preprocessor.
5559 Any options specified in the $F95FLAGS and $CPPFLAGS construction variables
5560 are included on this command line.
5561 You only need to set $F95PPCOM if you need to use a specific
5562 C-preprocessor command line for Fortran 95 files.
5563 You should normally set the $FORTRANPPCOM variable,
5564 which specifies the default C-preprocessor command line
5565 for all Fortran versions.
5566
5567 .IP FORTRAN
5568 The default Fortran compiler
5569 for all versions of Fortran.
5570
5571 .IP FORTRANCOM 
5572 The command line used to compile a Fortran source file to an object file.
5573 By default, any options specified
5574 in the $FORTRANFLAGS, $CPPFLAGS, $_CPPDEFFLAGS, 
5575 $_FORTRANMODFLAG, and $_FORTRANINCFLAGS construction variables
5576 are included on this command line.
5577
5578 .IP FORTRANCOMSTR
5579 The string displayed when a Fortran source file
5580 is compiled to an object file.
5581 If this is not set, then $FORTRANCOM
5582 (the command line) is displayed.
5583
5584 .IP FORTRANFLAGS
5585 General user-specified options that are passed to the Fortran compiler.
5586 Note that this variable does
5587 .I not
5588 contain
5589 .B -I
5590 (or similar) include or module search path options
5591 that scons generates automatically from $FORTRANPATH.
5592 See
5593 .BR _FORTRANINCFLAGS and _FORTRANMODFLAGS,
5594 below,
5595 for the variables that expand those options.
5596
5597 .IP _FORTRANINCFLAGS
5598 An automatically-generated construction variable
5599 containing the Fortran compiler command-line options
5600 for specifying directories to be searched for include 
5601 files and module files.
5602 The value of $_FORTRANINCFLAGS is created
5603 by prepending/appending $INCPREFIX and $INCSUFFIX
5604 to the beginning and end
5605 of each directory in $FORTRANPATH.
5606
5607 .IP FORTRANMODDIR
5608 Directory location where the Fortran compiler should place
5609 any module files it generates.  This variable is empty, by default. Some 
5610 Fortran compilers will internally append this directory in the search path 
5611 for module files, as well.
5612
5613 .IP FORTRANMODDIRPREFIX
5614 The prefix used to specify a module directory on the Fortran compiler command
5615 line.
5616 This will be appended to the beginning of the directory
5617 in the $FORTRANMODDIR construction variables
5618 when the $_FORTRANMODFLAG variables is automatically generated.
5619
5620 .IP FORTRANMODDIRSUFFIX
5621 The suffix used to specify a module directory on the Fortran compiler command
5622 line.
5623 This will be appended to the beginning of the directory
5624 in the $FORTRANMODDIR construction variables
5625 when the $_FORTRANMODFLAG variables is automatically generated.
5626
5627 .IP _FORTRANMODFLAG
5628 An automatically-generated construction variable
5629 containing the Fortran compiler command-line option
5630 for specifying the directory location where the Fortran
5631 compiler should place any module files that happen to get 
5632 generated during compilation.
5633 The value of $_FORTRANMODFLAG is created
5634 by prepending/appending $FORTRANMODDIRPREFIX and $FORTRANMODDIRSUFFIX
5635 to the beginning and end of the directory in $FORTRANMODDIR.
5636
5637 .IP FORTRANMODPREFIX
5638 The module file prefix used by the Fortran compiler.  SCons assumes that
5639 the Fortran compiler follows the quasi-standard naming convention for
5640 module files of
5641 .I <module_name>.mod.
5642 As a result, this variable is left empty, by default.  For situations in
5643 which the compiler does not necessarily follow the normal convention,
5644 the user may use this variable.  Its value will be appended to every
5645 module file name as scons attempts to resolve dependencies.
5646
5647 .IP FORTRANMODSUFFIX
5648 The module file suffix used by the Fortran compiler.  SCons assumes that
5649 the Fortran compiler follows the quasi-standard naming convention for
5650 module files of
5651 .I <module_name>.mod.
5652 As a result, this variable is set to ".mod", by default.  For situations
5653 in which the compiler does not necessarily follow the normal convention,
5654 the user may use this variable.  Its value will be appended to every
5655 module file name as scons attempts to resolve dependencies.
5656
5657 .IP FORTRANPATH
5658 The list of directories that the Fortran compiler will search for
5659 include files and (for some compilers) module files. The Fortran implicit
5660 dependency scanner will search these directories for include files (but
5661 not module files since they are autogenerated and, as such, may not
5662 actually exist at the time the scan takes place). Don't explicitly put
5663 include directory arguments in FORTRANFLAGS because the result will be
5664 non-portable and the directories will not be searched by the dependency
5665 scanner. Note: directory names in FORTRANPATH will be looked-up relative
5666 to the SConscript directory when they are used in a command. To force
5667 .B scons
5668 to look-up a directory relative to the root of the source tree use #:
5669
5670 .ES
5671 env = Environment(FORTRANPATH='#/include')
5672 .EE
5673
5674 .IP
5675 The directory look-up can also be forced using the 
5676 .BR Dir ()
5677 function:
5678
5679 .ES
5680 include = Dir('include')
5681 env = Environment(FORTRANPATH=include)
5682 .EE
5683
5684 .IP
5685 The directory list will be added to command lines
5686 through the automatically-generated
5687 $_FORTRANINCFLAGS
5688 construction variable,
5689 which is constructed by
5690 appending the values of the
5691 $INCPREFIX and $INCSUFFIX
5692 construction variables
5693 to the beginning and end
5694 of each directory in $FORTRANPATH.
5695 Any command lines you define that need
5696 the FORTRANPATH directory list should
5697 include $_FORTRANINCFLAGS:
5698
5699 .ES
5700 env = Environment(FORTRANCOM="my_compiler $_FORTRANINCFLAGS -c -o $TARGET $SOURCE")
5701 .EE
5702
5703 .IP FORTRANPPCOM 
5704 The command line used to compile a Fortran source file to an object file
5705 after first running the file through the C preprocessor. 
5706 By default, any options specified in the $FORTRANFLAGS, $CPPFLAGS,
5707 _CPPDEFFLAGS, $_FORTRANMODFLAG, and $_FORTRANINCFLAGS
5708 construction variables are included on this command line.
5709
5710 .IP FORTRANSUFFIXES
5711 The list of suffixes of files that will be scanned
5712 for Fortran implicit dependencies
5713 (INCLUDE lines & USE statements).
5714 The default list is:
5715
5716 .ES
5717 [".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
5718 ".f77", ".F77", ".f90", ".F90", ".f95", ".F95"]
5719 .EE
5720
5721 .IP File
5722 A function that converts a file name into a File instance relative to the
5723 target being built. 
5724
5725 .IP FRAMEWORKPATH
5726 On Mac OS X with gcc,
5727 a list containing the paths to search for frameworks.
5728 Used by the compiler to find framework-style includes like
5729 #include <Fmwk/Header.h>.
5730 Used by the linker to find user-specified frameworks when linking (see
5731 $FRAMEWORKS).
5732 For example:
5733 .ES
5734  env.AppendUnique(FRAMEWORKPATH='#myframeworkdir')
5735 .EE
5736 .IP
5737 will add
5738 .ES
5739   ... -Fmyframeworkdir
5740 .EE
5741 .IP
5742 to the compiler and linker command lines.
5743
5744 .IP _FRAMEWORKPATH
5745 On Mac OS X with gcc, an automatically-generated construction variable
5746 containing the linker command-line options corresponding to FRAMEWORKPATH.
5747
5748 .IP FRAMEWORKPATHPREFIX
5749 On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH entries.
5750 (see $FRAMEWORKPATH).
5751 The default value is
5752 .BR -F .
5753
5754 .IP FRAMEWORKPREFIX
5755 On Mac OS X with gcc,
5756 the prefix to be used for linking in frameworks
5757 (see $FRAMEWORKS).
5758 The default value is
5759 .BR -framework .
5760
5761 .IP FRAMEWORKS
5762 On Mac OS X with gcc, a list of the framework names to be linked into a
5763 program or shared library or bundle.
5764 The default value is the empty list.
5765 For example:
5766 .ES
5767  env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration'))
5768 .EE
5769
5770 .IP _FRAMEWORKS
5771 On Mac OS X with gcc,
5772 an automatically-generated construction variable
5773 containing the linker command-line options
5774 for linking with FRAMEWORKS.
5775
5776 .IP FRAMEWORKSFLAGS
5777 On Mac OS X with gcc,
5778 general user-supplied frameworks options to be added at
5779 the end of a command
5780 line building a loadable module.
5781 (This has been largely superceded by
5782 the $FRAMEWORKPATH, $FRAMEWORKPATHPREFIX,
5783 $FRAMWORKPREFIX and $FRAMEWORKS variables
5784 described above.)
5785
5786 .IP GS
5787 The Ghostscript program used to convert PostScript to PDF files.
5788
5789 .IP GSFLAGS
5790 General options passed to the Ghostscript program
5791 when converting PostScript to PDF files.
5792
5793 .IP GSCOM
5794 The Ghostscript command line used to convert PostScript to PDF files.
5795
5796 .IP GSCOMSTR
5797 The string displayed when
5798 Ghostscript is used to convert
5799 a PostScript file to a PDF file.
5800 If this is not set, then $GSCOM (the command line) is displayed.
5801
5802 .IP IDLSUFFIXES
5803 The list of suffixes of files that will be scanned
5804 for IDL implicit dependencies
5805 (#include or import lines).
5806 The default list is:
5807
5808 .ES
5809 [".idl", ".IDL"]
5810 .EE
5811
5812 .IP INCPREFIX
5813 The prefix used to specify an include directory on the C compiler command
5814 line.
5815 This will be appended to the beginning of each directory
5816 in the $CPPPATH and $FORTRANPATH construction variables
5817 when the $_CPPINCFLAGS and $_FORTRANINCFLAGS
5818 variables are automatically generated.
5819
5820 .IP INCSUFFIX
5821 The suffix used to specify an include directory on the C compiler command
5822 line.
5823 This will be appended to the end of each directory
5824 in the $CPPPATH and $FORTRANPATH construction variables
5825 when the $_CPPINCFLAGS and $_FORTRANINCFLAGS
5826 variables are automatically generated.
5827
5828 .IP INSTALL
5829 A function to be called to install a file into a
5830 destination file name.
5831 The default function copies the file into the destination
5832 (and sets the destination file's mode and permission bits
5833 to match the source file's).
5834 The function takes the following arguments:
5835
5836 .ES
5837 def install(dest, source, env):
5838 .EE
5839 .IP
5840 .I dest
5841 is the path name of the destination file.
5842 .I source
5843 is the path name of the source file.
5844 .I env
5845 is the construction environment
5846 (a dictionary of construction values)
5847 in force for this file installation.
5848
5849 .IP INTEL_C_COMPILER_VERSION
5850 Set by the "intelc" Tool
5851 to the major version number of the Intel C compiler
5852 selected for use.
5853
5854 .IP JAR
5855 The Java archive tool.
5856
5857 .IP JARCHDIR
5858 The directory to which the Java archive tool should change
5859 (using the
5860 .B \-C
5861 option).
5862
5863 .IP JARCOM
5864 The command line used to call the Java archive tool.
5865
5866 .IP JARCOMSTR
5867 The string displayed when the Java archive tool
5868 is called
5869 If this is not set, then $JARCOM (the command line) is displayed.
5870
5871 .ES
5872 env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET")
5873 .EE
5874
5875 .IP JARFLAGS
5876 General options passed to the Java archive tool.
5877 By default this is set to
5878 .B cf
5879 to create the necessary
5880 .I jar
5881 file.
5882
5883 .IP JARSUFFIX
5884 The suffix for Java archives:
5885 .B .jar
5886 by default.
5887
5888 .IP JAVAC
5889 The Java compiler.
5890
5891 .IP JAVACCOM
5892 The command line used to compile a directory tree containing
5893 Java source files to
5894 corresponding Java class files.
5895 Any options specified in the $JAVACFLAGS construction variable
5896 are included on this command line.
5897
5898 .IP JAVACCOMSTR
5899 The string displayed when compiling
5900 a directory tree of Java source files to
5901 corresponding Java class files.
5902 If this is not set, then $JAVACCOM (the command line) is displayed.
5903
5904 .ES
5905 env = Environment(JAVACCOMSTR = "Compiling class files $TARGETS from $SOURCES")
5906 .EE
5907
5908 .IP JAVACFLAGS
5909 General options that are passed to the Java compiler.
5910
5911 .IP JAVACLASSDIR
5912 The directory in which Java class files may be found.
5913 This is stripped from the beginning of any Java .class
5914 file names supplied to the
5915 .B JavaH
5916 builder.
5917
5918 .IP JAVACLASSSUFFIX
5919 The suffix for Java class files;
5920 .B .class
5921 by default.
5922
5923 .IP JAVAH
5924 The Java generator for C header and stub files.
5925
5926 .IP JAVAHCOM
5927 The command line used to generate C header and stub files
5928 from Java classes.
5929 Any options specified in the $JAVAHFLAGS construction variable
5930 are included on this command line.
5931
5932 .IP JAVAHCOMSTR
5933 The string displayed when C header and stub files
5934 are generated from Java classes.
5935 If this is not set, then $JAVAHCOM (the command line) is displayed.
5936
5937 .ES
5938 env = Environment(JAVAHCOMSTR = "Generating header/stub file(s) $TARGETS from $SOURCES")
5939 .EE
5940
5941 .IP JAVAHFLAGS
5942 General options passed to the C header and stub file generator
5943 for Java classes.
5944
5945 .IP JAVASUFFIX
5946 The suffix for Java files;
5947 .B .java
5948 by default.
5949
5950 .IP LATEX
5951 The LaTeX structured formatter and typesetter.
5952
5953 .IP LATEXCOM
5954 The command line used to call the LaTeX structured formatter and typesetter.
5955
5956 .IP LATEXCOMSTR
5957 The string displayed when calling
5958 the LaTeX structured formatter and typesetter.
5959 If this is not set, then $LATEXCOM (the command line) is displayed.
5960
5961 .ES
5962 env = Environment(LATEXCOMSTR = "Building $TARGET from LaTeX input $SOURCES")
5963 .EE
5964
5965 .IP LATEXFLAGS
5966 General options passed to the LaTeX structured formatter and typesetter.
5967
5968 .IP LDMODULE
5969 The linker for building loadable modules.
5970 By default, this is the same as $SHLINK.
5971
5972 .IP LDMODULECOM
5973 The command line for building loadable modules.
5974 On Mac OS X, this uses the $LDMODULE,
5975 $LDMODULEFLAGS and $FRAMEWORKSFLAGS variables.
5976 On other systems, this is the same as $SHLINK.
5977
5978 .IP LDMODULECOMSTR
5979 The string displayed when building loadable modules.
5980 If this is not set, then $LDMODULECOM (the command line) is displayed.
5981
5982 .IP LDMODULEFLAGS
5983 General user options passed to the linker for building loadable modules.
5984
5985 .IP LDMODULEPREFIX
5986 The prefix used for loadable module file names.
5987 On Mac OS X, this is null;
5988 on other systems, this is
5989 the same as $SHLIBPREFIX.
5990
5991 .IP LDMODULESUFFIX
5992 The suffix used for loadable module file names.
5993 On Mac OS X, this is null;
5994 on other systems, this is
5995 the same as $SHLIBSUFFIX.
5996
5997 .IP LEX
5998 The lexical analyzer generator.
5999
6000 .IP LEXFLAGS
6001 General options passed to the lexical analyzer generator.
6002
6003 .IP LEXCOM
6004 The command line used to call the lexical analyzer generator
6005 to generate a source file.
6006
6007 .IP LEXCOMSTR
6008 The string displayed when generating a source file
6009 using the lexical analyzer generator.
6010 If this is not set, then $LEXCOM (the command line) is displayed.
6011
6012 .ES
6013 env = Environment(LEXCOMSTR = "Lex'ing $TARGET from $SOURCES")
6014 .EE
6015
6016 .IP _LIBDIRFLAGS
6017 An automatically-generated construction variable
6018 containing the linker command-line options
6019 for specifying directories to be searched for library.
6020 The value of $_LIBDIRFLAGS is created
6021 by appending $LIBDIRPREFIX and $LIBDIRSUFFIX
6022 to the beginning and end
6023 of each directory in $LIBPATH.
6024
6025 .IP LIBDIRPREFIX
6026 The prefix used to specify a library directory on the linker command line.
6027 This will be appended to the beginning of each directory
6028 in the $LIBPATH construction variable
6029 when the $_LIBDIRFLAGS variable is automatically generated.
6030
6031 .IP LIBDIRSUFFIX
6032 The suffix used to specify a library directory on the linker command line.
6033 This will be appended to the end of each directory
6034 in the $LIBPATH construction variable
6035 when the $_LIBDIRFLAGS variable is automatically generated.
6036
6037 .IP _LIBFLAGS
6038 An automatically-generated construction variable
6039 containing the linker command-line options
6040 for specifying libraries to be linked with the resulting target.
6041 The value of $_LIBFLAGS is created
6042 by appending $LIBLINKPREFIX and $LIBLINKSUFFIX
6043 to the beginning and end
6044 of each filename in $LIBS.
6045
6046 .IP LIBLINKPREFIX
6047 The prefix used to specify a library to link on the linker command line.
6048 This will be appended to the beginning of each library
6049 in the $LIBS construction variable
6050 when the $_LIBFLAGS variable is automatically generated.
6051
6052 .IP LIBLINKSUFFIX
6053 The suffix used to specify a library to link on the linker command line.
6054 This will be appended to the end of each library
6055 in the $LIBS construction variable
6056 when the $_LIBFLAGS variable is automatically generated.
6057
6058 .IP LIBPATH
6059 The list of directories that will be searched for libraries.
6060 The implicit dependency scanner will search these
6061 directories for include files. Don't explicitly put include directory
6062 arguments in $LINKFLAGS or $SHLINKFLAGS
6063 because the result will be non-portable
6064 and the directories will not be searched by the dependency scanner. Note:
6065 directory names in LIBPATH will be looked-up relative to the SConscript
6066 directory when they are used in a command. To force 
6067 .B scons
6068 to look-up a directory relative to the root of the source tree use #:
6069
6070 .ES
6071 env = Environment(LIBPATH='#/libs')
6072 .EE
6073
6074 .IP
6075 The directory look-up can also be forced using the 
6076 .BR Dir ()
6077 function:
6078
6079 .ES
6080 libs = Dir('libs')
6081 env = Environment(LIBPATH=libs)
6082 .EE
6083
6084 .IP
6085 The directory list will be added to command lines
6086 through the automatically-generated
6087 $_LIBDIRFLAGS
6088 construction variable,
6089 which is constructed by
6090 appending the values of the
6091 $LIBDIRPREFIX and $LIBDIRSUFFIX
6092 construction variables
6093 to the beginning and end
6094 of each directory in $LIBPATH.
6095 Any command lines you define that need
6096 the LIBPATH directory list should
6097 include $_LIBDIRFLAGS:
6098
6099 .ES
6100 env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE")
6101 .EE
6102
6103 .IP LIBPREFIX
6104 The prefix used for (static) library file names.
6105 A default value is set for each platform
6106 (posix, win32, os2, etc.),
6107 but the value is overridden by individual tools
6108 (ar, mslib, sgiar, sunar, tlib, etc.)
6109 to reflect the names of the libraries they create.
6110
6111 .IP LIBPREFIXES
6112 An array of legal prefixes for library file names.
6113
6114 .IP LIBS
6115 A list of one or more libraries
6116 that will be linked with
6117 any executable programs
6118 created by this environment.
6119
6120 .IP
6121 The library list will be added to command lines
6122 through the automatically-generated
6123 $_LIBFLAGS
6124 construction variable,
6125 which is constructed by
6126 appending the values of the
6127 $LIBLINKPREFIX and $LIBLINKSUFFIX
6128 construction variables
6129 to the beginning and end
6130 of each filename in $LIBS.
6131 Any command lines you define that need
6132 the LIBS library list should
6133 include $_LIBFLAGS:
6134
6135 .ES
6136 env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE")
6137 .EE
6138
6139 .IP
6140 If you add a
6141 File
6142 object to the
6143 LIBS
6144 list, the name of that file will be added to
6145 $_LIBFLAGS,
6146 and thus the link line, as is, without
6147 $LIBLINKPREFIX
6148 or
6149 $LIBLINKSUFFIX.
6150 For example:
6151 .ES
6152 env.Append(LIBS=File('/tmp/mylib.so'))
6153 .EE
6154
6155 .IP
6156 In all cases, scons will add dependencies from the executable program to
6157 all the libraries in this list.
6158
6159 .IP LIBSUFFIX 
6160 The suffix used for (static) library file names.
6161 A default value is set for each platform
6162 (posix, win32, os2, etc.),
6163 but the value is overridden by individual tools
6164 (ar, mslib, sgiar, sunar, tlib, etc.)
6165 to reflect the names of the libraries they create.
6166
6167 .IP LIBSUFFIXES
6168 An array of legal suffixes for library file names.
6169
6170 .IP LINK
6171 The linker.
6172
6173 .IP LINKFLAGS
6174 General user options passed to the linker.
6175 Note that this variable should
6176 .I not
6177 contain
6178 .B -l
6179 (or similar) options for linking with the libraries listed in $LIBS,
6180 nor
6181 .B -L
6182 (or similar) library search path options
6183 that scons generates automatically from $LIBPATH.
6184 See
6185 .BR _LIBFLAGS ,
6186 above,
6187 for the variable that expands to library-link options,
6188 and
6189 .BR _LIBDIRFLAGS ,
6190 above,
6191 for the variable that expands to library search path options.
6192
6193 .IP LINKCOM
6194 The command line used to link object files into an executable.
6195
6196 .IP LINKCOMSTR
6197 The string displayed when object files
6198 are linked into an executable.
6199 If this is not set, then $LINKCOM (the command line) is displayed.
6200
6201 .ES
6202 env = Environment(LINKCOMSTR = "Linking $TARGET")
6203 .EE
6204
6205 .IP M4
6206 The M4 macro preprocessor.
6207
6208 .IP M4FLAGS
6209 General options passed to the M4 macro preprocessor.
6210
6211 .IP M4COM
6212 The command line used to pass files through the M4 macro preprocessor.
6213
6214 .IP M4COMSTR
6215 The string displayed when
6216 a file is passed through the M4 macro preprocessor.
6217 If this is not set, then $M4COM (the command line) is displayed.
6218
6219 .IP MAXLINELENGTH
6220 The maximum number of characters allowed on an external command line.
6221 On Win32 systems,
6222 link lines longer than this many characters
6223 are linke via a temporary file name.
6224
6225 .IP MSVS
6226 When the Microsoft Visual Studio tools are initialized, they set up
6227 this dictionary with the following keys:
6228
6229 .B VERSION:
6230 the version of MSVS being used (can be set via
6231 MSVS_VERSION)
6232
6233 .B VERSIONS:
6234 the available versions of MSVS installed
6235
6236 .B VCINSTALLDIR:
6237 installed directory of Visual C++
6238
6239 .B VSINSTALLDIR:
6240 installed directory of Visual Studio
6241
6242 .B FRAMEWORKDIR:
6243 installed directory of the .NET framework
6244
6245 .B FRAMEWORKVERSIONS:
6246 list of installed versions of the .NET framework, sorted latest to oldest.
6247
6248 .B FRAMEWORKVERSION:
6249 latest installed version of the .NET framework
6250
6251 .B FRAMEWORKSDKDIR:
6252 installed location of the .NET SDK.
6253
6254 .B PLATFORMSDKDIR:
6255 installed location of the Platform SDK.
6256
6257 .B PLATFORMSDK_MODULES:
6258 dictionary of installed Platform SDK modules,
6259 where the dictionary keys are keywords for the various modules, and
6260 the values are 2-tuples where the first is the release date, and the
6261 second is the version number.
6262
6263 If a value isn't set, it wasn't available in the registry.
6264
6265 .IP MSVS_IGNORE_IDE_PATHS
6266 Tells the MS Visual Studio tools to use minimal INCLUDE, LIB, and PATH settings,
6267 instead of the settings from the IDE.
6268
6269 For Visual Studio, SCons will (by default) automatically determine
6270 where MSVS is installed, and use the LIB, INCLUDE, and PATH variables
6271 set by the IDE.  You can override this behavior by setting these
6272 variables after Environment initialization, or by setting
6273 .B MSVS_IGNORE_IDE_PATHS = 1
6274 in the Environment initialization.
6275 Specifying this will not leave these unset, but will set them to a
6276 minimal set of paths needed to run the tools successfully.
6277
6278 .ES
6279 For VS6, the mininimal set is:
6280    INCLUDE:'<VSDir>\\VC98\\ATL\\include;<VSDir>\\VC98\\MFC\\include;<VSDir>\\VC98\\include'
6281    LIB:'<VSDir>\\VC98\\MFC\\lib;<VSDir>\\VC98\\lib'
6282    PATH:'<VSDir>\\Common\\MSDev98\\bin;<VSDir>\\VC98\\bin'
6283 For VS7, it is:
6284    INCLUDE:'<VSDir>\\Vc7\\atlmfc\\include;<VSDir>\\Vc7\\include'
6285    LIB:'<VSDir>\\Vc7\\atlmfc\\lib;<VSDir>\\Vc7\\lib'
6286    PATH:'<VSDir>\\Common7\\Tools\\bin;<VSDir>\\Common7\\Tools;<VSDir>\\Vc7\\bin'
6287 .EE
6288
6289 .IP
6290 Where '<VSDir>' is the installed location of Visual Studio.
6291
6292 .IP MSVS_USE_MFC_DIRS
6293 Tells the MS Visual Studio tool(s) to use
6294 the MFC directories in its default paths
6295 for compiling and linking.
6296 Under MSVS version 6,
6297 setting
6298 .B MSVS_USE_MFC_DIRS
6299 to a non-zero value
6300 adds the
6301 .B "ATL\\\\include"
6302 and
6303 .B "MFC\\\\include"
6304 directories to
6305 the default
6306 .B INCLUDE
6307 external environment variable,
6308 and adds the
6309 .B "MFC\\\\lib"
6310 directory to
6311 the default
6312 .B LIB
6313 external environment variable.
6314 Under MSVS version 7,
6315 setting
6316 .B MSVS_USE_MFC_DIRS
6317 to a non-zero value
6318 adds the
6319 .B "atlmfc\\\\include"
6320 directory to the default
6321 .B INCLUDE
6322 external environment variable,
6323 and adds the
6324 .B "atlmfc\\\\lib"
6325 directory to the default
6326 .B LIB
6327 external environment variable.
6328 The current default value is
6329 .BR 1 ,
6330 which means these directories
6331 are added to the paths by default.
6332 This default value is likely to change
6333 in a future release,
6334 so users who want the ATL and MFC
6335 values included in their paths
6336 are encouraged to enable the
6337 .B MSVS_USE_MFC_DIRS
6338 value explicitly
6339 to avoid future incompatibility.
6340 This variable has no effect if the
6341 .BR INCLUDE
6342 or
6343 .BR LIB
6344 environment variables are set explictly.
6345
6346 .IP MSVS_VERSION
6347 Sets the preferred version of MSVS to use.
6348
6349 SCons will (by default) select the latest version of MSVS
6350 installed on your machine.  So, if you have version 6 and version 7
6351 (MSVS .NET) installed, it will prefer version 7.  You can override this by
6352 specifying the 
6353 .B MSVS_VERSION
6354 variable in the Environment initialization, setting it to the
6355 appropriate version ('6.0' or '7.0', for example).
6356 If the given version isn't installed, tool initialization will fail.
6357
6358 .IP MSVSPROJECTCOM
6359 The action used to generate Microsoft Visual Studio
6360 project and solution files.
6361
6362 .IP MSVSPROJECTSUFFIX
6363 The suffix used for Microsoft Visual Studio project (DSP) files.
6364 The default value is
6365 .B .vcproj
6366 when using Visual Studio version 7.x (.NET),
6367 and
6368 .B .dsp
6369 when using earlier versions of Visual Studio.
6370
6371 .IP MSVSSOLUTIONSUFFIX
6372 The suffix used for Microsoft Visual Studio solution (DSW) files.
6373 The default value is
6374 .B .sln
6375 when using Visual Studio version 7.x (.NET),
6376 and
6377 .B .dsw
6378 when using earlier versions of Visual Studio.
6379
6380 .IP MWCW_VERSION
6381 The version number of the MetroWerks CodeWarrior C compiler
6382 to be used.
6383
6384 .IP MWCW_VERSIONS
6385 A list of installed versions of the MetroWerks CodeWarrior C compiler
6386 on this system.
6387
6388 .IP no_import_lib
6389 When set to non-zero,
6390 suppresses creation of a corresponding Win32 static import lib by the
6391 .B SharedLibrary
6392 builder when used with
6393 MinGW or Microsoft Visual Studio.
6394 This also suppresses creation
6395 of an export (.exp) file
6396 when using Microsoft Visual Studio.
6397
6398 .IP OBJPREFIX 
6399 The prefix used for (static) object file names.
6400
6401 .IP OBJSUFFIX 
6402 The suffix used for (static) object file names.
6403
6404 .IP P4
6405 The Perforce executable.
6406
6407 .IP P4COM
6408 The command line used to
6409 fetch source files from Perforce.
6410
6411 .IP P4COMSTR
6412 The string displayed when
6413 fetching a source file from Perforce.
6414 If this is not set, then $P4COM (the command line) is displayed.
6415
6416 .IP P4FLAGS
6417 General options that are passed to Perforce.
6418
6419 .IP PCH
6420 The Microsoft Visual C++ precompiled header that will be used when compiling
6421 object files. This variable is ignored by tools other than Microsoft Visual C++.
6422 When this variable is
6423 defined SCons will add options to the compiler command line to
6424 cause it to use the precompiled header, and will also set up the
6425 dependencies for the PCH file. Example: 
6426
6427 .ES
6428 env['PCH'] = 'StdAfx.pch'
6429 .EE
6430
6431 .IP PCHCOM
6432 The command line used by the
6433 .B PCH
6434 builder to generated a precompiled header.
6435
6436 .IP PCHCOMSTR
6437 The string displayed when generating a precompiled header.
6438 If this is not set, then $PCHCOM (the command line) is displayed.
6439
6440 .IP PCHSTOP
6441 This variable specifies how much of a source file is precompiled. This
6442 variable is ignored by tools other than Microsoft Visual C++, or when
6443 the PCH variable is not being used. When this variable is define it
6444 must be a string that is the name of the header that
6445 is included at the end of the precompiled portion of the source files, or
6446 the empty string if the "#pragma hrdstop" construct is being used:
6447
6448 .ES
6449 env['PCHSTOP'] = 'StdAfx.h'
6450 .EE
6451
6452 .IP PDB
6453 The Microsoft Visual C++ PDB file that will store debugging information for
6454 object files, shared libraries, and programs. This variable is ignored by
6455 tools other than Microsoft Visual C++.
6456 When this variable is
6457 defined SCons will add options to the compiler and linker command line to
6458 cause them to generate external debugging information, and will also set up the
6459 dependencies for the PDB file. Example:
6460
6461 .ES
6462 env['PDB'] = 'hello.pdb'
6463 .EE
6464
6465 .IP PDFCOM
6466 A deprecated synonym for $DVIPDFCOM.
6467
6468 .IP PDFPREFIX
6469 The prefix used for PDF file names.
6470
6471 .IP PDFSUFFIX
6472 The suffix used for PDF file names.
6473
6474 .IP PLATFORM
6475 The name of the platform used to create the Environment.  If no platform is
6476 specified when the Environment is created,
6477 .B SCons
6478 autodetects the platform.
6479
6480 .ES
6481 env = Environment(tools = [])
6482 if env['PLATFORM'] == 'cygwin':
6483     Tool('mingw')(env)
6484 else:
6485     Tool('msvc')(env)
6486 .EE
6487
6488 .IP PRINT_CMD_LINE_FUNC
6489 A Python function used to print the command lines as they are executed
6490 (assuming command printing is not disabled by the
6491 .B -q
6492 or
6493 .B -s
6494 options or their equivalents).
6495 The function should take four arguments:
6496 .IR s ,
6497 the command being executed (a string),
6498 .IR target ,
6499 the target being built (file node, list, or string name(s)),
6500 .IR source ,
6501 the source(s) used (file node, list, or string name(s)), and
6502 .IR env ,
6503 the environment being used.
6504
6505 The function must do the printing itself.  The default implementation,
6506 used if this variable is not set or is None, is:
6507 .ES
6508 def print_cmd_line(s, target, source, env):
6509   sys.stdout.write(s + "\n")
6510 .EE
6511
6512 Here's an example of a more interesting function:
6513 .ES
6514 def print_cmd_line(s, target, source, env):
6515    sys.stdout.write("Building %s -> %s...\n" %
6516     (' and '.join([str(x) for x in source]),
6517      ' and '.join([str(x) for x in target])))
6518 env=Environment(PRINT_CMD_LINE_FUNC=print_cmd_line)
6519 env.Program('foo', 'foo.c')
6520 .EE
6521
6522 This just prints "Building <targetname> from <sourcename>..." instead
6523 of the actual commands.
6524 Such a function could also log the actual commands to a log file,
6525 for example.
6526
6527 .IP PROGPREFIX
6528 The prefix used for executable file names.
6529
6530 .IP PROGSUFFIX
6531 The suffix used for executable file names.
6532
6533 .IP PSCOM
6534 The command line used to convert TeX DVI files into a PostScript file.
6535
6536 .IP PSCOMSTR
6537 The string displayed when a TeX DVI file
6538 is converted into a PostScript file.
6539 If this is not set, then $PSCOM (the command line) is displayed.
6540
6541 .IP PSPREFIX
6542 The prefix used for PostScript file names.
6543
6544 .IP PSSUFFIX
6545 The prefix used for PostScript file names.
6546
6547 .IP QTDIR
6548 The qt tool tries to take this from os.environ.
6549 It also initializes all QT_*
6550 construction variables listed below.
6551 (Note that all paths are constructed
6552 with python's os.path.join() method,
6553 but are listed here with the '/' separator
6554 for easier reading.)
6555 In addition, the construction environment
6556 variables CPPPATH, LIBPATH and LIBS may be modified
6557 and the variables
6558 PROGEMITTER, SHLIBEMITTER and LIBEMITTER
6559 are modified. Because the build-performance is affected when using this tool,
6560 you have to explicitly specify it at Environment creation:
6561
6562 .ES
6563 Environment(tools=['default','qt'])
6564 .EE
6565 .IP
6566 The qt tool supports the following operations:
6567
6568 .B Automatic moc file generation from header files.
6569 You do not have to specify moc files explicitly, the tool does it for you.
6570 However, there are a few preconditions to do so: Your header file must have
6571 the same filebase as your implementation file and must stay in the same
6572 directory. It must have one of the suffixes .h, .hpp, .H, .hxx, .hh. You 
6573 can turn off automatic moc file generation by setting QT_AUTOSCAN to 0.
6574 See also the corresponding builder method
6575 .B Moc()
6576
6577 .B Automatic moc file generation from cxx files.
6578 As stated in the qt documentation, include the moc file at the end of 
6579 the cxx file. Note that you have to include the file, which is generated
6580 by the transformation ${QT_MOCCXXPREFIX}<basename>${QT_MOCCXXSUFFIX}, by default
6581 <basename>.moc. A warning is generated after building the moc file, if you 
6582 do not include the correct file. If you are using BuildDir, you may 
6583 need to specify duplicate=1. You can turn off automatic moc file generation 
6584 by setting QT_AUTOSCAN to 0. See also the corresponding builder method
6585 .B Moc()
6586
6587 .B Automatic handling of .ui files.
6588 The implementation files generated from .ui files are handled much the same
6589 as yacc or lex files. Each .ui file given as a source of Program, Library or
6590 SharedLibrary will generate three files, the declaration file, the 
6591 implementation file and a moc file. Because there are also generated headers, 
6592 you may need to specify duplicate=1 in calls to BuildDir. See also the corresponding builder method
6593 .B Uic()
6594
6595 .IP QT_AUTOSCAN
6596 Turn off scanning for mocable files. Use the Moc Builder to explicitely 
6597 specify files to run moc on.
6598
6599 .IP QT_BINPATH
6600 The path where the qt binaries are installed.
6601 The default value is '$QTDIR/bin'.
6602
6603 .IP QT_CPPPATH
6604 The path where the qt header files are installed.
6605 The default value is '$QTDIR/include'.
6606 Note: If you set this variable to None, the tool won't change the CPPPATH
6607 construction variable.
6608
6609 .IP QT_DEBUG 
6610 Prints lots of debugging information while scanning for moc files.
6611
6612 .IP QT_LIBPATH
6613 The path where the qt libraries are installed.
6614 The default value is '$QTDIR/lib'. 
6615 Note: If you set this variable to None, the tool won't change the LIBPATH
6616 construction variable.
6617
6618 .IP QT_LIB
6619 Default value is 'qt'. You may want to set this to 'qt-mt'. Note: If you set
6620 this variable to None, the tool won't change the LIBS variable.
6621
6622 .IP QT_MOC
6623 Default value is '$QT_BINPATH/moc'.
6624
6625 .IP QT_MOCCXXPREFIX
6626 Default value is ''. Prefix for moc output files, when source is a cxx file.
6627
6628 .IP QT_MOCCXXSUFFIX
6629 Default value is '.moc'. Suffix for moc output files, when source is a cxx 
6630 file.
6631
6632 .IP QT_MOCFROMCPPFLAGS
6633 Default value is '-i'. These flags are passed to moc, when moccing a
6634 cpp file.
6635
6636 .IP QT_MOCFROMCXXCOM
6637 Command to generate a moc file from a cpp file.
6638
6639 .IP QT_MOCFROMCXXCOMSTR
6640 The string displayed when generating a moc file from a cpp file.
6641 If this is not set, then $QT_MOCFROMCXXCOM (the command line) is displayed.
6642
6643 .IP QT_MOCFROMHCOM
6644 Command to generate a moc file from a header.
6645
6646 .IP QT_MOCFROMHCOMSTR
6647 The string displayed when generating a moc file from a cpp file.
6648 If this is not set, then $QT_MOCFROMHCOM (the command line) is displayed.
6649
6650 .IP QT_MOCFROMHFLAGS
6651 Default value is ''. These flags are passed to moc, when moccing a header
6652 file.
6653
6654 .IP QT_MOCHPREFIX
6655 Default value is 'moc_'. Prefix for moc output files, when source is a header.
6656
6657 .IP QT_MOCHSUFFIX
6658 Default value is '$CXXFILESUFFIX'. Suffix for moc output files, when source is
6659 a header.
6660
6661 .IP QT_UIC
6662 Default value is '$QT_BINPATH/uic'.
6663
6664 .IP QT_UICCOM
6665 Command to generate header files from .ui files.
6666
6667 .IP QT_UICCOMSTR
6668 The string displayed when generating header files from .ui files.
6669 If this is not set, then $QT_UICCOM (the command line) is displayed.
6670
6671 .IP QT_UICDECLFLAGS
6672 Default value is ''. These flags are passed to uic, when creating a a h
6673 file from a .ui file.
6674
6675 .IP QT_UICDECLPREFIX
6676 Default value is ''. Prefix for uic generated header files.
6677
6678 .IP QT_UICDECLSUFFIX
6679 Default value is '.h'. Suffix for uic generated header files.
6680
6681 .IP QT_UICIMPLFLAGS
6682 Default value is ''. These flags are passed to uic, when creating a cxx
6683 file from a .ui file.
6684
6685 .IP QT_UICIMPLPREFIX
6686 Default value is 'uic_'. Prefix for uic generated implementation files.
6687
6688 .IP QT_UICIMPLSUFFIX
6689 Default value is '$CXXFILESUFFIX'. Suffix for uic generated implementation 
6690 files.
6691
6692 .IP QT_UISUFFIX
6693 Default value is '.ui'. Suffix of designer input files.
6694
6695 .IP RANLIB
6696 The archive indexer.
6697
6698 .IP RANLIBFLAGS
6699 General options passed to the archive indexer.
6700
6701 .IP RC
6702 The resource compiler used by the RES builder.
6703
6704 .IP RCCOM
6705 The command line used by the RES builder.
6706
6707 .IP RCCOMSTR
6708 The string displayed when invoking the resource compiler.
6709 If this is not set, then $RCCOM (the command line) is displayed.
6710
6711 .IP RCFLAGS
6712 The flags passed to the resource compiler by the RES builder.
6713
6714 .IP RCS
6715 The RCS executable.
6716 Note that this variable is not actually used
6717 for the command to fetch source files from RCS;
6718 see the
6719 .B RCS_CO
6720 construction variable, below.
6721
6722 .IP RCS_CO 
6723 The RCS "checkout" executable,
6724 used to fetch source files from RCS.
6725
6726 .IP RCS_COCOM
6727 The command line used to
6728 fetch (checkout) source files from RCS.
6729
6730 .IP RCS_COCOMSTR
6731 The string displayed when fetching
6732 a source file from RCS.
6733 If this is not set, then $RCS_COCOM
6734 (the command line) is displayed.
6735
6736 .IP RCS_COFLAGS
6737 Options that are passed to the $RCS_CO command.
6738
6739 .IP REGSVR
6740 The program used to register DLLs on Windows systems.
6741
6742 .IP REGSVRCOM
6743 The command line used to register a newly-built DLL file
6744 on Windows systems.
6745 Invoked when the "register=1"
6746 keyword argument is passed to the
6747 .B SharedLibrary
6748 Builder.
6749
6750 .IP REGSVRCOMSTR
6751 The string displayed when registering a newly-built DLL file.
6752 If this is not set, then $REGSVRCOM (the command line) is displayed.
6753
6754 .IP RDirs
6755 A function that converts a file name into a list of Dir instances by
6756 searching the repositories. 
6757
6758 .IP RMIC
6759 The Java RMI stub compiler.
6760
6761 .IP RMICCOM
6762 The command line used to compile stub
6763 and skeleton class files
6764 from Java classes that contain RMI implementations.
6765 Any options specified in the $RMICFLAGS construction variable
6766 are included on this command line.
6767
6768 .IP RMICCOMSTR
6769 The string displayed when compiling
6770 stub and skeleton class files
6771 from Java classes that contain RMI implementations.
6772 If this is not set, then $RMICCOM (the command line) is displayed.
6773
6774 .ES
6775 env = Environment(RMICCOMSTR = "Generating stub/skeleton class files $TARGETS from $SOURCES")
6776 .EE
6777
6778 .IP RMICFLAGS
6779 General options passed to the Java RMI stub compiler.
6780
6781 .IP RPCGEN
6782 The RPC protocol compiler.
6783
6784 .IP RPCGENCLIENTFLAGS
6785 Options passed to the RPC protocol compiler
6786 when generating client side stubs.
6787 These are in addition to any flags specified in the
6788 .B RPCGENFLAGS
6789 construction variable.
6790
6791 .IP RPCGENFLAGS
6792 General options passed to the RPC protocol compiler.
6793
6794 .IP RPCGENHEADERFLAGS
6795 Options passed to the RPC protocol compiler
6796 when generating a header file.
6797 These are in addition to any flags specified in the
6798 .B RPCGENFLAGS
6799 construction variable.
6800
6801 .IP RPCGENSERVICEFLAGS
6802 Options passed to the RPC protocol compiler
6803 when generating server side stubs.
6804 These are in addition to any flags specified in the
6805 .B RPCGENFLAGS
6806 construction variable.
6807
6808 .IP RPCGENXDRFLAGS
6809 Options passed to the RPC protocol compiler
6810 when generating XDR routines.
6811 These are in addition to any flags specified in the
6812 .B RPCGENFLAGS
6813 construction variable.
6814
6815 .IP RPATH
6816 A list of paths to search for shared libraries when running programs.
6817 Currently only used in the GNU (gnulink),
6818 IRIX (sgilink) and Sun (sunlink) linkers.
6819 Ignored on platforms and toolchains that don't support it.
6820 Note that the paths added to RPATH
6821 are not transformed by
6822 .B scons
6823 in any way:  if you want an absolute
6824 path, you must make it absolute yourself.
6825
6826 .IP SCANNERS
6827 A list of the available implicit dependency scanners.
6828 New file scanners may be added by
6829 appending to this list,
6830 although the more flexible approach
6831 is to associate scanners
6832 with a specific Builder.
6833 See the sections "Builder Objects"
6834 and "Scanner Objects,"
6835 below, for more information.
6836
6837 .IP SCCS
6838 The SCCS executable.
6839
6840 .IP SCCSCOM
6841 The command line used to
6842 fetch source files from SCCS.
6843
6844 .IP SCCSCOMSTR
6845 The string displayed when fetching
6846 a source file from a CVS repository.
6847 If this is not set, then $SCCSCOM
6848 (the command line) is displayed.
6849
6850 .IP SCCSFLAGS
6851 General options that are passed to SCCS.
6852
6853 .IP SCCSGETFLAGS
6854 Options that are passed specifically to the SCCS "get" subcommand.
6855 This can be set, for example, to
6856 .I -e
6857 to check out editable files from SCCS.
6858
6859 .IP SHCC
6860 The C compiler used for generating shared-library objects.
6861
6862 .IP SHCCCOM
6863 The command line used to compile a C source file
6864 to a shared-library object file.
6865 Any options specified in the $SHCCFLAGS and $CPPFLAGS construction variables
6866 are included on this command line.
6867
6868 .IP SHCCCOMSTR
6869 The string displayed when a C source file
6870 is compiled to a shared object file.
6871 If this is not set, then $SHCCCOM (the command line) is displayed.
6872
6873 .ES
6874 env = Environment(SHCCCOMSTR = "Compiling shared object $TARGET")
6875 .EE
6876
6877 .IP SHCCFLAGS
6878 Options that are passed to the C compiler
6879 to generate shared-library objects.
6880
6881 .IP SHCXX
6882 The C++ compiler used for generating shared-library objects.
6883
6884 .IP SHCXXCOM
6885 The command line used to compile a C++ source file
6886 to a shared-library object file.
6887 Any options specified in the $SHCXXFLAGS and $CPPFLAGS construction variables
6888 are included on this command line.
6889
6890 .IP SHCXXCOMSTR
6891 The string displayed when a C++ source file
6892 is compiled to a shared object file.
6893 If this is not set, then $SHCXXCOM (the command line) is displayed.
6894
6895 .ES
6896 env = Environment(SHCXXCOMSTR = "Compiling shared object $TARGET")
6897 .EE
6898
6899 .IP SHCXXFLAGS
6900 Options that are passed to the C++ compiler
6901 to generate shared-library objects.
6902
6903 .IP SHELL
6904 A string naming the shell program that will be passed to the 
6905 .I SPAWN 
6906 function. 
6907 See the 
6908 .I SPAWN 
6909 construction variable for more information.
6910
6911 .IP SHF77
6912 The Fortran 77 compiler used for generating shared-library objects.
6913 You should normally set the $SHFORTRANC variable,
6914 which specifies the default Fortran compiler
6915 for all Fortran versions.
6916 You only need to set $SHF77 if you need to use a specific compiler
6917 or compiler version for Fortran 77 files.
6918
6919 .IP SHF77COM
6920 The command line used to compile a Fortran 77 source file
6921 to a shared-library object file.
6922 You only need to set $SHF77COM if you need to use a specific
6923 command line for Fortran 77 files.
6924 You should normally set the $SHFORTRANCOM variable,
6925 which specifies the default command line
6926 for all Fortran versions.
6927
6928 .IP SHF77COMSTR
6929 The string displayed when a Fortran 77 source file
6930 is compiled to a shared-library object file.
6931 If this is not set, then $SHF77COM or $SHFORTRANCOM
6932 (the command line) is displayed.
6933
6934 .IP SHF77FLAGS
6935 Options that are passed to the Fortran 77 compiler
6936 to generated shared-library objects.
6937 You only need to set $SHF77FLAGS if you need to define specific
6938 user options for Fortran 77 files.
6939 You should normally set the $SHFORTRANFLAGS variable,
6940 which specifies the user-specified options
6941 passed to the default Fortran compiler
6942 for all Fortran versions.
6943
6944 .IP SHF77PPCOM
6945 The command line used to compile a Fortran 77 source file to a
6946 shared-library object file
6947 after first running the file through the C preprocessor.
6948 Any options specified in the $SHF77FLAGS and $CPPFLAGS construction variables
6949 are included on this command line.
6950 You only need to set $SHF77PPCOM if you need to use a specific
6951 C-preprocessor command line for Fortran 77 files.
6952 You should normally set the $SHFORTRANPPCOM variable,
6953 which specifies the default C-preprocessor command line
6954 for all Fortran versions.
6955
6956 .IP SHF90
6957 The Fortran 90 compiler used for generating shared-library objects.
6958 You should normally set the $SHFORTRANC variable,
6959 which specifies the default Fortran compiler
6960 for all Fortran versions.
6961 You only need to set $SHF90 if you need to use a specific compiler
6962 or compiler version for Fortran 90 files.
6963
6964 .IP SHF90COM
6965 The command line used to compile a Fortran 90 source file
6966 to a shared-library object file.
6967 You only need to set $SHF90COM if you need to use a specific
6968 command line for Fortran 90 files.
6969 You should normally set the $SHFORTRANCOM variable,
6970 which specifies the default command line
6971 for all Fortran versions.
6972
6973 .IP SHF90COMSTR
6974 The string displayed when a Fortran 90 source file
6975 is compiled to a shared-library object file.
6976 If this is not set, then $SHF90COM or $SHFORTRANCOM
6977 (the command line) is displayed.
6978
6979 .IP SHF90FLAGS
6980 Options that are passed to the Fortran 90 compiler
6981 to generated shared-library objects.
6982 You only need to set $SHF90FLAGS if you need to define specific
6983 user options for Fortran 90 files.
6984 You should normally set the $SHFORTRANFLAGS variable,
6985 which specifies the user-specified options
6986 passed to the default Fortran compiler
6987 for all Fortran versions.
6988
6989 .IP SHF90PPCOM
6990 The command line used to compile a Fortran 90 source file to a
6991 shared-library object file
6992 after first running the file through the C preprocessor.
6993 Any options specified in the $SHF90FLAGS and $CPPFLAGS construction variables
6994 are included on this command line.
6995 You only need to set $SHF90PPCOM if you need to use a specific
6996 C-preprocessor command line for Fortran 90 files.
6997 You should normally set the $SHFORTRANPPCOM variable,
6998 which specifies the default C-preprocessor command line
6999 for all Fortran versions.
7000
7001 .IP SHF95
7002 The Fortran 95 compiler used for generating shared-library objects.
7003 You should normally set the $SHFORTRANC variable,
7004 which specifies the default Fortran compiler
7005 for all Fortran versions.
7006 You only need to set $SHF95 if you need to use a specific compiler
7007 or compiler version for Fortran 95 files.
7008
7009 .IP SHF95COM
7010 The command line used to compile a Fortran 95 source file
7011 to a shared-library object file.
7012 You only need to set $SHF95COM if you need to use a specific
7013 command line for Fortran 95 files.
7014 You should normally set the $SHFORTRANCOM variable,
7015 which specifies the default command line
7016 for all Fortran versions.
7017
7018 .IP SHF95COMSTR
7019 The string displayed when a Fortran 95 source file
7020 is compiled to a shared-library object file.
7021 If this is not set, then $SHF95COM or $SHFORTRANCOM
7022 (the command line) is displayed.
7023
7024 .IP SHF95FLAGS
7025 Options that are passed to the Fortran 95 compiler
7026 to generated shared-library objects.
7027 You only need to set $SHF95FLAGS if you need to define specific
7028 user options for Fortran 95 files.
7029 You should normally set the $SHFORTRANFLAGS variable,
7030 which specifies the user-specified options
7031 passed to the default Fortran compiler
7032 for all Fortran versions.
7033
7034 .IP SHF95PPCOM
7035 The command line used to compile a Fortran 95 source file to a
7036 shared-library object file
7037 after first running the file through the C preprocessor.
7038 Any options specified in the $SHF95FLAGS and $CPPFLAGS construction variables
7039 are included on this command line.
7040 You only need to set $SHF95PPCOM if you need to use a specific
7041 C-preprocessor command line for Fortran 95 files.
7042 You should normally set the $SHFORTRANPPCOM variable,
7043 which specifies the default C-preprocessor command line
7044 for all Fortran versions.
7045
7046 .IP SHFORTRAN
7047 The default Fortran compiler used for generating shared-library objects.
7048
7049 .IP SHFORTRANCOM
7050 The command line used to compile a Fortran source file
7051 to a shared-library object file.
7052
7053 .IP FORTRANCOMSTR
7054 The string displayed when a Fortran source file
7055 is compiled to a shared-library object file.
7056 If this is not set, then $SHFORTRANCOM
7057 (the command line) is displayed.
7058
7059 .IP SHFORTRANFLAGS
7060 Options that are passed to the Fortran compiler
7061 to generate shared-library objects.
7062
7063 .IP SHFORTRANPPCOM
7064 The command line used to compile a Fortran source file to a
7065 shared-library object file
7066 after first running the file through the C preprocessor.
7067 Any options specified
7068 in the $SHFORTRANFLAGS and $CPPFLAGS construction variables
7069 are included on this command line.
7070
7071 .IP SHLIBPREFIX
7072 The prefix used for shared library file names.
7073
7074 .IP SHLIBSUFFIX
7075 The suffix used for shared library file names.
7076
7077 .IP SHLINK
7078 The linker for programs that use shared libraries.
7079
7080 .IP SHLINKCOM
7081 The command line used to link programs using shared libaries.
7082
7083 .IP SHLINKCOMSTR
7084 The string displayed when programs using shared libraries are linked.
7085 If this is not set, then $SHLINKCOM (the command line) is displayed.
7086
7087 .ES
7088 env = Environment(SHLINKCOMSTR = "Linking shared $TARGET")
7089 .EE
7090
7091 .IP SHLINKFLAGS
7092 General user options passed to the linker for programs using shared libraries.
7093 Note that this variable should
7094 .I not
7095 contain
7096 .B -l
7097 (or similar) options for linking with the libraries listed in $LIBS,
7098 nor
7099 .B -L
7100 (or similar) include search path options
7101 that scons generates automatically from $LIBPATH.
7102 See
7103 .BR _LIBFLAGS ,
7104 above,
7105 for the variable that expands to library-link options,
7106 and
7107 .BR _LIBDIRFLAGS ,
7108 above,
7109 for the variable that expands to library search path options.
7110
7111 .IP SHOBJPREFIX 
7112 The prefix used for shared object file names.
7113
7114 .IP SHOBJSUFFIX 
7115 The suffix used for shared object file names.
7116
7117 .IP SOURCE
7118 A reserved variable name
7119 that may not be set or used in a construction environment.
7120 (See "Variable Substitution," below.)
7121
7122 .IP SOURCES
7123 A reserved variable name
7124 that may not be set or used in a construction environment.
7125 (See "Variable Substitution," below.)
7126
7127 .IP SPAWN
7128 A command interpreter function that will be called to execute command line
7129 strings. The function must expect the following arguments:
7130
7131 .ES
7132 def spawn(shell, escape, cmd, args, env):
7133 .EE
7134 .IP
7135 .I sh
7136 is a string naming the shell program to use.
7137 .I escape
7138 is a function that can be called to escape shell special characters in
7139 the command line. 
7140 .I cmd
7141 is the path to the command to be executed.
7142 .I args
7143 is the arguments to the command.
7144 .I env
7145 is a dictionary of the environment variables
7146 in which the command should be executed.
7147 '\"
7148 '\".IP SVN
7149 '\"The Subversion executable (usually named
7150 '\".BR svn ).
7151 '\"
7152 '\".IP SVNCOM
7153 '\"The command line used to
7154 '\"fetch source files from a Subversion repository.
7155 '\"
7156 '\".IP SVNFLAGS
7157 '\"General options that are passed to Subversion.
7158
7159 .IP SWIG
7160 The scripting language wrapper and interface generator.
7161
7162 .IP SWIGCFILESUFFIX
7163 The suffix that will be used for intermediate C
7164 source files generated by
7165 the scripting language wrapper and interface generator.
7166 The default value is
7167 .BR _wrap$CFILESUFFIX .
7168 By default, this value is used whenever the
7169 .B -c++
7170 option is
7171 .I not
7172 specified as part of the
7173 .B SWIGFLAGS
7174 construction variable.
7175
7176 .IP SWIGCOM
7177 The command line used to call
7178 the scripting language wrapper and interface generator.
7179
7180 .IP SWIGCOMSTR
7181 The string displayed when calling
7182 the scripting language wrapper and interface generator.
7183 If this is not set, then $SWIGCOM (the command line) is displayed.
7184
7185 .IP SWIGCXXFILESUFFIX
7186 The suffix that will be used for intermediate C++
7187 source files generated by
7188 the scripting language wrapper and interface generator.
7189 The default value is
7190 .BR _wrap$CFILESUFFIX .
7191 By default, this value is used whenever the
7192 .B -c++
7193 option is specified as part of the
7194 .B SWIGFLAGS
7195 construction variable.
7196
7197 .IP SWIGFLAGS
7198 General options passed to
7199 the scripting language wrapper and interface generator.
7200 This is where you should set
7201 .BR -python ,
7202 .BR -perl5 ,
7203 .BR -tcl ,
7204 or whatever other options you want to specify to SWIG.
7205 If you set the
7206 .B -c++
7207 option in this variable,
7208 .B scons
7209 will, by default,
7210 generate a C++ intermediate source file
7211 with the extension that is specified as the
7212 .B $CXXFILESUFFIX
7213 variable.
7214
7215 .IP TAR
7216 The tar archiver.
7217
7218 .IP TARCOM
7219 The command line used to call the tar archiver.
7220
7221 .IP TARCOMSTR
7222 The string displayed when archiving files
7223 using the tar archiver.
7224 If this is not set, then $TARCOM (the command line) is displayed.
7225
7226 .ES
7227 env = Environment(TARCOMSTR = "Archiving $TARGET")
7228 .EE
7229
7230 .IP TARFLAGS
7231 General options passed to the tar archiver.
7232
7233 .IP TARGET
7234 A reserved variable name
7235 that may not be set or used in a construction environment.
7236 (See "Variable Substitution," below.)
7237
7238 .IP TARGETS
7239 A reserved variable name
7240 that may not be set or used in a construction environment.
7241 (See "Variable Substitution," below.)
7242
7243 .IP TARSUFFIX 
7244 The suffix used for tar file names.
7245
7246 .IP TEMPFILEPREFIX
7247 The prefix for a temporary file used
7248 to execute lines longer than $MAXLINELENGTH.
7249 The default is '@'.
7250 This may be set for toolchains that use other values,
7251 such as '-@' for the diab compiler
7252 or '-via' for ARM toolchain.
7253
7254 .IP TEX
7255 The TeX formatter and typesetter.
7256
7257 .IP TEXCOM
7258 The command line used to call the TeX formatter and typesetter.
7259
7260 .IP TEXCOMSTR
7261 The string displayed when calling
7262 the TeX formatter and typesetter.
7263 If this is not set, then $TEXCOM (the command line) is displayed.
7264
7265 .ES
7266 env = Environment(TEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
7267 .EE
7268
7269 .IP TEXFLAGS
7270 General options passed to the TeX formatter and typesetter.
7271
7272 .IP TOOLS
7273 A list of the names of the Tool specifications
7274 that are part of this construction environment.
7275
7276 .IP WIN32_INSERT_DEF
7277 When this is set to true,
7278 a library build of a WIN32 shared library (.dll file)
7279 will also build a corresponding .def file at the same time,
7280 if a .def file is not already listed as a build target.
7281 The default is 0 (do not build a .def file).
7282
7283 .IP WIN32DEFPREFIX
7284 The prefix used for WIN32 .def file names.
7285
7286 .IP WIN32DEFSUFFIX
7287 The suffix used for WIN32 .def file names.
7288
7289 .IP YACC
7290 The parser generator.
7291
7292 .IP YACCCOM
7293 The command line used to call the parser generator
7294 to generate a source file.
7295
7296 .IP YACCCOMSTR
7297 The string displayed when generating a source file
7298 using the parser generator.
7299 If this is not set, then $YACCCOM (the command line) is displayed.
7300
7301 .ES
7302 env = Environment(YACCCOMSTR = "Yacc'ing $TARGET from $SOURCES")
7303 .EE
7304
7305 .IP YACCFLAGS
7306 General options passed to the parser generator.
7307 If $YACCFLAGS contains a \-d option,
7308 SCons assumes that the call will also create a .h file
7309 (if the yacc source file ends in a .y suffix)
7310 or a .hpp file
7311 (if the yacc source file ends in a .yy suffix)
7312
7313 .IP YACCHFILESUFFIX
7314 The suffix of the C
7315 header file generated by the parser generator
7316 when the
7317 .B -d
7318 option is used.
7319 Note that setting this variable does not cause
7320 the parser generator to generate a header
7321 file with the specified suffix,
7322 it exists to allow you to specify
7323 what suffix the parser generator will use of its own accord.
7324 The default value is
7325 .BR .h .
7326
7327 .IP YACCHXXFILESUFFIX
7328 The suffix of the C++
7329 header file generated by the parser generator
7330 when the
7331 .B -d
7332 option is used.
7333 Note that setting this variable does not cause
7334 the parser generator to generate a header
7335 file with the specified suffix,
7336 it exists to allow you to specify
7337 what suffix the parser generator will use of its own accord.
7338 The default value is
7339 .BR .hpp .
7340
7341 .IP ZIP
7342 The zip compression and file packaging utility.
7343
7344 .IP ZIPCOM
7345 The command line used to call the zip utility,
7346 or the internal Python function used to create a
7347 zip archive.
7348
7349 .IP ZIPCOMSTR
7350 The string displayed when archiving files
7351 using the zip utility.
7352 If this is not set, then $ZIPCOM
7353 (the command line or internal Python function) is displayed.
7354
7355 .ES
7356 env = Environment(ZIPCOMSTR = "Zipping $TARGET")
7357 .EE
7358
7359 .IP ZIPCOMPRESSION
7360 The
7361 .I compression
7362 flag
7363 from the Python
7364 .B zipfile
7365 module used by the internal Python function
7366 to control whether the zip archive
7367 is compressed or not.
7368 The default value is
7369 .BR zipfile.ZIP_DEFLATED ,
7370 which creates a compressed zip archive.
7371 This value has no effect when using Python 1.5.2
7372 or if the
7373 .B zipfile
7374 module is otherwise unavailable.
7375
7376 .IP ZIPFLAGS
7377 General options passed to the zip utility.
7378
7379 .LP
7380 Construction variables can be retrieved and set using the 
7381 .B Dictionary 
7382 method of the construction environment:
7383
7384 .ES
7385 dict = env.Dictionary()
7386 dict["CC"] = "cc"
7387 .EE
7388
7389 or using the [] operator:
7390
7391 .ES
7392 env["CC"] = "cc"
7393 .EE
7394
7395 Construction variables can also be passed to the construction environment
7396 constructor:
7397
7398 .ES
7399 env = Environment(CC="cc")
7400 .EE
7401
7402 or when copying a construction environment using the 
7403 .B Copy 
7404 method:
7405
7406 .ES
7407 env2 = env.Copy(CC="cl.exe")
7408 .EE
7409
7410 .SS Configure Contexts
7411
7412 .B scons
7413 supports
7414 .I configure contexts,
7415 an integrated mechanism similar to the
7416 various AC_CHECK macros in GNU autoconf
7417 for testing for the existence of C header
7418 files, libraries, etc.
7419 In contrast to autoconf,
7420 .B scons
7421 does not maintain an explicit cache of the tested values,
7422 but uses its normal dependency tracking to keep the checked values
7423 up to date. However, users may override this behaviour with the 
7424 .B --config
7425 command line option.
7426
7427 The following methods can be used to perform checks:
7428
7429 .TP
7430 .RI Configure( env ", [" custom_tests ", " conf_dir ", " log_file ", " config_h ])
7431 .TP
7432 .RI env.Configure([ custom_tests ", " conf_dir ", " log_file ", " config_h ])
7433 This creates a configure context, which can be used to perform checks.
7434 .I env
7435 specifies the environment for building the tests.
7436 This environment may be modified when performing checks.
7437 .I custom_tests
7438 is a dictionary containing custom tests.
7439 See also the section about custom tests below. 
7440 By default, no custom tests are added to the configure context.
7441 .I conf_dir
7442 specifies a directory where the test cases are built.
7443 Note that this directory is not used for building
7444 normal targets.
7445 The default value is the directory
7446 #/.sconf_temp.
7447 .I log_file
7448 specifies a file which collects the output from commands
7449 that are executed to check for the existence of header files, libraries, etc.
7450 The default is the file #/config.log.
7451 If you are using the
7452 .B BuildDir
7453 method,
7454 you may want to specify a subdirectory under your build directory.
7455 .I config_h
7456 specifies a C header file where the results of tests 
7457 will be written, e.g. #define HAVE_STDIO_H, #define HAVE_LIBM, etc. 
7458 The default is to not write a
7459 .B config.h
7460 file.
7461 You can specify the same
7462 .B config.h
7463 file in multiple calls to Configure,
7464 in which case
7465 .B scons
7466 will concatenate all results in the specified file.
7467 Note that SCons
7468 uses its normal dependency checking
7469 to decide if it's necessary to rebuild
7470 the specified
7471 .I config_h
7472 file.
7473 This means that the file is not necessarily re-built each
7474 time scons is run,
7475 but is only rebuilt if its contents will have changed
7476 and some target that depends on the
7477 .I config_h
7478 file is being built.
7479
7480 .EE
7481 A created
7482 .B Configure
7483 instance has the following associated methods:
7484
7485 .TP 
7486 .RI Configure.Finish( self )
7487 This method should be called after configuration is done.
7488 It returns the environment as modified
7489 by the configuration checks performed.
7490 After this method is called, no further checks can be performed
7491 with this configuration context.
7492 However, you can create a new 
7493 .RI Configure 
7494 context to perform additional checks.
7495 Only one context should be active at a time.
7496
7497 The following Checks are predefined.
7498 (This list will likely grow larger as time
7499 goes by and developers contribute new useful tests.)
7500
7501 .TP
7502 .RI Configure.CheckHeader( self ", " header ", [" include_quotes ", " language ])
7503 Checks if 
7504 .I header
7505 is usable in the specified language.
7506 .I header
7507 may be a list,
7508 in which case the last item in the list
7509 is the header file to be checked,
7510 and the previous list items are
7511 header files whose
7512 .B #include
7513 lines should precede the
7514 header line being checked for.
7515 The optional argument 
7516 .I include_quotes 
7517 must be
7518 a two character string, where the first character denotes the opening
7519 quote and the second character denotes the closing quote.
7520 By default, both characters  are " (double quote).
7521 The optional argument
7522 .I language
7523 should be either
7524 .B C
7525 or
7526 .B C++
7527 and selects the compiler to be used for the check.
7528 Returns 1 on success and 0 on failure.
7529
7530 .TP
7531 .RI Configure.CheckCHeader( self ", " header ", [" include_quotes ])
7532 This is a wrapper around
7533 .B Configure.CheckHeader
7534 which checks if 
7535 .I header
7536 is usable in the C language.
7537 .I header
7538 may be a list,
7539 in which case the last item in the list
7540 is the header file to be checked,
7541 and the previous list items are
7542 header files whose
7543 .B #include
7544 lines should precede the
7545 header line being checked for.
7546 The optional argument 
7547 .I include_quotes 
7548 must be
7549 a two character string, where the first character denotes the opening
7550 quote and the second character denotes the closing quote (both default
7551 to \N'34').
7552 Returns 1 on success and 0 on failure.
7553
7554 .TP
7555 .RI Configure.CheckCXXHeader( self ", " header ", [" include_quotes ])
7556 This is a wrapper around
7557 .B Configure.CheckHeader
7558 which checks if 
7559 .I header
7560 is usable in the C++ language.
7561 .I header
7562 may be a list,
7563 in which case the last item in the list
7564 is the header file to be checked,
7565 and the previous list items are
7566 header files whose
7567 .B #include
7568 lines should precede the
7569 header line being checked for.
7570 The optional argument 
7571 .I include_quotes 
7572 must be
7573 a two character string, where the first character denotes the opening
7574 quote and the second character denotes the closing quote (both default
7575 to \N'34').
7576 Returns 1 on success and 0 on failure. 
7577
7578 .TP
7579 .RI Configure.CheckFunc( self ", " function_name ", [" header ", " language ])
7580 Checks if the specified
7581 C or C++ function is available.
7582 .I function_name
7583 is the name of the function to check for.
7584 The optional
7585 .I header
7586 argument is a string
7587 that will be
7588 placed at the top
7589 of the test file
7590 that will be compiled
7591 to check if the function exists;
7592 the default is:
7593 .ES
7594 #ifdef __cplusplus
7595 extern "C"
7596 #endif
7597 char function_name();
7598 .EE
7599 The optional
7600 .I language
7601 argument should be
7602 .B C
7603 or
7604 .B C++
7605 and selects the compiler to be used for the check;
7606 the default is "C".
7607
7608 .TP 
7609 .RI Configure.CheckLib( self ", [" library ", " symbol ", " header ", " language ", " autoadd=1 ])
7610 Checks if 
7611 .I library 
7612 provides 
7613 .IR symbol .
7614 If the value of
7615 .I autoadd
7616 is 1 and the library provides the specified
7617 .IR symbol ,
7618 appends the library to the LIBS construction environment variable.
7619 .I library 
7620 may also be None (the default),
7621 in which case 
7622 .I symbol 
7623 is checked with the current LIBS variable,
7624 or a list of library names,
7625 in which case each library in the list
7626 will be checked for
7627 .IR symbol .
7628 The default
7629 .I symbol
7630 is "main",
7631 which just check if
7632 you can link against the specified
7633 .IR library .
7634 The optional
7635 .I language
7636 argument should be
7637 .B C
7638 or
7639 .B C++
7640 and selects the compiler to be used for the check;
7641 the default is "C".
7642 The default value for
7643 .I autoadd
7644 is 1.
7645 It is assumed, that the C-language is used.
7646 This method returns 1 on success and 0 on error.
7647
7648 .TP 
7649 .RI Configure.CheckLibWithHeader( self ", " library ", " header ", " language ", [" call ", " autoadd ])
7650
7651 In contrast to the 
7652 .RI Configure.CheckLib 
7653 call, this call provides a more sophisticated way to check against libraries.
7654 Again, 
7655 .I library
7656 specifies the library or a list of libraries to check. 
7657 .I header
7658 specifies a header to check for.
7659 .I header
7660 may be a list,
7661 in which case the last item in the list
7662 is the header file to be checked,
7663 and the previous list items are
7664 header files whose
7665 .B #include
7666 lines should precede the
7667 header line being checked for.
7668 .I language
7669 may be one of 'C','c','CXX','cxx','C++' and 'c++'.
7670 .I call
7671 can be any valid expression (with a trailing ';'). The default is 'main();'.
7672 .I autoadd
7673 specifies whether to add the library to the environment (only if the check 
7674 succeeds). This method returns 1 on success and 0 on error.
7675
7676 .TP
7677 .RI Configure.CheckType( self ", " type_name ", [" includes ", " language ])
7678 Checks for the existence of a type defined by
7679 .BR typedef .
7680 .I type_name
7681 specifies the typedef name to check for.
7682 .I includes
7683 is a string containing one or more
7684 .B #include
7685 lines that will be inserted into the program
7686 that will be run to test for the existence of the type.
7687 The optional
7688 .I language
7689 argument should be
7690 .B C
7691 or
7692 .B C++
7693 and selects the compiler to be used for the check;
7694 the default is "C".
7695
7696 .EE
7697 Example of a typical Configure usage:
7698
7699 .ES
7700 env = Environment()
7701 conf = Configure( env )
7702 if not conf.CheckCHeader( 'math.h' ):
7703     print 'We really need math.h!'
7704     Exit(1)
7705 if conf.CheckLibWithHeader( 'qt', 'qapp.h', 'c++', 'QApplication qapp(0,0);' ):
7706     # do stuff for qt - usage, e.g.
7707     conf.env.Append( CPPFLAGS = '-DWITH_QT' )
7708 env = conf.Finish() 
7709 .EE
7710
7711 .EE
7712 You can define your own custom checks. 
7713 in addition to the predefined checks.
7714 These are passed in a dictionary to the Configure function.
7715 This dictionary maps the names of the checks
7716 to user defined Python callables 
7717 (either Python functions or class instances implementing the
7718 .I __call__
7719 method).
7720 The first argument of the call is always a 
7721 .I CheckContext
7722 instance followed by the arguments,
7723 which must be supplied by the user of the check.
7724 These CheckContext instances define the following methods:
7725
7726 .TP 
7727 .RI CheckContext.Message( self ", " text )
7728
7729 Usually called before the check is started. 
7730 .I text
7731 will be displayed to the user, e.g. 'Checking for library X...'
7732
7733 .TP
7734 .RI CheckContext.Result( self, ", " res )
7735
7736 Usually called after the check is done. 
7737 .I res
7738 can be either an integer or a string. In the former case, 'ok' (res != 0) 
7739 or 'failed' (res == 0) is displayed to the user, in the latter case the 
7740 given string is displayed.
7741
7742 .TP
7743 .RI CheckContext.TryCompile( self ", " text ", " extension )
7744 Checks if a file with the specified 
7745 .I extension
7746 (e.g. '.c') containing 
7747 .I text 
7748 can be compiled using the environment's
7749 .B Object 
7750 builder. Returns 1 on success and 0 on failure.
7751
7752 .TP 
7753 .RI CheckContext.TryLink( self ", " text ", " extension )
7754 Checks, if a file with the specified
7755 .I extension
7756 (e.g. '.c') containing 
7757 .I text 
7758 can be compiled using the environment's
7759 .B Program
7760 builder. Returns 1 on success and 0 on failure.
7761
7762 .TP
7763 .RI CheckContext.TryRun( self ", " text ", " extension )
7764 Checks, if a file with the specified
7765 .I extension
7766 (e.g. '.c') containing 
7767 .I text 
7768 can be compiled using the environment's
7769 .B Program
7770 builder. On success, the program is run. If the program
7771 executes successfully
7772 (that is, its return status is 0),
7773 a tuple
7774 .I (1, outputStr)
7775 is returned, where
7776 .I outputStr
7777 is the standard output of the
7778 program.
7779 If the program fails execution
7780 (its return status is non-zero),
7781 then (0, '') is returned.
7782
7783 .TP
7784 .RI CheckContext.TryAction( self ", " action ", [" text ", " extension ])
7785 Checks if the specified
7786 .I action 
7787 with an optional source file (contents
7788 .I text
7789 , extension 
7790 .I extension
7791 = ''
7792 ) can be executed. 
7793 .I action 
7794 may be anything which can be converted to a 
7795 .B scons
7796 .RI Action.
7797 On success,
7798 .I (1, outputStr)
7799 is returned, where
7800 .I outputStr
7801 is the content of the target file.
7802 On failure
7803 .I (0, '')
7804 is returned.
7805
7806 .TP
7807 .RI CheckContext.TryBuild( self ", " builder ", [" text ", " extension ])
7808 Low level implementation for testing specific builds;
7809 the methods above are based on this method.
7810 Given the Builder instance
7811 .I builder
7812 and the optional 
7813 .I text
7814 of a source file with optional
7815 .IR extension ,
7816 this method returns 1 on success and 0 on failure. In addition, 
7817 .I self.lastTarget 
7818 is set to the build target node, if the build was successful.
7819
7820 .EE
7821 Example for implementing and using custom tests:
7822
7823 .ES
7824 def CheckQt(context, qtdir):
7825     context.Message( 'Checking for qt ...' )
7826     lastLIBS = context.env['LIBS']
7827     lastLIBPATH = context.env['LIBPATH']
7828     lastCPPPATH= context.env['CPPPATH']
7829     context.env.Append(LIBS = 'qt', LIBPATH = qtdir + '/lib', CPPPATH = qtdir + '/include' )
7830     ret = context.TryLink("""
7831 #include <qapp.h>
7832 int main(int argc, char **argv) { 
7833   QApplication qapp(argc, argv);
7834   return 0;
7835 }
7836 """)
7837     if not ret:
7838         context.env.Replace(LIBS = lastLIBS, LIBPATH=lastLIBPATH, CPPPATH=lastCPPPATH)
7839     context.Result( ret )
7840     return ret
7841
7842 env = Environment()
7843 conf = Configure( env, custom_tests = { 'CheckQt' : CheckQt } )
7844 if not conf.CheckQt('/usr/lib/qt'):
7845     print 'We really need qt!'
7846     Exit(1)
7847 env = conf.Finish() 
7848 .EE
7849
7850 .SS Construction Variable Options
7851
7852 Often when building software, various options need to be specified at build
7853 time that are not known when the SConstruct/SConscript files are
7854 written. For example, libraries needed for the build may be in non-standard
7855 locations, or site-specific compiler options may need to be passed to the
7856 compiler. 
7857 .B scons
7858 provides a mechanism for overridding construction variables from the
7859 command line or a text-based SConscript file through an Options
7860 object. To create an Options object, call the Options() function:
7861
7862 .TP
7863 .RI Options([ files "], [" args ])
7864 This creates an Options object that will read construction variables from
7865 the file or list of filenames specified in
7866 .IR files .
7867 If no files are specified,
7868 or the
7869 .I files
7870 argument is
7871 .BR None ,
7872 then no files will be read.
7873 The optional argument
7874 .I args
7875 is a dictionary of
7876 values that will override anything read from the specified files;
7877 it is primarily intended to be passed the
7878 .B ARGUMENTS
7879 dictionary that holds variables
7880 specified on the command line.
7881 Example:
7882
7883 .ES
7884 opts = Options('custom.py')
7885 opts = Options('overrides.py', ARGUMENTS)
7886 opts = Options(None, {FOO:'expansion', BAR:7})
7887 .EE
7888
7889 Options objects have the following methods:
7890
7891 .TP
7892 .RI Add( key ", [" help ", " default ", " validator ", " converter ])
7893 This adds a customizable construction variable to the Options object. 
7894 .I key
7895 is the name of the variable. 
7896 .I help 
7897 is the help text for the variable.
7898 .I default 
7899 is the default value of the variable;
7900 if the default value is
7901 .B None
7902 and there is no explicit value specified,
7903 the construction variable will
7904 .I not
7905 be added to the construction environment.
7906 .I validator
7907 is called to validate the value of the variable, and should take three
7908 arguments: key, value, and environment
7909 .I converter
7910 is called to convert the value before putting it in the environment, and
7911 should take a single argument: value. Example:
7912
7913 .ES
7914 opts.Add('CC', 'The C compiler')
7915 .EE
7916
7917 .TP
7918 .RI AddOptions( list )
7919 A wrapper script that adds
7920 multiple customizable construction variables
7921 to an Options object.
7922 .I list
7923 is a list of tuple or list objects
7924 that contain the arguments
7925 for an individual call to the
7926 .B Add
7927 method.
7928
7929 .ES
7930 opt.AddOptions(
7931        ('debug', '', 0),
7932        ('CC', 'The C compiler'),
7933        ('VALIDATE', 'An option for testing validation',
7934         'notset', validator, None),
7935     )
7936 .EE
7937
7938 .TP
7939 .RI Update( env ", [" args ])
7940 This updates a construction environment
7941 .I env
7942 with the customized construction variables. Normally this method is not
7943 called directly, but is called indirectly by passing the Options object to
7944 the Environment() function:
7945
7946 .ES
7947 env = Environment(options=opts)
7948 .EE
7949
7950 .IP
7951 The text file(s) that were specified
7952 when the Options object was created
7953 are executed as Python scripts,
7954 and the values of (global) Python variables set in the file
7955 are added to the construction environment.
7956 Example:
7957
7958 .ES
7959 CC = 'my_cc'
7960 .EE
7961
7962 .TP
7963 .RI Save( filename ", " env )
7964 This saves the currently set options into a script file named  
7965 .I filename
7966 that can be used on the next invocation to automatically load the current
7967 settings.  This method combined with the Options method can be used to
7968 support caching of options between runs.
7969
7970 .ES
7971 env = Environment()
7972 opts = Options(['options.cache', 'custom.py'])
7973 opts.Add(...)
7974 opts.Update(env)
7975 opts.Save('options.cache', env)
7976 .EE
7977
7978 .TP
7979 .RI GenerateHelpText( env ", [" sort ])
7980 This generates help text documenting the customizable construction
7981 variables suitable to passing in to the Help() function. 
7982 .I env
7983 is the construction environment that will be used to get the actual values
7984 of customizable variables. Calling with 
7985 an optional
7986 .I sort
7987 function
7988 will cause the output to be sorted
7989 by the specified argument.
7990 The specific
7991 .I sort
7992 function
7993 should take two arguments
7994 and return
7995 -1, 0 or 1
7996 (like the standard Python
7997 .I cmp
7998 function).
7999
8000 .ES
8001 Help(opts.GenerateHelpText(env))
8002 Help(opts.GenerateHelpText(env, sort=cmp))
8003 .EE
8004
8005 .TP
8006 .RI FormatOptionHelpText( env ", " opt ", " help ", " default ", " actual )
8007 This method returns a formatted string
8008 containing the printable help text
8009 for one option.
8010 It is normally not called directly,
8011 but is called by the
8012 .IR GenerateHelpText ()
8013 method to create the returned help text.
8014 It may be overridden with your own
8015 function that takes the arguments specified above
8016 and returns a string of help text formatted to your liking.
8017 Note that the
8018 .IR GenerateHelpText ()
8019 will not put any blank lines or extra
8020 characters in between the entries,
8021 so you must add those characters to the returned
8022 string if you want the entries separated.
8023
8024 .ES
8025 def my_format(env, opt, help, default, actual):
8026     fmt = "\n%s: default=%s actual=%s (%s)\n"
8027     return fmt % (opt, default. actual, help)
8028 opts.FormatOptionHelpText = my_format
8029 .EE
8030
8031 To make it more convenient to work with customizable Options,
8032 .B scons
8033 provides a number of functions
8034 that make it easy to set up
8035 various types of Options:
8036
8037 .TP
8038 .RI BoolOption( key ", " help ", " default )
8039 Return a tuple of arguments
8040 to set up a Boolean option.
8041 The option will use
8042 the specified name
8043 .IR key ,
8044 have a default value of
8045 .IR default ,
8046 and display the specified
8047 .I help
8048 text.
8049 The option will interpret the values
8050 .BR y ,
8051 .BR yes ,
8052 .BR t ,
8053 .BR true ,
8054 .BR 1 ,
8055 .B on
8056 and
8057 .B all
8058 as true,
8059 and the values
8060 .BR n ,
8061 .BR no ,
8062 .BR f ,
8063 .BR false ,
8064 .BR 0 ,
8065 .B off
8066 and
8067 .B none
8068 as false.
8069
8070 .TP
8071 .RI EnumOption( key ", " help ", " default ", " allowed_values ", [" map ", " ignorecase ])
8072 Return a tuple of arguments
8073 to set up an option
8074 whose value may be one
8075 of a specified list of legal enumerated values.
8076 The option will use
8077 the specified name
8078 .IR key ,
8079 have a default value of
8080 .IR default ,
8081 and display the specified
8082 .I help
8083 text.
8084 The option will only support those
8085 values in the
8086 .I allowed_values
8087 list.
8088 The optional
8089 .I map
8090 argument is a dictionary
8091 that can be used to convert
8092 input values into specific legal values
8093 in the
8094 .I allowed_values
8095 list.
8096 If the value of
8097 .I ignore_case
8098 is
8099 .B 0
8100 (the default),
8101 then the values are case-sensitive.
8102 If the value of
8103 .I ignore_case
8104 is
8105 .BR 1 ,
8106 then values will be matched
8107 case-insensitive.
8108 If the value of
8109 .I ignore_case
8110 is
8111 .BR 1 ,
8112 then values will be matched
8113 case-insensitive,
8114 and all input values will be
8115 converted to lower case.
8116
8117 .TP
8118 .RI ListOption( key ", " help ", " default ", " names ", [", map ])
8119 Return a tuple of arguments
8120 to set up an option
8121 whose value may be one or more
8122 of a specified list of legal enumerated values.
8123 The option will use
8124 the specified name
8125 .IR key ,
8126 have a default value of
8127 .IR default ,
8128 and display the specified
8129 .I help
8130 text.
8131 The option will only support the values
8132 .BR all ,
8133 .BR none ,
8134 or the values in the
8135 .I names
8136 list.
8137 More than one value may be specified,
8138 with all values separated by commas.
8139 The default may be a string of
8140 comma-separated default values,
8141 or a list of the default values.
8142 The optional
8143 .I map
8144 argument is a dictionary
8145 that can be used to convert
8146 input values into specific legal values
8147 in the
8148 .I names
8149 list.
8150
8151 .TP
8152 .RI PackageOption( key ", " help ", " default )
8153 Return a tuple of arguments
8154 to set up an option
8155 whose value is a path name
8156 of a package that may be
8157 enabled, disabled or 
8158 given an explicit path name.
8159 The option will use
8160 the specified name
8161 .IR key ,
8162 have a default value of
8163 .IR default ,
8164 and display the specified
8165 .I help
8166 text.
8167 The option will support the values
8168 .BR yes ,
8169 .BR true ,
8170 .BR on ,
8171 .BR enable
8172 or
8173 .BR search ,
8174 in which case the specified
8175 .I default
8176 will be used,
8177 or the option may be set to an
8178 arbitrary string
8179 (typically the path name to a package
8180 that is being enabled).
8181 The option will also support the values
8182 .BR no ,
8183 .BR false ,
8184 .BR off
8185 or
8186 .BR disable
8187 to disable use of the specified option.
8188
8189 .TP
8190 .RI PathOption( key ", " help ", " default ", [" validator ])
8191 Return a tuple of arguments
8192 to set up an option
8193 whose value is expected to be a path name.
8194 The option will use
8195 the specified name
8196 .IR key ,
8197 have a default value of
8198 .IR default ,
8199 and display the specified
8200 .I help
8201 text.
8202 An additional
8203 .I validator
8204 may be specified
8205 that will be called to
8206 verify that the specified path
8207 is acceptable.
8208 SCons supplies the
8209 following ready-made validators:
8210 .BR PathOption.PathExists
8211 (the default),
8212 which verifies that the specified path exists;
8213 .BR PathOption.PathIsFile ,
8214 which verifies that the specified path is an existing file;
8215 .BR PathOption.PathIsDir ,
8216 which verifies that the specified path is an existing directory;
8217 and
8218 .BR PathOption.PathIsDirCreate ,
8219 which verifies that the specified path is a directory,
8220 and will create the specified directory if the path does not exist.
8221 You may supply your own
8222 .I validator
8223 function,
8224 which must take three arguments
8225 .RI ( key ,
8226 the name of the options variable to be set;
8227 .IR val ,
8228 the specified value being checked;
8229 and
8230 .IR env ,
8231 the construction environment)
8232 and should raise an exception
8233 if the specified value is not acceptable.
8234
8235 .RE
8236 These functions make it
8237 convenient to create a number
8238 of options with consistent behavior
8239 in a single call to the
8240 .B AddOptions
8241 method:
8242
8243 .ES
8244 opts.AddOptions(
8245     BoolOption('warnings', 'compilation with -Wall and similiar', 1),
8246     EnumOption('debug', 'debug output and symbols', 'no'
8247                allowed_values=('yes', 'no', 'full'),
8248                map={}, ignorecase=0),  # case sensitive
8249     ListOption('shared',
8250                'libraries to build as shared libraries',
8251                'all',
8252                names = list_of_libs),
8253     PackageOption('x11',
8254                   'use X11 installed here (yes = search some places)',
8255                   'yes'),
8256     PathOption('qtdir', 'where the root of Qt is installed', qtdir),
8257     PathOption('foopath', 'where the foo library is installed', foopath,
8258                PathOption.PathIsDir),
8259
8260 )
8261 .EE
8262
8263 .SS File and Directory Nodes
8264
8265 The
8266 .IR File ()
8267 and
8268 .IR Dir ()
8269 functions return
8270 .I File
8271 and
8272 .I Dir
8273 Nodes, respectively.
8274 python objects, respectively.
8275 Those objects have several user-visible attributes
8276 and methods that are often useful:
8277
8278 .IP path
8279 The build path
8280 of the given
8281 file or directory.
8282 This path is relative to the top-level directory
8283 (where the
8284 .B SConstruct
8285 file is found).
8286 The build path is the same as the source path if
8287 .I build_dir
8288 is not being used.
8289
8290 .IP abspath
8291 The absolute build path of the given file or directory.
8292
8293 .IP srcnode()
8294 The
8295 .IR srcnode ()
8296 method
8297 returns another
8298 .I File
8299 or
8300 .I Dir
8301 object representing the
8302 .I source
8303 path of the given
8304 .I File
8305 or
8306 .IR Dir .
8307 The 
8308
8309 .ES
8310 # Get the current build dir's path, relative to top.
8311 Dir('.').path
8312 # Current dir's absolute path
8313 Dir('.').abspath
8314 # Next line is always '.', because it is the top dir's path relative to itself.
8315 Dir('#.').path
8316 File('foo.c').srcnode().path   # source path of the given source file.
8317
8318 # Builders also return File objects:
8319 foo = env.Program('foo.c')
8320 print "foo will be built in %s"%foo.path
8321 .EE
8322
8323 .SH EXTENDING SCONS
8324 .SS Builder Objects
8325 .B scons
8326 can be extended to build different types of targets
8327 by adding new Builder objects
8328 to a construction environment.
8329 .IR "In general" ,
8330 you should only need to add a new Builder object
8331 when you want to build a new type of file or other external target.
8332 If you just want to invoke a different compiler or other tool
8333 to build a Program, Object, Library, or any other
8334 type of output file for which
8335 .B scons
8336 already has an existing Builder,
8337 it is generally much easier to
8338 use those existing Builders
8339 in a construction environment
8340 that sets the appropriate construction variables
8341 (CC, LINK, etc.).
8342
8343 Builder objects are created
8344 using the
8345 .B Builder 
8346 function.
8347 The
8348 .B Builder
8349 function accepts the following arguments:
8350
8351 .IP action
8352 The command line string used to build the target from the source. 
8353 .B action
8354 can also be:
8355 a list of strings representing the command
8356 to be executed and its arguments
8357 (suitable for enclosing white space in an argument),
8358 a dictionary
8359 mapping source file name suffixes to
8360 any combination of command line strings
8361 (if the builder should accept multiple source file extensions),
8362 a Python function;
8363 an Action object
8364 (see the next section);
8365 or a list of any of the above.
8366
8367 An action function
8368 takes three arguments:
8369 .I source 
8370 - a list of source nodes, 
8371 .I target
8372 - a list of target nodes,
8373 .I env
8374 - the construction environment.
8375
8376 .IP prefix 
8377 The prefix that will be prepended to the target file name.
8378 This may be specified as a:
8379
8380 .RS 10
8381 .HP 6
8382
8383 .IR string ,
8384
8385 .HP 6
8386
8387 .I callable object
8388 - a function or other callable that takes
8389 two arguments (a construction environment and a list of sources)
8390 and returns a prefix,
8391
8392 .HP 6
8393
8394 .I dictionary
8395 - specifies a mapping from a specific source suffix (of the first 
8396 source specified) to a corresponding target prefix.  Both the source
8397 suffix and target prefix specifications may use environment variable
8398 substitution, and the target prefix (the 'value' entries in the
8399 dictionary) may also be a callable object.  The default target prefix
8400 may be indicated by a dictionary entry with a key value of None.
8401 .RE
8402 .P
8403
8404 .ES
8405 b = Builder("build_it < $SOURCE > $TARGET"
8406             prefix = "file-")
8407
8408 def gen_prefix(env, sources):
8409     return "file-" + env['PLATFORM'] + '-'
8410 b = Builder("build_it < $SOURCE > $TARGET",
8411             prefix = gen_prefix)
8412
8413 b = Builder("build_it < $SOURCE > $TARGET",
8414             suffix = { None: "file-",
8415                        "$SRC_SFX_A": gen_prefix })
8416 .EE
8417
8418 .IP suffix
8419 The suffix that will be appended to the target file name.
8420 This may be specified in the same manner as the prefix above.
8421 If the suffix is a string, then
8422 .B scons
8423 will append a '.' to the beginning of the suffix if it's not already
8424 there.  The string returned by callable object (or obtained from the
8425 dictionary) is untouched and must append its own '.'  to the beginning
8426 if one is desired.
8427
8428 .ES
8429 b = Builder("build_it < $SOURCE > $TARGET"
8430             suffix = "-file")
8431
8432 def gen_suffix(env, sources):
8433     return "." + env['PLATFORM'] + "-file"
8434 b = Builder("build_it < $SOURCE > $TARGET",
8435             suffix = gen_suffix)
8436
8437 b = Builder("build_it < $SOURCE > $TARGET",
8438             suffix = { None: ".sfx1",
8439                        "$SRC_SFX_A": gen_suffix })
8440 .EE
8441
8442 .IP src_suffix
8443 The expected source file name suffix.  This may be a string or a list
8444 of strings.
8445
8446 .IP target_scanner
8447 A Scanner object that
8448 will be invoked to find
8449 implicit dependencies for this target file.
8450 This keyword argument should be used
8451 for Scanner objects that find
8452 implicit dependencies
8453 based only on the target file
8454 and the construction environment,
8455 .I not 
8456 for implicit
8457 (See the section "Scanner Objects," below,
8458 for information about creating Scanner objects.)
8459
8460 .IP source_scanner
8461 A Scanner object that
8462 will be invoked to
8463 find implicit dependences in
8464 any source files
8465 used to build this target file.
8466 This is where you would
8467 specify a scanner to
8468 find things like
8469 .B #include
8470 lines in source files.
8471 The pre-built
8472 .B DirScanner
8473 Scanner object may be used to
8474 indicate that this Builder
8475 should scan directory trees
8476 for on-disk changes to files
8477 that
8478 .B scons
8479 does not know about from other Builder or function calls.
8480 (See the section "Scanner Objects," below,
8481 for information about creating your own Scanner objects.)
8482
8483 .IP target_factory
8484 A factory function that the Builder will use
8485 to turn any targets specified as strings into SCons Nodes.
8486 By default,
8487 SCons assumes that all targets are files.
8488 Other useful target_factory
8489 values include
8490 .BR Dir ,
8491 for when a Builder creates a directory target,
8492 and
8493 .BR Entry ,
8494 for when a Builder can create either a file
8495 or directory target.
8496
8497 Example:
8498
8499 .ES
8500 MakeDirectoryBuilder = Builder(action=my_mkdir, target_factory=Dir)
8501 env = Environment()
8502 env.Append(BUILDERS = {'MakeDirectory':MakeDirectoryBuilder})
8503 env.MakeDirectory('new_directory', [])
8504 .EE
8505
8506 Note that the call to the MakeDirectory Builder
8507 needs to specify an empty source list
8508 to make the string represent the builder's target;
8509 without that, it would assume the argument is the source,
8510 and would try to deduce the target name from it,
8511 which in the absence of an automatically-added prefix or suffix
8512 would lead to a matching target and source name
8513 and a circular dependency.
8514
8515 .IP source_factory
8516 A factory function that the Builder will use
8517 to turn any sources specified as strings into SCons Nodes.
8518 By default,
8519 SCons assumes that all source are files.
8520 Other useful source_factory
8521 values include
8522 .BR Dir ,
8523 for when a Builder uses a directory as a source,
8524 and
8525 .BR Entry ,
8526 for when a Builder can use files
8527 or directories (or both) as sources.
8528
8529 Example:
8530
8531 .ES
8532 CollectBuilder = Builder(action=my_mkdir, source_factory=Entry)
8533 env = Environment()
8534 env.Append(BUILDERS = {'Collect':CollectBuilder})
8535 env.Collect('archive', ['directory_name', 'file_name'])
8536 .EE
8537
8538 .IP emitter
8539 A function or list of functions to manipulate the target and source
8540 lists before dependencies are established
8541 and the target(s) are actually built.
8542 .B emitter
8543 can also be a string containing a construction variable to expand
8544 to an emitter function or list of functions,
8545 or a dictionary mapping source file suffixes
8546 to emitter functions.
8547 (Only the suffix of the first source file
8548 is used to select the actual emitter function
8549 from an emitter dictionary.)
8550
8551 An emitter function
8552 takes three arguments:
8553 .I source 
8554 - a list of source nodes, 
8555 .I target
8556 - a list of target nodes,
8557 .I env
8558 - the construction environment.
8559 An emitter must return a tuple containing two lists,
8560 the list of targets to be built by this builder,
8561 and the list of sources for this builder.
8562
8563 Example:
8564
8565 .ES
8566 def e(target, source, env):
8567     return (target + ['foo.foo'], source + ['foo.src'])
8568
8569 # Simple association of an emitter function with a Builder.
8570 b = Builder("my_build < $TARGET > $SOURCE",
8571             emitter = e)
8572
8573 def e2(target, source, env):
8574     return (target + ['bar.foo'], source + ['bar.src'])
8575
8576 # Simple association of a list of emitter functions with a Builder.
8577 b = Builder("my_build < $TARGET > $SOURCE",
8578             emitter = [e, e2])
8579
8580 # Calling an emitter function through a construction variable.
8581 env = Environment(MY_EMITTER = e)
8582 b = Builder("my_build < $TARGET > $SOURCE",
8583             emitter = '$MY_EMITTER')
8584
8585 # Calling a list of emitter functions through a construction variable.
8586 env = Environment(EMITTER_LIST = [e, e2])
8587 b = Builder("my_build < $TARGET > $SOURCE",
8588             emitter = '$EMITTER_LIST')
8589
8590 # Associating multiple emitters with different file
8591 # suffixes using a dictionary.
8592 def e_suf1(target, source, env):
8593     return (target + ['another_target_file'], source)
8594 def e_suf2(target, source, env):
8595     return (target, source + ['another_source_file'])
8596 b = Builder("my_build < $TARGET > $SOURCE",
8597             emitter = {'.suf1' : e_suf1,
8598                        '.suf2' : e_suf2})
8599 .EE
8600
8601 .IP multi
8602 Specifies whether this builder is allowed to be called multiple times for
8603 the same target file(s). The default is 0, which means the builder
8604 can not be called multiple times for the same target file(s). Calling a
8605 builder multiple times for the same target simply adds additional source
8606 files to the target; it is not allowed to change the environment associated
8607 with the target, specify addition environment overrides, or associate a different
8608 builder with the target. 
8609
8610 .IP env
8611 A construction environment that can be used
8612 to fetch source code using this Builder.
8613 (Note that this environment is
8614 .I not
8615 used for normal builds of normal target files,
8616 which use the environment that was
8617 used to call the Builder for the target file.)
8618
8619 .IP generator
8620 A function that returns a list of actions that will be executed to build
8621 the target(s) from the source(s).
8622 The returned action(s) may be
8623 an Action object, or anything that
8624 can be converted into an Action object
8625 (see the next section).
8626
8627 The generator function
8628 takes four arguments:
8629 .I source 
8630 - a list of source nodes, 
8631 .I target
8632 - a list of target nodes,
8633 .I env
8634 - the construction environment,
8635 .I for_signature
8636 - a Boolean value that specifies
8637 whether the generator is being called
8638 for generating a build signature
8639 (as opposed to actually executing the command).
8640 Example:
8641
8642 .ES
8643 def g(source, target, env, for_signature):
8644     return [["gcc", "-c", "-o"] + target + source] 
8645
8646 b = Builder(generator=g)
8647 .EE
8648
8649 .IP
8650 The 
8651 .I generator
8652 and
8653 .I action
8654 arguments must not both be used for the same Builder.
8655
8656 .IP src_builder
8657 Specifies a builder to use when a source file name suffix does not match
8658 any of the suffixes of the builder. Using this argument produces a
8659 multi-stage builder.
8660
8661 .IP single_source
8662 Specifies that this builder expects exactly one source file per call. Giving
8663 more than one source files without target files results in implicitely calling
8664 the builder multiple times (once for each source given). Giving multiple 
8665 source files together with target files results in a UserError exception.
8666
8667 .RE
8668 .IP
8669 The 
8670 .I generator
8671 and
8672 .I action
8673 arguments must not both be used for the same Builder.
8674
8675 .IP env
8676 A construction environment that can be used
8677 to fetch source code using this Builder.
8678 (Note that this environment is
8679 .I not
8680 used for normal builds of normal target files,
8681 which use the environment that was
8682 used to call the Builder for the target file.)
8683
8684 .ES
8685 b = Builder(action="build < $SOURCE > $TARGET")
8686 env = Environment(BUILDERS = {'MyBuild' : b})
8687 env.MyBuild('foo.out', 'foo.in', my_arg = 'xyzzy')
8688 .EE
8689
8690 .IP chdir
8691 A directory from which scons
8692 will execute the
8693 action(s) specified
8694 for this Builder.
8695 If the
8696 .B chdir
8697 argument is
8698 a string or a directory Node,
8699 scons will change to the specified directory.
8700 If the
8701 .B chdir
8702 is not a string or Node
8703 and is non-zero,
8704 then scons will change to the
8705 target file's directory.
8706
8707 Note that scons will
8708 .I not
8709 automatically modify
8710 its expansion of
8711 construction variables like
8712 .B $TARGET
8713 and
8714 .B $SOURCE
8715 when using the chdir
8716 keyword argument--that is,
8717 the expanded file names
8718 will still be relative to
8719 the top-level SConstruct directory,
8720 and consequently incorrect
8721 relative to the chdir directory.
8722 Builders created using chdir keyword argument,
8723 will need to use construction variable
8724 expansions like
8725 .B ${TARGET.file}
8726 and
8727 .B ${SOURCE.file}
8728 to use just the filename portion of the
8729 targets and source.
8730
8731 .ES
8732 b = Builder(action="build < ${SOURCE.file} > ${TARGET.file}",
8733             chdir=1)
8734 env = Environment(BUILDERS = {'MyBuild' : b})
8735 env.MyBuild('sub/dir/foo.out', 'sub/dir/foo.in')
8736 .EE
8737
8738 .RE
8739 Any additional keyword arguments supplied
8740 when a Builder object is created
8741 (that is, when the Builder() function is called)
8742 will be set in the executing construction
8743 environment when the Builder object is called.
8744 The canonical example here would be
8745 to set a construction variable to 
8746 the repository of a source code system.
8747
8748 Any additional keyword arguments supplied
8749 when a Builder
8750 .I object
8751 is called
8752 will only be associated with the target
8753 created by that particular Builder call
8754 (and any other files built as a
8755 result of the call).
8756
8757 These extra keyword arguments are passed to the
8758 following functions:
8759 command generator functions,
8760 function Actions,
8761 and emitter functions.
8762
8763 .SS Action Objects
8764
8765 The
8766 .BR Builder()
8767 function will turn its
8768 .B action
8769 keyword argument into an appropriate
8770 internal Action object.
8771 You can also explicity create Action objects
8772 using the
8773 .BR Action ()
8774 global function,
8775 which can then be passed to the
8776 .BR Builder ()
8777 function.
8778 This can be used to configure
8779 an Action object more flexibly,
8780 or it may simply be more efficient
8781 than letting each separate Builder object
8782 create a separate Action
8783 when multiple
8784 Builder objects need to do the same thing.
8785
8786 The
8787 .BR Action ()
8788 global function
8789 returns an appropriate object for the action
8790 represented by the type of the first argument:
8791
8792 .IP Action
8793 If the first argument is already an Action object,
8794 the object is simply returned.
8795
8796 .IP String
8797 If the first argument is a string,
8798 a command-line Action is returned.
8799 Note that the command line string
8800 may be preceded by an
8801 .B @
8802 (at-sign)
8803 to suppress printing of the
8804 specified command line,
8805 or by a
8806 .B \-
8807 (hyphen)
8808 to ignore the exit status from
8809 the specified command.
8810 Examples:
8811
8812 .ES
8813 Action('$CC -c -o $TARGET $SOURCES')
8814
8815 # Doesn't print the line being executed.
8816 Action('@build $TARGET $SOURCES')
8817
8818 # Ignores
8819 Action('-build $TARGET $SOURCES')
8820 .EE
8821
8822 .\" XXX From Gary Ruben, 23 April 2002:
8823 .\" What would be useful is a discussion of how you execute command
8824 .\" shell commands ie. what is the process used to spawn the shell, pass
8825 .\" environment variables to it etc., whether there is one shell per
8826 .\" environment or one per command etc.  It might help to look at the Gnu
8827 .\" make documentation to see what they think is important to discuss about
8828 .\" a build system. I'm sure you can do a better job of organising the
8829 .\" documentation than they have :-)
8830
8831
8832 .IP List
8833 If the first argument is a list,
8834 then a list of Action objects is returned.
8835 An Action object is created as necessary
8836 for each element in the list.
8837 If an element
8838 .I within
8839 the list is itself a list,
8840 the internal list is the
8841 command and arguments to be executed via
8842 the command line.
8843 This allows white space to be enclosed
8844 in an argument by defining
8845 a command in a list within a list:
8846
8847 .ES
8848 Action([['cc', '-c', '-DWHITE SPACE', '-o', '$TARGET', '$SOURCES']])
8849 .EE
8850
8851 .IP Function
8852 If the first argument is a Python function,
8853 a function Action is returned.
8854 The Python function takes three keyword arguments,
8855 .B target
8856 (a Node object representing the target file),
8857 .B source
8858 (a Node object representing the source file)
8859 and
8860 .B env
8861 (the construction environment
8862 used for building the target file).
8863 The
8864 .B target
8865 and
8866 .B source
8867 arguments may be lists of Node objects if there is
8868 more than one target file or source file.
8869 The actual target and source file name(s) may
8870 be retrieved from their Node objects
8871 via the built-in Python str() function:
8872
8873 .ES
8874 target_file_name = str(target)
8875 source_file_names = map(lambda x: str(x), source)
8876 .EE
8877 .IP
8878 The function should return
8879 .B 0
8880 or
8881 .B None
8882 to indicate a successful build of the target file(s).
8883 The function may raise an exception
8884 or return a non-zero exit status
8885 to indicate an unsuccessful build.
8886
8887 .ES
8888 def build_it(target = None, source = None, env = None):
8889     # build the target from the source
8890     return 0
8891  
8892 a = Action(build_it)
8893 .EE
8894
8895 If the action argument is not one of the above,
8896 None is returned.
8897
8898 The second, optional argument
8899 is a Python function that returns
8900 a string to be printed to describe the action being executed.
8901 Like a function to build a file,
8902 this function takes three arguments:
8903 .B target
8904 (a Node object representing the target file),
8905 .B source
8906 (a Node object representing the source file)
8907 and
8908 .BR env
8909 (a construction environment).
8910 The
8911 .B target
8912 and
8913 .B source
8914 arguments may be lists of Node objects if there is
8915 more than one target file or source file.
8916 Examples:
8917
8918 .ES
8919 def build_it(target, source, env):
8920     # build the target from the source
8921     return 0
8922
8923 def string_it(target, source, env):
8924     return "building '%s' from '%s'" % (target[0], source[0])
8925
8926 # Use a positional argument.
8927 a = Action(build_it, string_it)
8928
8929 # Alternatively, use a keyword argument.
8930 a = Action(build_it, strfunction=string_it)
8931 .EE
8932
8933 The third, also optional argument
8934 is a list of construction variables
8935 whose values will be included
8936 in the signature of the Action
8937 when deciding whether a target should
8938 be rebuilt because the action changed.
8939 This is necessary whenever you want a target to
8940 be rebuilt when a specific
8941 construction variable changes,
8942 because the underlying Python code for a function
8943 will not change when the value of the construction variable does.
8944
8945 .ES
8946 def build_it(target, source, env):
8947     # build the target from the 'XXX' construction variable
8948     open(target[0], 'w').write(env['XXX'])
8949     return 0
8950
8951 def string_it(target, source):
8952     return "building '%s' from '%s'" % (target[0], source[0])
8953
8954 # Use positional arguments.
8955 a = Action(build_it, string_it, ['XXX'])
8956
8957 # Alternatively, use a keyword argument.
8958 a = Action(build_it, varlist=['XXX'])
8959 .EE
8960 .PP
8961
8962 The
8963 .BR Action ()
8964 global function
8965 also takes a
8966 .B chdir
8967 keyword argument
8968 which specifies that
8969 scons will execute the action
8970 after changing to the specified directory.
8971 If the chdir argument is
8972 a string or a directory Node,
8973 scons will change to the specified directory.
8974 If the chdir argument
8975 is not a string or Node
8976 and is non-zero,
8977 then scons will change to the
8978 target file's directory.
8979
8980 Note that scons will
8981 .I not
8982 automatically modify
8983 its expansion of
8984 construction variables like
8985 .B $TARGET
8986 and
8987 .B $SOURCE
8988 when using the chdir
8989 keyword argument--that is,
8990 the expanded file names
8991 will still be relative to
8992 the top-level SConstruct directory,
8993 and consequently incorrect
8994 relative to the chdir directory.
8995 Builders created using chdir keyword argument,
8996 will need to use construction variable
8997 expansions like
8998 .B ${TARGET.file}
8999 and
9000 .B ${SOURCE.file}
9001 to use just the filename portion of the
9002 targets and source.
9003
9004 .ES
9005 a = Action("build < ${SOURCE.file} > ${TARGET.file}",
9006            chdir=1)
9007 .EE
9008
9009 The
9010 .BR Action ()
9011 global function
9012 also takes an
9013 .B exitstatfunc
9014 keyword argument
9015 which specifies a function
9016 that is passed the exit status
9017 (or return value)
9018 from the specified action
9019 and can return an arbitrary
9020 or modified value.
9021 This can be used, for example,
9022 to specify that an Action object's
9023 return value should be ignored
9024 and SCons should, therefore,
9025 consider that the action always suceeds:
9026
9027 .ES
9028 def always_succeed(s):
9029     # Always return 0, which indicates success.
9030     return 0
9031 a = Action("build < ${SOURCE.file} > ${TARGET.file}",
9032            exitstatfunc=always_succeed)
9033 .EE
9034
9035 .SS Miscellaneous Action Functions
9036
9037 .B scons
9038 supplies a number of functions
9039 that arrange for various common
9040 file and directory manipulations
9041 to be performed.
9042 These are similar in concept to "tasks" in the 
9043 Ant build tool,
9044 although the implementation is slightly different.
9045 These functions do not actually
9046 perform the specified action
9047 at the time the function is called,
9048 but instead return an Action object
9049 that can be executed at the
9050 appropriate time.
9051 (In Object-Oriented terminology,
9052 these are actually
9053 Action
9054 .I Factory
9055 functions
9056 that return Action objects.)
9057
9058 In practice,
9059 there are two natural ways
9060 that these
9061 Action Functions
9062 are intended to be used.
9063
9064 First,
9065 if you need
9066 to perform the action
9067 at the time the SConscript
9068 file is being read,
9069 you can use the
9070 .B Execute
9071 global function to do so:
9072 .ES
9073 Execute(Touch('file'))
9074 .EE
9075
9076 Second,
9077 you can use these functions
9078 to supply Actions in a list
9079 for use by the
9080 .B Command
9081 method.
9082 This can allow you to
9083 perform more complicated
9084 sequences of file manipulation
9085 without relying
9086 on platform-specific
9087 external commands:
9088 that 
9089 .ES
9090 env = Environment(TMPBUILD = '/tmp/builddir')
9091 env.Command('foo.out', 'foo.in',
9092             [Mkdir('$TMPBUILD'),
9093              Copy('$TMPBUILD', '${SOURCE.dir}')
9094              "cd $TMPBUILD && make",
9095              Delete('$TMPBUILD')])
9096 .EE
9097
9098 .TP
9099 .RI Chmod( dest ", " mode )
9100 Returns an Action object that
9101 changes the permissions on the specified
9102 .I dest
9103 file or directory to the specified
9104 .IR mode .
9105 Examples:
9106
9107 .ES
9108 Execute(Chmod('file', 0755))
9109
9110 env.Command('foo.out', 'foo.in',
9111             [Copy('$TARGET', '$SOURCE'),
9112              Chmod('$TARGET', 0755)])
9113 .EE
9114
9115 .TP
9116 .RI Copy( dest ", " src )
9117 Returns an Action object
9118 that will copy the
9119 .I src
9120 source file or directory to the
9121 .I dest
9122 destination file or directory.
9123 Examples:
9124
9125 .ES
9126 Execute(Copy('foo.output', 'foo.input'))
9127
9128 env.Command('bar.out', 'bar.in',
9129             Copy('$TARGET', '$SOURCE'))
9130 .EE
9131
9132 .TP
9133 .RI Delete( entry ", [" must_exist ])
9134 Returns an Action that
9135 deletes the specified
9136 .IR entry ,
9137 which may be a file or a directory tree.
9138 If a directory is specified,
9139 the entire directory tree
9140 will be removed.
9141 If the
9142 .I must_exist
9143 flag is set,
9144 then a Python error will be thrown
9145 if the specified entry does not exist;
9146 the default is
9147 .BR must_exist=0 ,
9148 that is, the Action will silently do nothing
9149 if the entry does not exist.
9150 Examples:
9151
9152 .ES
9153 Execute(Delete('/tmp/buildroot'))
9154
9155 env.Command('foo.out', 'foo.in',
9156             [Delete('${TARGET.dir}'),
9157              MyBuildAction])
9158
9159 Execute(Delete('file_that_must_exist', must_exist=1))
9160 .EE
9161
9162 .TP
9163 .RI Mkdir( dir )
9164 Returns an Action
9165 that creates the specified
9166 directory
9167 .I dir .
9168 Examples:
9169
9170 .ES
9171 Execute(Mkdir('/tmp/outputdir'))
9172
9173 env.Command('foo.out', 'foo.in',
9174             [Mkdir('/tmp/builddir',
9175              Copy('$SOURCE', '/tmp/builddir')
9176              "cd /tmp/builddir && ])
9177
9178 .EE
9179
9180 .TP
9181 .RI Move( dest ", " src )
9182 Returns an Action
9183 that moves the specified
9184 .I src
9185 file or directory to
9186 the specified
9187 .I dest
9188 file or directory.
9189 Examples:
9190
9191 .ES
9192 Execute(Move('file.destination', 'file.source'))
9193
9194 env.Command('output_file', 'input_file',
9195             [MyBuildAction,
9196              Move('$TARGET', 'file_created_by_MyBuildAction')])
9197 .EE
9198
9199 .TP
9200 .RI Touch( file )
9201 Returns an Action
9202 that updates the modification time
9203 on the specified
9204 .IR file .
9205 Examples:
9206
9207 .ES
9208 Execute(Touch('file_to_be_touched'))
9209
9210 env.Command('marker', 'input_file',
9211             [MyBuildAction,
9212              Touch('$TARGET')])
9213 .EE
9214
9215 .SS Variable Substitution
9216
9217 Before executing a command,
9218 .B scons
9219 performs construction variable interpolation on the strings that make up
9220 the command line of builders.
9221 Variables are introduced by a
9222 .B $
9223 prefix.
9224 Besides construction variables, scons provides the following
9225 variables for each command execution:
9226
9227 .IP TARGET
9228 The file name of the target being built, or the file name of the first 
9229 target if multiple targets are being built.
9230
9231 .IP TARGETS
9232 The file names of all targets being built.
9233
9234 .IP SOURCE
9235 The file name of the source of the build command, or the file name of the
9236 first source if multiple sources are being built.
9237
9238 .IP SOURCES
9239 The file names of the sources of the build command.
9240
9241 (Note that the above variables are reserved
9242 and may not be set in a construction environment.)
9243
9244 .LP 
9245 For example, given the construction variable CC='cc', targets=['foo'], and
9246 sources=['foo.c', 'bar.c']:
9247
9248 .ES
9249 action='$CC -c -o $TARGET $SOURCES'
9250 .EE
9251
9252 would produce the command line:
9253
9254 .ES
9255 cc -c -o foo foo.c bar.c
9256 .EE
9257
9258 Variable names may be surrounded by curly braces ({})
9259 to separate the name from the trailing characters.
9260 Within the curly braces, a variable name may have
9261 a Python slice subscript appended to select one
9262 or more items from a list.
9263 In the previous example, the string:
9264
9265 .ES
9266 ${SOURCES[1]}
9267 .EE
9268
9269 would produce:
9270
9271 .ES
9272 bar.c
9273 .EE
9274
9275 Additionally, a variable name may
9276 have the following special
9277 modifiers appended within the enclosing curly braces
9278 to modify the interpolated string:
9279
9280 .IP base
9281 The base path of the file name,
9282 including the directory path
9283 but excluding any suffix.
9284
9285 .IP dir
9286 The name of the directory in which the file exists.
9287
9288 .IP file
9289 The file name,
9290 minus any directory portion.
9291
9292 .IP filebase
9293 Just the basename of the file,
9294 minus any suffix
9295 and minus the directory.
9296
9297 .IP suffix
9298 Just the file suffix.
9299
9300 .IP abspath
9301 The absolute path name of the file.
9302
9303 .IP posix
9304 The POSIX form of the path,
9305 with directories separated by
9306 .B /
9307 (forward slashes)
9308 not backslashes.
9309 This is sometimes necessary on Win32 systems
9310 when a path references a file on other (POSIX) systems.
9311
9312 .IP srcpath
9313 The directory and file name to the source file linked to this file
9314 through BuildDir.  If this file isn't linked, it just returns the
9315 directory and filename unchanged.
9316
9317 .IP srcdir
9318 The directory containing the source file linked to this file
9319 through BuildDir.  If this file isn't linked, it just returns the
9320 directory part of the filename.
9321
9322 .IP rsrcpath
9323 The directory and file name to the source file linked to this file
9324 through BuildDir.  If the file does not exist locally but exists in
9325 a Repository, the path in the Repository is returned.
9326 If this file isn't linked, it just returns the
9327 directory and filename unchanged.
9328
9329 .IP rsrcdir
9330 The Repository directory containing the source file linked to this file
9331 through BuildDir.  If this file isn't linked, it just returns the
9332 directory part of the filename.
9333
9334 .LP
9335 For example, the specified target will
9336 expand as follows for the corresponding modifiers:
9337
9338 .ES
9339 $TARGET              => sub/dir/file.x
9340 ${TARGET.base}       => sub/dir/file
9341 ${TARGET.dir}        => sub/dir
9342 ${TARGET.file}       => file.x
9343 ${TARGET.filebase}   => file
9344 ${TARGET.suffix}     => .x
9345 ${TARGET.abspath}    => /top/dir/sub/dir/file.x
9346
9347 SConscript('src/SConscript', build_dir='sub/dir')
9348 $SOURCE              => sub/dir/file.x
9349 ${SOURCE.srcpath}    => src/file.x
9350 ${SOURCE.srcdir}     => src
9351
9352 Repository('/usr/repository')
9353 $SOURCE              => sub/dir/file.x
9354 ${SOURCE.rsrcpath}   => /usr/repository/src/file.x
9355 ${SOURCE.rsrcdir}    => /usr/repository/src
9356 .EE
9357
9358 Lastly, a variable name
9359 may be a callable Python function
9360 associated with a
9361 construction variable in the environment.
9362 The function should
9363 take four arguments:
9364 .I target
9365 - a list of target nodes,
9366 .I source 
9367 - a list of source nodes, 
9368 .I env
9369 - the construction environment,
9370 .I for_signature
9371 - a Boolean value that specifies
9372 whether the function is being called
9373 for generating a build signature.
9374 SCons will insert whatever
9375 the called function returns
9376 into the expanded string:
9377
9378 .ES
9379 def foo(target, source, env, for_signature):
9380     return "bar"
9381
9382 # Will expand $BAR to "bar baz"
9383 env=Environment(FOO=foo, BAR="$FOO baz")
9384 .EE
9385
9386 You can use this feature to pass arguments to a
9387 Python function by creating a callable class
9388 that stores one or more arguments in an object,
9389 and then uses them when the
9390 .B __call__()
9391 method is called.
9392 Note that in this case,
9393 the entire variable expansion must
9394 be enclosed by curly braces
9395 so that the arguments will
9396 be associated with the
9397 instantiation of the class:
9398
9399 .ES
9400 class foo:
9401     def __init__(self, arg):
9402         self.arg = arg
9403
9404     def __call__(self, target, source, env, for_signature):
9405         return arg + " bar"
9406
9407 # Will expand $BAR to "my argument bar baz"
9408 env=Environment(FOO=foo, BAR="${FOO('my argument')} baz")
9409 .EE
9410
9411 .LP
9412 The special pseudo-variables
9413 .B "$("
9414 and
9415 .B "$)"
9416 may be used to surround parts of a command line
9417 that may change
9418 .I without
9419 causing a rebuild--that is,
9420 which are not included in the signature
9421 of target files built with this command.
9422 All text between
9423 .B "$("
9424 and
9425 .B "$)"
9426 will be removed from the command line
9427 before it is added to file signatures,
9428 and the
9429 .B "$("
9430 and
9431 .B "$)"
9432 will be removed before the command is executed.
9433 For example, the command line:
9434
9435 .ES
9436 echo Last build occurred $( $TODAY $). > $TARGET
9437 .EE
9438
9439 .LP
9440 would execute the command:
9441
9442 .ES
9443 echo Last build occurred $TODAY. > $TARGET
9444 .EE
9445
9446 .LP
9447 but the command signature added to any target files would be:
9448
9449 .ES
9450 echo Last build occurred  . > $TARGET
9451 .EE
9452
9453 SCons uses the following rules when converting construction variables into
9454 command lines:
9455
9456 .IP String
9457 When the value is a string it is interpreted as a space delimited list of
9458 command line arguments. 
9459
9460 .IP List
9461 When the value is a list it is interpreted as a list of command line
9462 arguments. Each element of the list is converted to a string.
9463
9464 .IP Other
9465 Anything that is not a list or string is converted to a string and
9466 interpreted as a single command line argument.
9467
9468 .IP Newline
9469 Newline characters (\\n) delimit lines. The newline parsing is done after
9470 all other parsing, so it is not possible for arguments (e.g. file names) to
9471 contain embedded newline characters. This limitation will likely go away in
9472 a future version of SCons.
9473
9474 .SS Scanner Objects
9475
9476 You can use the
9477 .B Scanner
9478 function to define
9479 objects to scan
9480 new file types for implicit dependencies.
9481 Scanner accepts the following arguments:
9482
9483 .IP function
9484 A Python function that will process
9485 the Node (file)
9486 and return a list of strings (file names)
9487 representing the implicit
9488 dependencies found in the contents.
9489 The function takes three or four arguments:
9490
9491     def scanner_function(node, env, path):
9492
9493     def scanner_function(node, env, path, arg):
9494
9495 The
9496 .B node
9497 argument is the internal
9498 SCons node representing the file.
9499 Use
9500 .B str(node)
9501 to fetch the name of the file, and
9502 .B node.get_contents()
9503 to fetch contents of the file.
9504
9505 The
9506 .B env
9507 argument is the construction environment for the scan.
9508 Fetch values from it using the
9509 .B env.Dictionary()
9510 method.
9511
9512 The
9513 .B path
9514 argument is a tuple (or list)
9515 of directories that can be searched
9516 for files.
9517 This will usually be the tuple returned by the
9518 .B path_function
9519 argument (see below).
9520
9521 The
9522 .B arg
9523 argument is the argument supplied
9524 when the scanner was created, if any.
9525
9526 .IP name
9527 The name of the Scanner.
9528 This is mainly used
9529 to identify the Scanner internally.
9530
9531 .IP argument
9532 An optional argument that, if specified,
9533 will be passed to the scanner function
9534 (described above)
9535 and the path function
9536 (specified below).
9537
9538 .IP skeys
9539 An optional list that can be used to
9540 determine which scanner should be used for
9541 a given Node.
9542 In the usual case of scanning for file names,
9543 this argument will be a list of suffixes
9544 for the different file types that this
9545 Scanner knows how to scan.
9546 If the argument is a string,
9547 then it will be expanded 
9548 into a list by the current environment.
9549
9550 .IP path_function
9551 A Python function that takes
9552 two or three arguments:
9553 a construction environment, directory Node,
9554 and optional argument supplied
9555 when the scanner was created.
9556 The
9557 .B path_function
9558 returns a tuple of directories
9559 that can be searched for files to be returned
9560 by this Scanner object.
9561
9562 .IP node_class
9563 The class of Node that should be returned
9564 by this Scanner object.
9565 Any strings or other objects returned
9566 by the scanner function
9567 that are not of this class
9568 will be run through the
9569 .B node_factory
9570 function.
9571
9572 .IP node_factory
9573 A Python function that will take a string
9574 or other object
9575 and turn it into the appropriate class of Node
9576 to be returned by this Scanner object.
9577
9578 .IP scan_check
9579 An optional Python function that takes two arguments,
9580 a Node (file) and a construction environment,
9581 and returns whether the
9582 Node should, in fact,
9583 be scanned for dependencies.
9584 This check can be used to eliminate unnecessary
9585 calls to the scanner function when,
9586 for example, the underlying file
9587 represented by a Node does not yet exist.
9588
9589 .IP recursive
9590 An optional flag that
9591 specifies whether this scanner should be re-invoked
9592 on the dependency files returned by the scanner.
9593 When this flag is not set,
9594 the Node subsystem will
9595 only invoke the scanner on the file being scanned,
9596 and not (for example) also on the files
9597 specified by the #include lines
9598 in the file being scanned.
9599 .I recursive
9600 may be a callable function,
9601 in which case it will be called with a list of
9602 Nodes found and
9603 should return a list of Nodes
9604 that should be scanned recursively;
9605 this can be used to select a specific subset of
9606 Nodes for additional scanning.
9607
9608 Note that
9609 .B scons
9610 has a global
9611 .B SourceFileScanner
9612 object that is used by
9613 the
9614 .BR Object (),
9615 .BR SharedObject (),
9616 and 
9617 .BR StaticObject ()
9618 builders to decide
9619 which scanner should be used
9620 for different file extensions.
9621 You can using the
9622 .BR SourceFileScanner.add_scanner ()
9623 method to add your own Scanner object
9624 to the
9625 .B scons
9626 infrastructure
9627 that builds target programs or
9628 libraries from a list of
9629 source files of different types:
9630
9631 .ES
9632 def xyz_scan(node, env, path):
9633     contents = node.get_contents()
9634     # Scan the contents and return the included files.
9635
9636 XYZScanner = Scanner(xyz_scan)
9637
9638 SourceFileScanner.add_scanner('.xyx', XYZScanner)
9639
9640 env.Program('my_prog', ['file1.c', 'file2.f', 'file3.xyz'])
9641 .EE
9642
9643 .SH SYSTEM-SPECIFIC BEHAVIOR
9644 SCons and its configuration files are very portable,
9645 due largely to its implementation in Python.
9646 There are, however, a few portability
9647 issues waiting to trap the unwary.
9648 .SS .C file suffix
9649 SCons handles the upper-case
9650 .B .C
9651 file suffix differently,
9652 depending on the capabilities of
9653 the underlying system.
9654 On a case-sensitive system
9655 such as Linux or UNIX,
9656 SCons treats a file with a 
9657 .B .C
9658 suffix as a C++ source file.
9659 On a case-insensitive system
9660 such as Windows,
9661 SCons treats a file with a 
9662 .B .C
9663 suffix as a C source file.
9664 .SS .F file suffix
9665 SCons handles the upper-case
9666 .B .F
9667 file suffix differently,
9668 depending on the capabilities of
9669 the underlying system.
9670 On a case-sensitive system
9671 such as Linux or UNIX,
9672 SCons treats a file with a 
9673 .B .F
9674 suffix as a Fortran source file
9675 that is to be first run through
9676 the standard C preprocessor.
9677 On a case-insensitive system
9678 such as Windows,
9679 SCons treats a file with a 
9680 .B .F
9681 suffix as a Fortran source file that should
9682 .I not
9683 be run through the C preprocessor.
9684 .SS WIN32:  Cygwin Tools and Cygwin Python vs. Windows Pythons
9685 Cygwin supplies a set of tools and utilities
9686 that let users work on a
9687 Windows system using a more POSIX-like environment.
9688 The Cygwin tools, including Cygwin Python,
9689 do this, in part,
9690 by sharing an ability to interpret UNIX-like path names.
9691 For example, the Cygwin tools
9692 will internally translate a Cygwin path name
9693 like /cygdrive/c/mydir
9694 to an equivalent Windows pathname
9695 of C:/mydir (equivalent to C:\\mydir).
9696
9697 Versions of Python
9698 that are built for native Windows execution,
9699 such as the python.org and ActiveState versions,
9700 do not have the Cygwin path name semantics.
9701 This means that using a native Windows version of Python
9702 to build compiled programs using Cygwin tools
9703 (such as gcc, bison, and flex)
9704 may yield unpredictable results.
9705 "Mixing and matching" in this way
9706 can be made to work,
9707 but it requires careful attention to the use of path names
9708 in your SConscript files.
9709
9710 In practice, users can sidestep
9711 the issue by adopting the following rules:
9712 When using gcc,
9713 use the Cygwin-supplied Python interpreter
9714 to run SCons;
9715 when using Microsoft Visual C/C++
9716 (or some other Windows compiler)
9717 use the python.org or ActiveState version of Python
9718 to run SCons.
9719 .SS WIN32:  scons.bat file
9720 On WIN32 systems,
9721 SCons is executed via a wrapper
9722 .B scons.bat
9723 file.
9724 This has (at least) two ramifications:
9725
9726 First, Windows command-line users
9727 that want to use variable assignment
9728 on the command line
9729 may have to put double quotes
9730 around the assignments:
9731
9732 .ES
9733 scons "FOO=BAR" "BAZ=BLEH"
9734 .EE
9735
9736 Second, the Cygwin shell does not
9737 recognize this file as being the same
9738 as an
9739 .B scons
9740 command issued at the command-line prompt.
9741 You can work around this either by
9742 executing
9743 .B scons.bat
9744 from the Cygwin command line,
9745 or by creating a wrapper shell
9746 script named
9747 .B scons .
9748
9749 .SS MinGW
9750
9751 The MinGW bin directory must be in your PATH environment variable or the
9752 PATH variable under the ENV construction variable for SCons
9753 to detect and use the MinGW tools. When running under the native Windows
9754 Python interpreter, SCons will prefer the MinGW tools over the Cygwin
9755 tools, if they are both installed, regardless of the order of the bin
9756 directories in the PATH variable. If you have both MSVC and MinGW
9757 installed and you want to use MinGW instead of MSVC,
9758 then you must explictly tell SCons to use MinGW by passing 
9759
9760 .ES
9761 tools=['mingw']
9762 .EE
9763
9764 to the Environment() function, because SCons will prefer the MSVC tools
9765 over the MinGW tools.
9766
9767 .SH EXAMPLES
9768
9769 To help you get started using SCons,
9770 this section contains a brief overview of some common tasks.
9771
9772 .SS Basic Compilation From a Single Source File
9773
9774 .ES
9775 env = Environment()
9776 env.Program(target = 'foo', source = 'foo.c')
9777 .EE
9778
9779 Note:  Build the file by specifying
9780 the target as an argument
9781 ("scons foo" or "scons foo.exe").
9782 or by specifying a dot ("scons .").
9783
9784 .SS Basic Compilation From Multiple Source Files
9785
9786 .ES
9787 env = Environment()
9788 env.Program(target = 'foo', source = Split('f1.c f2.c f3.c'))
9789 .EE
9790
9791 .SS Setting a Compilation Flag
9792
9793 .ES
9794 env = Environment(CCFLAGS = '-g')
9795 env.Program(target = 'foo', source = 'foo.c')
9796 .EE
9797
9798 .SS Search The Local Directory For .h Files
9799
9800 Note:  You do
9801 .I not
9802 need to set CCFLAGS to specify -I options by hand.
9803 SCons will construct the right -I options from CPPPATH.
9804
9805 .ES
9806 env = Environment(CPPPATH = ['.'])
9807 env.Program(target = 'foo', source = 'foo.c')
9808 .EE
9809
9810 .SS Search Multiple Directories For .h Files
9811
9812 .ES
9813 env = Environment(CPPPATH = ['include1', 'include2'])
9814 env.Program(target = 'foo', source = 'foo.c')
9815 .EE
9816
9817 .SS Building a Static Library
9818
9819 .ES
9820 env = Environment()
9821 env.StaticLibrary(target = 'foo', source = Split('l1.c l2.c'))
9822 env.StaticLibrary(target = 'bar', source = ['l3.c', 'l4.c'])
9823 .EE
9824
9825 .SS Building a Shared Library
9826
9827 .ES
9828 env = Environment()
9829 env.SharedLibrary(target = 'foo', source = ['l5.c', 'l6.c'])
9830 env.SharedLibrary(target = 'bar', source = Split('l7.c l8.c'))
9831 .EE
9832
9833 .SS Linking a Local Library Into a Program
9834
9835 .ES
9836 env = Environment(LIBS = 'mylib', LIBPATH = ['.'])
9837 env.Library(target = 'mylib', source = Split('l1.c l2.c'))
9838 env.Program(target = 'prog', source = ['p1.c', 'p2.c'])
9839 .EE
9840
9841 .SS Defining Your Own Builder Object
9842
9843 Notice that when you invoke the Builder,
9844 you can leave off the target file suffix,
9845 and SCons will add it automatically.
9846
9847 .ES
9848 bld = Builder(action = 'pdftex < $SOURCES > $TARGET'
9849               suffix = '.pdf',
9850               src_suffix = '.tex')
9851 env = Environment(BUILDERS = {'PDFBuilder' : bld})
9852 env.PDFBuilder(target = 'foo.pdf', source = 'foo.tex')
9853
9854 # The following creates "bar.pdf" from "bar.tex"
9855 env.PDFBuilder(target = 'bar', source = 'bar')
9856 .EE
9857
9858 Note also that the above initialization
9859 overwrites the default Builder objects,
9860 so the Environment created above
9861 can not be used call Builders like env.Program(),
9862 env.Object(), env.StaticLibrary(), etc.
9863
9864 .SS Adding Your Own Builder Object to an Environment
9865
9866 .ES
9867 bld = Builder(action = 'pdftex < $SOURCES > $TARGET'
9868               suffix = '.pdf',
9869               src_suffix = '.tex')
9870 env = Environment()
9871 env.Append(BUILDERS = {'PDFBuilder' : bld})
9872 env.PDFBuilder(target = 'foo.pdf', source = 'foo.tex')
9873 env.Program(target = 'bar', source = 'bar.c')
9874 .EE
9875
9876 You also can use other Pythonic techniques to add
9877 to the BUILDERS construction variable, such as:
9878
9879 .ES
9880 env = Environment()
9881 env['BUILDERS]['PDFBuilder'] = bld
9882 .EE
9883
9884 .SS Defining Your Own Scanner Object
9885
9886 .ES
9887 import re
9888
9889 '\" Note:  the \\ in the following are for the benefit of nroff/troff,
9890 '\" not inappropriate doubled escape characters within the r'' raw string.
9891 include_re = re.compile(r'^include\\s+(\\S+)$', re.M)
9892
9893 def kfile_scan(node, env, path, arg):
9894     contents = node.get_contents()
9895     includes = include_re.findall(contents)
9896     return includes
9897
9898 kscan = Scanner(name = 'kfile',
9899                 function = kfile_scan,
9900                 argument = None,
9901                 skeys = ['.k'])
9902 scanners = Environment().Dictionary('SCANNERS')
9903 env = Environment(SCANNERS = scanners + [kscan])
9904
9905 env.Command('foo', 'foo.k', 'kprocess < $SOURCES > $TARGET')
9906
9907 bar_in = File('bar.in')
9908 env.Command('bar', bar_in, 'kprocess $SOURCES > $TARGET')
9909 bar_in.target_scanner = kscan
9910 .EE
9911
9912 .SS Creating a Hierarchical Build
9913
9914 Notice that the file names specified in a subdirectory's
9915 SConscript
9916 file are relative to that subdirectory.
9917
9918 .ES
9919 SConstruct:
9920
9921     env = Environment()
9922     env.Program(target = 'foo', source = 'foo.c')
9923
9924     SConscript('sub/SConscript')
9925
9926 sub/SConscript:
9927
9928     env = Environment()
9929     # Builds sub/foo from sub/foo.c
9930     env.Program(target = 'foo', source = 'foo.c')
9931
9932     SConscript('dir/SConscript')
9933
9934 sub/dir/SConscript:
9935
9936     env = Environment()
9937     # Builds sub/dir/foo from sub/dir/foo.c
9938     env.Program(target = 'foo', source = 'foo.c')
9939 .EE
9940
9941 .SS Sharing Variables Between SConscript Files
9942
9943 You must explicitly Export() and Import() variables that
9944 you want to share between SConscript files.
9945
9946 .ES
9947 SConstruct:
9948
9949     env = Environment()
9950     env.Program(target = 'foo', source = 'foo.c')
9951
9952     Export("env")
9953     SConscript('subdirectory/SConscript')
9954
9955 subdirectory/SConscript:
9956
9957     Import("env")
9958     env.Program(target = 'foo', source = 'foo.c')
9959 .EE
9960
9961 .SS Building Multiple Variants From the Same Source
9962
9963 Use the build_dir keyword argument to
9964 the SConscript function to establish
9965 one or more separate build directories for
9966 a given source directory:
9967
9968 .ES
9969 SConstruct:
9970
9971     cppdefines = ['FOO']
9972     Export("cppdefines")
9973     SConscript('src/SConscript', build_dir='foo')
9974
9975     cppdefines = ['BAR']
9976     Export("cppdefines")
9977     SConscript('src/SConscript', build_dir='bar')
9978
9979 src/SConscript:
9980
9981     Import("cppdefines")
9982     env = Environment(CPPDEFINES = cppdefines)
9983     env.Program(target = 'src', source = 'src.c')
9984 .EE
9985
9986 Note the use of the Export() method
9987 to set the "cppdefines" variable to a different
9988 value each time we call the SConscript function.
9989
9990 .SS Hierarchical Build of Two Libraries Linked With a Program
9991
9992 .ES
9993 SConstruct:
9994
9995     env = Environment(LIBPATH = ['#libA', '#libB'])
9996     Export('env')
9997     SConscript('libA/SConscript')
9998     SConscript('libB/SConscript')
9999     SConscript('Main/SConscript')
10000
10001 libA/SConscript:
10002
10003     Import('env')
10004     env.Library('a', Split('a1.c a2.c a3.c'))
10005
10006 libB/SConscript:                                                  
10007
10008     Import('env')
10009     env.Library('b', Split('b1.c b2.c b3.c'))
10010
10011 Main/SConscript:
10012
10013     Import('env')
10014     e = env.Copy(LIBS = ['a', 'b'])
10015     e.Program('foo', Split('m1.c m2.c m3.c'))
10016 .EE
10017
10018 The '#' in the LIBPATH directories specify that they're relative to the
10019 top-level directory, so they don't turn into "Main/libA" when they're
10020 used in Main/SConscript.
10021
10022 Specifying only 'a' and 'b' for the library names
10023 allows SCons to append the appropriate library
10024 prefix and suffix for the current platform
10025 (for example, 'liba.a' on POSIX systems,
10026 'a.lib' on Windows).
10027
10028 .SS Customizing contruction variables from the command line.
10029
10030 The following would allow the C compiler to be specified on the command
10031 line or in the file custom.py. 
10032
10033 .ES
10034 opts = Options('custom.py')
10035 opts.Add('CC', 'The C compiler.')
10036 env = Environment(options=opts)
10037 Help(opts.GenerateHelpText(env))
10038 .EE
10039
10040 The user could specify the C compiler on the command line:
10041
10042 .ES
10043 scons "CC=my_cc"
10044 .EE
10045
10046 or in the custom.py file:
10047
10048 .ES
10049 CC = 'my_cc'
10050 .EE
10051
10052 or get documentation on the options:
10053
10054 .ES
10055 $ scons -h
10056
10057 CC: The C compiler.
10058     default: None
10059     actual: cc
10060
10061 .EE
10062
10063 .SS Using Microsoft Visual C++ precompiled headers
10064
10065 Since windows.h includes everything and the kitchen sink, it can take quite
10066 some time to compile it over and over again for a bunch of object files, so
10067 Microsoft provides a mechanism to compile a set of headers once and then
10068 include the previously compiled headers in any object file. This
10069 technology is called precompiled headers. The general recipe is to create a
10070 file named "StdAfx.cpp" that includes a single header named "StdAfx.h", and
10071 then include every header you want to precompile in "StdAfx.h", and finally
10072 include "StdAfx.h" as the first header in all the source files you are
10073 compiling to object files. For example:
10074
10075 StdAfx.h:
10076 .ES
10077 #include <windows.h>
10078 #include <my_big_header.h>
10079 .EE
10080
10081 StdAfx.cpp:
10082 .ES
10083 #include <StdAfx.h>
10084 .EE
10085
10086 Foo.cpp:
10087 .ES
10088 #include <StdAfx.h>
10089
10090 /* do some stuff */
10091 .EE
10092
10093 Bar.cpp:
10094 .ES
10095 #include <StdAfx.h>
10096
10097 /* do some other stuff */
10098 .EE
10099
10100 SConstruct:
10101 .ES
10102 env=Environment()
10103 env['PCHSTOP'] = 'StdAfx.h'
10104 env['PCH'] = env.PCH('StdAfx.cpp')[0]
10105 env.Program('MyApp', ['Foo.cpp', 'Bar.cpp'])
10106 .EE
10107
10108 For more information see the document for the PCH builder, and the PCH and
10109 PCHSTOP construction variables. To learn about the details of precompiled
10110 headers consult the MSDN documention for /Yc, /Yu, and /Yp.
10111
10112 .SS Using Microsoft Visual C++ external debugging information
10113
10114 Since including debugging information in programs and shared libraries can
10115 cause their size to increase significantly, Microsoft provides a mechanism
10116 for including the debugging information in an external file called a PDB
10117 file. SCons supports PDB files through the PDB construction
10118 variable. 
10119
10120 SConstruct:
10121 .ES
10122 env=Environment()
10123 env['PDB'] = 'MyApp.pdb'
10124 env.Program('MyApp', ['Foo.cpp', 'Bar.cpp'])
10125 .EE
10126
10127 For more information see the document for the PDB construction variable.
10128
10129 .SH ENVIRONMENT
10130
10131 .IP SCONS_LIB_DIR
10132 Specifies the directory that contains the SCons Python module directory
10133 (e.g. /home/aroach/scons-src-0.01/src/engine).
10134
10135 .IP SCONSFLAGS
10136 A string of options that will be used by scons in addition to those passed
10137 on the command line.
10138
10139 .SH "SEE ALSO"
10140 .B scons
10141 User Manual,
10142 .B scons
10143 Design Document,
10144 .B scons
10145 source code.
10146
10147 .SH AUTHORS
10148 Steven Knight <knight@baldmt.com>
10149 .br
10150 Anthony Roach <aroach@electriceyeball.com>
10151