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