Add support on IRIX. (Chad Austin)
[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 "August 2004"
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 "-C" " directory" ",  --directory=" directory
426 Change to the specified 
427 .I directory
428 before searching for the 
429 .IR SConstruct ,
430 .IR Sconstruct ,
431 or
432 .I sconstruct
433 file, or doing anything
434 else.  Multiple 
435 .B -C
436 options are interpreted
437 relative to the previous one, and the right-most
438 .B -C
439 option wins. (This option is nearly
440 equivalent to 
441 .BR "-f directory/SConstruct" ,
442 except that it will search for
443 .IR SConstruct ,
444 .IR Sconstruct , 
445 or
446 .I sconstruct
447 in the specified directory.)
448
449 .\" .TP
450 .\" -d
451 .\" Display dependencies while building target files.  Useful for
452 .\" figuring out why a specific file is being rebuilt, as well as
453 .\" general debugging of the build process.
454
455 .TP
456 -D
457 Works exactly the same way as the
458 .B -u
459 option except for the way default targets are handled.
460 When this option is used and no targets are specified on the command line,
461 all default targets are built, whether or not they are below the current
462 directory.
463
464 .TP
465 .RI --debug= type
466 Debug the build process.
467 .I type
468 specifies what type of debugging:
469
470 .TP
471 --debug=count
472 Print a count of how many objects are created
473 of the various classes used internally by SCons.
474 This only works when run under Python 2.1 or later.
475
476 .TP
477 --debug=dtree
478 Print the dependency tree
479 after each top-level target is built. This prints out only derived files.
480
481 .TP
482 --debug=includes
483 Print the include tree after each top-level target is built. 
484 This is generally used to find out what files are included by the sources
485 of a given derived file:
486
487 .ES
488 $ scons --debug=includes foo.o
489 .EE
490
491 .TP
492 --debug=memory
493 Prints how much memory SCons uses
494 before and after reading the SConscript files
495 and before and after building.
496
497 .TP
498 --debug=objects
499 Prints a list of the various objects
500 of the various classes used internally by SCons.
501 This only works when run under Python 2.1 or later.
502
503 .TP
504 --debug=pdb
505 Re-run SCons under the control of the
506 .RI pdb
507 Python debugger.
508 .EE
509
510 .TP
511 --debug=presub
512 Print the raw command line used to build each target
513 before the construction environment variables are substituted.
514 Also shows which targets are being built by this command.
515 Output looks something like this:
516 .ES
517 $ scons --debug=presub
518 Building myprog.o with action(s):
519   $SHCC $SHCCFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
520 ...
521 .EE
522
523 .TP
524 --debug=time
525 Prints various time profiling information: the time spent
526 executing each build command, the total build time, the total time spent
527 executing build commands, the total time spent executing SConstruct and
528 SConscript files, and the total time spent executing SCons itself.
529
530 .TP
531 --debug=tree
532 Print the dependency tree
533 after each top-level target is built. This prints out the complete
534 dependency tree including implicit dependencies and ignored
535 dependencies.
536
537 .\" .TP
538 .\" -e, --environment-overrides
539 .\" Variables from the execution environment override construction
540 .\" variables from the SConscript files.
541
542 .TP
543 .RI -f " file" ", --file=" file ", --makefile=" file ", --sconstruct=" file
544 Use 
545 .I file 
546 as the initial SConscript file.
547
548 .TP 
549 -h, --help
550 Print a local help message for this build, if one is defined in
551 the SConscript file(s), plus a line that describes the 
552 .B -H
553 option for command-line option help.  If no local help message
554 is defined, prints the standard help message about command-line
555 options.  Exits after displaying the appropriate message.
556
557 .TP
558 -H, --help-options
559 Print the standard help message about command-line options and
560 exit.
561
562 .TP
563 -i, --ignore-errors
564 Ignore all errors from commands executed to rebuild files.
565
566 .TP 
567 .RI -I " directory" ", --include-dir=" directory
568 Specifies a 
569 .I directory
570 to search for
571 imported Python modules.  If several 
572 .B -I
573 options
574 are used, the directories are searched in the order specified.
575
576 .TP
577 --implicit-cache
578 Cache implicit dependencies. This can cause 
579 .B scons
580 to miss changes in the implicit dependencies in cases where a new implicit
581 dependency is added earlier in the implicit dependency search path
582 (e.g. CPPPATH) than a current implicit dependency with the same name.
583
584 .TP
585 --implicit-deps-changed
586 Force SCons to ignore the cached implicit dependencies. This causes the
587 implicit dependencies to be rescanned and recached. This implies
588 .BR --implicit-cache .
589
590 .TP
591 --implicit-deps-unchanged
592 Force SCons to ignore changes in the implicit dependencies.
593 This causes cached implicit dependencies to always be used.
594 This implies 
595 .BR --implicit-cache .
596
597 .TP
598 .RI -j " N" ", --jobs=" N
599 Specifies the number of jobs (commands) to run simultaneously.
600 If there is more than one 
601 .B -j 
602 option, the last one is effective.
603 .\" ??? If the 
604 .\" .B -j 
605 .\" option
606 .\" is specified without an argument,
607 .\" .B scons 
608 .\" will not limit the number of
609 .\" simultaneous jobs.
610
611 .TP
612 -k, --keep-going
613 Continue as much as possible after an error.  The target that
614 failed and those that depend on it will not be remade, but other
615 targets specified on the command line will still be processed.
616
617 .\" .TP
618 .\" .RI  -l " N" ", --load-average=" N ", --max-load=" N
619 .\" No new jobs (commands) will be started if
620 .\" there are other jobs running and the system load
621 .\" average is at least 
622 .\" .I N
623 .\" (a floating-point number).
624
625 .TP
626 .RI --duplicate= ORDER
627 There are three ways to duplicate files in a build tree: hard links,
628 soft (symbolic) links and copies. The default behaviour of SCons is to 
629 prefer hard links to soft links to copies. You can specify different
630 behaviours with this option.
631 .IR ORDER 
632 must be one of 
633 .IR hard-soft-copy
634 (the default),
635 .IR soft-hard-copy ,
636 .IR hard-copy ,
637 .IR soft-copy
638 or
639 .IR copy .
640 SCons will attempt to duplicate files using
641 the mechanisms in the specified order.
642
643 .\"
644 .\" .TP
645 .\" --list-derived
646 .\" List derived files (targets, dependencies) that would be built,
647 .\" but do not build them.
648 .\" [XXX This can probably go away with the right
649 .\" combination of other options.  Revisit this issue.]
650 .\"
651 .\" .TP
652 .\" --list-actions
653 .\" List derived files that would be built, with the actions
654 .\" (commands) that build them.  Does not build the files.
655 .\" [XXX This can probably go away with the right
656 .\" combination of other options.  Revisit this issue.]
657 .\"
658 .\" .TP
659 .\" --list-where
660 .\" List derived files that would be built, plus where the file is
661 .\" defined (file name and line number).  Does not build the files.
662 .\" [XXX This can probably go away with the right
663 .\" combination of other options.  Revisit this issue.]
664
665 .TP
666 -m
667 Ignored for compatibility with non-GNU versions of
668 .BR make .
669
670 .TP
671 .RI --max-drift= SECONDS
672 Set the maximum expected drift in the modification time of files to 
673 .IR SECONDS .
674 This value determines how old a file must be before its content signature
675 is cached. The default value is 2 days, which means a file must have a
676 modification time of at least two days ago in order to have its content
677 signature cached. A negative value means to never cache the content
678 signature and to ignore the cached value if there already is one. A value
679 of 0 means to always cache the signature, no matter how old the file is.
680
681 .TP
682 -n, --just-print, --dry-run, --recon
683 No execute.  Print the commands that would be executed to build
684 any out-of-date target files, but do not execute the commands.
685
686 .\" .TP
687 .\" .RI -o " file" ", --old-file=" file ", --assume-old=" file
688 .\" Do not rebuild 
689 .\" .IR file ,
690 .\" and do
691 .\" not rebuild anything due to changes in the contents of
692 .\" .IR file .
693 .\" .TP 
694 .\" .RI --override " file"
695 .\" Read values to override specific build environment variables
696 .\" from the specified 
697 .\" .IR file .
698 .\" .TP
699 .\" -p
700 .\" Print the data base (construction environments,
701 .\" Builder and Scanner objects) that are defined
702 .\" after reading the SConscript files.
703 .\" After printing, a normal build is performed
704 .\" as usual, as specified by other command-line options.
705 .\" This also prints version information
706 .\" printed by the 
707 .\" .B -v
708 .\" option.
709 .\"
710 .\" To print the database without performing a build do:
711 .\"
712 .\" .ES
713 .\" scons -p -q
714 .\" .EE
715
716 .TP
717 .RI --profile= file
718 Run SCons under the Python profiler
719 and save the results in the specified
720 .IR file .
721 The results may be analyzed using the Python
722 pstats module.
723 .TP
724 -q, --question
725 Do not run any commands, or print anything.  Just return an exit
726 status that is zero if the specified targets are already up to
727 date, non-zero otherwise.
728 .TP
729 -Q
730 Quiets SCons status messages about
731 reading SConscript files,
732 building targets
733 and entering directories.
734 Commands that are executed
735 to rebuild target files are still printed.
736
737 .\" .TP
738 .\" -r, -R, --no-builtin-rules, --no-builtin-variables
739 .\" Clear the default construction variables.  Construction
740 .\" environments that are created will be completely empty.
741
742 .TP
743 --random
744 Build dependencies in a random order.  This is useful when
745 building multiple trees simultaneously with caching enabled,
746 to prevent multiple builds from simultaneously trying to build
747 or retrieve the same target files.
748
749 .TP
750 -s, --silent, --quiet
751 Silent.  Do not print commands that are executed to rebuild
752 target files.
753 Also suppresses SCons status messages.
754
755 .TP
756 -S, --no-keep-going, --stop
757 Ignored for compatibility with GNU 
758 .BR make .
759
760 .TP
761 .RI --save-explain-info= 0|1
762 By default,
763 scons will save additional information about the build
764 that is used by the
765 .B --debug=explain
766 option.
767 Setting
768 .B --save-explain-info=0
769 will tell scons to speed up the build
770 by not saving this information.
771
772 .TP
773 -t, --touch
774 Ignored for compatibility with GNU
775 .BR make .  
776 (Touching a file to make it
777 appear up-to-date is unnecessary when using 
778 .BR scons .)
779
780 .TP
781 -u, --up, --search-up
782 Walks up the directory structure until an 
783 .I SConstruct ,
784 .I Sconstruct
785 or 
786 .I sconstruct
787 file is found, and uses that
788 as the top of the directory tree.
789 If no targets are specified on the command line,
790 only targets at or below the
791 current directory will be built.
792
793 .TP
794 -U
795 Works exactly the same way as the
796 .B -u
797 option except for the way default targets are handled.
798 When this option is used and no targets are specified on the command line,
799 all default targets that are defined in the SConscript(s) in the current
800 directory are built, regardless of what directory the resultant targets end
801 up in.
802
803 .TP
804 -v, --version
805 Print the 
806 .B scons
807 version, copyright information,
808 list of authors, and any other relevant information.
809 Then exit.
810
811 .TP
812 -w, --print-directory
813 Print a message containing the working directory before and
814 after other processing.
815
816 .TP
817 .RI --warn= type ", --warn=no-" type
818 Enable or disable warnings.
819 .I type
820 specifies the type of warnings to be enabled or disabled:
821
822 .TP
823 --warn=all, --warn=no-all
824 Enables or disables all warnings.
825
826 .TP
827 --warn=dependency, --warn=no-dependency
828 Enables or disables warnings about dependencies.
829 These warnings are disabled by default.
830
831 .TP
832 --warn=deprecated, --warn=no-deprecated
833 Enables or disables warnings about use of deprecated features.
834 These warnings are enabled by default.
835
836 .TP
837 --warn=missing-sconscript, --warn=no-missing-sconscript
838 Enables or disables warnings about missing SConscript files.
839 These warnings are enabled by default.
840
841 .TP
842 --no-print-directory
843 Turn off -w, even if it was turned on implicitly.
844
845 .\" .TP
846 .\" .RI --write-filenames= file
847 .\" Write all filenames considered into
848 .\" .IR file .
849 .\"
850 .\" .TP
851 .\" .RI -W " file" ", --what-if=" file ", --new-file=" file ", --assume-new=" file
852 .\" Pretend that the target 
853 .\" .I file 
854 .\" has been
855 .\" modified.  When used with the 
856 .\" .B -n
857 .\" option, this
858 .\" show you what would be rebuilt if you were to modify that file.
859 .\" Without 
860 .\" .B -n
861 .\" ... what? XXX
862 .\"
863 .\" .TP
864 .\" --warn-undefined-variables
865 .\" Warn when an undefined variable is referenced.
866
867 .TP 
868 .RI -Y " repository" ", --repository=" repository
869 Search the specified repository for any input and target
870 files not found in the local directory hierarchy.  Multiple
871 .B -Y
872 options may specified, in which case the
873 repositories are searched in the order specified.
874
875 .SH CONFIGURATION FILE REFERENCE
876 .\" .SS Python Basics
877 .\" XXX Adding this in the future would be a help.
878 .SS Construction Environments
879 A construction environment is the basic means by which the SConscript
880 files communicate build information to 
881 .BR scons .
882 A new construction environment is created using the 
883 .B Environment 
884 function:
885
886 .ES
887 env = Environment()
888 .EE
889
890 By default, a new construction environment is
891 initialized with a set of builder methods
892 and construction variables that are appropriate
893 for the current platform.
894 An optional platform keyword argument may be
895 used to specify that an environment should
896 be initialized for a different platform:
897
898 .ES
899 env = Environment(platform = 'cygwin')
900 env = Environment(platform = 'os2')
901 env = Environment(platform = 'posix')
902 env = Environment(platform = 'win32')
903 .EE
904
905 Specifying a platform initializes the appropriate
906 construction variables in the environment
907 to use and generate file names with prefixes
908 and suffixes appropriate for the platform.
909
910 Note that the
911 .B win32
912 platform adds the
913 .B SYSTEMROOT
914 variable from the user's external environment
915 to the construction environment's
916 .B ENV
917 dictionary.
918 This is so that any executed commands
919 that use sockets to connect with other systems
920 (such as fetching source files from
921 external CVS repository specifications like 
922 .BR :pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons )
923 will work on Win32 systems.
924
925 The platform argument may be function or callable object,
926 in which case the Environment() method
927 will call the specified argument to update
928 the new construction environment:
929
930 .ES
931 def my_platform(env):
932     env['VAR'] = 'xyzzy'
933
934 env = Environment(platform = my_platform)
935 .EE
936
937 Additionally, a specific set of tools
938 with which to initialize the environment
939 may specified as an optional keyword argument:
940
941 .ES
942 env = Environment(tools = ['msvc', 'lex'])
943 .EE
944
945 Non-built-in tools may be specified using the toolpath argument:
946
947 .ES
948 env = Environment(tools = ['foo'], toolpath = ['tools'])
949 .EE
950
951 This looks for a tool specification in tools/foo.py.  foo.py should
952 have two functions: generate(env) and exists(env).  generate()
953 modifies the passed in environment and exists() should return a true
954 value if the tool is available.  Tools in the toolpath are used before
955 any of the built-in ones.  For example, adding gcc.py to the toolpath
956 would override the built-in gcc tool.
957
958 The elements of the tools list may also
959 be functions or callable objects,
960 in which case the Environment() method
961 will call the specified elements
962 to update the new construction environment:
963
964 .ES
965 def my_tool(env):
966     env['XYZZY'] = 'xyzzy'
967
968 env = Environment(tools = [my_tool])
969 .EE
970
971 The tool definition (i.e. my_tool()) can use the PLATFORM variable from
972 the environment it receives to customize the tool for different platforms.
973
974 If no tool list is specified, then SCons will auto-detect the installed
975 tools using the PATH variable in the ENV construction variable and the
976 platform name when the Environment is constructed. Changing the PATH
977 variable after the Environment is constructed will not cause the tools to
978 be redetected.
979
980 SCons supports the following tool specifications out of the box:
981
982 .ES
983 386asm
984 aixc++
985 aixcc
986 aixf77
987 aixlink
988 ar
989 as
990 bcc32
991 c++
992 cc
993 cvf
994 dmd
995 dvipdf
996 dvips
997 f77
998 f90
999 f95
1000 fortran
1001 g++
1002 g77
1003 gas
1004 gcc
1005 gnulink
1006 gs
1007 hpc++
1008 hpcc
1009 hplink
1010 icc
1011 icl
1012 ifl
1013 ifort
1014 ilink
1015 ilink32
1016 jar
1017 javac
1018 javah
1019 latex
1020 lex
1021 link
1022 linkloc
1023 m4
1024 masm
1025 midl
1026 mingw
1027 mslib
1028 mslink
1029 msvc
1030 msvs
1031 nasm
1032 pdflatex
1033 pdftex
1034 qt
1035 rmic
1036 sgiar
1037 sgic++
1038 sgicc
1039 sgilink
1040 sunar
1041 sunc++
1042 suncc
1043 sunlink
1044 swig
1045 tar
1046 tex
1047 tlib
1048 yacc
1049 zip
1050 .EE
1051
1052 Additionally, there is a "tool" named
1053 .B default
1054 which configures the
1055 environment with a default set of tools for the current platform.
1056
1057 On posix and cygwin platforms
1058 the GNU tools (e.g. gcc) are preferred by SCons,
1059 on win32 the Microsoft tools (e.g. msvc)
1060 followed by MinGW are preferred by SCons,
1061 and in OS/2 the IBM tools (e.g. icc) are preferred by SCons.
1062
1063 .SS Builder Methods
1064
1065 Build rules are specified by calling a construction
1066 environment's builder methods.
1067 The arguments to the builder methods are
1068 .B target
1069 (a list of target files)
1070 and
1071 .B source
1072 (a list of source files).
1073
1074 Because long lists of file names
1075 can lead to a lot of quoting,
1076 .B scons
1077 supplies a
1078 .B Split()
1079 global function
1080 and a same-named environment method
1081 that split a single string
1082 into a list, separated on
1083 strings of white-space characters.
1084 (These are similar to the
1085 string.split() method
1086 from the standard Python library,
1087 but work even if the input isn't a string.)
1088
1089 Like all Python arguments,
1090 the target and source arguments to a builder method
1091 can be specified either with or without
1092 the "target" and "source" keywords.
1093 When the keywords are omitted,
1094 the target is first,
1095 followed by the source.
1096 The following are equivalent examples of calling the Program builder method:
1097
1098 .ES
1099 env.Program('bar', ['bar.c', 'foo.c'])
1100 env.Program('bar', Split('bar.c foo.c'))
1101 env.Program('bar', env.Split('bar.c foo.c'))
1102 env.Program(source =  ['bar.c', 'foo.c'], target = 'bar')
1103 env.Program(target = 'bar', Split('bar.c foo.c'))
1104 env.Program(target = 'bar', env.Split('bar.c foo.c'))
1105 env.Program('bar', source = string.split('bar.c foo.c'))
1106 .EE
1107
1108 When the target shares the same base name
1109 as the source and only the suffix varies,
1110 and if the builder method has a suffix defined for the target file type,
1111 then the target argument may be omitted completely,
1112 and
1113 .B scons
1114 will deduce the target file name from
1115 the source file name.
1116 The following examples all build the
1117 executable program
1118 .B bar
1119 (on POSIX systems)
1120 or 
1121 .B bar.exe
1122 (on Windows systems)
1123 from the bar.c source file:
1124
1125 .ES
1126 env.Program(target = 'bar', source = 'bar.c')
1127 env.Program('bar', source = 'bar.c')
1128 env.Program(source = 'bar.c')
1129 env.Program('bar.c')
1130 .EE
1131
1132 It is possible to override or add construction variables when calling a
1133 builder method by passing additional keyword arguments.
1134 These overridden or added
1135 variables will only be in effect when building the target, so they will not
1136 affect other parts of the build. For example, if you want to add additional
1137 libraries for just one program:
1138
1139 .ES
1140 env.Program('hello', 'hello.c', LIBS=['gl', 'glut'])
1141 .EE
1142
1143 or generate a shared library with a nonstandard suffix:
1144
1145 .ES
1146 env.SharedLibrary('word', 'word.cpp', SHLIBSUFFIX='.ocx')
1147 .EE
1148
1149 Although the builder methods defined by
1150 .B scons
1151 are, in fact,
1152 methods of a construction environment object,
1153 they may also be called without an explicit environment:
1154
1155 .ES
1156 Program('hello', 'hello.c')
1157 SharedLibrary('word', 'word.cpp')
1158 .EE
1159
1160 In this case,
1161 the methods are called internally using a default construction
1162 environment that consists of the tools and values that
1163 .B scons
1164 has determined are appropriate for the local system.
1165
1166 All builder methods return a Node or a list of Nodes,
1167 representing the target or targets that will be built.
1168 A list of Nodes is returned if there is more than one target,
1169 and a single Node is returned if there is only one target.
1170 A
1171 .I Node
1172 is an internal SCons object
1173 which represents
1174 build targets or sources.
1175
1176 The returned Node(s)
1177 can be passed to other builder methods as source(s)
1178 or passed to any SCons function or method
1179 where a filename would normally be accepted.
1180 For example, if it were necessary
1181 to add a specific
1182 .B -D
1183 flag when compiling one specific object file:
1184
1185 .ES
1186 bar_obj = env.StaticObject('bar.c', CCFLAGS='-DBAR')
1187 env.Program(source = ['foo.c', bar_obj, 'main.c'])
1188 .EE
1189
1190 Using a Node in this way
1191 makes for a more portable build
1192 by avoiding having to specify
1193 a platform-specific object suffix
1194 when calling the Program() builder method.
1195
1196 The path name for a Node's file may be used
1197 by passing the Node to the Python-builtin
1198 .B str()
1199 function:
1200
1201 .ES
1202 bar_obj = env.StaticObject('bar.c', CCFLAGS='-DBAR')
1203 print "The path to bar_obj is:", str(bar_obj)
1204 .EE
1205
1206 .B scons
1207 provides the following builder methods:
1208
1209 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1210 .IP CFile()
1211 .IP env.CFile()
1212 Builds a C source file given a lex (.l) or yacc (.y) input file.
1213 The suffix specified by the $CFILESUFFIX construction variable
1214 (.c by default)
1215 is automatically added to the target
1216 if it is not already present. Example:
1217
1218 .ES
1219 # builds foo.c
1220 env.CFile(target = 'foo.c', source = 'foo.l')
1221 # builds bar.c
1222 env.CFile(target = 'bar', source = 'bar.y')
1223 .EE
1224
1225 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1226 .IP CXXFile()
1227 .IP env.CXXFile()
1228 Builds a C++ source file given a lex (.ll) or yacc (.yy)
1229 input file.
1230 The suffix specified by the $CXXFILESUFFIX construction variable
1231 (.cc by default)
1232 is automatically added to the target
1233 if it is not already present. Example:
1234
1235 .ES
1236 # builds foo.cc
1237 env.CXXFile(target = 'foo.cc', source = 'foo.ll')
1238 # builds bar.cc
1239 env.CXXFile(target = 'bar', source = 'bar.yy')
1240 .EE
1241
1242 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1243 .IP DVI()
1244 .IP env.DVI()
1245 Builds a .dvi file from a .tex, .ltx or .latex input file.
1246 If the source file suffix is .tex,
1247 .B scons
1248 will examine the contents of the file;
1249 if the string
1250 .B \\documentclass
1251 or
1252 .B \\documentstyle
1253 is found, the file is assumed to be a LaTeX file and
1254 the target is built by invoking the $LATEXCOM command line;
1255 otherwise, the $TEXCOM command line is used.
1256 If the file is a LaTeX file,
1257 the
1258 .B DVI
1259 builder method will also examine the contents
1260 of the
1261 .B .aux file
1262 and invoke the $BIBTEX command line
1263 if the string
1264 .B bibdata
1265 is found,
1266 and will examine the contents
1267 .B .log
1268 file and re-run the $LATEXCOM command
1269 if the log file says it is necessary.
1270
1271 The suffix .dvi
1272 (hard-coded within TeX itself)
1273 is automatically added to the target
1274 if it is not already present. Examples:
1275
1276 .ES
1277 # builds from aaa.tex
1278 env.DVI(target = 'aaa.dvi', source = 'aaa.tex')
1279 # builds bbb.dvi
1280 env.DVI(target = 'bbb', source = 'bbb.ltx')
1281 # builds from ccc.latex
1282 env.DVI(target = 'ccc.dvi', source = 'ccc.latex')
1283 .EE
1284
1285 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1286 .IP Jar()
1287 .IP env.Jar()
1288 Builds a Java archive (.jar) file
1289 from a source tree of .class files.
1290 If the $JARCHDIR value is set, the
1291 .B jar
1292 command will change to the specified directory using the
1293 .B \-C
1294 option.
1295 If the contents any of the source files begin with the string
1296 .BR Manifest-Version ,
1297 the file is assumed to be a manifest
1298 and is passed to the
1299 .B jar
1300 command with the
1301 .B m
1302 option set.
1303
1304 .ES
1305 env.Jar(target = 'foo.jar', source = 'classes')
1306 .EE
1307
1308 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1309 .IP Java()
1310 .IP env.Java()
1311 Builds one or more Java class files
1312 from one or more source trees of .java files.
1313 The class files will be placed underneath
1314 the specified target directory.
1315 SCons will parse each source .java file
1316 to find the classes
1317 (including inner classes)
1318 defined within that file,
1319 and from that figure out the
1320 target .class files that will be created.
1321 SCons will also search each Java file
1322 for the Java package name,
1323 which it assumes can be found on a line
1324 beginning with the string
1325 .B package
1326 in the first column;
1327 the resulting .class files
1328 will be placed in a directory reflecting
1329 the specified package name.
1330 For example,
1331 the file
1332 .I Foo.java
1333 defining a single public
1334 .I Foo
1335 class and
1336 containing a package name of
1337 .I sub.dir
1338 will generate a corresponding
1339 .IR sub/dir/Foo.class
1340 class file.
1341
1342 Example:
1343
1344 .ES
1345 env.Java(target = 'classes', source = 'src')
1346 env.Java(target = 'classes', source = ['src1', 'src2'])
1347 .EE
1348
1349 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1350 .IP JavaH()
1351 .IP env.JavaH()
1352 Builds C header and source files for
1353 implementing Java native methods.
1354 The target can be either a directory
1355 in which the header files will be written,
1356 or a header file name which
1357 will contain all of the definitions.
1358 The source can be either the names of .class files,
1359 or the objects returned from the
1360 .B Java
1361 builder method.
1362
1363 If the construction variable
1364 .B JAVACLASSDIR
1365 is set, either in the environment
1366 or in the call to the
1367 .B JavaH
1368 builder method itself,
1369 then the value of the variable
1370 will be stripped from the
1371 beginning of any .class file names.
1372
1373 Examples:
1374
1375 .ES
1376 # builds java_native.h
1377 classes = env.Java(target = 'classdir', source = 'src')
1378 env.JavaH(target = 'java_native.h', source = classes)
1379
1380 # builds include/package_foo.h and include/package_bar.h
1381 env.JavaH(target = 'include',
1382           source = ['package/foo.class', 'package/bar.class'])
1383
1384 # builds export/foo.h and export/bar.h
1385 env.JavaH(target = 'export',
1386           source = ['classes/foo.class', 'classes/bar.class'],
1387           JAVACLASSDIR = 'classes')
1388 .EE
1389
1390 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1391 .IP Library()
1392 .IP env.Library()
1393 A synonym for the
1394 .B StaticLibrary
1395 builder method.
1396
1397 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1398 .IP M4()
1399 .IP env.M4()
1400 Builds an output file from an M4 input file.
1401 This uses a default $M4FLAGS value of
1402 .BR -E ,
1403 which considers all warnings to be fatal
1404 and stops on the first warning
1405 when using the GNU version of m4.
1406 Example:
1407
1408 .ES
1409 env.M4(target = 'foo.c', source = 'foo.c.m4')
1410 .EE
1411
1412 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1413 .IP Moc()
1414 .IP env.Moc()
1415 Builds an output file from a moc input file. Moc input files are either 
1416 header files or cxx files. This builder is only available after using the 
1417 tool 'qt'. See the QTDIR variable for more information.
1418 Example:
1419
1420 .ES
1421 env.Moc('foo.h') # generates moc_foo.cc
1422 env.Moc('foo.cpp') # generates foo.moc
1423 .EE
1424
1425 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1426 .IP MSVSProject()
1427 .IP env.MSVSProject()
1428 Builds Microsoft Visual Studio project files.
1429 This builds a Visual Studio project file, based on the version of
1430 Visual Studio that is configured (either the latest installed version,
1431 or the version set by 
1432 .B MSVS_VERSION
1433 in the Environment constructor).
1434 For VS 6, it will generate 
1435 .B .dsp
1436 and
1437 .B .dsw
1438 files, for VS 7, it will
1439 generate
1440 .B .vcproj
1441 and
1442 .B .sln
1443 files.
1444
1445 It takes several lists of filenames to be placed into the project
1446 file, currently these are limited to 
1447 .B srcs, incs, localincs, resources,
1448 and
1449 .B misc.
1450 These are pretty self explanatory, but it
1451 should be noted that the 'srcs' list is NOT added to the $SOURCES
1452 environment variable.  This is because it represents a list of files
1453 to be added to the project file, not the source used to build the
1454 project file (in this case, the 'source' is the SConscript file used
1455 to call MSVSProject).
1456
1457 In addition to these values (which are all optional, although not
1458 specifying any of them results in an empty project file), the
1459 following values must be specified:
1460
1461 target: The name of the target .dsp or .vcproj file.  The correct
1462 suffix for the version of Visual Studio must be used, but the value
1463
1464 env['MSVSPROJECTSUFFIX']
1465
1466 will be defined to the correct value (see example below).
1467
1468 variant: The name of this particular variant.  These are typically
1469 things like "Debug" or "Release", but really can be anything you want.
1470 Multiple calls to MSVSProject with different variants are allowed: all
1471 variants will be added to the project file with their appropriate
1472 build targets and sources.
1473
1474 buildtarget: A list of SCons.Node.FS objects which is returned from
1475 the command which builds the target.  This is used to tell SCons what
1476 to build when the 'build' button is pressed inside of the IDE.
1477
1478 Example Usage:
1479
1480 .ES
1481         barsrcs = ['bar.cpp'],
1482         barincs = ['bar.h'],
1483         barlocalincs = ['StdAfx.h']
1484         barresources = ['bar.rc','resource.h']
1485         barmisc = ['bar_readme.txt']
1486
1487         dll = local.SharedLibrary(target = 'bar.dll',
1488                                   source = barsrcs)
1489
1490         local.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'],
1491                           srcs = barsrcs,
1492                           incs = barincs,
1493                           localincs = barlocalincs,
1494                           resources = barresources,
1495                           misc = barmisc,
1496                           buildtarget = dll,
1497                           variant = 'Release')
1498 .EE
1499
1500 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1501 .IP Object()
1502 .IP env.Object()
1503 A synonym for the
1504 .B StaticObject
1505 builder method.
1506
1507 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1508 .IP PCH()
1509 .IP env.PCH()
1510 Builds a Microsoft Visual C++ precompiled header.
1511 Calling this builder method
1512 returns a list of two targets: the PCH as the first element, and the object
1513 file as the second element. Normally the object file is ignored.
1514 This builder method is only
1515 provided when Microsoft Visual C++ is being used as the compiler. 
1516 The PCH builder method is generally used in
1517 conjuction with the PCH construction variable to force object files to use
1518 the precompiled header:
1519
1520 .ES
1521 env['PCH'] = env.PCH('StdAfx.cpp')[0]
1522 .EE
1523
1524 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1525 .IP PDF()
1526 .IP env.PDF()
1527 Builds a .pdf file from a .dvi input file
1528 (or, by extension, a .tex, .ltx, or .latex input file).
1529 The suffix specified by the $PDFSUFFIX construction variable
1530 (.pdf by default)
1531 is added automatically to the target
1532 if it is not already present.  Example:
1533
1534 .ES
1535 # builds from aaa.tex
1536 env.PDF(target = 'aaa.pdf', source = 'aaa.tex')
1537 # builds bbb.pdf from bbb.dvi
1538 env.PDF(target = 'bbb', source = 'bbb.dvi')
1539 .EE
1540
1541 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1542 .IP PostScript()
1543 .IP env.PostScript()
1544 Builds a .ps file from a .dvi input file
1545 (or, by extension, a .tex, .ltx, or .latex input file).
1546 The suffix specified by the $PSSUFFIX construction variable
1547 (.ps by default)
1548 is added automatically to the target
1549 if it is not already present.  Example:
1550
1551 .ES
1552 # builds from aaa.tex
1553 env.PostScript(target = 'aaa.ps', source = 'aaa.tex')
1554 # builds bbb.ps from bbb.dvi
1555 env.PostScript(target = 'bbb', source = 'bbb.dvi')
1556 .EE
1557
1558 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1559 .IP Program()
1560 .IP env.Program()
1561 Builds an executable given one or more object files
1562 or C, C++, D, or Fortran source files.
1563 If any C, C++, D or Fortran source files are specified,
1564 then they will be automatically
1565 compiled to object files using the
1566 .B Object
1567 builder method;
1568 see that builder method's description for
1569 a list of legal source file suffixes
1570 and how they are interpreted.
1571 The target executable file prefix
1572 (specified by the $PROGPREFIX construction variable; nothing by default)
1573 and suffix
1574 (specified by the $PROGSUFFIX construction variable;
1575 by default, .exe on Windows systems, nothing on POSIX systems)
1576 are automatically added to the target if not already present.
1577 Example:
1578
1579 .ES
1580 env.Program(target = 'foo', source = ['foo.o', 'bar.c', 'baz.f'])
1581 .EE
1582
1583 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1584 .IP RES()
1585 .IP env.RES()
1586 Builds a Microsoft Visual C++ resource file.
1587 This builder method is only provided
1588 when Microsoft Visual C++ or MinGW is being used as the compiler. The
1589 .I .res
1590 (or 
1591 .I .o 
1592 for MinGW) suffix is added to the target name if no other suffix is given. The source
1593 file is scanned for implicit dependencies as though it were a C file. Example:
1594
1595 .ES
1596 env.RES('resource.rc')
1597 .EE
1598
1599 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1600 .IP RMIC()
1601 .IP env.RMIC()
1602 Builds stub and skeleton class files
1603 for remote objects
1604 from Java .class files.
1605 The target is a directory
1606 relative to which the stub
1607 and skeleton class files will be written.
1608 The source can be the names of .class files,
1609 or the objects return from the
1610 .B Java
1611 builder method.
1612
1613 If the construction variable
1614 .B JAVACLASSDIR
1615 is set, either in the environment
1616 or in the call to the
1617 .B RMIC
1618 builder method itself,
1619 then the value of the variable
1620 will be stripped from the
1621 beginning of any .class file names.
1622
1623 .ES
1624 classes = env.Java(target = 'classdir', source = 'src')
1625 env.RMIC(target = 'outdir1', source = classes)
1626
1627 env.RMIC(target = 'outdir2',
1628          source = ['package/foo.class', 'package/bar.class'])
1629
1630 env.RMIC(target = 'outdir3',
1631          source = ['classes/foo.class', 'classes/bar.class'],
1632          JAVACLASSDIR = 'classes')
1633 .EE
1634
1635 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1636 .IP SharedLibrary()
1637 .IP env.SharedLibrary()
1638 Builds a shared library
1639 (.so on a POSIX system, .dll on WIN32)
1640 given one or more object files
1641 or C, C++, D or Fortran source files.
1642 If any source files are given,
1643 then they will be automatically
1644 compiled to object files.
1645 The static library prefix and suffix (if any)
1646 are automatically added to the target.
1647 The target library file prefix
1648 (specified by the $SHLIBPREFIX construction variable;
1649 by default, lib on POSIX systems, nothing on Windows systems)
1650 and suffix
1651 (specified by the $SHLIBSUFFIX construction variable;
1652 by default, .dll on Windows systems, .so on POSIX systems)
1653 are automatically added to the target if not already present.
1654 Example:
1655
1656 .ES
1657 env.SharedLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
1658 .EE
1659 .IP
1660 On WIN32 systems, the
1661 .B SharedLibrary
1662 builder method will always build an import (.lib) library
1663 in addition to the shared (.dll) library,
1664 adding a .lib library with the same basename
1665 if there is not already a .lib file explicitly
1666 listed in the targets.
1667
1668 Any object files listed in the
1669 .B source
1670 must have been built for a shared library
1671 (that is, using the
1672 .B SharedObject
1673 builder method).
1674 .B scons
1675 will raise an error if there is any mismatch.
1676 .IP
1677 On WIN32 systems, specifying "register=1" will cause the dll to be
1678 registered after it is built using REGSVR32.  The command that is run
1679 ("regsvr32" by default) is determined by $REGSVR construction
1680 variable, and the flags passed are determined by $REGSVRFLAGS.  By
1681 default, $REGSVRFLAGS includes "/s", to prevent dialogs from popping
1682 up and requiring user attention when it is run.  If you change
1683 $REGSVRFLAGS, be sure to include "/s".  For example,
1684
1685 .ES
1686 env.SharedLibrary(target = 'bar',
1687                   source = ['bar.cxx', 'foo.obj'],
1688                   register=1)
1689 .EE
1690
1691 .IP
1692 will register "bar.dll" as a COM object when it is done linking it.
1693
1694 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1695 .IP SharedObject()
1696 .IP env.SharedObject()
1697 Builds an object file for
1698 inclusion in a shared library.
1699 Source files must have one of the same set of extensions
1700 specified above for the
1701 .B StaticObject
1702 builder method.
1703 On some platforms building a shared object requires additional
1704 compiler options (e.g. -fPIC for gcc) in addition to those needed to build a
1705 normal (static) object, but on some platforms there is no difference between a
1706 shared object and a normal (static) one. When there is a difference, SCons
1707 will only allow shared objects to be linked into a shared library, and will
1708 use a different suffix for shared objects. On platforms where there is no
1709 difference, SCons will allow both normal (static)
1710 and shared objects to be linked into a
1711 shared library, and will use the same suffix for shared and normal
1712 (static) objects.
1713 The target object file prefix
1714 (specified by the $SHOBJPREFIX construction variable;
1715 by default, the same as $OBJPREFIX)
1716 and suffix
1717 (specified by the $SHOBJSUFFIX construction variable)
1718 are automatically added to the target if not already present. 
1719 Examples:
1720
1721 .ES
1722 env.SharedObject(target = 'ddd', source = 'ddd.c')
1723 env.SharedObject(target = 'eee.o', source = 'eee.cpp')
1724 env.SharedObject(target = 'fff.obj', source = 'fff.for')
1725 .EE
1726
1727 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1728 .IP StaticLibrary()
1729 .IP env.StaticLibrary()
1730 Builds a static library given one or more object files
1731 or C, C++, D or Fortran source files.
1732 If any source files are given,
1733 then they will be automatically
1734 compiled to object files.
1735 The static library prefix and suffix (if any)
1736 are automatically added to the target.
1737 The target library file prefix
1738 (specified by the $LIBPREFIX construction variable;
1739 by default, lib on POSIX systems, nothing on Windows systems)
1740 and suffix
1741 (specified by the $LIBSUFFIX construction variable;
1742 by default, .lib on Windows systems, .a on POSIX systems)
1743 are automatically added to the target if not already present.
1744 Example:
1745
1746 .ES
1747 env.StaticLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
1748 .EE
1749
1750 .IP
1751 Any object files listed in the
1752 .B source
1753 must have been built for a static library
1754 (that is, using the
1755 .B StaticObject
1756 builder method).
1757 .B scons
1758 will raise an error if there is any mismatch.
1759
1760 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1761 .IP StaticObject()
1762 .IP env.StaticObject()
1763 Builds a static object file
1764 from one or more C, C++, D, or Fortran source files.
1765 Source files must have one of the following extensions:
1766
1767 .ES
1768   .asm    assembly language file
1769   .ASM    assembly language file
1770   .c      C file
1771   .C      WIN32:  C file
1772           POSIX:  C++ file
1773   .cc     C++ file
1774   .cpp    C++ file
1775   .cxx    C++ file
1776   .cxx    C++ file
1777   .c++    C++ file
1778   .C++    C++ file
1779   .d      D file
1780   .f      Fortran file
1781   .F      WIN32:  Fortran file
1782           POSIX:  Fortran file + C pre-processor
1783   .for    Fortran file
1784   .FOR    Fortran file
1785   .fpp    Fortran file + C pre-processor
1786   .FPP    Fortran file + C pre-processor
1787   .s      assembly language file
1788   .S      WIN32:  assembly language file
1789           POSIX:  assembly language file + C pre-processor
1790   .spp    assembly language file + C pre-processor
1791   .SPP    assembly language file + C pre-processor
1792 .EE
1793 .IP
1794 The target object file prefix
1795 (specified by the $OBJPREFIX construction variable; nothing by default)
1796 and suffix
1797 (specified by the $OBJSUFFIX construction variable;
1798 \.obj on Windows systems, .o on POSIX systems)
1799 are automatically added to the target if not already present.
1800 Examples:
1801
1802 .ES
1803 env.StaticObject(target = 'aaa', source = 'aaa.c')
1804 env.StaticObject(target = 'bbb.o', source = 'bbb.c++')
1805 env.StaticObject(target = 'ccc.obj', source = 'ccc.f')
1806 .EE
1807
1808 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1809 .IP Tar()
1810 .IP env.Tar()
1811 Builds a tar archive of the specified files
1812 and/or directories.
1813 Unlike most builder methods,
1814 the
1815 .B Tar
1816 builder method may be called multiple times
1817 for a given target;
1818 each additional call
1819 adds to the list of entries
1820 that will be built into the archive.
1821
1822 .ES
1823 env.Tar('src.tar', 'src')
1824
1825 # Create the stuff.tar file.
1826 env.Tar('stuff', ['subdir1', 'subdir2'])
1827 # Also add "another" to the stuff.tar file.
1828 env.Tar('stuff', 'another')
1829
1830 # Set TARFLAGS to create a gzip-filtered archive.
1831 env = Environment(TARFLAGS = '-c -z')
1832 env.Tar('foo.tar.gz', 'foo')
1833
1834 # Also set the suffix to .tgz.
1835 env = Environment(TARFLAGS = '-c -z',
1836                   TARSUFFIX = '.tgz')
1837 env.Tar('foo')
1838 .EE
1839
1840 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1841 .IP TypeLibrary()
1842 .IP env.TypeLibrary()
1843 Builds a Windows type library (.tlb) file from and input IDL file
1844 (.idl).  In addition, it will build the associated inteface stub and
1845 proxy source files.  It names them according to the base name of the .idl file.
1846 .IP
1847 For example,
1848
1849 .ES
1850 env.TypeLibrary(source="foo.idl")
1851 .EE
1852 .IP
1853 Will create foo.tlb, foo.h, foo_i.c, foo_p.c, and foo_data.c.
1854
1855 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1856 .IP Uic()
1857 .IP env.Uic()
1858 Builds a header file, an implementation file and a moc file from an ui file.
1859 and returns the corresponding nodes in the above order.
1860 This builder is only available after using the tool 'qt'. Note: you can 
1861 specify .ui files directly as inputs for Program, Library and SharedLibrary
1862 without using this builder. Using the builder lets you override the standard
1863 naming conventions (be careful: prefixes are always prepended to names of
1864 built files; if you don't want prefixes, you may set them to ``).
1865 See the QTDIR variable for more information.
1866 Example:
1867
1868 .ES
1869 env.Uic('foo.ui') # -> ['foo.h', 'uic_foo.cc', 'moc_foo.cc']
1870 env.Uic(target = Split('include/foo.h gen/uicfoo.cc gen/mocfoo.cc'),
1871         source = 'foo.ui') # -> ['include/foo.h', 'gen/uicfoo.cc', 'gen/mocfoo.cc']
1872 .EE
1873
1874 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1875 .IP Zip()
1876 .IP env.Zip()
1877 Builds a zip archive of the specified files
1878 and/or directories.
1879 Unlike most builder methods,
1880 the
1881 .B Zip
1882 builder method may be called multiple times
1883 for a given target;
1884 each additional call
1885 adds to the list of entries
1886 that will be built into the archive.
1887
1888 .ES
1889 env.Zip('src.zip', 'src')
1890
1891 # Create the stuff.zip file.
1892 env.Zip('stuff', ['subdir1', 'subdir2'])
1893 # Also add "another" to the stuff.tar file.
1894 env.Zip('stuff', 'another')
1895 .EE
1896
1897 .B scons
1898 automatically scans
1899 C source files, C++ source files,
1900 Fortran source files with
1901 .B .F
1902 (POSIX systems only),
1903 .B .fpp,
1904 or
1905 .B .FPP
1906 file extensions,
1907 and assembly language files with
1908 .B .S
1909 (POSIX systems only),
1910 .B .spp,
1911 or
1912 .B .SPP
1913 files extensions
1914 for C preprocessor dependencies,
1915 so the dependencies do not need to be specified explicitly.
1916 In addition, all
1917 targets of builder methods automatically depend on their sources.
1918 An explicit dependency can
1919 be specified using the 
1920 .B Depends 
1921 method of a construction environment (see below).
1922
1923 .SS Methods and Functions to Do Things
1924 In addition to Builder methods,
1925 .B scons
1926 provides a number of other construction environment methods
1927 and global functions to
1928 manipulate the build configuration.
1929
1930 Usually, a construction environment method
1931 and global function with the same name both exist
1932 so that you don't have to remember whether
1933 to a specific bit of functionality
1934 must be called with or without a construction environment.
1935 In the following list,
1936 if you call something as a global function
1937 it looks like:
1938 .ES
1939 .RI Function( arguments )
1940 .EE
1941 and if you call something through a construction
1942 environment it looks like:
1943 .ES
1944 .RI env.Function( arguments )
1945 .EE
1946 If you can call the functionality in both ways,
1947 then both forms are listed.
1948
1949 Except where otherwise noted,
1950 the same-named
1951 construction environment method
1952 and global function 
1953 provide the exact same functionality.
1954 The only difference is that,
1955 where appropriate,
1956 calling the functionality through a construction environment will
1957 substitute construction variables into
1958 any supplied strings.
1959 For example:
1960 .ES
1961 env = Environment(FOO = 'foo')
1962 Default('$FOO')
1963 env.Default('$FOO')
1964 .EE
1965 the first call to the global
1966 .B Default()
1967 function will actually add a target named
1968 .B $FOO
1969 to the list of default targets,
1970 while the second call to the
1971 .B env.Default()
1972 construction environment method
1973 will expand the value
1974 and add a target named
1975 .B foo
1976 to the list of default targets.
1977 For more on construction variable expansion,
1978 see the next section on
1979 construction variables.
1980
1981 Construction environment methods
1982 and global functions supported by
1983 .B scons
1984 include:
1985
1986 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1987 .TP 
1988 .RI Action( action ", [" strfunction ", " varlist ])
1989 .TP
1990 .RI env.Action( action ", [" strfunction ", " varlist ])
1991 Creates an Action object for
1992 the specified
1993 .IR action .
1994 See the section "Action Objects,"
1995 below, for a complete explanation of the arguments and behavior.
1996
1997 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1998 .TP 
1999 .RI AddPostAction( target ", " action )
2000 .TP
2001 .RI env.AddPostAction( target ", " action )
2002 Arranges for the specified
2003 .I action
2004 to be performed
2005 after the specified
2006 .I target
2007 has been built.
2008 The specified action(s) may be
2009 an Action object, or anything that
2010 can be converted into an Action object
2011 (see below).
2012
2013 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2014 .TP 
2015 .RI AddPreAction( target ", " action )
2016 .TP
2017 .RI env.AddPreAction( target ", " action )
2018 Arranges for the specified
2019 .I action
2020 to be performed
2021 before the specified
2022 .I target
2023 is built.
2024 The specified action(s) may be
2025 an Action object, or anything that
2026 can be converted into an Action object
2027 (see below).
2028
2029 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2030 .TP
2031 .RI Alias( alias ", [" targets ])
2032 .TP
2033 .RI env.Alias( alias ", [" targets ])
2034 Creates one or more phony targets that
2035 expand to one or more other targets.
2036 Returns the Node object representing the alias,
2037 which exists outside of any file system.
2038 This Node object, or the alias name,
2039 may be used as a dependency of any other target,
2040 including another alias.
2041 .B Alias
2042 can be called multiple times for the same
2043 alias to add additional targets to the alias.
2044
2045 .ES
2046 Alias('install')
2047 Alias('install', '/usr/bin')
2048 Alias(['install', 'install-lib'], '/usr/local/lib')
2049
2050 env.Alias('install', ['/usr/local/bin', '/usr/local/lib'])
2051 env.Alias('install', ['/usr/local/man'])
2052 .EE
2053
2054 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2055 .TP
2056 .RI AlwaysBuild( target ", ...)"
2057 .TP
2058 .RI env.AlwaysBuild( target ", ...)"
2059 Marks each given
2060 .I target
2061 so that it is always assumed to be out of date,
2062 and will always be rebuilt if needed.
2063 Note, however, that
2064 .BR AlwaysBuild ()
2065 does not add its target(s) to the default target list,
2066 so the targets will only be built
2067 if they are specified on the command line,
2068 or are a dependent of a target specified on the command line--but
2069 they will
2070 .I always
2071 be built if so specified.
2072 Multiple targets can be passed in to a single call to
2073 .BR AlwaysBuild ().
2074
2075 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2076 .TP
2077 .RI env.Append( key = val ", [...])"
2078 Appends the specified keyword arguments
2079 to the end of construction variables in the environment.
2080 If the Environment does not have
2081 the specified construction variable,
2082 it is simply added to the environment.
2083 If the values of the construction variable
2084 and the keyword argument are the same type,
2085 then the two values will be simply added together.
2086 Otherwise, the construction variable
2087 and the value of the keyword argument
2088 are both coerced to lists,
2089 and the lists are added together.
2090 (See also the Prepend method, below.)
2091
2092 .ES
2093 env.Append(CCFLAGS = ' -g', FOO = ['foo.yyy'])
2094 .EE
2095
2096 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2097 .TP
2098 .RI env.AppendENVPath( name ", " newpath ", [" envname ", " sep ])
2099 This appends new path elements to the given path in the
2100 specified external environment
2101 .RB ( ENV
2102 by default).
2103 This will only add
2104 any particular path once (leaving the last one it encounters and
2105 ignoring the rest, to preserve path order),
2106 and to help assure this,
2107 will normalize all paths (using
2108 .B os.path.normpath
2109 and
2110 .BR os.path.normcase ).
2111 This can also handle the
2112 case where the given old path variable is a list instead of a
2113 string, in which case a list will be returned instead of a string.
2114 Example:
2115
2116 .ES
2117 print 'before:',env['ENV']['INCLUDE']
2118 include_path = '/foo/bar:/foo'
2119 env.PrependENVPath('INCLUDE', include_path)
2120 print 'after:',env['ENV']['INCLUDE']
2121
2122 yields:
2123 before: /foo:/biz
2124 after: /biz:/foo/bar:/foo
2125 .EE
2126
2127 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2128 .TP
2129 .RI env.AppendUnique( key = val ", [...])"
2130 Appends the specified keyword arguments
2131 to the end of construction variables in the environment.
2132 If the Environment does not have
2133 the specified construction variable,
2134 it is simply added to the environment.
2135 If the construction variable being appended to is a list,
2136 then any value(s) that already exist in the
2137 construction variable will
2138 .I not
2139 be added again to the list.
2140
2141 .ES
2142 env.AppendUnique(CCFLAGS = '-g', FOO = ['foo.yyy'])
2143 .EE
2144
2145 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2146 .TP
2147 env.BitKeeper()
2148 A factory function that
2149 returns a Builder object
2150 to be used to fetch source files
2151 using BitKeeper.
2152 The returned Builder
2153 is intended to be passed to the
2154 .B SourceCode
2155 function.
2156
2157 .ES
2158 env.SourceCode('.', env.BitKeeper())
2159 .EE
2160
2161 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2162 .TP
2163 .RI BuildDir( build_dir ", " src_dir ", [" duplicate ])
2164 .TP
2165 .RI env.BuildDir( build_dir ", " src_dir ", [" duplicate ])
2166 This specifies a build directory
2167 .I build_dir
2168 in which to build all derived files
2169 that would normally be built under
2170 .IR src_dir .
2171 Multiple build directories can be set up for multiple build variants, for
2172 example. 
2173 .I src_dir
2174 must be underneath the SConstruct file's directory,
2175 and
2176 .I build_dir
2177 may not be underneath the
2178 .I src_dir .
2179
2180 The default behavior is for
2181 .B scons
2182 to duplicate all of the files in the tree underneath
2183 .I src_dir
2184 into
2185 .IR build_dir ,
2186 and then build the derived files within the copied tree.
2187 (The duplication is performed by
2188 linking or copying,
2189 depending on the platform; see also the
2190 .IR --duplicate
2191 option.)
2192 This guarantees correct builds
2193 regardless of whether intermediate source files
2194 are generated during the build,
2195 where preprocessors or other scanners search
2196 for included files,
2197 or whether individual compilers or other invoked tools
2198 are hard-coded to put derived files in the same directory as source files.
2199
2200 This behavior of making a complete copy of the source tree
2201 may be disabled by setting
2202 .I duplicate
2203 to 0.
2204 This will cause
2205 .B scons
2206 to invoke Builders using the
2207 path names of source files in
2208 .I src_dir
2209 and the path names of derived files within
2210 .IR build_dir .
2211 This is always more efficient than
2212 .IR duplicate =1,
2213 and is usually safe for most builds.
2214 Specifying
2215 .IR duplicate =0,
2216 however,
2217 may cause build problems
2218 if source files are generated during the build,
2219 if any invoked tools are hard-coded to
2220 put derived files in the same directory as the source files.
2221
2222 Note that specifying a
2223 .B BuildDir
2224 works most naturally
2225 with a subsidiary SConscript file
2226 in the source directory.
2227 However,
2228 you would then call the subsidiary SConscript file
2229 not in the source directory,
2230 but in the
2231 .I build_dir ,
2232 as if
2233 .B scons
2234 had made a virtual copy of the source tree
2235 regardless of the value of 
2236 .IR duplicate .
2237 This is how you tell
2238 .B scons
2239 which variant of a source tree to build.
2240 For example:
2241
2242 .ES
2243 BuildDir('build-variant1', 'src')
2244 SConscript('build-variant1/SConscript')
2245 BuildDir('build-variant2', 'src')
2246 SConscript('build-variant2/SConscript')
2247 .EE
2248
2249 .IP
2250 See also the
2251 .BR SConscript ()
2252 function, described below,
2253 for another way to 
2254 specify a build directory
2255 in conjunction with calling a subsidiary
2256 SConscript file.)
2257
2258 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2259 .TP 
2260 .RI Builder( action ", [" arguments ])
2261 .TP 
2262 .RI env.Builder( action ", [" arguments ])
2263 Creates a Builder object for
2264 the specified
2265 .IR action .
2266 See the section "Builder Objects,"
2267 below, for a complete explanation of the arguments and behavior.
2268
2269 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2270 .TP 
2271 .RI CacheDir( cache_dir )
2272 .TP 
2273 .RI env.CacheDir( cache_dir )
2274 Specifies that
2275 .B scons
2276 will maintain a cache of derived files in
2277 .I cache_dir .
2278 The derived files in the cache will be shared
2279 among all the builds using the same
2280 .BR CacheDir ()
2281 call.
2282
2283 When a
2284 .BR CacheDir ()
2285 is being used and
2286 .B scons
2287 finds a derived file that needs to be rebuilt,
2288 it will first look in the cache to see if a
2289 derived file has already been built
2290 from identical input files and an identical build action
2291 (as incorporated into the MD5 build signature).
2292 If so,
2293 .B scons
2294 will retrieve the file from the cache.
2295 If the derived file is not present in the cache,
2296 .B scons
2297 will rebuild it and
2298 then place a copy of the built file in the cache
2299 (identified by its MD5 build signature),
2300 so that it may be retrieved by other
2301 builds that need to build the same derived file
2302 from identical inputs.
2303
2304 Use of a specified
2305 .BR CacheDir()
2306 may be disabled for any invocation
2307 by using the
2308 .B --cache-disable
2309 option.
2310
2311 If the
2312 .B --cache-force
2313 option is used,
2314 .B scons
2315 will place a copy of
2316 .I all
2317 derived files in the cache,
2318 even if they already existed
2319 and were not built by this invocation.
2320 This is useful to populate a cache
2321 the first time
2322 .BR CacheDir ()
2323 is added to a build,
2324 or after using the
2325 .B --cache-disable
2326 option.
2327
2328 When using
2329 .BR CacheDir (),
2330 .B scons
2331 will report,
2332 "Retrieved `file' from cache,"
2333 unless the
2334 .B --cache-show
2335 option is being used.
2336 When the
2337 .B --cache-show
2338 option is used,
2339 .B scons
2340 will print the action that
2341 .I would
2342 have been used to build the file,
2343 without any indication that
2344 the file was actually retrieved from the cache.
2345 This is useful to generate build logs
2346 that are equivalent regardless of whether
2347 a given derived file has been built in-place
2348 or retrieved from the cache.
2349
2350 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2351 .TP 
2352 .RI Clean( target ", " files_or_dirs )
2353 .TP 
2354 .RI env.Clean( target ", " files_or_dirs )
2355 This specifies a list of files or directories which should be removed
2356 whenever the target is specified with the
2357 .B -c
2358 command line option.
2359 Multiple calls to
2360 .BR Clean ()
2361 are legal,
2362 and create a new target or add files and directories to the
2363 clean list for the specified target.
2364
2365 Multiple files or directories should be specified
2366 either as separate arguments to the
2367 .BR Clean ()
2368 method, or as a list.
2369 .BR Clean ()
2370 will also accept the return value of any of the construction environment
2371 Builder methods.
2372 Examples:
2373
2374 .ES
2375 Clean('foo', ['bar', 'baz'])
2376 Clean('dist', env.Program('hello', 'hello.c'))
2377 .EE
2378
2379 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2380 .TP
2381 .RI Command( target ", " source ", " commands ", [" key = val ", ...])"
2382 .TP
2383 .RI env.Command( target ", " source ", " commands ", [" key = val ", ...])"
2384 Executes a specific action
2385 (or list of actions)
2386 to build a target file or files.
2387 This is more convenient
2388 than defining a separate Builder object
2389 for a single special-case build.
2390 Any keyword arguments specified override any
2391 same-named existing construction variables.
2392
2393 Note that an action can be an external command,
2394 specified as a string,
2395 or a callable Python object;
2396 see "Action Objects," below.
2397 Examples:
2398
2399 .ES
2400 env.Command('foo.out', 'foo.in',
2401             "$FOO_BUILD < $SOURCES > $TARGET")
2402
2403 env.Command('bar.out', 'bar.in',
2404             ["rm -f $TARGET",
2405              "$BAR_BUILD < $SOURCES > $TARGET"],
2406             ENV = {'PATH' : '/usr/local/bin/'})
2407
2408 def rename(env, target, source):
2409     import os
2410     os.rename('.tmp', str(target[0]))
2411
2412 env.Command('baz.out', 'baz.in',
2413             ["$BAZ_BUILD < $SOURCES > .tmp",
2414              rename ])
2415 .EE
2416
2417 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2418 .TP
2419 .RI Configure( env ", [" custom_tests ", " conf_dir ", " log_file ])
2420 .TP
2421 .RI env.Configure([ custom_tests ", " conf_dir ", " log_file ])
2422 Creates a Configure object for integrated
2423 functionality similar to GNU autoconf.
2424 See the section "Configure Contexts,"
2425 below, for a complete explanation of the arguments and behavior.
2426
2427 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2428 .TP
2429 .RI env.Copy([ key = val ", ...])"
2430 Return a separate copy of a construction environment.
2431 If there are any keyword arguments specified,
2432 they are added to the returned copy,
2433 overwriting any existing values
2434 for the keywords.
2435
2436 .ES
2437 env2 = env.Copy()
2438 env3 = env.Copy(CCFLAGS = '-g')
2439 .EE
2440 .IP
2441 Additionally, a list of tools and a toolpath may be specified, as in
2442 the Environment constructor:
2443
2444 .ES
2445 def MyTool(env): env['FOO'] = 'bar'
2446 env4 = env.Copy(tools = ['msvc', MyTool])
2447 .EE
2448
2449 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2450 .TP
2451 .RI env.CVS( repository ", " module )
2452 A factory function that
2453 returns a Builder object
2454 to be used to fetch source files
2455 from the specified
2456 CVS
2457 .IR repository .
2458 The returned Builder
2459 is intended to be passed to the
2460 .B SourceCode
2461 function.
2462
2463 The optional specified
2464 .I module
2465 will be added to the beginning
2466 of all repository path names;
2467 this can be used, in essence,
2468 to strip initial directory names
2469 from the repository path names,
2470 so that you only have to
2471 replicate part of the repository
2472 directory hierarchy in your
2473 local build directory:
2474
2475 .ES
2476 # Will fetch foo/bar/src.c
2477 # from /usr/local/CVSROOT/foo/bar/src.c.
2478 env.SourceCode('.', env.CVS('/usr/local/CVSROOT'))
2479
2480 # Will fetch bar/src.c
2481 # from /usr/local/CVSROOT/foo/bar/src.c.
2482 env.SourceCode('.', env.CVS('/usr/local/CVSROOT', 'foo'))
2483
2484 # Will fetch src.c
2485 # from /usr/local/CVSROOT/foo/bar/src.c.
2486 env.SourceCode('.', env.CVS('/usr/local/CVSROOT', 'foo/bar'))
2487 .EE
2488
2489 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2490 .TP 
2491 .RI Default( targets )
2492 .TP
2493 .RI env.Default( targets )
2494 This specifies a list of default targets,
2495 which will be built by
2496 .B scons
2497 if no explicit targets are given on the command line.
2498 Multiple calls to
2499 .BR Default ()
2500 are legal,
2501 and add to the list of default targets.
2502
2503 Multiple targets should be specified as
2504 separate arguments to the
2505 .BR Default ()
2506 method, or as a list.
2507 .BR Default ()
2508 will also accept the Node returned by any
2509 of a construction environment's
2510 builder methods.
2511 Examples:
2512
2513 .ES
2514 Default('foo', 'bar', 'baz')
2515 env.Default(['a', 'b', 'c'])
2516 hello = env.Program('hello', 'hello.c')
2517 env.Default(hello)
2518 .EE
2519 .IP
2520 An argument to
2521 .BR Default ()
2522 of
2523 .B None
2524 will clear all default targets.
2525 Later calls to
2526 .BR Default ()
2527 will add to the (now empty) default-target list
2528 like normal.
2529
2530 The current list of targets added using the
2531 .BR Default ()
2532 function or method is available in the
2533 .B DEFAULT_TARGETS
2534 list;
2535 see below.
2536
2537 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2538 .TP
2539 .RI DefaultEnvironment([ args ])
2540 Creates and returns a default construction environment object.
2541 This construction environment is used internally by SCons
2542 in order to execute many of the global functions in this list,
2543 and to fetch source files transparently
2544 from source code management systems.
2545
2546 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2547 .TP
2548 .RI Depends( target ", " dependency )
2549 .TP
2550 .RI env.Depends( target ", " dependency )
2551 Specifies an explicit dependency;
2552 the target file(s) will be rebuilt
2553 whenever the dependency file(s) has changed.
2554 This should only be necessary
2555 for cases where the dependency
2556 is not caught by a Scanner
2557 for the file.
2558
2559 .ES
2560 env.Depends('foo', 'other-input-file-for-foo')
2561 .EE
2562
2563 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2564 .TP
2565 .RI env.Dictionary([ vars ])
2566 Returns a dictionary object
2567 containing copies of all of the
2568 construction variables in the environment.
2569 If there are any variable names specified,
2570 only the specified construction
2571 variables are returned in the dictionary.
2572
2573 .ES
2574 dict = env.Dictionary()
2575 cc_dict = env.Dictionary('CC', 'CCFLAGS', 'CCCOM')
2576 .EE
2577
2578 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2579 .TP
2580 .RI Dir( name ", [" directory ])
2581 .TP
2582 .RI env.Dir( name ", [" directory ])
2583 This returns an object that represents a given directory 
2584 .IR name . 
2585 .I name
2586 can be a relative or absolute path. 
2587 .I directory
2588 is an optional directory that will be used as the parent directory. 
2589
2590 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2591 .TP
2592 .RI EnsurePythonVersion( major ", " minor )
2593 .TP
2594 .RI env.EnsurePythonVersion( major ", " minor )
2595 Ensure that the Python version is at least 
2596 .IR major . minor . 
2597 This function will
2598 print out an error message and exit SCons with a non-zero exit code if the
2599 actual Python version is not late enough.
2600
2601 .ES
2602 EnsurePythonVersion(2,2)
2603 .EE
2604
2605 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2606 .TP
2607 .RI EnsureSConsVersion( major ", " minor )
2608 .TP
2609 .RI env.EnsureSConsVersion( major ", " minor )
2610 Ensure that the SCons version is at least 
2611 .IR major . minor . 
2612 This function will
2613 print out an error message and exit SCons with a non-zero exit code if the
2614 actual SCons version is not late enough.
2615
2616 .ES
2617 EnsureSConsVersion(0,9)
2618 .EE
2619
2620 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2621 .TP
2622 .RI Environment([ key = value ", ...])"
2623 .TP
2624 .RI env.Environment([ key = value ", ...])"
2625 Return a new construction environment
2626 initialized with the specified
2627 .IR key = value
2628 pairs.
2629
2630 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2631 .TP 
2632 .RI Execute( action ", [" strfunction ", " varlist ])
2633 .TP
2634 .RI env.Execute( action ", [" strfunction ", " varlist ])
2635 Executes an Action object.
2636 The specified
2637 .IR action
2638 may be an Action object
2639 (see the section "Action Objects,"
2640 below, for a complete explanation of the arguments and behavior),
2641 or it may be a command-line string,
2642 list of commands,
2643 or executable Python function,
2644 each of which will be converted
2645 into an Action object
2646 and then executed.
2647 The exit value of the command
2648 or return value of the Python function
2649 will be returned.
2650
2651 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2652 .TP
2653 .RI Exit([ value ])
2654 .TP
2655 .RI env.Exit([ value ])
2656 This tells
2657 .B scons
2658 to exit immediately
2659 with the specified
2660 .IR value .
2661 A default exit value of
2662 .B 0
2663 (zero)
2664 is used if no value is specified.
2665
2666 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2667 .TP
2668 .RI Export( vars )
2669 .TP
2670 .RI env.Export( vars )
2671 This tells 
2672 .B scons
2673 to export a list of variables from the current
2674 SConscript file to all other SConscript files.
2675 The exported variables are kept in a global collection,
2676 so subsequent calls to
2677 .BR Export ()
2678 will over-write previous exports that have the same name. 
2679 Multiple variable names can be passed to
2680 .BR Export ()
2681 as separate arguments or as a list. A dictionary can be used to map
2682 variables to a different name when exported. Both local variables and
2683 global variables can be exported.
2684 Examples:
2685
2686 .ES
2687 env = Environment()
2688 # Make env available for all SConscript files to Import().
2689 Export("env")
2690
2691 package = 'my_name'
2692 # Make env and package available for all SConscript files:.
2693 Export("env", "package")
2694
2695 # Make env and package available for all SConscript files:
2696 Export(["env", "package"])
2697
2698 # Make env available using the name debug:.
2699 Export({"debug":env})
2700 .EE
2701
2702 .IP
2703 Note that the
2704 .BR SConscript ()
2705 function supports an
2706 .I exports
2707 argument that makes it easier to to export a variable or
2708 set of variables to a single SConscript file.
2709 See the description of the
2710 .BR SConscript ()
2711 function, below.
2712
2713 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2714 .TP 
2715 .RI File( name ", [" directory ])
2716 .TP 
2717 .RI env.File( name ", [" directory ])
2718 This returns an object that represents a given file 
2719 .IR name . 
2720 .I name
2721 can be a relative or absolute path. 
2722 .I directory
2723 is an optional directory that will be used as the parent directory. 
2724
2725 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2726 .TP
2727 .RI FindFile( file ", " dirs )
2728 .TP
2729 .RI env.FindFile( file ", " dirs )
2730 Search for 
2731 .I file 
2732 in the path specified by 
2733 .IR dirs .
2734 .I file
2735 may be a list of file names or a single file name. In addition to searching
2736 for files that exist in the filesytem, this function also searches for
2737 derived files that have not yet been built.
2738
2739 .ES
2740 foo = env.FindFile('foo', ['dir1', 'dir2'])
2741 .EE
2742
2743 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2744 .TP
2745 .RI GetBuildPath( file ", [" ... ])
2746 .TP
2747 .RI env.GetBuildPath( file ", [" ... ])
2748 Returns the
2749 .B scons
2750 path name (or names) for the specified
2751 .I file
2752 (or files).
2753 The specified
2754 .I file
2755 or files
2756 may be
2757 .B scons
2758 Nodes or strings representing path names.
2759
2760 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2761 .TP
2762 .RI GetLaunchDir()
2763 .TP
2764 .RI env.GetLaunchDir()
2765 Returns the absolute path name of the directory from which
2766 .B
2767 scons
2768 was initially invoked.
2769 This can be useful when using the
2770 .BR \-u ,
2771 .BR \-U
2772 or
2773 .BR \-D
2774 options, which internally
2775 change to the directory in which the
2776 .B SConstruct
2777 file is found.
2778
2779 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2780 .TP
2781 .RI GetOption( name )
2782 .TP
2783 .RI env.GetOption( name )
2784 This function provides a way to query a select subset of the scons command line
2785 options from a SConscript file. See 
2786 .IR SetOption () 
2787 for a description of the options available.
2788
2789 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2790 '\".TP
2791 '\".RI GlobalBuilders( flag )
2792 '\"When
2793 '\".B flag
2794 '\"is non-zero,
2795 '\"adds the names of the default builders
2796 '\"(Program, Library, etc.)
2797 '\"to the global name space
2798 '\"so they can be called without an explicit construction environment.
2799 '\"(This is the default.)
2800 '\"When
2801 '\".B
2802 '\"flag is zero,
2803 '\"the names of the default builders are removed
2804 '\"from the global name space
2805 '\"so that an explicit construction environment is required
2806 '\"to call all builders.
2807
2808 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2809 .TP
2810 .RI Help( text )
2811 .TP
2812 .RI env.Help( text )
2813 This specifies help text to be printed if the 
2814 .B -h 
2815 argument is given to
2816 .BR scons .
2817 .B scons
2818 will exit after printing out the help text.
2819
2820 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2821 .TP
2822 .RI Ignore( target ", " dependency )
2823 .TP
2824 .RI env.Ignore( target ", " dependency )
2825 The specified dependency file(s)
2826 will be ignored when deciding if
2827 the target file(s) need to be rebuilt.
2828
2829 .ES
2830 env.Ignore('foo', 'foo.c')
2831 env.Ignore('bar', ['bar1.h', 'bar2.h'])
2832 .EE
2833
2834 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2835 .TP 
2836 .RI Import( vars )
2837 .TP 
2838 .RI env.Import( vars )
2839 This tells 
2840 .B scons
2841 to import a list of variables into the current SConscript file. This
2842 will import variables that were exported with
2843 .BR Export ()
2844 or in the 
2845 .I exports
2846 argument to 
2847 .BR SConscript ().
2848 Variables exported by 
2849 .BR SConscript ()
2850 have precedence.
2851 Multiple variable names can be passed to 
2852 .BR Import ()
2853 as separate arguments or as a list. The variable "*" can be used
2854 to import all variables.
2855 Examples:
2856
2857 .ES
2858 Import("env")
2859 Import("env", "variable")
2860 Import(["env", "variable"])
2861 Import("*")
2862 .EE
2863
2864 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2865 .TP
2866 .RI Install( dir ", " source )
2867 .TP
2868 .RI env.Install( dir ", " source )
2869 Installs one or more files in a destination directory.
2870 The file names remain the same.
2871
2872 .ES
2873 env.Install(dir = '/usr/local/bin', source = ['foo', 'bar'])
2874 .EE
2875
2876 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2877 .TP
2878 .RI InstallAs( target ", " source )
2879 .TP
2880 .RI env.InstallAs( target ", " source )
2881 Installs one or more files as specific file names,
2882 allowing changing a file name as part of the
2883 installation.
2884 It is an error if the target and source
2885 list different numbers of files.
2886
2887 .ES
2888 env.InstallAs(target = '/usr/local/bin/foo',
2889               source = 'foo_debug')
2890 env.InstallAs(target = ['../lib/libfoo.a', '../lib/libbar.a'],
2891               source = ['libFOO.a', 'libBAR.a'])
2892 .EE
2893
2894 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2895 .TP
2896 .RI Literal( string )
2897 .TP
2898 .RI env.Literal( string )
2899 The specified
2900 .I string
2901 will be preserved as-is
2902 and not have construction variables expanded.
2903
2904 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2905 .TP
2906 .RI Local( targets )
2907 .TP
2908 .RI env.Local( targets )
2909 The specified
2910 .I targets
2911 will have copies made in the local tree,
2912 even if an already up-to-date copy
2913 exists in a repository.
2914 Returns a list of the target Node or Nodes.
2915
2916 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2917 .TP
2918 .RI env.ParseConfig( command ", [" function ])
2919 Calls the specified
2920 .I function
2921 to modify the environment as specified by the output of
2922 .I command .
2923 The default
2924 .I function
2925 expects the output of a typical
2926 .I *-config command
2927 (for example,
2928 .BR gtk-config )
2929 and parses the returned
2930 .BR -L ,
2931 .BR -l ,
2932 .BR -Wa ,
2933 .BR -Wl ,
2934 .BR -Wp ,
2935 .B -I
2936 and other options
2937 into the
2938 .BR LIBPATH ,
2939 .BR LIBS ,
2940 .BR ASFLAGS ,
2941 .BR LINKFLAGS ,
2942 .BR CPPFLAGS ,
2943 .B CPPPATH
2944 and
2945 .B CCFLAGS
2946 variables,
2947 respectively.
2948
2949 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2950 .TP
2951 env.Perforce()
2952 A factory function that
2953 returns a Builder object
2954 to be used to fetch source files
2955 from the Perforce source code management system.
2956 The returned Builder
2957 is intended to be passed to the
2958 .B SourceCode
2959 function:
2960
2961 .ES
2962 env.SourceCode('.', env.Perforce())
2963 .EE
2964 .IP
2965 Perforce uses a number of external
2966 environment variables for its operation.
2967 Consequently, this function adds the
2968 following variables from the user's external environment
2969 to the construction environment's
2970 ENV dictionary:
2971 P4CHARSET,
2972 P4CLIENT,
2973 P4LANGUAGE,
2974 P4PASSWD,
2975 P4PORT,
2976 P4USER,
2977 SYSTEMROOT,
2978 USER,
2979 and
2980 USERNAME.
2981
2982 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2983 .TP
2984 .RI Platform( string )
2985 Returns a callable object
2986 that can be used to initialize
2987 a construction environment using the
2988 platform keyword of the Environment() method:
2989
2990 .ES
2991 env = Environment(platform = Platform('win32'))
2992 .EE
2993 .TP
2994 .RI env.Platform( string )
2995 Applies the callable object for the specified platform
2996 .I string
2997 to the environment through which the method was called.
2998
2999 .ES
3000 env.Platform('posix')
3001 .EE
3002 .IP
3003 Note that the
3004 .B win32
3005 platform adds the
3006 .B SYSTEMROOT
3007 variable from the user's external environment
3008 to the construction environment's
3009 .B ENV
3010 dictionary.
3011 This is so that any executed commands
3012 that use sockets to connect with other systems
3013 (such as fetching source files from
3014 external CVS repository specifications like 
3015 .BR :pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons )
3016 will work on Win32 systems.
3017
3018 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3019 .TP
3020 .RI Precious( target ", ...)"
3021 .TP
3022 .RI env.Precious( target ", ...)"
3023 Marks each given
3024 .I target
3025 as precious so it is not deleted before it is rebuilt. Normally
3026 .B scons
3027 deletes a target before building it.
3028 Multiple targets can be passed in to a single call to
3029 .BR Precious ().
3030
3031 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3032 .TP
3033 .RI env.Prepend( key = val ", [...])"
3034 Appends the specified keyword arguments
3035 to the beginning of construction variables in the environment.
3036 If the Environment does not have
3037 the specified construction variable,
3038 it is simply added to the environment.
3039 If the values of the construction variable
3040 and the keyword argument are the same type,
3041 then the two values will be simply added together.
3042 Otherwise, the construction variable
3043 and the value of the keyword argument
3044 are both coerced to lists,
3045 and the lists are added together.
3046 (See also the Append method, above.)
3047
3048 .ES
3049 env.Prepend(CCFLAGS = '-g ', FOO = ['foo.yyy'])
3050 .EE
3051
3052 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3053 .TP
3054 .RI env.PrependENVPath( name ", " newpath ", [" envname ", " sep ])
3055 This appends new path elements to the given path in the
3056 specified external environment
3057 .RB ( ENV
3058 by default).
3059 This will only add
3060 any particular path once (leaving the first one it encounters and
3061 ignoring the rest, to preserve path order),
3062 and to help assure this,
3063 will normalize all paths (using
3064 .B os.path.normpath
3065 and
3066 .BR os.path.normcase ).
3067 This can also handle the
3068 case where the given old path variable is a list instead of a
3069 string, in which case a list will be returned instead of a string.
3070 Example:
3071
3072 .ES
3073 print 'before:',env['ENV']['INCLUDE']
3074 include_path = '/foo/bar:/foo'
3075 env.PrependENVPath('INCLUDE', include_path)
3076 print 'after:',env['ENV']['INCLUDE']
3077
3078 yields:
3079 before: /biz:/foo
3080 after: /foo/bar:/foo:/biz
3081 .EE
3082
3083 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3084 .TP
3085 .RI env.AppendUnique( key = val ", [...])"
3086 Appends the specified keyword arguments
3087 to the beginning of construction variables in the environment.
3088 If the Environment does not have
3089 the specified construction variable,
3090 it is simply added to the environment.
3091 If the construction variable being appended to is a list,
3092 then any value(s) that already exist in the
3093 construction variable will
3094 .I not
3095 be added again to the list.
3096
3097 .ES
3098 env.PrependUnique(CCFLAGS = '-g', FOO = ['foo.yyy'])
3099 .EE
3100
3101 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3102 .TP
3103 env.RCS()
3104 A factory function that
3105 returns a Builder object
3106 to be used to fetch source files
3107 from RCS.
3108 The returned Builder
3109 is intended to be passed to the
3110 .B SourceCode
3111 function:
3112
3113 .ES
3114 env.SourceCode('.', env.RCS())
3115 .EE
3116 .IP
3117 Note that
3118 .B scons
3119 will fetch source files
3120 from RCS subdirectories automatically,
3121 so configuring RCS
3122 as demonstrated in the above example
3123 should only be necessary if
3124 you are fetching from
3125 RCS,v
3126 files in the same
3127 directory as the source files,
3128 or if you need to explicitly specify RCS
3129 for a specific subdirectory.
3130
3131 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3132 .TP
3133 .RI env.Replace( key = val ", [...])"
3134 Replaces construction variables in the Environment
3135 with the specified keyword arguments.
3136
3137 .ES
3138 env.Replace(CCFLAGS = '-g', FOO = 'foo.xxx')
3139 .EE
3140
3141 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3142 .TP
3143 .RI Repository( directory )
3144 .TP
3145 .RI env.Repository( directory )
3146 Specifies that
3147 .I directory
3148 is a repository to be searched for files.
3149 Multiple calls to
3150 .BR Repository ()
3151 are legal,
3152 and each one adds to the list of
3153 repositories that will be searched.
3154
3155 To
3156 .BR scons ,
3157 a repository is a copy of the source tree,
3158 from the top-level directory on down,
3159 which may contain
3160 both source files and derived files
3161 that can be used to build targets in
3162 the local source tree.
3163 The canonical example would be an
3164 official source tree maintained by an integrator.
3165 If the repository contains derived files,
3166 then the derived files should have been built using
3167 .BR scons ,
3168 so that the repository contains the necessary
3169 signature information to allow
3170 .B scons
3171 to figure out when it is appropriate to
3172 use the repository copy of a derived file,
3173 instead of building one locally.
3174
3175 Note that if an up-to-date derived file
3176 already exists in a repository,
3177 .B scons
3178 will
3179 .I not
3180 make a copy in the local directory tree.
3181 In order to guarantee that a local copy
3182 will be made,
3183 use the
3184 .B Local()
3185 method.
3186
3187 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3188 .TP
3189 .RI Return( vars )
3190 This tells
3191 .B scons
3192 what variable(s) to use as the return value(s) of the current SConscript
3193 file. These variables will be returned to the "calling" SConscript file
3194 as the return value(s) of 
3195 .BR SConscript ().
3196 Multiple variable names should be passed to 
3197 .BR Return ()
3198 as a list. Example:
3199
3200 .ES
3201 Return("foo")
3202 Return(["foo", "bar"])
3203 .EE
3204
3205 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3206 .TP 
3207 .RI Scanner( function ", [" argument ", " keys ", " path_function ", " node_class ", " node_factory ", " scan_check ", " recursive ])
3208 .TP 
3209 .RI env.Scanner( function ", [" argument ", " keys ", " path_function ", " node_class ", " node_factory ", " scan_check ", " recursive ])
3210 Creates a Scanner object for
3211 the specified
3212 .IR function .
3213 See the section "Scanner Objects,"
3214 below, for a complete explanation of the arguments and behavior.
3215
3216 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3217 .TP
3218 env.SCCS()
3219 A factory function that
3220 returns a Builder object
3221 to be used to fetch source files
3222 from SCCS.
3223 The returned Builder
3224 is intended to be passed to the
3225 .B SourceCode
3226 function:
3227
3228 .ES
3229 env.SourceCode('.', env.SCCS())
3230 .EE
3231 .IP
3232 Note that
3233 .B scons
3234 will fetch source files
3235 from SCCS subdirectories automatically,
3236 so configuring SCCS
3237 as demonstrated in the above example
3238 should only be necessary if
3239 you are fetching from
3240 .I s.SCCS
3241 files in the same
3242 directory as the source files,
3243 or if you need to explicitly specify SCCS
3244 for a specific subdirectory.
3245
3246 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3247 .TP
3248 .RI SConscript( scripts ", [" exports ", " build_dir ", " src_dir ", " duplicate ])
3249 .TP
3250 .RI env.SConscript( scripts ", [" exports ", " build_dir ", " src_dir ", " duplicate ])
3251 .TP
3252 .RI SConscript(dirs= subdirs ", [name=" script ", " exports ", " build_dir ", " src_dir ", " duplicate ])
3253 .TP
3254 .RI env.SConscript(dirs= subdirs ", [name=" script ", " exports ", " build_dir ", " src_dir ", " duplicate ])
3255 This tells
3256 .B scons
3257 to execute
3258 one or more subsidiary SConscript (configuration) files.
3259 There are two ways to call the
3260 .BR SConscript ()
3261 function.
3262
3263 The first way you can call
3264 .BR SConscript ()
3265 is to explicitly specify one or more
3266 .I scripts
3267 as the first argument.
3268 A single script may be specified as a string;
3269 multiple scripts must be specified as a list
3270 (either explicitly or as created by
3271 a function like
3272 .BR Split ()).
3273
3274 The second way you can call
3275 .BR SConscript ()
3276 is to specify a list of (sub)directory names
3277 as a
3278 .RI dirs= subdirs
3279 keyword argument.
3280 In this case,
3281 .B scons
3282 will, by default,
3283 execute a subsidiary configuration file named
3284 .B SConscript
3285 in each of the specified directories.
3286 You may specify a name other than
3287 .B SConscript
3288 by supplying an optional
3289 .RI name= script
3290 keyword argument.
3291
3292 The optional 
3293 .I exports
3294 argument provides a list of variable names or a dictionary of
3295 named values to export to the
3296 .IR script(s) ". "
3297 These variables are locally exported only to the specified
3298 .IR script(s) ,
3299 and do not affect the
3300 global pool of variables used by
3301 the
3302 .BR Export ()
3303 function.
3304 '\"If multiple dirs are provided,
3305 '\"each script gets a fresh export.
3306 The subsidiary
3307 .I script(s)
3308 must use the
3309 .BR Import ()
3310 function to import the variables.
3311
3312 The optional
3313 .I build_dir
3314 argument specifies that all of the target files
3315 (for example, object files and executables)
3316 that would normally be built in the subdirectory in which
3317 .I script
3318 resides should actually
3319 be built in
3320 .IR build_dir .
3321
3322 The optional
3323 .I src_dir
3324 argument specifies that the
3325 source files from which
3326 the target files should be built
3327 can be found in
3328 .IR src_dir .
3329
3330 By default,
3331 .B scons
3332 will link or copy (depending on the platform)
3333 all the source files into the build directory.
3334 This behavior may be disabled by
3335 setting the optional
3336 .I duplicate
3337 argument to 0
3338 (it is set to 1 by default),
3339 in which case
3340 .B scons
3341 will refer directly to
3342 the source files in their source directory
3343 when building target files.
3344 (Setting
3345 .IR duplicate =0
3346 is usually safe, and always more efficient
3347 than the default of
3348 .IR duplicate =1,
3349 but it may cause build problems in certain end-cases,
3350 such as compiling from source files that
3351 are generated by the build.)
3352
3353 Any variables returned by 
3354 .I script 
3355 using 
3356 .BR Return ()
3357 will be returned by the call to
3358 .BR SConscript (). 
3359
3360 Examples:
3361
3362 .ES
3363 SConscript('subdir/SConscript')
3364 foo = SConscript('sub/SConscript', exports='env')
3365 SConscript('dir/SConscript', exports=['env', 'variable'])
3366 SConscript('src/SConscript', build_dir='build', duplicate=0)
3367 SConscript('bld/SConscript', src_dir='src', exports='env variable')
3368 SConscript(dirs=['sub1', 'sub2'])
3369 SConscript(dirs=['sub3', 'sub4'], name='MySConscript')
3370 .EE
3371
3372 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3373 .TP
3374 .RI SConscriptChdir( value )
3375 .TP
3376 .RI env.SConscriptChdir( value )
3377 By default,
3378 .B scons
3379 changes its working directory
3380 to the directory in which each
3381 subsidiary SConscript file lives.
3382 This behavior may be disabled
3383 by specifying either:
3384
3385 .ES
3386 SConscriptChdir(0)
3387 env.SConscriptChdir(0)
3388 .EE
3389 .IP
3390 in which case
3391 .B scons
3392 will stay in the top-level directory
3393 while reading all SConscript files.
3394 (This may be necessary when building from repositories,
3395 when all the directories in which SConscript files may be found
3396 don't necessarily exist locally.)
3397
3398 You may enable and disable
3399 this ability by calling
3400 SConscriptChdir()
3401 multiple times:
3402
3403 .ES
3404 env = Environment()
3405 SConscriptChdir(0)
3406 SConscript('foo/SConscript')    # will not chdir to foo
3407 env.SConscriptChdir(1)
3408 SConscript('bar/SConscript')    # will chdir to bar
3409 .EE
3410
3411 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3412 .TP
3413 .RI SConsignFile([ file , dbm_module ])
3414 .TP
3415 .RI env.SConsignFile([ file , dbm_module ])
3416 This tells
3417 .B scons
3418 to store all file signatures
3419 in the specified
3420 .IR file .
3421 If the
3422 .I file
3423 is omitted,
3424 .B .sconsign.dbm
3425 is used by default.
3426 If
3427 .I file
3428 is not an absolute path name,
3429 the file is placed in the same directory as the top-level
3430 .B SConstruct
3431 file.
3432
3433 The optional
3434 .I dbm_module
3435 argument can be used to specify
3436 which Python database module
3437 The default is to use a custom
3438 .B SCons.dblite
3439 module that uses pickled
3440 Python data structures,
3441 and which works on all Python versions from 1.5.2 on.
3442
3443 Examples:
3444
3445 .ES
3446 # Stores signatures in ".sconsign.dbm"
3447 # in the top-level SConstruct directory.
3448 SConsignFile()
3449
3450 # Stores signatures in the file "etc/scons-signatures"
3451 # relative to the top-level SConstruct directory.
3452 SConsignFile("etc/scons-signatures")
3453
3454 # Stores signatures in the specified absolute file name.
3455 SConsignFile("/home/me/SCons/signatures")
3456 .EE
3457
3458 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3459 .TP
3460 .RI SetOption( name ", " value )
3461 .TP
3462 .RI env.SetOption( name ", " value )
3463 This function provides a way to set a select subset of the scons command
3464 line options from a SConscript file. The options supported are:
3465 .B clean
3466 which corresponds to -c, --clean, and --remove;
3467 .B duplicate
3468 which 
3469 corresponds to --duplicate;
3470 .B implicit_cache
3471 which corresponds to --implicit-cache;
3472 .B max_drift
3473 which corresponds to --max-drift;
3474 .B num_jobs
3475 which corresponds to -j and --jobs;
3476 .B save_explain_info
3477 which corresponds to --save-explain-info.
3478 See the documentation for the
3479 corresponding command line object for information about each specific
3480 option. Example:
3481
3482 .ES
3483 SetOption('max_drift', 1)
3484 .EE
3485
3486 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3487 .TP
3488 .RI SideEffect( side_effect ", " target )
3489 .TP
3490 .RI env.SideEffect( side_effect ", " target )
3491 Declares
3492 .I side_effect
3493 as a side effect of building
3494 .IR target . 
3495 Both 
3496 .I side_effect 
3497 and
3498 .I target
3499 can be a list, a file name, or a node.
3500 A side effect is a target that is created
3501 as a side effect of building other targets.
3502 For example, a Windows PDB
3503 file is created as a side effect of building the .obj
3504 files for a static library.
3505 If a target is a side effect of multiple build commands,
3506 .B scons
3507 will ensure that only one set of commands
3508 is executed at a time.
3509 Consequently, you only need to use this method
3510 for side-effect targets that are built as a result of
3511 multiple build commands.
3512
3513 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3514 .TP
3515 .RI SourceCode( entries ", " builder )
3516 .TP
3517 .RI env.SourceCode( entries ", " builder )
3518 Arrange for non-existent source files to
3519 be fetched from a source code management system
3520 using the specified
3521 .IR builder .
3522 The specified
3523 .I entries
3524 may be a Node, string or list of both,
3525 and may represent either individual
3526 source files or directories in which
3527 source files can be found.
3528
3529 For any non-existent source files,
3530 .B scons
3531 will search up the directory tree
3532 and use the first
3533 .B SourceCode
3534 builder it finds.
3535 The specified
3536 .I builder
3537 may be
3538 .BR None ,
3539 in which case
3540 .B scons
3541 will not use a builder to fetch
3542 source files for the specified
3543 .IR entries ,
3544 even if a
3545 .B SourceCode
3546 builder has been specified
3547 for a directory higher up the tree.
3548
3549 .B scons
3550 will, by default,
3551 fetch files from SCCS or RCS subdirectories
3552 without explicit configuration.
3553 This takes some extra processing time
3554 to search for the necessary
3555 source code management files on disk.
3556 You can avoid these extra searches
3557 and speed up your build a little
3558 by disabling these searches as follows:
3559
3560 .ES
3561 env.SourceCode('.', None)
3562 .EE
3563
3564 .IP
3565 Note that if the specified
3566 .I builder
3567 is one you create by hand,
3568 it must have an associated
3569 construction environment to use
3570 when fetching a source file.
3571
3572 .B scons
3573 provides a set of canned factory
3574 functions that return appropriate
3575 Builders for various popular
3576 source code management systems.
3577 Canonical examples of invocation include:
3578
3579 .ES
3580 env.SourceCode('.', env.BitKeeper('/usr/local/BKsources'))
3581 env.SourceCode('src', env.CVS('/usr/local/CVSROOT'))
3582 env.SourceCode('/', env.RCS())
3583 env.SourceCode(['f1.c', 'f2.c'], env.SCCS())
3584 env.SourceCode('no_source.c', None)
3585 .EE
3586 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion'))
3587 '\"
3588 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3589 '\".TP
3590 '\".RI Subversion( repository ", " module )
3591 '\"A factory function that
3592 '\"returns a Builder object
3593 '\"to be used to fetch source files
3594 '\"from the specified Subversion
3595 '\".IR repository .
3596 '\"The returned Builder
3597 '\"is intended to be passed to the
3598 '\".B SourceCode
3599 '\"function.
3600 '\"
3601 '\"The optional specified
3602 '\".I module
3603 '\"will be added to the beginning
3604 '\"of all repository path names;
3605 '\"this can be used, in essence,
3606 '\"to strip initial directory names
3607 '\"from the repository path names,
3608 '\"so that you only have to
3609 '\"replicate part of the repository
3610 '\"directory hierarchy in your
3611 '\"local build directory:
3612 '\"
3613 '\".ES
3614 '\"# Will fetch foo/bar/src.c
3615 '\"# from /usr/local/Subversion/foo/bar/src.c.
3616 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion'))
3617 '\"
3618 '\"# Will fetch bar/src.c
3619 '\"# from /usr/local/Subversion/foo/bar/src.c.
3620 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion', 'foo'))
3621 '\"
3622 '\"# Will fetch src.c
3623 '\"# from /usr/local/Subversion/foo/bar/src.c.
3624 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion', 'foo/bar'))
3625 '\".EE
3626
3627 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3628 .TP
3629 .RI SourceSignatures( type )
3630 .TP
3631 .RI env.SourceSignatures( type )
3632 This function tells SCons what type of signature to use for source files:
3633 .B "MD5"
3634 or
3635 .BR "timestamp" .
3636 If the environment method is used,
3637 the specified type of source signature
3638 is only used when deciding whether targets
3639 built with that environment are up-to-date or must be rebuilt.
3640 If the global function is used,
3641 the specified type of source signature becomes the default
3642 used for all decisions
3643 about whether targets are up-to-date.
3644
3645 "MD5" means the signature of a source file
3646 is the MD5 checksum of its contents.
3647 "timestamp" means the signature of a source file
3648 is its timestamp (modification time).
3649 There is no different between the two behaviors
3650 for Python
3651 .BR Value ()
3652 node objects.
3653 "MD5" signatures take longer to compute,
3654 but are more accurate than "timestamp" signatures.
3655 The default is "MD5".
3656
3657 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3658 .TP
3659 .RI Split( arg )
3660 .TP
3661 .RI env.Split( arg )
3662 Returns a list of file names or other objects.
3663 If arg is a string,
3664 it will be split on strings of white-space characters
3665 within the string,
3666 making it easier to write long lists of file names.
3667 If arg is already a list,
3668 the list will be returned untouched.
3669 If arg is any other type of object,
3670 it will be returned as a list
3671 containing just the object.
3672
3673 .ES
3674 files = Split("f1.c f2.c f3.c")
3675 files = env.Split("f4.c f5.c f6.c")
3676 files = Split("""
3677         f7.c
3678         f8.c
3679         f9.c
3680 """)
3681 .EE
3682
3683 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3684 .TP
3685 .RI TargetSignatures( type )
3686 .TP
3687 .RI env.TargetSignatures( type )
3688 This function tells SCons what type of signatures to use
3689 for target files:
3690 .B "build"
3691 or
3692 .BR "content" .
3693 If the environment method is used,
3694 the specified type of signature is only used
3695 for targets built with that environment.
3696 If the global function is used,
3697 the specified type of signature becomes the default
3698 used for all target files that
3699 don't have an explicit target signature type
3700 specified for their environments.
3701
3702 "build" means the signature of a target file
3703 is made by concatenating all of the
3704 signatures of all its source files.
3705 "content" means the signature of a target
3706 file is an MD5 checksum of its contents.
3707 "build" signatures are usually faster to compute,
3708 but "content" signatures can prevent unnecessary rebuilds
3709 when a target file is rebuilt to the exact same contents
3710 as the previous build.
3711 The default is "build".
3712
3713 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3714 .TP
3715 .RI Tool( string, toolpath=[] )
3716 Returns a callable object
3717 that can be used to initialize
3718 a construction environment using the
3719 tools keyword of the Environment() method.
3720 The object may be called with a construction
3721 environment as an argument,
3722 in which case the object will be
3723 add the necessary variables
3724 to the construction environment
3725 and the name of the tool will be added to the
3726 .B $TOOLS
3727 construction variable.
3728
3729 .ES
3730 env = Environment(tools = [ Tool('msvc') ])
3731
3732 env = Environment()
3733 t = Tool('msvc')
3734 t(env)  # adds 'msvc' to the TOOLS variable
3735 u = Tool('opengl', toolpath = ['tools'])
3736 u(env)  # adds 'opengl' to the TOOLS variable
3737 .EE
3738 .TP
3739 .RI env.Tool( string [, toolpath] )
3740 Applies the callable object for the specified tool
3741 .I string
3742 to the environment through which the method was called.
3743
3744 .ES
3745 env.Tool('gcc')
3746 env.Tool('opengl', toolpath = ['build/tools'])
3747 .EE
3748
3749 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3750 .TP
3751 .RI Value( value )
3752 .TP
3753 .RI env.Value( value )
3754 Returns a Node object representing the specified Python value.  Value
3755 nodes can be used as dependencies of targets.  If the result of
3756 calling
3757 .BR str( value )
3758 changes between SCons runs, any targets depending on
3759 .BR Value( value )
3760 will be rebuilt.  When using timestamp source signatures, Value nodes'
3761 timestamps are equal to the system time when the node is created.
3762
3763 .ES
3764 def create(target, source, env):
3765     f = open(str(target[0]), 'wb')
3766     f.write('prefix=' + source[0].get_contents())
3767     
3768 prefix = ARGUMENTS.get('prefix', '/usr/local')
3769 env = Environment()
3770 env['BUILDERS']['Config'] = Builder(action = create)
3771 env.Config(target = 'package-config', source = Value(prefix))
3772 .EE
3773
3774 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3775 .TP
3776 .RI WhereIs( program ", [" path  ", " pathext ", " reject ])
3777 .TP
3778 .RI env.WhereIs( program ", [" path  ", " pathext ", " reject ])
3779
3780 Searches for the specified executable
3781 .I program,
3782 returning the full path name to the program
3783 if it is found,
3784 and returning None if not.
3785 Searches the specified
3786 .I path,
3787 the value of the calling environment's PATH
3788 (env['ENV']['PATH']),
3789 or the user's current external PATH
3790 (os.environ['PATH'])
3791 by default.
3792 On Win32 systems, searches for executable
3793 programs with any of the file extensions
3794 listed in the specified
3795 .I pathext,
3796 the calling environment's PATHEXT
3797 (env['ENV']['PATHEXT'])
3798 or the user's current PATHEXT
3799 (os.environ['PATHEXT'])
3800 by default.
3801 Will not select any
3802 path name or names
3803 in the specified
3804 .I reject
3805 list, if any.
3806
3807 .SS SConscript Variables
3808 In addition to the global functions and methods,
3809 .B scons
3810 supports a number of Python variables
3811 that can be used in SConscript files
3812 to affect how you want the build to be performed.
3813
3814 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3815 .TP
3816 ARGLIST
3817 A list
3818 .IR keyword = value
3819 arguments specified on the command line.
3820 Each element in the list is a tuple
3821 containing the
3822 .RI ( keyword , value )
3823 of the argument.
3824 The separate
3825 .I keyword
3826 and
3827 .I value
3828 elements of the tuple
3829 can be accessed by
3830 subscripting for element
3831 .B [0]
3832 and
3833 .B [1]
3834 of the tuple, respectively.
3835
3836 .ES
3837 print "first keyword, value =", ARGLIST[0][0], ARGLIST[0][1]
3838 print "second keyword, value =", ARGLIST[1][0], ARGLIST[1][1]
3839 third_tuple = ARGLIST[2]
3840 print "third keyword, value =", third_tuple[0], third_tuple[1]
3841 for key, value in ARGLIST:
3842     # process key and value
3843 .EE
3844
3845 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3846 .TP
3847 ARGUMENTS
3848 A dictionary of all the
3849 .IR keyword = value
3850 arguments specified on the command line.
3851 The dictionary is not in order,
3852 and if a given keyword has
3853 more than one value assigned to it
3854 on the command line,
3855 the last (right-most) value is
3856 the one in the
3857 .B ARGUMENTS
3858 dictionary.
3859
3860 .ES
3861 if ARGUMENTS.get('debug', 0):
3862     env = Environment(CCFLAGS = '-g')
3863 else:
3864     env = Environment()
3865 .EE
3866
3867 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3868 .TP
3869 BUILD_TARGETS
3870 A list of the targets which
3871 .B scons
3872 will actually try to build,
3873 regardless of whether they were specified on
3874 the command line or via the
3875 .BR Default ()
3876 function or method.
3877 The elements of this list may be strings
3878 .I or
3879 nodes, so you should run the list through the Python
3880 .B str
3881 function to make sure any Node path names
3882 are converted to strings.
3883
3884 Because this list may be taken from the
3885 list of targets specified using the
3886 .BR Default ()
3887 function or method,
3888 the contents of the list may change
3889 on each successive call to
3890 .BR Default ().
3891 See the
3892 .B DEFAULT_TARGETS
3893 list, below,
3894 for additional information.
3895
3896 .ES
3897 if 'foo' in BUILD_TARGETS:
3898     print "Don't forget to test the `foo' program!"
3899 if 'special/program' in BUILD_TARGETS:
3900     SConscript('special')
3901 .EE
3902 .IP
3903 Note that the
3904 .B BUILD_TARGETS
3905 list only contains targets expected listed
3906 on the command line or via calls to the
3907 .BR Default ()
3908 function or method.
3909 It does
3910 .I not
3911 contain all dependent targets that will be built as
3912 a result of making the sure the explicitly-specified
3913 targets are up to date.
3914
3915 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3916 .TP
3917 COMMAND_LINE_TARGETS
3918 A list of the targets explicitly specified on
3919 the command line.
3920 If there are no targets specified on the command line,
3921 the list is empty.
3922 This can be used, for example,
3923 to take specific actions only
3924 when a certain target or targets
3925 is explicitly being built:
3926
3927 .ES
3928 if 'foo' in COMMAND_LINE_TARGETS:
3929     print "Don't forget to test the `foo' program!"
3930 if 'special/program' in COMMAND_LINE_TARGETS:
3931     SConscript('special')
3932 .EE
3933
3934 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3935 .TP
3936 DEFAULT_TARGETS
3937 A list of the target
3938 .I nodes
3939 that have been specified using the
3940 .BR Default ()
3941 function or method.
3942 The elements of the list are nodes,
3943 so you need to run them through the Python
3944 .B str
3945 function to get at the path name for each Node.
3946
3947 .ES
3948 print str(DEFAULT_TARGETS[0])
3949 if 'foo' in map(str, DEFAULT_TARGETS):
3950     print "Don't forget to test the `foo' program!"
3951 .EE
3952 .IP
3953 The contents of the
3954 .B DEFAULT_TARGETS
3955 list change on on each successive call to the
3956 .BR Default ()
3957 function:
3958
3959 .ES
3960 print map(str, DEFAULT_TARGETS)   # originally []
3961 Default('foo')
3962 print map(str, DEFAULT_TARGETS)   # now a node ['foo']
3963 Default('bar')
3964 print map(str, DEFAULT_TARGETS)   # now a node ['foo', 'bar']
3965 Default(None)
3966 print map(str, DEFAULT_TARGETS)   # back to []
3967 .EE
3968 .IP
3969 Consequently, be sure to use
3970 .B DEFAULT_TARGETS
3971 only after you've made all of your
3972 .BR Default ()
3973 calls,
3974 or else simply be careful of the order
3975 of these statements in your SConscript files
3976 so that you don't look for a specific
3977 default target before it's actually been added to the list.
3978
3979 .SS Construction Variables
3980 .\" XXX From Gary Ruben, 23 April 2002:
3981 .\" I think it would be good to have an example with each construction
3982 .\" variable description in the documentation.
3983 .\" eg.
3984 .\" CC     The C compiler
3985 .\"    Example: env["CC"] = "c68x"
3986 .\"    Default: env["CC"] = "cc"
3987 .\" 
3988 .\" CCCOM  The command line ...
3989 .\"    Example:
3990 .\"        To generate the compiler line c68x -ps -qq -mr -o $TARGET $SOURCES
3991 .\"        env["CC"] = "c68x"
3992 .\"        env["CFLAGS"] = "-ps -qq -mr"
3993 .\"        env["CCCOM"] = "$CC $CFLAGS -o $TARGET $SOURCES
3994 .\"    Default:
3995 .\"        (I dunno what this is ;-)
3996 A construction environment has an associated dictionary of
3997 .I construction variables
3998 that are used by built-in or user-supplied build rules.
3999 Construction variables must follow the same rules for
4000 Python identifiers:
4001 the initial character must be an underscore or letter,
4002 followed by any number of underscores, letters, or digits.
4003
4004 A number of useful construction variables are automatically defined by
4005 scons for each supported platform, and additional construction variables
4006 can be defined by the user. The following is a list of the automatically
4007 defined construction variables:
4008
4009 .IP AR
4010 The static library archiver.
4011
4012 .IP ARCOM
4013 The command line used to generate a static library from object files.
4014
4015 .IP ARFLAGS
4016 General options passed to the static library archiver.
4017
4018 .IP AS
4019 The assembler.
4020
4021 .IP ASCOM
4022 The command line used to generate an object file
4023 from an assembly-language source file.
4024
4025 .IP ASFLAGS
4026 General options passed to the assembler.
4027
4028 .IP ASPPCOM
4029 The command line used to assemble an assembly-language
4030 source file into an object file
4031 after first running the file through the C preprocessor.
4032 Any options specified in the $ASFLAGS and $CPPFLAGS construction variables
4033 are included on this command line.
4034
4035 .IP BIBTEX
4036 The bibliography generator for the TeX formatter and typesetter and the
4037 LaTeX structured formatter and typesetter.
4038
4039 .IP BIBTEXCOM
4040 The command line used to call the bibliography generator for the
4041 TeX formatter and typesetter and the LaTeX structured formatter and
4042 typesetter.
4043
4044 .IP BIBTEXFLAGS
4045 General options passed to the bibliography generator for the TeX formatter
4046 and typesetter and the LaTeX structured formatter and typesetter.
4047
4048 .IP BITKEEPER
4049 The BitKeeper executable.
4050
4051 .IP BITKEEPERCOM
4052 The command line for
4053 fetching source files using BitKEeper.
4054
4055 .IP BITKEEPERGET
4056 The command ($BITKEEPER) and subcommand
4057 for fetching source files using BitKeeper.
4058
4059 .IP BITKEEPERGETFLAGS
4060 Options that are passed to the BitKeeper
4061 .B get
4062 subcommand.
4063
4064 .IP BUILDERS
4065 A dictionary mapping the names of the builders
4066 available through this environment
4067 to underlying Builder objects.
4068 Builders named
4069 Alias, CFile, CXXFile, DVI, Library, Object, PDF, PostScript, and Program
4070 are available by default.
4071 If you initialize this variable when an
4072 Environment is created:
4073
4074 .ES
4075 env = Environment(BUILDERS = {'NewBuilder' : foo})
4076 .EE
4077 .IP
4078 the default Builders will no longer be available.
4079 To use a new Builder object in addition to the default Builders,
4080 add your new Builder object like this:
4081
4082 .ES
4083 env = Environment()
4084 env.Append(BUILDERS = {'NewBuilder' : foo})
4085 .EE
4086 .IP
4087 or this:
4088
4089 .ES
4090 env = Environment()
4091 env['BUILDERS]['NewBuilder'] = foo
4092 .EE
4093
4094 .IP CC 
4095 The C compiler.
4096
4097 .IP CCCOM 
4098 The command line used to compile a C source file to a (static) object file.
4099 Any options specified in the $CCFLAGS and $CPPFLAGS construction variables
4100 are included on this command line.
4101
4102 .IP CCFLAGS 
4103 General options that are passed to the C compiler.
4104
4105 .IP CFILESUFFIX
4106 The suffix for C source files.
4107 This is used by the internal CFile builder
4108 when generating C files from Lex (.l) or YACC (.y) input files.
4109 The default suffix, of course, is
4110 .I .c
4111 (lower case).
4112 On case-insensitive systems (like Win32),
4113 SCons also treats
4114 .I .C
4115 (upper case) files
4116 as C files.
4117
4118 .IP CCVERSION
4119 The version number of the C compiler.
4120 This may or may not be set,
4121 depending on the specific C compiler being used.
4122
4123 .IP _concat
4124 A function used to produce variables like $_CPPINCFLAGS. It takes
4125 four or five
4126 arguments: a prefix to concatenate onto each element, a list of
4127 elements, a suffix to concatenate onto each element, an environment
4128 for variable interpolation, and an optional function that will be
4129 called to transform the list before concatenation.
4130
4131 .ES
4132 env['_CPPINCFLAGS'] = '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs)} $)',
4133 .EE
4134
4135 .IP CPPDEFINES
4136 A platform independent specification of C preprocessor definitions.
4137 The definitions will be added to command lines
4138 through the automatically-generated
4139 $_CPPDEFFLAGS construction variable (see below),
4140 which is constructed according to
4141 the type of value of $CPPDEFINES:
4142
4143 .IP
4144 If $CPPDEFINES is a string,
4145 the values of the
4146 $CPPDEFPREFIX and $CPPDEFSUFFIX
4147 construction variables
4148 will be added to the beginning and end.
4149
4150 .ES
4151 # Will add -Dxyz to POSIX compiler command lines,
4152 # and /Dxyz to Microsoft Visual C++ command lines.
4153 env = Environment(CPPDEFINES='xyz')
4154 .EE
4155
4156 .IP
4157 If $CPPDEFINES is a list,
4158 the values of the
4159 $CPPDEFPREFIX and $CPPDEFSUFFIX
4160 construction variables
4161 will be appended to the beginning and end
4162 of each element in the list.
4163 If any element is a list or tuple,
4164 then the first item is the name being
4165 defined and the second item is its value:
4166
4167 .ES
4168 # Will add -DB=2 -DA to POSIX compiler command lines,
4169 # and /DB=2 /DA to Microsoft Visual C++ command lines.
4170 env = Environment(CPPDEFINES=[('B', 2), 'A'])
4171 .EE
4172
4173 .IP
4174 If $CPPDEFINES is a dictionary,
4175 the values of the
4176 $CPPDEFPREFIX and $CPPDEFSUFFIX
4177 construction variables
4178 will be appended to the beginning and end
4179 of each item from the dictionary.
4180 The key of each dictionary item
4181 is a name being defined
4182 to the dictionary item's corresponding value;
4183 if the value is
4184 .BR None ,
4185 then the name is defined without an explicit value.
4186 Note that the resulting flags are sorted by keyword
4187 to ensure that the order of the options on the
4188 command line is consistent each time
4189 .B scons
4190  is run.
4191
4192 .ES
4193 # Will add -DA -DB=2 to POSIX compiler command lines,
4194 # and /DA /DB=2 to Microsoft Visual C++ command lines.
4195 env = Environment(CPPDEFINES={'B':2, 'A':None})
4196 .EE
4197
4198 .IP _CPPDEFFLAGS
4199 An automatically-generated construction variable
4200 containing the C preprocessor command-line options
4201 to define values.
4202 The value of $_CPPDEFFLAGS is created
4203 by appending $CPPDEFPREFIX and $CPPDEFSUFFIX
4204 to the beginning and end
4205 of each directory in $CPPDEFINES.
4206
4207 .IP CPPDEFPREFIX
4208 The prefix used to specify preprocessor definitions
4209 on the C compiler command line.
4210 This will be appended to the beginning of each definition
4211 in the $CPPDEFINES construction variable
4212 when the $_CPPDEFFLAGS variable is automatically generated.
4213
4214 .IP CPPDEFSUFFIX
4215 The suffix used to specify preprocessor definitions
4216 on the C compiler command line.
4217 This will be appended to the end of each definition
4218 in the $CPPDEFINES construction variable
4219 when the $_CPPDEFFLAGS variable is automatically generated.
4220
4221 .IP CPPFLAGS
4222 User-specified C preprocessor options.
4223 These will be included in any command that uses the C preprocessor,
4224 including not just compilation of C and C++ source files
4225 via the $CCCOM, $SHCCCOM, $CXXCOM and $SHCXXCOM command lines,
4226 but also the $FORTRANPPCOM, $SHFORTRANPPCOM,
4227 $F77PPCOM and $SHF77PPCOM command lines
4228 used to compile a Fortran source file,
4229 and the $ASPPCOM command line
4230 used to assemble an assembly language source file,
4231 after first running each file through the C preprocessor.
4232 Note that this variable does
4233 .I not
4234 contain
4235 .B -I
4236 (or similar) include search path options
4237 that scons generates automatically from $CPPPATH.
4238 See
4239 .BR _CPPINCFLAGS ,
4240 below,
4241 for the variable that expands to those options.
4242
4243 .IP _CPPINCFLAGS
4244 An automatically-generated construction variable
4245 containing the C preprocessor command-line options
4246 for specifying directories to be searched for include files.
4247 The value of $_CPPINCFLAGS is created
4248 by appending $INCPREFIX and $INCSUFFIX
4249 to the beginning and end
4250 of each directory in $CPPPATH.
4251
4252 .IP CPPPATH
4253 The list of directories that the C preprocessor will search for include
4254 directories. The C/C++ implicit dependency scanner will search these
4255 directories for include files. Don't explicitly put include directory
4256 arguments in CCFLAGS or CXXFLAGS because the result will be non-portable
4257 and the directories will not be searched by the dependency scanner. Note:
4258 directory names in CPPPATH will be looked-up relative to the SConscript
4259 directory when they are used in a command. To force 
4260 .B scons
4261 to look-up a directory relative to the root of the source tree use #:
4262
4263 .ES
4264 env = Environment(CPPPATH='#/include')
4265 .EE
4266
4267 .IP
4268 The directory look-up can also be forced using the 
4269 .BR Dir ()
4270 function:
4271
4272 .ES
4273 include = Dir('include')
4274 env = Environment(CPPPATH=include)
4275 .EE
4276
4277 .IP
4278 The directory list will be added to command lines
4279 through the automatically-generated
4280 $_CPPINCFLAGS
4281 construction variable,
4282 which is constructed by
4283 appending the values of the
4284 $INCPREFIX and $INCSUFFIX
4285 construction variables
4286 to the beginning and end
4287 of each directory in $CPPPATH.
4288 Any command lines you define that need
4289 the CPPPATH directory list should
4290 include $_CPPINCFLAGS:
4291
4292 .ES
4293 env = Environment(CCCOM="my_compiler $_CPPINCFLAGS -c -o $TARGET $SOURCE")
4294 .EE
4295
4296 .IP CPPSUFFIXES
4297 The list of suffixes of files that will be scanned
4298 for C preprocessor implicit dependencies
4299 (#include lines).
4300 The default list is:
4301
4302 .ES
4303 [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
4304  ".h", ".H", ".hxx", ".hpp", ".hh",
4305  ".F", ".fpp", ".FPP",
4306  ".S", ".spp", ".SPP"]
4307 .EE
4308
4309 .IP CVS
4310 The CVS executable.
4311
4312 .IP CVSCOFLAGS
4313 Options that are passed to the CVS checkout subcommand.
4314
4315 .IP CVSCOM
4316 The command line used to
4317 fetch source files from a CVS repository.
4318
4319 .IP CVSFLAGS
4320 General options that are passed to CVS.
4321 By default, this is set to
4322 "-d $CVSREPOSITORY"
4323 to specify from where the files must be fetched.
4324
4325 .IP CVSREPOSITORY
4326 The path to the CVS repository.
4327 This is referenced in the default
4328 $CVSFLAGS value.
4329
4330 .IP CXX
4331 The C++ compiler.
4332
4333 .IP CXXFILESUFFIX
4334 The suffix for C++ source files.
4335 This is used by the internal CXXFile builder
4336 when generating C++ files from Lex (.ll) or YACC (.yy) input files.
4337 The default suffix is
4338 .IR .cc .
4339 SCons also treats files with the suffixes
4340 .IR .cpp ,
4341 .IR .cxx ,
4342 .IR .c++ ,
4343 and
4344 .I .C++
4345 as C++ files.
4346 On case-sensitive systems (Linux, UNIX, and other POSIX-alikes),
4347 SCons also treats
4348 .I .C
4349 (upper case) files
4350 as C++ files.
4351
4352 .IP CXXCOM
4353 The command line used to compile a C++ source file to an object file.
4354 Any options specified in the $CXXFLAGS and $CPPFLAGS construction variables
4355 are included on this command line.
4356
4357 .IP CXXFLAGS 
4358 General options that are passed to the C++ compiler.
4359
4360 .IP CXXVERSION
4361 The version number of the C++ compiler.
4362 This may or may not be set,
4363 depending on the specific C++ compiler being used.
4364
4365 .IP Dir
4366 A function that converts a file name into a Dir instance relative to the
4367 target being built. 
4368
4369 .IP DSUFFIXES
4370 The list of suffixes of files that will be scanned
4371 for imported D package files.
4372 The default list is:
4373
4374 .ES
4375 ['.d']
4376 .EE
4377
4378 .IP DVIPDF
4379 The TeX DVI file to PDF file converter.
4380
4381 .IP DVIPDFFLAGS
4382 General options passed to the TeX DVI file to PDF file converter.
4383
4384 .IP DVIPDFCOM
4385 The command line used to convert TeX DVI files into a PDF file.
4386
4387 .IP DVIPS
4388 The TeX DVI file to PostScript converter.
4389
4390 .IP DVIPSFLAGS
4391 General options passed to the TeX DVI file to PostScript converter.
4392
4393 .IP ENV
4394 A dictionary of environment variables
4395 to use when invoking commands. When ENV is used in a command all list
4396 values will be joined using the path separator and any other non-string
4397 values will simply be coerced to a string.
4398 Note that, by default,
4399 .B scons
4400 does
4401 .I not
4402 propagate the environment in force when you
4403 execute
4404 .B scons
4405 to the commands used to build target files.
4406 This is so that builds will be guaranteed
4407 repeatable regardless of the environment
4408 variables set at the time
4409 .B scons
4410 is invoked.
4411
4412 If you want to propagate your
4413 environment variables
4414 to the commands executed
4415 to build target files,
4416 you must do so explicitly:
4417
4418 .ES
4419 import os
4420 env = Environment(ENV = os.environ)
4421 .EE
4422
4423 .RS
4424 Note that you can choose only to propagate
4425 certain environment variables.
4426 A common example is
4427 the system
4428 .B PATH
4429 environment variable,
4430 so that
4431 .B scons
4432 uses the same utilities
4433 as the invoking shell (or other process):
4434 .RE
4435
4436 .ES
4437 import os
4438 env = Environment(ENV = {'PATH' : os.environ['PATH']})
4439 .EE
4440
4441 .IP ESCAPE
4442 A function that will be called to escape shell special characters in
4443 command lines. The function should take one argument: the command line
4444 string to escape; and should return the escaped command line.
4445
4446 .IP F77
4447 The Fortran 77 compiler.
4448 You should normally set the $FORTRAN variable,
4449 which specifies the default Fortran compiler
4450 for all Fortran versions.
4451 You only need to set $F77 if you need to use a specific compiler
4452 or compiler version for Fortran 77 files.
4453
4454 .IP F77COM
4455 The command line used to compile a Fortran 77 source file to an object file.
4456 You only need to set $F77COM if you need to use a specific
4457 command line for Fortran 77 files.
4458 You should normally set the $FORTRANCOM variable,
4459 which specifies the default command line
4460 for all Fortran versions.
4461
4462 .IP F77FLAGS
4463 General user-specified options that are passed to the Fortran 77 compiler.
4464 Note that this variable does
4465 .I not
4466 contain
4467 .B -I
4468 (or similar) include search path options
4469 that scons generates automatically from $F77PATH.
4470 See
4471 .BR _F77INCFLAGS ,
4472 below,
4473 for the variable that expands to those options.
4474 You only need to set $F77FLAGS if you need to define specific
4475 user options for Fortran 77 files.
4476 You should normally set the $FORTRANFLAGS variable,
4477 which specifies the user-specified options
4478 passed to the default Fortran compiler
4479 for all Fortran versions.
4480
4481 .IP _F77INCFLAGS
4482 An automatically-generated construction variable
4483 containing the Fortran 77 compiler command-line options
4484 for specifying directories to be searched for include files.
4485 The value of $_F77INCFLAGS is created
4486 by appending $INCPREFIX and $INCSUFFIX
4487 to the beginning and end
4488 of each directory in $F77PATH.
4489
4490 .IP F77PATH
4491 The list of directories that the Fortran 77 compiler will search for include
4492 directories. The implicit dependency scanner will search these
4493 directories for include files. Don't explicitly put include directory
4494 arguments in $F77FLAGS because the result will be non-portable
4495 and the directories will not be searched by the dependency scanner. Note:
4496 directory names in $F77PATH will be looked-up relative to the SConscript
4497 directory when they are used in a command. To force
4498 .B scons
4499 to look-up a directory relative to the root of the source tree use #:
4500 You only need to set $F77PATH if you need to define a specific
4501 include path for Fortran 77 files.
4502 You should normally set the $FORTRANPATH variable,
4503 which specifies the include path
4504 for the default Fortran compiler
4505 for all Fortran versions.
4506
4507 .ES
4508 env = Environment(F77PATH='#/include')
4509 .EE
4510
4511 .IP
4512 The directory look-up can also be forced using the
4513 .BR Dir ()
4514 function:
4515
4516 .ES
4517 include = Dir('include')
4518 env = Environment(F77PATH=include)
4519 .EE
4520
4521 .IP
4522 The directory list will be added to command lines
4523 through the automatically-generated
4524 $_F77INCFLAGS
4525 construction variable,
4526 which is constructed by
4527 appending the values of the
4528 $INCPREFIX and $INCSUFFIX
4529 construction variables
4530 to the beginning and end
4531 of each directory in $F77PATH.
4532 Any command lines you define that need
4533 the F77PATH directory list should
4534 include $_F77INCFLAGS:
4535
4536 .ES
4537 env = Environment(F77COM="my_compiler $_F77INCFLAGS -c -o $TARGET $SOURCE")
4538 .EE
4539
4540 .IP F77PPCOM
4541 The command line used to compile a Fortran 77 source file to an object file
4542 after first running the file through the C preprocessor.
4543 Any options specified in the $F77FLAGS and $CPPFLAGS construction variables
4544 are included on this command line.
4545 You only need to set $F77PPCOM if you need to use a specific
4546 C-preprocessor command line for Fortran 77 files.
4547 You should normally set the $FORTRANPPCOM variable,
4548 which specifies the default C-preprocessor command line
4549 for all Fortran versions.
4550
4551 .IP F90
4552 The Fortran 90 compiler.
4553 You should normally set the $FORTRAN variable,
4554 which specifies the default Fortran compiler
4555 for all Fortran versions.
4556 You only need to set $F90 if you need to use a specific compiler
4557 or compiler version for Fortran 90 files.
4558
4559 .IP F90COM
4560 The command line used to compile a Fortran 90 source file to an object file.
4561 You only need to set $F90COM if you need to use a specific
4562 command line for Fortran 90 files.
4563 You should normally set the $FORTRANCOM variable,
4564 which specifies the default command line
4565 for all Fortran versions.
4566
4567 .IP F90FLAGS
4568 General user-specified options that are passed to the Fortran 90 compiler.
4569 Note that this variable does
4570 .I not
4571 contain
4572 .B -I
4573 (or similar) include search path options
4574 that scons generates automatically from $F90PATH.
4575 See
4576 .BR _F90INCFLAGS ,
4577 below,
4578 for the variable that expands to those options.
4579 You only need to set $F90FLAGS if you need to define specific
4580 user options for Fortran 90 files.
4581 You should normally set the $FORTRANFLAGS variable,
4582 which specifies the user-specified options
4583 passed to the default Fortran compiler
4584 for all Fortran versions.
4585
4586 .IP _F90INCFLAGS
4587 An automatically-generated construction variable
4588 containing the Fortran 90 compiler command-line options
4589 for specifying directories to be searched for include files.
4590 The value of $_F90INCFLAGS is created
4591 by appending $INCPREFIX and $INCSUFFIX
4592 to the beginning and end
4593 of each directory in $F90PATH.
4594
4595 .IP F90PATH
4596 The list of directories that the Fortran 90 compiler will search for include
4597 directories. The implicit dependency scanner will search these
4598 directories for include files. Don't explicitly put include directory
4599 arguments in $F90FLAGS because the result will be non-portable
4600 and the directories will not be searched by the dependency scanner. Note:
4601 directory names in $F90PATH will be looked-up relative to the SConscript
4602 directory when they are used in a command. To force
4603 .B scons
4604 to look-up a directory relative to the root of the source tree use #:
4605 You only need to set $F90PATH if you need to define a specific
4606 include path for Fortran 90 files.
4607 You should normally set the $FORTRANPATH variable,
4608 which specifies the include path
4609 for the default Fortran compiler
4610 for all Fortran versions.
4611
4612 .ES
4613 env = Environment(F90PATH='#/include')
4614 .EE
4615
4616 .IP
4617 The directory look-up can also be forced using the
4618 .BR Dir ()
4619 function:
4620
4621 .ES
4622 include = Dir('include')
4623 env = Environment(F90PATH=include)
4624 .EE
4625
4626 .IP
4627 The directory list will be added to command lines
4628 through the automatically-generated
4629 $_F90INCFLAGS
4630 construction variable,
4631 which is constructed by
4632 appending the values of the
4633 $INCPREFIX and $INCSUFFIX
4634 construction variables
4635 to the beginning and end
4636 of each directory in $F90PATH.
4637 Any command lines you define that need
4638 the F90PATH directory list should
4639 include $_F90INCFLAGS:
4640
4641 .ES
4642 env = Environment(F90COM="my_compiler $_F90INCFLAGS -c -o $TARGET $SOURCE")
4643 .EE
4644
4645 .IP F90PPCOM
4646 The command line used to compile a Fortran 90 source file to an object file
4647 after first running the file through the C preprocessor.
4648 Any options specified in the $F90FLAGS and $CPPFLAGS construction variables
4649 are included on this command line.
4650 You only need to set $F90PPCOM if you need to use a specific
4651 C-preprocessor command line for Fortran 90 files.
4652 You should normally set the $FORTRANPPCOM variable,
4653 which specifies the default C-preprocessor command line
4654 for all Fortran versions.
4655
4656 .IP F95
4657 The Fortran 95 compiler.
4658 You should normally set the $FORTRAN variable,
4659 which specifies the default Fortran compiler
4660 for all Fortran versions.
4661 You only need to set $F95 if you need to use a specific compiler
4662 or compiler version for Fortran 95 files.
4663
4664 .IP F95COM
4665 The command line used to compile a Fortran 95 source file to an object file.
4666 You only need to set $F95COM if you need to use a specific
4667 command line for Fortran 95 files.
4668 You should normally set the $FORTRANCOM variable,
4669 which specifies the default command line
4670 for all Fortran versions.
4671
4672 .IP F95FLAGS
4673 General user-specified options that are passed to the Fortran 95 compiler.
4674 Note that this variable does
4675 .I not
4676 contain
4677 .B -I
4678 (or similar) include search path options
4679 that scons generates automatically from $F95PATH.
4680 See
4681 .BR _F95INCFLAGS ,
4682 below,
4683 for the variable that expands to those options.
4684 You only need to set $F95FLAGS if you need to define specific
4685 user options for Fortran 95 files.
4686 You should normally set the $FORTRANFLAGS variable,
4687 which specifies the user-specified options
4688 passed to the default Fortran compiler
4689 for all Fortran versions.
4690
4691 .IP _F95INCFLAGS
4692 An automatically-generated construction variable
4693 containing the Fortran 95 compiler command-line options
4694 for specifying directories to be searched for include files.
4695 The value of $_F95INCFLAGS is created
4696 by appending $INCPREFIX and $INCSUFFIX
4697 to the beginning and end
4698 of each directory in $F95PATH.
4699
4700 .IP F95PATH
4701 The list of directories that the Fortran 95 compiler will search for include
4702 directories. The implicit dependency scanner will search these
4703 directories for include files. Don't explicitly put include directory
4704 arguments in $F95FLAGS because the result will be non-portable
4705 and the directories will not be searched by the dependency scanner. Note:
4706 directory names in $F95PATH will be looked-up relative to the SConscript
4707 directory when they are used in a command. To force
4708 .B scons
4709 to look-up a directory relative to the root of the source tree use #:
4710 You only need to set $F95PATH if you need to define a specific
4711 include path for Fortran 95 files.
4712 You should normally set the $FORTRANPATH variable,
4713 which specifies the include path
4714 for the default Fortran compiler
4715 for all Fortran versions.
4716
4717 .ES
4718 env = Environment(F95PATH='#/include')
4719 .EE
4720
4721 .IP
4722 The directory look-up can also be forced using the
4723 .BR Dir ()
4724 function:
4725
4726 .ES
4727 include = Dir('include')
4728 env = Environment(F95PATH=include)
4729 .EE
4730
4731 .IP
4732 The directory list will be added to command lines
4733 through the automatically-generated
4734 $_F95INCFLAGS
4735 construction variable,
4736 which is constructed by
4737 appending the values of the
4738 $INCPREFIX and $INCSUFFIX
4739 construction variables
4740 to the beginning and end
4741 of each directory in $F95PATH.
4742 Any command lines you define that need
4743 the F95PATH directory list should
4744 include $_F95INCFLAGS:
4745
4746 .ES
4747 env = Environment(F95COM="my_compiler $_F95INCFLAGS -c -o $TARGET $SOURCE")
4748 .EE
4749
4750 .IP F95PPCOM
4751 The command line used to compile a Fortran 95 source file to an object file
4752 after first running the file through the C preprocessor.
4753 Any options specified in the $F95FLAGS and $CPPFLAGS construction variables
4754 are included on this command line.
4755 You only need to set $F95PPCOM if you need to use a specific
4756 C-preprocessor command line for Fortran 95 files.
4757 You should normally set the $FORTRANPPCOM variable,
4758 which specifies the default C-preprocessor command line
4759 for all Fortran versions.
4760
4761 .IP FORTRAN
4762 The default Fortran compiler
4763 for all versions of Fortran.
4764
4765 .IP FORTRANCOM 
4766 The command line used to compile a Fortran source file to an object file.
4767 By default, any options specified
4768 in the $FORTRANFLAGS, $CPPFLAGS, $_CPPDEFFLAGS, 
4769 $_FORTRANMODFLAG, and $_FORTRANINCFLAGS construction variables
4770 are included on this command line.
4771
4772 .IP FORTRANFLAGS
4773 General user-specified options that are passed to the Fortran compiler.
4774 Note that this variable does
4775 .I not
4776 contain
4777 .B -I
4778 (or similar) include or module search path options
4779 that scons generates automatically from $FORTRANPATH.
4780 See
4781 .BR _FORTRANINCFLAGS and _FORTRANMODFLAGS,
4782 below,
4783 for the variables that expand those options.
4784
4785 .IP _FORTRANINCFLAGS
4786 An automatically-generated construction variable
4787 containing the Fortran compiler command-line options
4788 for specifying directories to be searched for include 
4789 files and module files.
4790 The value of $_FORTRANINCFLAGS is created
4791 by prepending/appending $INCPREFIX and $INCSUFFIX
4792 to the beginning and end
4793 of each directory in $FORTRANPATH.
4794
4795 .IP FORTRANMODDIR
4796 Directory location where the Fortran compiler should place
4797 any module files it generates.  This variable is empty, by default. Some 
4798 Fortran compilers will internally append this directory in the search path 
4799 for module files, as well
4800
4801 .IP FORTRANMODDIRPREFIX
4802 The prefix used to specify a module directory on the Fortran compiler command
4803 line.
4804 This will be appended to the beginning of the directory
4805 in the $FORTRANMODDIR construction variables
4806 when the $_FORTRANMODFLAG variables is automatically generated.
4807
4808 .IP FORTRANMODDIRSUFFIX
4809 The suffix used to specify a module directory on the Fortran compiler command
4810 line.
4811 This will be appended to the beginning of the directory
4812 in the $FORTRANMODDIR construction variables
4813 when the $_FORTRANMODFLAG variables is automatically generated.
4814
4815 .IP FORTRANMODFLAG
4816 An automatically-generated construction variable
4817 containing the Fortran compiler command-line option
4818 for specifying the directory location where the Fortran
4819 compiler should place any module files that happen to get 
4820 generated during compilation.
4821 The value of $_FORTRANMODFLAG is created
4822 by prepending/appending $FORTRANMODDIRPREFIX and $FORTRANMODDIRSUFFIX
4823 to the beginning and end of the directory in $FORTRANMODDIR.
4824
4825 .IP FORTRANMODPREFIX
4826 The module file prefix used by the Fortran compiler.  SCons assumes that
4827 the Fortran compiler follows the quasi-standard naming convention for
4828 module files of
4829 .I <module_name>.mod.
4830 As a result, this variable is left empty, by default.  For situations in
4831 which the compiler does not necessarily follow the normal convention,
4832 the user may use this variable.  Its value will be appended to every
4833 module file name as scons attempts to resolve dependencies.
4834
4835 .IP FORTRANMODSUFFIX
4836 The module file suffix used by the Fortran compiler.  SCons assumes that
4837 the Fortran compiler follows the quasi-standard naming convention for
4838 module files of
4839 .I <module_name>.mod.
4840 As a result, this variable is set to ".mod", by default.  For situations
4841 in which the compiler does not necessarily follow the normal convention,
4842 the user may use this variable.  Its value will be appended to every
4843 module file name as scons attempts to resolve dependencies.
4844
4845 .IP FORTRANPATH
4846 The list of directories that the Fortran compiler will search for
4847 include files and (for some compilers) module files. The Fortran implicit
4848 dependency scanner will search these directories for include files (but
4849 not module files since they are autogenerated and, as such, may not
4850 actually exist at the time the scan takes place). Don't explicitly put
4851 include directory arguments in FORTRANFLAGS because the result will be
4852 non-portable and the directories will not be searched by the dependency
4853 scanner. Note: directory names in FORTRANPATH will be looked-up relative
4854 to the SConscript directory when they are used in a command. To force
4855 .B scons
4856 to look-up a directory relative to the root of the source tree use #:
4857
4858 .ES
4859 env = Environment(FORTRANPATH='#/include')
4860 .EE
4861
4862 .IP
4863 The directory look-up can also be forced using the 
4864 .BR Dir ()
4865 function:
4866
4867 .ES
4868 include = Dir('include')
4869 env = Environment(FORTRANPATH=include)
4870 .EE
4871
4872 .IP
4873 The directory list will be added to command lines
4874 through the automatically-generated
4875 $_FORTRANINCFLAGS
4876 construction variable,
4877 which is constructed by
4878 appending the values of the
4879 $INCPREFIX and $INCSUFFIX
4880 construction variables
4881 to the beginning and end
4882 of each directory in $FORTRANPATH.
4883 Any command lines you define that need
4884 the FORTRANPATH directory list should
4885 include $_FORTRANINCFLAGS:
4886
4887 .ES
4888 env = Environment(FORTRANCOM="my_compiler $_FORTRANINCFLAGS -c -o $TARGET $SOURCE")
4889 .EE
4890
4891 .IP FORTRANPPCOM 
4892 The command line used to compile a Fortran source file to an object file
4893 after first running the file through the C preprocessor. 
4894 By default, any options specified in the $FORTRANFLAGS, $CPPFLAGS,
4895 _CPPDEFFLAGS, $_FORTRANMODFLAG, and $_FORTRANINCFLAGS
4896 construction variables are included on this command line.
4897
4898 .IP FORTRANSUFFIXES
4899 The list of suffixes of files that will be scanned
4900 for Fortran implicit dependencies
4901 (INCLUDE lines & USE statements).
4902 The default list is:
4903
4904 .ES
4905 [".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
4906 ".f77", ".F77", ".f90", ".F90", ".f95", ".F95"]
4907 .EE
4908
4909 .IP File
4910 A function that converts a file name into a File instance relative to the
4911 target being built. 
4912
4913 .IP GS
4914 The Ghostscript program used to convert PostScript to PDF files.
4915
4916 .IP GSFLAGS
4917 General options passed to the Ghostscript program
4918 when converting PostScript to PDF files.
4919
4920 .IP GSCOM
4921 The Ghostscript command line used to convert PostScript to PDF files.
4922
4923 .IP IDLSUFFIXES
4924 The list of suffixes of files that will be scanned
4925 for IDL implicit dependencies
4926 (#include or import lines).
4927 The default list is:
4928
4929 .ES
4930 [".idl", ".IDL"]
4931 .EE
4932
4933 .IP INCPREFIX
4934 The prefix used to specify an include directory on the C compiler command
4935 line.
4936 This will be appended to the beginning of each directory
4937 in the $CPPPATH and $FORTRANPATH construction variables
4938 when the $_CPPINCFLAGS and $_FORTRANINCFLAGS
4939 variables are automatically generated.
4940
4941 .IP INCSUFFIX
4942 The suffix used to specify an include directory on the C compiler command
4943 line.
4944 This will be appended to the end of each directory
4945 in the $CPPPATH and $FORTRANPATH construction variables
4946 when the $_CPPINCFLAGS and $_FORTRANINCFLAGS
4947 variables are automatically generated.
4948
4949 .IP INSTALL
4950 A function to be called to install a file into a
4951 destination file name.
4952 The default function copies the file into the destination
4953 (and sets the destination file's mode and permission bits
4954 to match the source file's).
4955 The function takes the following arguments:
4956
4957 .ES
4958 def install(dest, source, env):
4959 .EE
4960 .IP
4961 .I dest
4962 is the path name of the destination file.
4963 .I source
4964 is the path name of the source file.
4965 .I env
4966 is the construction environment
4967 (a dictionary of construction values)
4968 in force for this file installation.
4969
4970 .IP JAR
4971 The Java archive tool.
4972
4973 .IP JARCHDIR
4974 The directory to which the Java archive tool should change
4975 (using the
4976 .B \-C
4977 option).
4978
4979 .IP JARCOM
4980 The command line used to call the Java archive tool.
4981
4982 .IP JARFLAGS
4983 General options passed to the Java archive tool.
4984 By default this is set to
4985 .B cf
4986 to create the necessary
4987 .I jar
4988 file.
4989
4990 .IP JARSUFFIX
4991 The suffix for Java archives:
4992 .B .jar
4993 by default.
4994
4995 .IP JAVAC
4996 The Java compiler.
4997
4998 .IP JAVACCOM
4999 The command line used to compile a directory tree containing
5000 Java source files to
5001 corresponding Java class files.
5002 Any options specified in the $JAVACFLAGS construction variable
5003 are included on this command line.
5004
5005 .IP JAVACFLAGS
5006 General options that are passed to the Java compiler.
5007
5008 .IP JAVACLASSDIR
5009 The directory in which Java class files may be found.
5010 This is stripped from the beginning of any Java .class
5011 file names supplied to the
5012 .B JavaH
5013 builder.
5014
5015 .IP JAVACLASSSUFFIX
5016 The suffix for Java class files;
5017 .B .class
5018 by default.
5019
5020 .IP JAVAH
5021 The Java generator for C header and stub files.
5022
5023 .IP JAVAHCOM
5024 The command line used to generate C header and stub files
5025 from Java classes.
5026 Any options specified in the $JAVAHFLAGS construction variable
5027 are included on this command line.
5028
5029 .IP JAVAHFLAGS
5030 General options passed to the C header and stub file generator
5031 for Java classes.
5032
5033 .IP JAVASUFFIX
5034 The suffix for Java files;
5035 .B .java
5036 by default.
5037
5038 .IP LATEX
5039 The LaTeX structured formatter and typesetter.
5040
5041 .IP LATEXCOM
5042 The command line used to call the LaTeX structured formatter and typesetter.
5043
5044 .IP LATEXFLAGS
5045 General options passed to the LaTeX structured formatter and typesetter.
5046
5047 .IP LEX
5048 The lexical analyzer generator.
5049
5050 .IP LEXFLAGS
5051 General options passed to the lexical analyzer generator.
5052
5053 .IP LEXCOM
5054 The command line used to call the lexical analyzer generator
5055 to generate a source file.
5056
5057 .IP _LIBDIRFLAGS
5058 An automatically-generated construction variable
5059 containing the linker command-line options
5060 for specifying directories to be searched for library.
5061 The value of $_LIBDIRFLAGS is created
5062 by appending $LIBDIRPREFIX and $LIBDIRSUFFIX
5063 to the beginning and end
5064 of each directory in $LIBPATH.
5065
5066 .IP LIBDIRPREFIX
5067 The prefix used to specify a library directory on the linker command line.
5068 This will be appended to the beginning of each directory
5069 in the $LIBPATH construction variable
5070 when the $_LIBDIRFLAGS variable is automatically generated.
5071
5072 .IP LIBDIRSUFFIX
5073 The suffix used to specify a library directory on the linker command line.
5074 This will be appended to the end of each directory
5075 in the $LIBPATH construction variable
5076 when the $_LIBDIRFLAGS variable is automatically generated.
5077
5078 .IP _LIBFLAGS
5079 An automatically-generated construction variable
5080 containing the linker command-line options
5081 for specifying libraries to be linked with the resulting target.
5082 The value of $_LIBFLAGS is created
5083 by appending $LIBLINKPREFIX and $LIBLINKSUFFIX
5084 to the beginning and end
5085 of each directory in $LIBS.
5086
5087 .IP LIBLINKPREFIX
5088 The prefix used to specify a library to link on the linker command line.
5089 This will be appended to the beginning of each library
5090 in the $LIBS construction variable
5091 when the $_LIBFLAGS variable is automatically generated.
5092
5093 .IP LIBLINKSUFFIX
5094 The suffix used to specify a library to link on the linker command line.
5095 This will be appended to the end of each library
5096 in the $LIBS construction variable
5097 when the $_LIBFLAGS variable is automatically generated.
5098
5099 .IP LIBPATH
5100 The list of directories that will be searched for libraries.
5101 The implicit dependency scanner will search these
5102 directories for include files. Don't explicitly put include directory
5103 arguments in $LINKFLAGS or $SHLINKFLAGS
5104 because the result will be non-portable
5105 and the directories will not be searched by the dependency scanner. Note:
5106 directory names in LIBPATH will be looked-up relative to the SConscript
5107 directory when they are used in a command. To force 
5108 .B scons
5109 to look-up a directory relative to the root of the source tree use #:
5110
5111 .ES
5112 env = Environment(LIBPATH='#/libs')
5113 .EE
5114
5115 .IP
5116 The directory look-up can also be forced using the 
5117 .BR Dir ()
5118 function:
5119
5120 .ES
5121 libs = Dir('libs')
5122 env = Environment(LIBPATH=libs)
5123 .EE
5124
5125 .IP
5126 The directory list will be added to command lines
5127 through the automatically-generated
5128 $_LIBDIRFLAGS
5129 construction variable,
5130 which is constructed by
5131 appending the values of the
5132 $LIBDIRPREFIX and $LIBDIRSUFFIX
5133 construction variables
5134 to the beginning and end
5135 of each directory in $LIBPATH.
5136 Any command lines you define that need
5137 the LIBPATH directory list should
5138 include $_LIBDIRFLAGS:
5139
5140 .ES
5141 env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE")
5142 .EE
5143
5144 .IP LIBPREFIX
5145 The prefix used for (static) library file names.
5146 A default value is set for each platform
5147 (posix, win32, os2, etc.),
5148 but the value is overridden by individual tools
5149 (ar, mslib, sgiar, sunar, tlib, etc.)
5150 to reflect the names of the libraries they create.
5151
5152 .IP LIBPREFIXES
5153 An array of legal prefixes for library file names.
5154
5155 .IP LIBS
5156 A list of one or more libraries
5157 that will be linked with
5158 any executable programs
5159 created by this environment.
5160
5161 .IP
5162 The library list will be added to command lines
5163 through the automatically-generated
5164 $_LIBFLAGS
5165 construction variable,
5166 which is constructed by
5167 appending the values of the
5168 $LIBLINKPREFIX and $LIBLINKSUFFIX
5169 construction variables
5170 to the beginning and end
5171 of each directory in $LIBS.
5172 Any command lines you define that need
5173 the LIBS library list should
5174 include $_LIBFLAGS:
5175
5176 .ES
5177 env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE")
5178 .EE
5179
5180 .IP LIBSUFFIX 
5181 The suffix used for (static) library file names.
5182 A default value is set for each platform
5183 (posix, win32, os2, etc.),
5184 but the value is overridden by individual tools
5185 (ar, mslib, sgiar, sunar, tlib, etc.)
5186 to reflect the names of the libraries they create.
5187
5188 .IP LIBSUFFIXES
5189 An array of legal suffixes for library file names.
5190
5191 .IP LINK
5192 The linker.
5193
5194 .IP LINKFLAGS
5195 General user options passed to the linker.
5196 Note that this variable should
5197 .I not
5198 contain
5199 .B -l
5200 (or similar) options for linking with the libraries listed in $LIBS,
5201 nor
5202 .B -L
5203 (or similar) library search path options
5204 that scons generates automatically from $LIBPATH.
5205 See
5206 .BR _LIBFLAGS ,
5207 above,
5208 for the variable that expands to library-link options,
5209 and
5210 .BR _LIBDIRFLAGS ,
5211 above,
5212 for the variable that expands to library search path options.
5213
5214 .IP LINKCOM
5215 The command line used to link object files into an executable.
5216
5217 .IP M4
5218 The M4 macro preprocessor.
5219
5220 .IP M4FLAGS
5221 General options passed to the M4 macro preprocessor.
5222
5223 .IP M4COM
5224 The command line used to pass files through the macro preprocessor.
5225
5226 .IP MAXLINELENGTH
5227 The maximum number of characters allowed on an external command line.
5228 On Win32 systems,
5229 link lines longer than this many characters
5230 are linke via a temporary file name.
5231
5232 .IP MSVS
5233 When the Microsoft Visual Studio tools are initialized, they set up
5234 this dictionary with the following keys:
5235
5236 .B VERSION:
5237 the version of MSVS being used (can be set via
5238 MSVS_VERSION)
5239
5240 .B VERSIONS:
5241 the available versions of MSVS installed
5242
5243 .B VCINSTALLDIR:
5244 installed directory of Visual C++
5245
5246 .B VSINSTALLDIR:
5247 installed directory of Visual Studio
5248
5249 .B FRAMEWORKDIR:
5250 installed directory of the .NET framework
5251
5252 .B FRAMEWORKVERSIONS:
5253 list of installed versions of the .NET framework, sorted latest to oldest.
5254
5255 .B FRAMEWORKVERSION:
5256 latest installed version of the .NET framework
5257
5258 .B FRAMEWORKSDKDIR:
5259 installed location of the .NET SDK.
5260
5261 .B PLATFORMSDKDIR:
5262 installed location of the Platform SDK.
5263
5264 .B PLATFORMSDK_MODULES:
5265 dictionary of installed Platform SDK modules,
5266 where the dictionary keys are keywords for the various modules, and
5267 the values are 2-tuples where the first is the release date, and the
5268 second is the version number.
5269
5270 If a value isn't set, it wasn't available in the registry.
5271
5272 .IP MSVS_IGNORE_IDE_PATHS
5273 Tells the MS Visual Studio tools to use minimal INCLUDE, LIB, and PATH settings,
5274 instead of the settings from the IDE.
5275
5276 For Visual Studio, SCons will (by default) automatically determine
5277 where MSVS is installed, and use the LIB, INCLUDE, and PATH variables
5278 set by the IDE.  You can override this behavior by setting these
5279 variables after Environment initialization, or by setting
5280 .B MSVS_IGNORE_IDE_PATHS = 1
5281 in the Environment initialization.
5282 Specifying this will not leave these unset, but will set them to a
5283 minimal set of paths needed to run the tools successfully.
5284
5285 .ES
5286 For VS6, the mininimal set is:
5287    INCLUDE:'<VSDir>\\VC98\\ATL\\include;<VSDir>\\VC98\\MFC\\include;<VSDir>\\VC98\\include'
5288    LIB:'<VSDir>\\VC98\\MFC\\lib;<VSDir>\\VC98\\lib'
5289    PATH:'<VSDir>\\Common\\MSDev98\\bin;<VSDir>\\VC98\\bin'
5290 For VS7, it is:
5291    INCLUDE:'<VSDir>\\Vc7\\atlmfc\\include;<VSDir>\\Vc7\\include'
5292    LIB:'<VSDir>\\Vc7\\atlmfc\\lib;<VSDir>\\Vc7\\lib'
5293    PATH:'<VSDir>\\Common7\\Tools\\bin;<VSDir>\\Common7\\Tools;<VSDir>\\Vc7\\bin'
5294 .EE
5295
5296 .IP
5297 Where '<VSDir>' is the installed location of Visual Studio.
5298
5299 .IP MSVS_USE_MFC_DIRS
5300 Tells the MS Visual Studio tool(s) to use
5301 the MFC directories in its default paths
5302 for compiling and linking.
5303 Under MSVS version 6,
5304 setting
5305 .B MSVS_USE_MFC_DIRS
5306 to a non-zero value
5307 adds the
5308 .BR ATL\\include
5309 and
5310 .BR MFC\\include
5311 directories to
5312 the default
5313 .B INCLUDE
5314 external environment variable,
5315 and adds the
5316 .B MFC\\lib
5317 directory to
5318 the default
5319 .B LIB
5320 external environment variable.
5321 Under MSVS version 7,
5322 setting
5323 .B MSVS_USE_MFC_DIRS
5324 to a non-zero value
5325 adds the
5326 .BR atlmfc\\include
5327 directory to the default
5328 .B INCLUDE
5329 external environment variable,
5330 and adds the
5331 .BR atlmfc\\lib
5332 directory to the default
5333 .B LIB
5334 external environment variable.
5335 The current default value is
5336 .BR 1 ,
5337 which means these directories
5338 are added to the paths by default.
5339 This default value is likely to change
5340 in a future release,
5341 so users who want the ATL and MFC
5342 values included in their paths
5343 are encouraged to enable the
5344 .B MSVS_USE_MFC_DIRS
5345 value explicitly
5346 to avoid future incompatibility.
5347 This variable has no effect if the
5348 .BR INCLUDE
5349 or
5350 .BR LIB
5351 environment variables are set explictly.
5352
5353 .IP MSVS_VERSION
5354 Sets the preferred version of MSVS to use.
5355
5356 SCons will (by default) select the latest version of MSVS
5357 installed on your machine.  So, if you have version 6 and version 7
5358 (MSVS .NET) installed, it will prefer version 7.  You can override this by
5359 specifying the 
5360 .B MSVS_VERSION
5361 variable in the Environment initialization, setting it to the
5362 appropriate version ('6.0' or '7.0', for example).
5363 If the given version isn't installed, tool initialization will fail.
5364
5365 .IP MSVSPROJECTCOM
5366 The action used to generate Microsoft Visual Studio
5367 project and solution files.
5368
5369 .IP MSVSPROJECTSUFFIX
5370 The suffix used for Microsoft Visual Studio project (DSP) files.
5371 The default value is
5372 .B .vcproj
5373 when using Visual Studio version 7.x (.NET),
5374 and
5375 .B .dsp
5376 when using earlier versions of Visual Studio.
5377
5378 .IP MSVSSOLUTIONSUFFIX
5379 The suffix used for Microsoft Visual Studio solution (DSW) files.
5380 The default value is
5381 .B .sln
5382 when using Visual Studio version 7.x (.NET),
5383 and
5384 .B .dsw
5385 when using earlier versions of Visual Studio.
5386
5387 .IP no_import_lib
5388 When set to non-zero,
5389 suppresses creation of a corresponding Win32 static import lib by the
5390 .B SharedLibrary
5391 builder when used with
5392 MinGW or Microsoft Visual Studio.
5393 This also suppresses creation
5394 of an export (.exp) file
5395 when using Microsoft Visual Studio.
5396
5397 .IP OBJPREFIX 
5398 The prefix used for (static) object file names.
5399
5400 .IP OBJSUFFIX 
5401 The suffix used for (static) object file names.
5402
5403 .IP P4
5404 The Perforce executable.
5405
5406 .IP P4COM
5407 The command line used to
5408 fetch source files from Perforce.
5409
5410 .IP P4FLAGS
5411 General options that are passed to Perforce.
5412
5413 .IP PCH
5414 The Microsoft Visual C++ precompiled header that will be used when compiling
5415 object files. This variable is ignored by tools other than Microsoft Visual C++.
5416 When this variable is
5417 defined SCons will add options to the compiler command line to
5418 cause it to use the precompiled header, and will also set up the
5419 dependencies for the PCH file. Example: 
5420
5421 .ES
5422 env['PCH'] = 'StdAfx.pch'
5423 .EE
5424
5425 .IP PCHSTOP
5426 This variable specifies how much of a source file is precompiled. This
5427 variable is ignored by tools other than Microsoft Visual C++, or when
5428 the PCH variable is not being used. When this variable is define it
5429 must be a string that is the name of the header that
5430 is included at the end of the precompiled portion of the source files, or
5431 the empty string if the "#pragma hrdstop" construct is being used:
5432
5433 .ES
5434 env['PCHSTOP'] = 'StdAfx.h'
5435 .EE
5436
5437 .IP PDB
5438 The Microsoft Visual C++ PDB file that will store debugging information for
5439 object files, shared libraries, and programs. This variable is ignored by
5440 tools other than Microsoft Visual C++.
5441 When this variable is
5442 defined SCons will add options to the compiler and linker command line to
5443 cause them to generate external debugging information, and will also set up the
5444 dependencies for the PDB file. Example:
5445
5446 .ES
5447 env['PDB'] = 'hello.pdb'
5448 .EE
5449
5450 .IP PDFCOM
5451 A deprecated synonym for $DVIPDFCOM.
5452
5453 .IP PDFPREFIX
5454 The prefix used for PDF file names.
5455
5456 .IP PDFSUFFIX
5457 The suffix used for PDF file names.
5458
5459 .IP PLATFORM
5460 The name of the platform used to create the Environment.  If no platform is
5461 specified when the Environment is created,
5462 .B SCons
5463 autodetects the platform.
5464
5465 .ES
5466 env = Environment(tools = [])
5467 if env['PLATFORM'] == 'cygwin':
5468     Tool('mingw')(env)
5469 else:
5470     Tool('msvc')(env)
5471 .EE
5472
5473 .IP PROGPREFIX
5474 The prefix used for executable file names.
5475
5476 .IP PROGSUFFIX
5477 The suffix used for executable file names.
5478
5479 .IP PSCOM
5480 The command line used to convert TeX DVI files into a PostScript file.
5481
5482 .IP PSPREFIX
5483 The prefix used for PostScript file names.
5484
5485 .IP PSSUFFIX
5486 The prefix used for PostScript file names.
5487
5488 .IP QTDIR
5489 The qt tool tries to take this from os.environ.
5490 It also initializes all QT_*
5491 construction variables listed below.
5492 (Note that all paths are constructed
5493 with python's os.path.join() method,
5494 but are listed here with the '/' separator
5495 for easier reading.)
5496 In addition, the construction environment
5497 variables CPPPATH, LIBPATH, LIBS, PROGEMITTER, SHLIBEMITTER and LIBEMITTER
5498 are modified. Because the build-performance is affected when using this tool,
5499 you have to explicitly specify it at Environment creation:
5500
5501 .ES
5502 Environment(tools=['default','qt'])
5503 .EE
5504
5505 The qt tool supports the following operations:
5506
5507 .B Automatic moc file generation from header files.
5508 You do not have to specify moc files explicitly, the tool does it for you.
5509 However, there are a few preconditions to do so: Your header file must have
5510 the same filebase as your implementation file and must stay in the same
5511 directory. It must have one of the suffixes .h, .hpp, .H, .hxx, .hh. You 
5512 can turn off automatic moc file generation by setting QT_AUTOSCAN to 0.
5513 See also the corresponding builder method
5514 .B Moc()
5515
5516 .B Automatic moc file generation from cxx files.
5517 As stated in the qt documentation, include the moc file at the end of 
5518 the cxx file. Note that you have to include the file, which is generated
5519 by the transformation ${QT_MOCCXXPREFIX}<basename>${QT_MOCCXXSUFFIX}, by default
5520 <basename>.moc. A warning is generated after building the moc file, if you 
5521 do not include the correct file. If you are using BuildDir, you may 
5522 need to specify duplicate=1. You can turn off automatic moc file generation 
5523 by setting QT_AUTOSCAN to 0. See also the corresponding builder method
5524 .B Moc()
5525
5526 .B Automatic handling of .ui files.
5527 The implementation files generated from .ui files are handled much the same
5528 as yacc or lex files. Each .ui file given as a source of Program, Library or
5529 SharedLibrary will generate three files, the declaration file, the 
5530 implementation file and a moc file. Because there are also generated headers, 
5531 you may need to specify duplicate=1 in calls to BuildDir. See also the corresponding builder method
5532 .B Uic()
5533
5534 .IP QT_AUTOSCAN
5535 Turn off scanning for mocable files. Use the Moc Builder to explicitely 
5536 specify files to run moc on.
5537
5538 .IP QT_DEBUG 
5539 Prints lots of debugging information while scanning for moc files.
5540
5541 .IP QT_LIB
5542 Default value is 'qt'. You may want to set this to 'qt-mt'.
5543
5544 .IP QT_MOC
5545 Default value is '$QTDIR/bin/moc'.
5546
5547 .IP QT_MOCCXXPREFIX
5548 Default value is ''. Prefix for moc output files, when source is a cxx file.
5549
5550 .IP QT_MOCCXXSUFFIX
5551 Default value is '.moc'. Suffix for moc output files, when source is a cxx 
5552 file.
5553
5554 .IP QT_MOCFROMCPPFLAGS
5555 Default value is '-i'. These flags are passed to moc, when moccing a
5556 cpp file.
5557
5558 .IP QT_MOCFROMCXXCOM
5559 Command to generate a moc file from a cpp file.
5560
5561 .IP QT_MOCFROMHCOM
5562 Command to generate a moc file from a header.
5563
5564 .IP QT_MOCFROMHFLAGS
5565 Default value is ''. These flags are passed to moc, when moccing a header
5566 file.
5567
5568 .IP QT_MOCHPREFIX
5569 Default value is 'moc_'. Prefix for moc output files, when source is a header.
5570
5571 .IP QT_MOCHSUFFIX
5572 Default value is '$CXXFILESUFFIX'. Suffix for moc output files, when source is
5573 a header.
5574
5575 .IP QT_UIC
5576 Default value is '$QTDIR/bin/uic'.
5577
5578 .IP QT_UICDECLCOM
5579 Command to generate header files from .ui files.
5580
5581 .IP QT_UICDECLFLAGS
5582 Default value is ''. These flags are passed to uic, when creating a a h
5583 file from a .ui file.
5584
5585 .IP QT_UICDECLPREFIX
5586 Default value is ''. Prefix for uic generated header files.
5587
5588 .IP QT_UICDECLSUFFIX
5589 Default value is '.h'. Suffix for uic generated header files.
5590
5591 .IP QT_UICIMPLCOM
5592 Command to generate cxx files from .ui files.
5593
5594 .IP QT_UICIMPLFLAGS
5595 Default value is ''. These flags are passed to uic, when creating a cxx
5596 file from a .ui file.
5597
5598 .IP QT_UICIMPLPREFIX
5599 Default value is 'uic_'. Prefix for uic generated implementation files.
5600
5601 .IP QT_UICIMPLSUFFIX
5602 Default value is '$CXXFILESUFFIX'. Suffix for uic generated implementation 
5603 files.
5604
5605 .IP QT_UISUFFIX
5606 Default value is '.ui'. Suffix of designer input files.
5607
5608 .IP RANLIB
5609 The archive indexer.
5610
5611 .IP RANLIBFLAGS
5612 General options passed to the archive indexer.
5613
5614 .IP RC
5615 The resource compiler used by the RES builder.
5616
5617 .IP RCCOM
5618 The command line used by the RES builder.
5619
5620 .IP RCFLAGS
5621 The flags passed to the resource compiler by the RES builder.
5622
5623 .IP RCS
5624 The RCS executable.
5625 Note that this variable is not actually used
5626 for the command to fetch source files from RCS;
5627 see the
5628 .B RCS_CO
5629 construction variable, below.
5630
5631 .IP RCS_CO 
5632 The RCS "checkout" executable,
5633 used to fetch source files from RCS.
5634
5635 .IP RCS_COCOM
5636 The command line used to
5637 fetch (checkout) source files from RCS.
5638
5639 .IP RCS_COFLAGS
5640 Options that are passed to the $RCS_CO command.
5641
5642 .IP RDirs
5643 A function that converts a file name into a list of Dir instances by
5644 searching the repositories. 
5645
5646 .IP RMIC
5647 The Java RMI stub compiler.
5648
5649 .IP RMICCOM
5650 The command line used to compile stub
5651 and skeleton class files
5652 from Java classes that contain RMI implementations.
5653 Any options specified in the $RMICFLAGS construction variable
5654 are included on this command line.
5655
5656 .IP RMICFLAGS
5657 General options passed to the Java RMI stub compiler.
5658
5659 .IP RPATH
5660 A list of paths to search for shared libraries when running programs.
5661 Currently only used in the GNU linker (gnulink) and IRIX linker (sgilink).
5662 Ignored on platforms and toolchains that don't support it.
5663 Note that the paths added to RPATH
5664 are not transformed by
5665 .B scons
5666 in any way:  if you want an absolute
5667 path, you must make it absolute yourself.
5668
5669 .IP SCANNERS
5670 A list of the available implicit dependency scanners.
5671 New file scanners may be added by
5672 appending to this list,
5673 although the more flexible approach
5674 is to associate scanners
5675 with a specific Builder.
5676 See the sections "Builder Objects"
5677 and "Scanner Objects,"
5678 below, for more information.
5679
5680 .IP SCCS
5681 The SCCS executable.
5682
5683 .IP SCCSCOM
5684 The command line used to
5685 fetch source files from SCCS.
5686
5687 .IP SCCSFLAGS
5688 General options that are passed to SCCS.
5689
5690 .IP SCCSGETFLAGS
5691 Options that are passed specifically to the SCCS "get" subcommand.
5692 This can be set, for example, to
5693 .I -e
5694 to check out editable files from SCCS.
5695
5696 .IP SHCC
5697 The C compiler used for generating shared-library objects.
5698
5699 .IP SHCCCOM
5700 The command line used to compile a C source file
5701 to a shared-library object file.
5702 Any options specified in the $SHCCFLAGS and $CPPFLAGS construction variables
5703 are included on this command line.
5704
5705 .IP SHCCFLAGS
5706 Options that are passed to the C compiler
5707 to generate shared-library objects.
5708
5709 .IP SHCXX
5710 The C++ compiler used for generating shared-library objects.
5711
5712 .IP SHCXXCOM
5713 The command line used to compile a C++ source file
5714 to a shared-library object file.
5715 Any options specified in the $SHCXXFLAGS and $CPPFLAGS construction variables
5716 are included on this command line.
5717
5718 .IP SHCXXFLAGS
5719 Options that are passed to the C++ compiler
5720 to generate shared-library objects.
5721
5722 .IP SHELL
5723 A string naming the shell program that will be passed to the 
5724 .I SPAWN 
5725 function. 
5726 See the 
5727 .I SPAWN 
5728 construction variable for more information.
5729
5730 .IP SHF77
5731 The Fortran 77 compiler used for generating shared-library objects.
5732 You should normally set the $SHFORTRANC variable,
5733 which specifies the default Fortran compiler
5734 for all Fortran versions.
5735 You only need to set $SHF77 if you need to use a specific compiler
5736 or compiler version for Fortran 77 files.
5737
5738 .IP SHF77COM
5739 The command line used to compile a Fortran 77 source file
5740 to a shared-library object file.
5741 You only need to set $SHF77COM if you need to use a specific
5742 command line for Fortran 77 files.
5743 You should normally set the $SHFORTRANCOM variable,
5744 which specifies the default command line
5745 for all Fortran versions.
5746
5747 .IP SHF77FLAGS
5748 Options that are passed to the Fortran 77 compiler
5749 to generated shared-library objects.
5750 You only need to set $SHF77FLAGS if you need to define specific
5751 user options for Fortran 77 files.
5752 You should normally set the $SHFORTRANFLAGS variable,
5753 which specifies the user-specified options
5754 passed to the default Fortran compiler
5755 for all Fortran versions.
5756
5757 .IP SHF77PPCOM
5758 The command line used to compile a Fortran 77 source file to a
5759 shared-library object file
5760 after first running the file through the C preprocessor.
5761 Any options specified in the $SHF77FLAGS and $CPPFLAGS construction variables
5762 are included on this command line.
5763 You only need to set $SHF77PPCOM if you need to use a specific
5764 C-preprocessor command line for Fortran 77 files.
5765 You should normally set the $SHFORTRANPPCOM variable,
5766 which specifies the default C-preprocessor command line
5767 for all Fortran versions.
5768
5769 .IP SHF90
5770 The Fortran 90 compiler used for generating shared-library objects.
5771 You should normally set the $SHFORTRANC variable,
5772 which specifies the default Fortran compiler
5773 for all Fortran versions.
5774 You only need to set $SHF90 if you need to use a specific compiler
5775 or compiler version for Fortran 90 files.
5776
5777 .IP SHF90COM
5778 The command line used to compile a Fortran 90 source file
5779 to a shared-library object file.
5780 You only need to set $SHF90COM if you need to use a specific
5781 command line for Fortran 90 files.
5782 You should normally set the $SHFORTRANCOM variable,
5783 which specifies the default command line
5784 for all Fortran versions.
5785
5786 .IP SHF90FLAGS
5787 Options that are passed to the Fortran 90 compiler
5788 to generated shared-library objects.
5789 You only need to set $SHF90FLAGS if you need to define specific
5790 user options for Fortran 90 files.
5791 You should normally set the $SHFORTRANFLAGS variable,
5792 which specifies the user-specified options
5793 passed to the default Fortran compiler
5794 for all Fortran versions.
5795
5796 .IP SHF90PPCOM
5797 The command line used to compile a Fortran 90 source file to a
5798 shared-library object file
5799 after first running the file through the C preprocessor.
5800 Any options specified in the $SHF90FLAGS and $CPPFLAGS construction variables
5801 are included on this command line.
5802 You only need to set $SHF90PPCOM if you need to use a specific
5803 C-preprocessor command line for Fortran 90 files.
5804 You should normally set the $SHFORTRANPPCOM variable,
5805 which specifies the default C-preprocessor command line
5806 for all Fortran versions.
5807
5808 .IP SHF95
5809 The Fortran 95 compiler used for generating shared-library objects.
5810 You should normally set the $SHFORTRANC variable,
5811 which specifies the default Fortran compiler
5812 for all Fortran versions.
5813 You only need to set $SHF95 if you need to use a specific compiler
5814 or compiler version for Fortran 95 files.
5815
5816 .IP SHF95COM
5817 The command line used to compile a Fortran 95 source file
5818 to a shared-library object file.
5819 You only need to set $SHF95COM if you need to use a specific
5820 command line for Fortran 95 files.
5821 You should normally set the $SHFORTRANCOM variable,
5822 which specifies the default command line
5823 for all Fortran versions.
5824
5825 .IP SHF95FLAGS
5826 Options that are passed to the Fortran 95 compiler
5827 to generated shared-library objects.
5828 You only need to set $SHF95FLAGS if you need to define specific
5829 user options for Fortran 95 files.
5830 You should normally set the $SHFORTRANFLAGS variable,
5831 which specifies the user-specified options
5832 passed to the default Fortran compiler
5833 for all Fortran versions.
5834
5835 .IP SHF95PPCOM
5836 The command line used to compile a Fortran 95 source file to a
5837 shared-library object file
5838 after first running the file through the C preprocessor.
5839 Any options specified in the $SHF95FLAGS and $CPPFLAGS construction variables
5840 are included on this command line.
5841 You only need to set $SHF95PPCOM if you need to use a specific
5842 C-preprocessor command line for Fortran 95 files.
5843 You should normally set the $SHFORTRANPPCOM variable,
5844 which specifies the default C-preprocessor command line
5845 for all Fortran versions.
5846
5847 .IP SHFORTRAN
5848 The default Fortran compiler used for generating shared-library objects.
5849
5850 .IP SHFORTRANCOM
5851 The command line used to compile a Fortran source file
5852 to a shared-library object file.
5853
5854 .IP SHFORTRANFLAGS
5855 Options that are passed to the Fortran compiler
5856 to generate shared-library objects.
5857
5858 .IP SHFORTRANPPCOM
5859 The command line used to compile a Fortran source file to a
5860 shared-library object file
5861 after first running the file through the C preprocessor.
5862 Any options specified
5863 in the $SHFORTRANFLAGS and $CPPFLAGS construction variables
5864 are included on this command line.
5865
5866 .IP SHLIBPREFIX
5867 The prefix used for shared library file names.
5868
5869 .IP SHLIBSUFFIX
5870 The suffix used for shared library file names.
5871
5872 .IP SHLINK
5873 The linker for programs that use shared libraries.
5874
5875 .IP SHLINKFLAGS
5876 General user options passed to the linker for programs using shared libraries.
5877 Note that this variable should
5878 .I not
5879 contain
5880 .B -l
5881 (or similar) options for linking with the libraries listed in $LIBS,
5882 nor
5883 .B -L
5884 (or similar) include search path options
5885 that scons generates automatically from $LIBPATH.
5886 See
5887 .BR _LIBFLAGS ,
5888 above,
5889 for the variable that expands to library-link options,
5890 and
5891 .BR _LIBDIRFLAGS ,
5892 above,
5893 for the variable that expands to library search path options.
5894
5895 .IP SHOBJPREFIX 
5896 The prefix used for shared object file names.
5897
5898 .IP SHOBJSUFFIX 
5899 The suffix used for shared object file names.
5900
5901 .IP SOURCE
5902 A reserved variable name
5903 that may not be set or used in a construction environment.
5904 (See "Variable Substitution," below.)
5905
5906 .IP SOURCES
5907 A reserved variable name
5908 that may not be set or used in a construction environment.
5909 (See "Variable Substitution," below.)
5910
5911 .IP SPAWN
5912 A command interpreter function that will be called to execute command line
5913 strings. The function must expect 4 arguments:
5914
5915 .ES
5916 def spawn(shell, escape, cmd, args, env):
5917 .EE
5918 .IP
5919 .I sh
5920 is a string naming the shell program to use.
5921 .I escape
5922 is a function that can be called to escape shell special characters in
5923 the command line. 
5924 .I cmd
5925 is the path to the command to be executed.
5926 .I args
5927 is that arguments to the command.
5928 .I env
5929 is a dictionary of the environment variables
5930 in which the command should be executed.
5931 '\"
5932 '\".IP SVN
5933 '\"The Subversion executable (usually named
5934 '\".BR svn ).
5935 '\"
5936 '\".IP SVNCOM
5937 '\"The command line used to
5938 '\"fetch source files from a Subversion repository.
5939 '\"
5940 '\".IP SVNFLAGS
5941 '\"General options that are passed to Subversion.
5942
5943 .IP SWIG
5944 The scripting language wrapper and interface generator.
5945
5946 .IP SWIGCFILESUFFIX
5947 The suffix that will be used for intermediate C
5948 source files generated by
5949 the scripting language wrapper and interface generator.
5950 The default value is
5951 .BR _wrap$CFILESUFFIX .
5952 By default, this value is used whenever the
5953 .B -c++
5954 option is
5955 .I not
5956 specified as part of the
5957 .B SWIGFLAGS
5958 construction variable.
5959
5960 .IP SWIGCOM
5961 The command line used to call
5962 the scripting language wrapper and interface generator.
5963
5964 .IP SWIGCXXFILESUFFIX
5965 The suffix that will be used for intermediate C++
5966 source files generated by
5967 the scripting language wrapper and interface generator.
5968 The default value is
5969 .BR _wrap$CFILESUFFIX .
5970 By default, this value is used whenever the
5971 .B -c++
5972 option is specified as part of the
5973 .B SWIGFLAGS
5974 construction variable.
5975
5976 .IP SWIGFLAGS
5977 General options passed to
5978 the scripting language wrapper and interface generator.
5979 This is where you should set
5980 .BR -python ,
5981 .BR -perl5 ,
5982 .BR -tcl ,
5983 or whatever other options you want to specify to SWIG.
5984 If you set the
5985 .B -c++
5986 option in this variable,
5987 .B scons
5988 will, by default,
5989 generate a C++ intermediate source file
5990 with the extension that is specified as the
5991 .B $CXXFILESUFFIX
5992 variable.
5993
5994 .IP TAR
5995 The tar archiver.
5996
5997 .IP TARCOM
5998 The command line used to call the tar archiver.
5999
6000 .IP TARFLAGS
6001 General options passed to the tar archiver.
6002
6003 .IP TARGET
6004 A reserved variable name
6005 that may not be set or used in a construction environment.
6006 (See "Variable Substitution," below.)
6007
6008 .IP TARGETS
6009 A reserved variable name
6010 that may not be set or used in a construction environment.
6011 (See "Variable Substitution," below.)
6012
6013 .IP TARSUFFIX 
6014 The suffix used for tar file names.
6015
6016 .IP TEX
6017 The TeX formatter and typesetter.
6018
6019 .IP TEXCOM
6020 The command line used to call the TeX formatter and typesetter.
6021
6022 .IP TEXFLAGS
6023 General options passed to the TeX formatter and typesetter.
6024
6025 .IP TOOLS
6026 A list of the names of the Tool specifications
6027 that are part of this construction environment.
6028
6029 .IP WIN32_INSERT_DEF
6030 When this is set to true,
6031 a library build of a WIN32 shared library (.dll file)
6032 will also build a corresponding .def file at the same time,
6033 if a .def file is not already listed as a build target.
6034 The default is 0 (do not build a .def file).
6035
6036 .IP WIN32DEFPREFIX
6037 The prefix used for WIN32 .def file names.
6038
6039 .IP WIN32DEFSUFFIX
6040 The suffix used for WIN32 .def file names.
6041
6042 .IP YACC
6043 The parser generator.
6044
6045 .IP YACCCOM
6046 The command line used to call the parser generator
6047 to generate a source file.
6048
6049 .IP YACCFLAGS
6050 General options passed to the parser generator.
6051 If $YACCFLAGS contains a \-d option,
6052 SCons assumes that the call will also create a .h file
6053 (if the yacc source file ends in a .y suffix)
6054 or a .hpp file
6055 (if the yacc source file ends in a .yy suffix)
6056
6057 .IP ZIP
6058 The zip compression and file packaging utility.
6059
6060 .IP ZIPCOM
6061 The command line used to call the zip utility,
6062 or the internal Python function used to create a
6063 zip archive.
6064
6065 .IP ZIPCOMPRESSION
6066 The
6067 .I compression
6068 flag
6069 from the Python
6070 .B zipfile
6071 module used by the internal Python function
6072 to control whether the zip archive
6073 is compressed or not.
6074 The default value is
6075 .BR zipfile.ZIP_DEFLATED ,
6076 which creates a compressed zip archive.
6077 This value has no effect when using Python 1.5.2
6078 or if the
6079 .B zipfile
6080 module is otherwise unavailable.
6081
6082 .IP ZIPFLAGS
6083 General options passed to the zip utility.
6084
6085 .LP
6086 Construction variables can be retrieved and set using the 
6087 .B Dictionary 
6088 method of the construction environment:
6089
6090 .ES
6091 dict = env.Dictionary()
6092 dict["CC"] = "cc"
6093 .EE
6094
6095 or using the [] operator:
6096
6097 .ES
6098 env["CC"] = "cc"
6099 .EE
6100
6101 Construction variables can also be passed to the construction environment
6102 constructor:
6103
6104 .ES
6105 env = Environment(CC="cc")
6106 .EE
6107
6108 or when copying a construction environment using the 
6109 .B Copy 
6110 method:
6111
6112 .ES
6113 env2 = env.Copy(CC="cl.exe")
6114 .EE
6115
6116 .SS Configure Contexts
6117
6118 .B scons
6119 supports
6120 .I configure contexts,
6121 an integrated mechanism similar to the
6122 various AC_CHECK macros in GNU autoconf
6123 for testing for the existence of C header
6124 files, libraries, etc.
6125 In contrast to autoconf,
6126 .B scons
6127 does not maintain an explicit cache of the tested values,
6128 but uses its normal dependency tracking to keep the checked values
6129 up to date. 
6130 The following methods can be used to perform checks:
6131
6132 .TP
6133 .RI Configure( env ", [" custom_tests ", " conf_dir ", " log_file ])
6134 .TP
6135 .RI env.Configure([ custom_tests ", " conf_dir ", " log_file ])
6136 This creates a configure context, which can be used to perform checks.
6137 .I env
6138 specifies the environment for building the tests.
6139 This environment may be modified when performing checks.
6140 .I custom_tests
6141 is a dictionary containing custom tests.
6142 See also the section about custom tests below. 
6143 By default, no custom tests are added to the configure context.
6144 .I conf_dir
6145 specifies a directory where the test cases are built.
6146 Note that this directory is not used for building
6147 normal targets.
6148 The default value is the directory
6149 #/.sconf_temp.
6150 .I log_file
6151 specifies a file which collects the output from commands
6152 that are executed to check for the existence of header files, libraries, etc.
6153 The default is the file #/config.log.
6154 If you are using the
6155 .B BuildDir
6156 method,
6157 you may want to specify a subdirectory under your build directory.
6158
6159 .EE
6160 A created
6161 .B Configure
6162 instance has the following associated methods:
6163
6164 .TP 
6165 .RI Configure.Finish( self )
6166 This method should be called after configuration is done.
6167 It returns the environment as modified
6168 by the configuration checks performed.
6169 After this method is called, no further checks can be performed
6170 with this configuration context.
6171 However, you can create a new 
6172 .RI Configure 
6173 context to perform additional checks.
6174 Only one context should be active at a time.
6175
6176 The following Checks are predefined.
6177 (This list will likely grow larger as time
6178 goes by and developers contribute new useful tests.)
6179
6180 .TP
6181 .RI Configure.CheckHeader( self ", " header ", [" include_quotes ", " language ])
6182 Checks if 
6183 .I header
6184 is usable in the specified language.
6185 .I header
6186 may be a list,
6187 in which case the last item in the list
6188 is the header file to be checked,
6189 and the previous list items are
6190 header files whose
6191 .B #include
6192 lines should precede the
6193 header line being checked for.
6194 The optional argument 
6195 .I include_quotes 
6196 must be
6197 a two character string, where the first character denotes the opening
6198 quote and the second character denotes the closing quote.
6199 By default, both characters  are " (double quote).
6200 The optional argument
6201 .I language
6202 should be either
6203 .B C
6204 or
6205 .B C++
6206 and selects the compiler to be used for the check.
6207 Returns 1 on success and 0 on failure.
6208
6209 .TP
6210 .RI Configure.CheckCHeader( self ", " header ", [" include_quotes ])
6211 This is a wrapper around
6212 .B Configure.CheckHeader
6213 which checks if 
6214 .I header
6215 is usable in the C language.
6216 .I header
6217 may be a list,
6218 in which case the last item in the list
6219 is the header file to be checked,
6220 and the previous list items are
6221 header files whose
6222 .B #include
6223 lines should precede the
6224 header line being checked for.
6225 The optional argument 
6226 .I include_quotes 
6227 must be
6228 a two character string, where the first character denotes the opening
6229 quote and the second character denotes the closing quote (both default
6230 to \N'34').
6231 Returns 1 on success and 0 on failure.
6232
6233 .TP
6234 .RI Configure.CheckCXXHeader( self ", " header ", [" include_quotes ])
6235 This is a wrapper around
6236 .B Configure.CheckHeader
6237 which checks if 
6238 .I header
6239 is usable in the C++ language.
6240 .I header
6241 may be a list,
6242 in which case the last item in the list
6243 is the header file to be checked,
6244 and the previous list items are
6245 header files whose
6246 .B #include
6247 lines should precede the
6248 header line being checked for.
6249 The optional argument 
6250 .I include_quotes 
6251 must be
6252 a two character string, where the first character denotes the opening
6253 quote and the second character denotes the closing quote (both default
6254 to \N'34').
6255 Returns 1 on success and 0 on failure. 
6256
6257 .TP
6258 .RI Configure.CheckFunc( self ", " function_name ", [" language ])
6259 Checks if the specified
6260 C or C+++ function is available.
6261 .I function_name
6262 is the name of the function to check for.
6263 The optional
6264 .I language
6265 argument should be
6266 .B C
6267 or
6268 .B C++
6269 and selects the compiler to be used for the check;
6270 the default is "C".
6271
6272 .TP 
6273 .RI Configure.CheckLib( self ", [" library ", " symbol ", " header ", " language ", " autoadd ])
6274 Checks if 
6275 .I library 
6276 provides 
6277 .IR symbol .
6278 If the value of
6279 .I autoadd
6280 is 1 and the library provides the specified
6281 .IR symbol ,
6282 appends the library to the LIBS construction environment variable.
6283 .I library 
6284 may also be None (the default),
6285 in which case 
6286 .I symbol 
6287 is checked with the current LIBS variable,
6288 or a list of library names,
6289 in which case each library in the list
6290 will be checked for
6291 .IR symbol .
6292 The default
6293 .I symbol
6294 is "main",
6295 which just check if
6296 you can link against the specified
6297 .IR library .
6298 The optional
6299 .I language
6300 argument should be
6301 .B C
6302 or
6303 .B C++
6304 and selects the compiler to be used for the check;
6305 the default is "C".
6306 The default value for
6307 .I autoadd
6308 is 1.
6309 It is assumed, that the C-language is used.
6310 This method returns 1 on success and 0 on error.
6311
6312 .TP 
6313 .RI Configure.CheckLibWithHeader( self ", " library ", " header ", " language ", [" call ", " autoadd ])
6314
6315 In contrast to the 
6316 .RI Configure.CheckLib 
6317 call, this call provides a more sophisticated way to check against libraries.
6318 Again, 
6319 .I library
6320 specifies the library or a list of libraries to check. 
6321 .I header
6322 specifies a header to check for.
6323 .I header
6324 may be a list,
6325 in which case the last item in the list
6326 is the header file to be checked,
6327 and the previous list items are
6328 header files whose
6329 .B #include
6330 lines should precede the
6331 header line being checked for.
6332 .I language
6333 may be one of 'C','c','CXX','cxx','C++' and 'c++'.
6334 .I call
6335 can be any valid expression (with a trailing ';'). The default is 'main();'.
6336 .I autoadd
6337 specifies whether to add the library to the environment (only if the check 
6338 succeeds). This method returns 1 on success and 0 on error.
6339
6340 .TP
6341 .RI Configure.CheckType( self ", " type_name ", [" includes ", " language ])
6342 Checks for the existence of a type defined by
6343 .BR typedef .
6344 .I type_name
6345 specifies the typedef name to check for.
6346 .I includes
6347 is a string containing one or more
6348 .B #include
6349 lines that will be inserted into the program
6350 that will be run to test for the existence of the type.
6351 The optional
6352 .I language
6353 argument should be
6354 .B C
6355 or
6356 .B C++
6357 and selects the compiler to be used for the check;
6358 the default is "C".
6359
6360 .EE
6361 Example of a typical Configure usage:
6362
6363 .ES
6364 env = Environment()
6365 conf = Configure( env )
6366 if not conf.CheckCHeader( 'math.h' ):
6367     print 'We really need math.h!'
6368     Exit(1)
6369 if conf.CheckLibWithHeader( 'qt', 'qapp.h', 'c++', 'QApplication qapp(0,0);' ):
6370     # do stuff for qt - usage, e.g.
6371     conf.env.Append( CPPFLAGS = '-DWITH_QT' )
6372 env = conf.Finish() 
6373 .EE
6374
6375 .EE
6376 You can define your own custom checks. 
6377 in addition to the predefined checks.
6378 These are passed in a dictionary to the Configure function.
6379 This dictionary maps the names of the checks
6380 to user defined Python callables 
6381 (either Python functions or class instances implementing the
6382 .I __call__
6383 method).
6384 The first argument of the call is always a 
6385 .I CheckContext
6386 instance followed by the arguments,
6387 which must be supplied by the user of the check.
6388 These CheckContext instances define the following methods:
6389
6390 .TP 
6391 .RI CheckContext.Message( self ", " text )
6392
6393 Usually called before the check is started. 
6394 .I text
6395 will be displayed to the user, e.g. 'Checking for library X...'
6396
6397 .TP
6398 .RI CheckContext.Result( self, ", " res )
6399
6400 Usually called after the check is done. 
6401 .I res
6402 can be either an integer or a string. In the former case, 'ok' (res != 0) 
6403 or 'failed' (res == 0) is displayed to the user, in the latter case the 
6404 given string is displayed.
6405
6406 .TP
6407 .RI CheckContext.TryCompile( self ", " text ", " extension )
6408 Checks if a file with the specified 
6409 .I extension
6410 (e.g. '.c') containing 
6411 .I text 
6412 can be compiled using the environment's
6413 .B Object 
6414 builder. Returns 1 on success and 0 on failure.
6415
6416 .TP 
6417 .RI CheckContext.TryLink( self ", " text ", " extension )
6418 Checks, if a file with the specified
6419 .I extension
6420 (e.g. '.c') containing 
6421 .I text 
6422 can be compiled using the environment's
6423 .B Program
6424 builder. Returns 1 on success and 0 on failure.
6425
6426 .TP
6427 .RI CheckContext.TryRun( self ", " text ", " extension )
6428 Checks, if a file with the specified
6429 .I extension
6430 (e.g. '.c') containing 
6431 .I text 
6432 can be compiled using the environment's
6433 .B Program
6434 builder. On success, the program is run. If the program
6435 executes successfully
6436 (that is, its return status is 0),
6437 a tuple
6438 .I (1, outputStr)
6439 is returned, where
6440 .I outputStr
6441 is the standard output of the
6442 program.
6443 If the program fails execution
6444 (its return status is non-zero),
6445 then (0, '') is returned.
6446
6447 .TP
6448 .RI CheckContext.TryAction( self ", " action ", [" text ", " extension ])
6449 Checks if the specified
6450 .I action 
6451 with an optional source file (contents
6452 .I text
6453 , extension 
6454 .I extension
6455 = ''
6456 ) can be executed. 
6457 .I action 
6458 may be anything which can be converted to a 
6459 .B scons
6460 .RI Action.
6461 On success,
6462 .I (1, outputStr)
6463 is returned, where
6464 .I outputStr
6465 is the content of the target file.
6466 On failure
6467 .I (0, '')
6468 is returned.
6469
6470 .TP
6471 .RI CheckContext.TryBuild( self ", " builder ", [" text ", " extension ])
6472 Low level implementation for testing specific builds;
6473 the methods above are based on this method.
6474 Given the Builder instance
6475 .I builder
6476 and the optional 
6477 .I text
6478 of a source file with optional
6479 .IR extension ,
6480 this method returns 1 on success and 0 on failure. In addition, 
6481 .I self.lastTarget 
6482 is set to the build target node, if the build was successful.
6483
6484 .EE
6485 Example for implementing and using custom tests:
6486
6487 .ES
6488 def CheckQt(context, qtdir):
6489     context.Message( 'Checking for qt ...' )
6490     lastLIBS = context.env['LIBS']
6491     lastLIBPATH = context.env['LIBPATH']
6492     lastCPPPATH= context.env['CPPPATH']
6493     context.env.Append(LIBS = 'qt', LIBPATH = qtdir + '/lib', CPPPATH = qtdir + '/include' )
6494     ret = context.TryLink("""
6495 #include <qapp.h>
6496 int main(int argc, char **argv) { 
6497   QApplication qapp(argc, argv);
6498   return 0;
6499 }
6500 """)
6501     if not ret:
6502         context.env.Replace(LIBS = lastLIBS, LIBPATH=lastLIBPATH, CPPPATH=lastCPPPATH)
6503     context.Result( ret )
6504     return ret
6505
6506 env = Environment()
6507 conf = Configure( env, custom_tests = { 'CheckQt' : CheckQt } )
6508 if not conf.CheckQt('/usr/lib/qt'):
6509     print 'We really need qt!'
6510     Exit(1)
6511 env = conf.Finish() 
6512 .EE
6513
6514 .SS Construction Variable Options
6515
6516 Often when building software, various options need to be specified at build
6517 time that are not known when the SConstruct/SConscript files are
6518 written. For example, libraries needed for the build may be in non-standard
6519 locations, or site-specific compiler options may need to be passed to the
6520 compiler. 
6521 .B scons
6522 provides a mechanism for overridding construction variables from the
6523 command line or a text-based SConscript file through an Options
6524 object. To create an Options object, call the Options() function:
6525
6526 .TP
6527 .RI Options([ files "], [" args ])
6528 This creates an Options object that will read construction variables from
6529 the file or list of filenames specified in
6530 .IR files .
6531 If no files are specified,
6532 or the
6533 .I files
6534 argument is
6535 .BR None ,
6536 then no files will be read.
6537 The optional argument
6538 .I args
6539 is a dictionary of
6540 values that will override anything read from the specified files;
6541 it is primarily intended to be passed the
6542 .B ARGUMENTS
6543 dictionary that holds variables
6544 specified on the command line.
6545 Example:
6546
6547 .ES
6548 opts = Options('custom.py')
6549 opts = Options('overrides.py', ARGUMENTS)
6550 opts = Options(None, {FOO:'expansion', BAR:7})
6551 .EE
6552
6553 Options objects have the following methods:
6554
6555 .TP
6556 .RI Add( key ", [" help ", " default ", " validator ", " converter ])
6557 This adds a customizable construction variable to the Options object. 
6558 .I key
6559 is the name of the variable. 
6560 .I help 
6561 is the help text for the variable.
6562 .I default 
6563 is the default value of the variable.
6564 .I validator
6565 is called to validate the value of the variable, and should take three
6566 arguments: key, value, and environment
6567 .I converter
6568 is called to convert the value before putting it in the environment, and
6569 should take a single argument: value. Example:
6570
6571 .ES
6572 opts.Add('CC', 'The C compiler')
6573 .EE
6574
6575 .TP
6576 .RI AddOptions( list )
6577 A wrapper script that adds
6578 multiple customizable construction variables
6579 to an Options object.
6580 .I list
6581 is a list of tuple or list objects
6582 that contain the arguments
6583 for an individual call to the
6584 .B Add
6585 method.
6586
6587 .ES
6588 opt.AddOptions(
6589        ('debug', '', 0),
6590        ('CC', 'The C compiler'),
6591        ('VALIDATE', 'An option for testing validation',
6592         'notset', validator, None),
6593     )
6594 .EE
6595
6596 .TP
6597 .RI Update( env ", [" args ])
6598 This updates a construction environment
6599 .I env
6600 with the customized construction variables. Normally this method is not
6601 called directly, but is called indirectly by passing the Options object to
6602 the Environment() function:
6603
6604 .ES
6605 env = Environment(options=opts)
6606 .EE
6607
6608 .TP
6609 .RI Save( filename ", " env )
6610 This saves the currently set options into a script file named  
6611 .I filename
6612 that can be used on the next invocation to automatically load the current
6613 settings.  This method combined with the Options method can be used to
6614 support caching of options between runs.
6615
6616 .ES
6617 env = Environment()
6618 opts = Options(['options.cache', 'custom.py'])
6619 opts.Add(...)
6620 opts.Update(env)
6621 opts.Save('options.cache', env)
6622 .EE
6623
6624 .TP
6625 .RI GenerateHelpText( env ", [" sort ])
6626 This generates help text documenting the customizable construction
6627 variables suitable to passing in to the Help() function. 
6628 .I env
6629 is the construction environment that will be used to get the actual values
6630 of customizable variables. Calling with 
6631 an optional
6632 .I sort
6633 function
6634 will cause the output to be sorted
6635 by the specified argument.
6636 The specific
6637 .I sort
6638 function
6639 should take two arguments
6640 and return
6641 -1, 0 or 1
6642 (like the standard Python
6643 .I cmp
6644 function).
6645
6646 .ES
6647 Help(opts.GenerateHelpText(env))
6648 Help(opts.GenerateHelpText(env, sort=cmp))
6649 .EE
6650
6651 The text based SConscript file is executed as a Python script, and the
6652 global variables are queried for customizable construction
6653 variables. Example:
6654
6655 .ES
6656 CC = 'my_cc'
6657 .EE
6658
6659 To make it more convenient to work with customizable Options,
6660 .B scons
6661 provides a number of functions
6662 that make it easy to set up
6663 various types of Options:
6664
6665 .TP
6666 .RI BoolOption( key ", " help ", " default )
6667 Return a tuple of arguments
6668 to set up a Boolean option.
6669 The option will use
6670 the specified name
6671 .IR key ,
6672 have a default value of
6673 .IR default ,
6674 and display the specified
6675 .I help
6676 text.
6677 The option will interpret the values
6678 .BR y ,
6679 .BR yes ,
6680 .BR t ,
6681 .BR true ,
6682 .BR 1 ,
6683 .B on
6684 and
6685 .B all
6686 as true,
6687 and the values
6688 .BR n ,
6689 .BR no ,
6690 .BR f ,
6691 .BR false ,
6692 .BR 0 ,
6693 .B off
6694 and
6695 .B none
6696 as false.
6697
6698 .TP
6699 .RI EnumOption( key ", " help ", " default ", " allowed_values ", [" map ", " ignorecase ])
6700 Return a tuple of arguments
6701 to set up an option
6702 whose value may be one
6703 of a specified list of legal enumerated values.
6704 The option will use
6705 the specified name
6706 .IR key ,
6707 have a default value of
6708 .IR default ,
6709 and display the specified
6710 .I help
6711 text.
6712 The option will only support those
6713 values in the
6714 .I allowed_values
6715 list.
6716 The optional
6717 .I map
6718 argument is a dictionary
6719 that can be used to convert
6720 input values into specific legal values
6721 in the
6722 .I allowed_values
6723 list.
6724 If the value of
6725 .I ignore_case
6726 is
6727 .B 0
6728 (the default),
6729 then the values are case-sensitive.
6730 If the value of
6731 .I ignore_case
6732 is
6733 .BR 1 ,
6734 then values will be matched
6735 case-insensitive.
6736 If the value of
6737 .I ignore_case
6738 is
6739 .BR 1 ,
6740 then values will be matched
6741 case-insensitive,
6742 and all input values will be
6743 converted to lower case.
6744
6745 .TP
6746 .RI ListOption( key ", " help ", " default ", " names )
6747 Return a tuple of arguments
6748 to set up an option
6749 whose value may be one or more
6750 of a specified list of legal enumerated values.
6751 The option will use
6752 the specified name
6753 .IR key ,
6754 have a default value of
6755 .IR default ,
6756 and display the specified
6757 .I help
6758 text.
6759 The option will only support the values
6760 .BR all ,
6761 .BR none ,
6762 or the values in the
6763 .I names
6764 list.
6765 More than one value may be specified,
6766 with all values separated by commas.
6767
6768 .TP
6769 .RI PackageOption( key ", " help ", " default )
6770 Return a tuple of arguments
6771 to set up an option
6772 whose value is a path name
6773 of a package that may be
6774 enabled, disabled or 
6775 given an explicit path name.
6776 The option will use
6777 the specified name
6778 .IR key ,
6779 have a default value of
6780 .IR default ,
6781 and display the specified
6782 .I help
6783 text.
6784 The option will support the values
6785 .BR yes ,
6786 .BR true ,
6787 .BR on ,
6788 .BR enable
6789 or
6790 .BR search ,
6791 in which case the specified
6792 .I default
6793 will be used,
6794 or the option may be set to an
6795 arbitrary string
6796 (typically the path name to a package
6797 that is being enabled).
6798 The option will also support the values
6799 .BR no ,
6800 .BR flase ,
6801 .BR off
6802 or
6803 .BR disable
6804 to disable use of the specified option.
6805
6806 .TP
6807 .RI PathOption( key ", " help ", " default )
6808 Return a tuple of arguments
6809 to set up an option
6810 whose value is expected to be a path name.
6811 The option will use
6812 the specified name
6813 .IR key ,
6814 have a default value of
6815 .IR default ,
6816 and display the specified
6817 .I help
6818 text.
6819
6820 .RE
6821 These functions make it
6822 convenient to create a number
6823 of options with consistent behavior
6824 in a single call to the
6825 .B AddOptions
6826 method:
6827
6828 .ES
6829 opts.AddOptions(
6830     BoolOption('warnings', 'compilation with -Wall and similiar', 1),
6831     EnumOption('debug', 'debug output and symbols', 'no'
6832                allowed_values=('yes', 'no', 'full'),
6833                map={}, ignorecase=0),  # case sensitive
6834     ListOption('shared',
6835                'libraries to build as shared libraries',
6836                'all',
6837                names = list_of_libs),
6838     PackageOption('x11',
6839                   'use X11 installed here (yes = search some places)',
6840                   'yes'),
6841     PathOption('qtdir', 'where the root of Qt is installed', qtdir),
6842 )
6843 .EE
6844
6845 .SH EXTENDING SCONS
6846 .SS Builder Objects
6847 .B scons
6848 can be extended to build different types of targets
6849 by adding new Builder objects
6850 to a construction environment.
6851 .IR "In general" ,
6852 you should only need to add a new Builder object
6853 when you want to build a new type of file or other external target.
6854 If you just want to invoke a different compiler or other tool
6855 to build a Program, Object, Library, or any other
6856 type of output file for which
6857 .B scons
6858 already has an existing Builder,
6859 it is generally much easier to
6860 use those existing Builders
6861 in a construction environment
6862 that sets the appropriate construction variables
6863 (CC, LINK, etc.).
6864
6865 Builder objects are created
6866 using the 
6867 .B Builder 
6868 function.
6869 The
6870 .B Builder
6871 function accepts the following arguments:
6872
6873 .IP action
6874 The command line string used to build the target from the source. 
6875 .B action
6876 can also be:
6877 a list of strings representing the command
6878 to be executed and its arguments
6879 (suitable for enclosing white space in an argument),
6880 a dictionary
6881 mapping source file name suffixes to
6882 any combination of command line strings
6883 (if the builder should accept multiple source file extensions),
6884 a Python function;
6885 an Action object
6886 (see the next section);
6887 or a list of any of the above.
6888
6889 An action function
6890 takes three arguments:
6891 .I source 
6892 - a list of source nodes, 
6893 .I target
6894 - a list of target nodes,
6895 .I env
6896 - the construction environment.
6897
6898 .IP prefix 
6899 The prefix that will be prepended to the target file name.
6900 This may be a simple string,  or a callable object that takes
6901 two arguments, a construction environment and a list of sources,
6902 and returns a prefix.
6903
6904 .ES
6905 b = Builder("build_it < $SOURCE > $TARGET"
6906             prefix = "file-")
6907
6908 def gen_prefix(env, sources):
6909     return "file-" + env['PLATFORM'] + '-'
6910 b = Builder("build_it < $SOURCE > $TARGET"
6911             prefix = gen_prefix)
6912 .EE
6913
6914 .IP suffix
6915 The suffix that will be appended to the target file name.
6916 This may be a simple string, or a callable object that takes
6917 two arguments, a construction environment and a list of sources,
6918 and returns a suffix.
6919 If the suffix is a string, then
6920 .B scons
6921 will append a '.' to the beginning of the
6922 suffix if it's not already there.
6923 The string returned by callable object
6924 is untouched and must append its own '.'
6925 to the beginning if one is desired.
6926
6927 .ES
6928 b = Builder("build_it < $SOURCE > $TARGET"
6929             suffix = "file-"
6930
6931 def gen_suffix(env, sources):
6932     return "." + env['PLATFORM'] + "-file"
6933 b = Builder("build_it < $SOURCE > $TARGET"
6934             suffix = gen_suffix)
6935 .EE
6936
6937 .IP src_suffix
6938 The expected source file name suffix.
6939
6940 .IP target_scanner
6941 A Scanner object that
6942 will be invoked to find
6943 implicit dependencies for this target file.
6944 This keyword argument should be used
6945 for Scanner objects that find
6946 implicit dependencies
6947 based only on the target file
6948 and the construction environment,
6949 .I not 
6950 for implicit
6951 (See the section "Scanner Objects," below,
6952 for information about creating Scanner objects.)
6953
6954 .IP source_scanner
6955 A Scanner object that
6956 will be invoked to
6957 find implicit dependences in
6958 any source files
6959 used to build this target file.
6960 This is where you would
6961 specify a scanner to
6962 find things like
6963 .B #include
6964 lines in source files.
6965 (See the section "Scanner Objects," below,
6966 for information about creating Scanner objects.)
6967
6968 .IP target_factory
6969 A factory function that the Builder will use
6970 to turn any targets specified as strings into SCons Nodes.
6971 By default,
6972 SCons assumes that all targets are files.
6973 Other useful target_factory
6974 values include
6975 .BR Dir ,
6976 for when a Builder creates a directory target,
6977 and
6978 .BR Entry ,
6979 for when a Builder can create either a file
6980 or directory target.
6981
6982 Example:
6983
6984 .ES
6985 MakeDirectoryBuilder = Builder(action=my_mkdir, target_factory=Dir)
6986 env = Environment()
6987 env.Append(BUILDERS = {'MakeDirectory':MakeDirectoryBuilder})
6988 env.MakeDirectory('new_directory')
6989 .EE
6990
6991 .IP source_factory
6992 A factory function that the Builder will use
6993 to turn any sources specified as strings into SCons Nodes.
6994 By default,
6995 SCons assumes that all source are files.
6996 Other useful source_factory
6997 values include
6998 .BR Dir ,
6999 for when a Builder uses a directory as a source,
7000 and
7001 .BR Entry ,
7002 for when a Builder can use files
7003 or directories (or both) as sources.
7004
7005 Example:
7006
7007 .ES
7008 CollectBuilder = Builder(action=my_mkdir, source_factory=Entry)
7009 env = Environment()
7010 env.Append(BUILDERS = {'Collect':CollectBuilder})
7011 env.Collect('archive', ['directory_name', 'file_name'])
7012 .EE
7013
7014 .IP emitter
7015 A function or list of functions to manipulate the target and source
7016 lists before dependencies are established
7017 and the target(s) are actually built.
7018 .B emitter
7019 can also be a string containing a construction variable to expand
7020 to an emitter function or list of functions,
7021 or a dictionary mapping source file suffixes
7022 to emitter functions.
7023 (Only the suffix of the first source file
7024 is used to select the actual emitter function
7025 from an emitter dictionary.)
7026
7027 An emitter function
7028 takes three arguments:
7029 .I source 
7030 - a list of source nodes, 
7031 .I target
7032 - a list of target nodes,
7033 .I env
7034 - the construction environment.
7035 An emitter must return a tuple containing two lists,
7036 the list of targets to be built by this builder,
7037 and the list of sources for this builder.
7038
7039 Example:
7040
7041 .ES
7042 def e(target, source, env):
7043     return (target + ['foo.foo'], source + ['foo.src'])
7044
7045 # Simple association of an emitter function with a Builder.
7046 b = Builder("my_build < $TARGET > $SOURCE",
7047             emitter = e)
7048
7049 def e2(target, source, env):
7050     return (target + ['bar.foo'], source + ['bar.src'])
7051
7052 # Simple association of a list of emitter functions with a Builder.
7053 b = Builder("my_build < $TARGET > $SOURCE",
7054             emitter = [e, e2])
7055
7056 # Calling an emitter function through a construction variable.
7057 env = Environment(MY_EMITTER = e)
7058 b = Builder("my_build < $TARGET > $SOURCE",
7059             emitter = '$MY_EMITTER')
7060
7061 # Calling a list of emitter functions through a construction variable.
7062 env = Environment(EMITTER_LIST = [e, e2])
7063 b = Builder("my_build < $TARGET > $SOURCE",
7064             emitter = '$EMITTER_LIST')
7065
7066 # Associating multiple emitters with different file
7067 # suffixes using a dictionary.
7068 def e_suf1(target, source, env):
7069     return (target + ['another_target_file'], source)
7070 def e_suf2(target, source, env):
7071     return (target, source + ['another_source_file'])
7072 b = Builder("my_build < $TARGET > $SOURCE",
7073             emitter = {'.suf1' : e_suf1,
7074                        '.suf2' : e_suf2})
7075 .EE
7076 .IP
7077 The 
7078 .I generator
7079 and
7080 .I action
7081 arguments must not both be used for the same Builder.
7082
7083 .IP multi
7084 Specifies whether this builder is allowed to be called multiple times for
7085 the same target file(s). The default is 0, which means the builder
7086 can not be called multiple times for the same target file(s). Calling a
7087 builder multiple times for the same target simply adds additional source
7088 files to the target; it is not allowed to change the environment associated
7089 with the target, specify addition environment overrides, or associate a different
7090 builder with the target. 
7091
7092 .IP env
7093 A construction environment that can be used
7094 to fetch source code using this Builder.
7095 (Note that this environment is
7096 .I not
7097 used for normal builds of normal target files,
7098 which use the environment that was
7099 used to call the Builder for the target file.)
7100
7101 .IP generator
7102 A function that returns a list of actions that will be executed to build
7103 the target(s) from the source(s).
7104 The returned action(s) may be
7105 an Action object, or anything that
7106 can be converted into an Action object
7107 (see the next section).
7108
7109 The generator function
7110 takes four arguments:
7111 .I source 
7112 - a list of source nodes, 
7113 .I target
7114 - a list of target nodes,
7115 .I env
7116 - the construction environment,
7117 .I for_signature
7118 - a Boolean value that specifies
7119 whether the generator is being called
7120 for generating a build signature
7121 (as opposed to actually executing the command).
7122 Example:
7123
7124 .ES
7125 def g(source, target, env, for_signature):
7126     return [["gcc", "-c", "-o"] + target + source] 
7127
7128 b = Builder(generator=g)
7129 .EE
7130
7131 .IP src_builder
7132 Specifies a builder to use when a source file name suffix does not match
7133 any of the suffixes of the builder. Using this argument produces a
7134 multi-stage builder.
7135
7136 .IP single_source
7137 Specifies that this builder expects exactly one source file per call. Giving
7138 more than one source files without target files results in implicitely calling
7139 the builder multiple times (once for each source given). Giving multiple 
7140 source files together with target files results in a UserError exception.
7141
7142 .RE
7143 .IP
7144 The 
7145 .I generator
7146 and
7147 .I action
7148 arguments must not both be used for the same Builder.
7149
7150 .IP env
7151 A construction environment that can be used
7152 to fetch source code using this Builder.
7153 (Note that this environment is
7154 .I not
7155 used for normal builds of normal target files,
7156 which use the environment that was
7157 used to call the Builder for the target file.)
7158
7159 .ES
7160 b = Builder(action="build < $SOURCE > $TARGET")
7161 env = Environment(BUILDERS = {'MyBuild' : b})
7162 env.MyBuild('foo.out', 'foo.in', my_arg = 'xyzzy')
7163 .EE
7164
7165 .RE
7166 Any additional keyword arguments supplied
7167 when a Builder object is created
7168 (that is, when the Builder() function is called)
7169 will be set in the executing construction
7170 environment when the Builder object is called.
7171 The canonical example here would be
7172 to set a construction variable to 
7173 the repository of a source code system.
7174
7175 Any additional keyword arguments supplied
7176 when a Builder
7177 .I object
7178 is called
7179 will only be associated with the target
7180 created by that particular Builder call
7181 (and any other files built as a
7182 result of the call).
7183
7184 These extra keyword arguments are passed to the
7185 following functions:
7186 command generator functions,
7187 function Actions,
7188 and emitter functions.
7189
7190 .SS Action Objects
7191
7192 The
7193 .BR Builder()
7194 function will turn its
7195 .B action
7196 keyword argument into an appropriate
7197 internal Action object.
7198 You can also explicity create Action objects
7199 using the
7200 .BR Action ()
7201 global function,
7202 which can then be passed to the
7203 .BR Builder ()
7204 function.
7205 This can be used to configure
7206 an Action object more flexibly,
7207 or it may simply be more efficient
7208 than letting each separate Builder object
7209 create a separate Action
7210 when multiple
7211 Builder objects need to do the same thing.
7212
7213 The
7214 .BR Action ()
7215 global function
7216 returns an appropriate object for the action
7217 represented by the type of the first argument:
7218
7219 .IP Action
7220 If the first argument is already an Action object,
7221 the object is simply returned.
7222
7223 .IP String
7224 If the first argument is a string,
7225 a command-line Action is returned.
7226
7227 .ES
7228 Action('$CC -c -o $TARGET $SOURCES')
7229 .EE
7230
7231 .\" XXX From Gary Ruben, 23 April 2002:
7232 .\" What would be useful is a discussion of how you execute command
7233 .\" shell commands ie. what is the process used to spawn the shell, pass
7234 .\" environment variables to it etc., whether there is one shell per
7235 .\" environment or one per command etc.  It might help to look at the Gnu
7236 .\" make documentation to see what they think is important to discuss about
7237 .\" a build system. I'm sure you can do a better job of organising the
7238 .\" documentation than they have :-)
7239
7240
7241 .IP List
7242 If the first argument is a list,
7243 then a list of Action objects is returned.
7244 An Action object is created as necessary
7245 for each element in the list.
7246 If an element
7247 .I within
7248 the list is itself a list,
7249 the internal list is the
7250 command and arguments to be executed via
7251 the command line.
7252 This allows white space to be enclosed
7253 in an argument by defining
7254 a command in a list within a list:
7255
7256 .ES
7257 Action([['cc', '-c', '-DWHITE SPACE', '-o', '$TARGET', '$SOURCES']])
7258 .EE
7259
7260 .IP Function
7261 If the first argument is a Python function,
7262 a function Action is returned.
7263 The Python function takes three keyword arguments,
7264 .B target
7265 (a Node object representing the target file),
7266 .B source
7267 (a Node object representing the source file)
7268 and
7269 .B env
7270 (the construction environment
7271 used for building the target file).
7272 The
7273 .B target
7274 and
7275 .B source
7276 arguments may be lists of Node objects if there is
7277 more than one target file or source file.
7278 The actual target and source file name(s) may
7279 be retrieved from their Node objects
7280 via the built-in Python str() function:
7281
7282 .ES
7283 target_file_name = str(target)
7284 source_file_names = map(lambda x: str(x), source)
7285 .EE
7286 .IP
7287 The function should return
7288 .B 0
7289 or
7290 .B None
7291 to indicate a successful build of the target file(s).
7292 The function may raise an exception
7293 or return a non-zero exit status
7294 to indicate an unsuccessful build.
7295
7296 .ES
7297 def build_it(target = None, source = None, env = None):
7298     # build the target from the source
7299     return 0
7300  
7301 a = Action(build_it)
7302 .EE
7303
7304 The second, optional argument
7305 is a Python function that returns
7306 a string to be printed to describe the action being executed.
7307 Like a function to build a file,
7308 this function takes three arguments:
7309 .B target
7310 (a Node object representing the target file),
7311 .B source
7312 (a Node object representing the source file)
7313 and
7314 .BR env
7315 (a construction environment).
7316 The
7317 .B target
7318 and
7319 .B source
7320 arguments may be lists of Node objects if there is
7321 more than one target file or source file.
7322 Examples:
7323
7324 .ES
7325 def build_it(target, source, env):
7326     # build the target from the source
7327     return 0
7328
7329 def string_it(target, source, env):
7330     return "building '%s' from '%s'" % (target[0], source[0])
7331
7332 # Use a positional argument.
7333 a = Action(build_it, string_it)
7334
7335 # Alternatively, use a keyword argument.
7336 a = Action(build_it, strfunction=string_it)
7337 .EE
7338
7339 The third, also optional argument
7340 is a list of construction variables
7341 whose values will be included
7342 in the signature of the Action
7343 when deciding whether a target should
7344 be rebuilt because the action changed.
7345 This is necessary whenever you want a target to
7346 be rebuilt when a specific
7347 construction variable changes,
7348 because the underlying Python code for a function
7349 will not change when the value of the construction variable does.
7350
7351 .ES
7352 def build_it(target, source, env):
7353     # build the target from the 'XXX' construction variable
7354     open(target[0], 'w').write(env['XXX'])
7355     return 0
7356
7357 def string_it(target, source):
7358     return "building '%s' from '%s'" % (target[0], source[0])
7359
7360 # Use positional arguments.
7361 a = Action(build_it, string_it, ['XXX'])
7362
7363 # Alternatively, use a keyword argument.
7364 a = Action(build_it, varlist=['XXX'])
7365 .EE
7366 .PP
7367 If the action argument is not one of the above,
7368 None is returned.
7369
7370 .SS Miscellaneous Action Functions
7371
7372 .B scons
7373 supplies a number of functions
7374 that arrange for various common
7375 file and directory manipulations
7376 to be performed.
7377 These are similar in concept to "tasks" in the 
7378 Ant build tool,
7379 although the implementation is slightly different.
7380 These functions do not actually
7381 perform the specified action
7382 at the time the function is called,
7383 but instead return an Action object
7384 that can be executed at the
7385 appropriate time.
7386 (In Object-Oriented terminology,
7387 these are actually
7388 Action
7389 .I Factory
7390 functions
7391 that return Action objects.)
7392
7393 In practice,
7394 there are two natural ways
7395 that these
7396 Action Functions
7397 are intended to be used.
7398
7399 First,
7400 if you need
7401 to perform the action
7402 at the time the SConscript
7403 file is being read,
7404 you can use the
7405 .B Execute
7406 global function to do so:
7407 .ES
7408 Execute(Touch('file'))
7409 .EE
7410
7411 Second,
7412 you can use these functions
7413 to supply Actions in a list
7414 for use by the
7415 .B Command
7416 method.
7417 This can allow you to
7418 perform more complicated
7419 sequences of file manipulation
7420 without relying
7421 on platform-specific
7422 external commands:
7423 that 
7424 .ES
7425 env = Environment(TMPBUILD = '/tmp/builddir')
7426 env.Command('foo.out', 'foo.in',
7427             [Mkdir('$TMPBUILD'),
7428              Copy('${SOURCE.dir}', '$TMPBUILD')
7429              "cd $TMPBUILD && make",
7430              Delete('$TMPBUILD')])
7431 .EE
7432
7433 .TP
7434 .RI Chmod( dest ", " mode )
7435 Returns an Action object that
7436 changes the permissions on the specified
7437 .I dest
7438 file or directory to the specified
7439 .IR mode .
7440 Examples:
7441
7442 .ES
7443 Execute(Chmod('file', 0755))
7444
7445 env.Command('foo.out', 'foo.in',
7446             [Copy('$TARGET', '$SOURCE'),
7447              Chmod('$TARGET', 0755)])
7448 .EE
7449
7450 .TP
7451 .RI Copy( dest ", " src )
7452 Returns an Action object
7453 that will copy the
7454 .I src
7455 source file or directory to the
7456 .I dest
7457 destination file or directory.
7458 Examples:
7459
7460 .ES
7461 Execute(Copy('foo.output', 'foo.input'))
7462
7463 env.Command('bar.out', 'bar.in',
7464             Copy('$TARGET', '$SOURCE'))
7465 .EE
7466
7467 .TP
7468 .RI Delete( entry )
7469 Returns an Action that
7470 deletes the specified
7471 .IR entry ,
7472 which may be a file or a directory tree.
7473 If a directory is specified,
7474 the entire directory tree
7475 will be removed.
7476 Examples:
7477
7478 .ES
7479 Execute(Delete('/tmp/buildroot'))
7480
7481 env.Command('foo.out', 'foo.in',
7482             [Delete('${TARGET.dir}'),
7483              MyBuildAction])
7484 .EE
7485
7486 .TP
7487 .RI Mkdir( dir )
7488 Returns an Action
7489 that creates the specified
7490 directory
7491 .I dir .
7492 Examples:
7493
7494 .ES
7495 Execute(Mkdir('/tmp/outputdir'))
7496
7497 env.Command('foo.out', 'foo.in',
7498             [Mkdir('/tmp/builddir',
7499              Copy('$SOURCE', '/tmp/builddir')
7500              "cd /tmp/builddir && ])
7501
7502 .EE
7503
7504 .TP
7505 .RI Move( dest ", " src )
7506 Returns an Action
7507 that moves the specified
7508 .I src
7509 file or directory to
7510 the specified
7511 .I dest
7512 file or directory.
7513 Examples:
7514
7515 .ES
7516 Execute(Move('file.destination', 'file.source'))
7517
7518 env.Command('output_file', 'input_file',
7519             [MyBuildAction,
7520              Move('$TARGET', 'file_created_by_MyBuildAction')])
7521 .EE
7522
7523 .TP
7524 .RI Touch( file )
7525 Returns an Action
7526 that updates the modification time
7527 on the specified
7528 .IR file .
7529 Examples:
7530
7531 .ES
7532 Execute(Touch('file_to_be_touched'))
7533
7534 env.Command('marker', 'input_file',
7535             [MyBuildAction,
7536              Touch('$TARGET')])
7537 .EE
7538
7539 .SS Variable Substitution
7540
7541 Before executing a command,
7542 .B scons
7543 performs construction variable interpolation on the strings that make up
7544 the command line of builders.
7545 Variables are introduced by a
7546 .B $
7547 prefix.
7548 Besides construction variables, scons provides the following
7549 variables for each command execution:
7550
7551 .IP TARGET
7552 The file name of the target being built, or the file name of the first 
7553 target if multiple targets are being built.
7554
7555 .IP TARGETS
7556 The file names of all targets being built.
7557
7558 .IP SOURCE
7559 The file name of the source of the build command, or the file name of the
7560 first source if multiple sources are being built.
7561
7562 .IP SOURCES
7563 The file names of the sources of the build command.
7564
7565 (Note that the above variables are reserved
7566 and may not be set in a construction environment.)
7567
7568 .LP 
7569 For example, given the construction variable CC='cc', targets=['foo'], and
7570 sources=['foo.c', 'bar.c']:
7571
7572 .ES
7573 action='$CC -c -o $TARGET $SOURCES'
7574 .EE
7575
7576 would produce the command line:
7577
7578 .ES
7579 cc -c -o foo foo.c bar.c
7580 .EE
7581
7582 Variable names may be surrounded by curly braces ({})
7583 to separate the name from the trailing characters.
7584 Within the curly braces, a variable name may have
7585 a Python slice subscript appended to select one
7586 or more items from a list.
7587 In the previous example, the string:
7588
7589 .ES
7590 ${SOURCES[1]}
7591 .EE
7592
7593 would produce:
7594
7595 .ES
7596 bar.c
7597 .EE
7598
7599 Additionally, a variable name may
7600 have the following special
7601 modifiers appended within the enclosing curly braces
7602 to modify the interpolated string:
7603
7604 .IP base
7605 The base path of the file name,
7606 including the directory path
7607 but excluding any suffix.
7608
7609 .IP dir
7610 The name of the directory in which the file exists.
7611
7612 .IP file
7613 The file name,
7614 minus any directory portion.
7615
7616 .IP filebase
7617 Just the basename of the file,
7618 minus any suffix
7619 and minus the directory.
7620
7621 .IP suffix
7622 Just the file suffix.
7623
7624 .IP abspath
7625 The absolute path name of the file.
7626
7627 .IP posix
7628 The POSIX form of the path,
7629 with directories separated by
7630 .B /
7631 (forward slashes)
7632 not backslashes.
7633 This is sometimes necessary on Win32 systems
7634 when a path references a file on other (POSIX) systems.
7635
7636 .IP srcpath
7637 The directory and file name to the source file linked to this file
7638 through BuildDir.  If this file isn't linked, it just returns the
7639 directory and filename unchanged.
7640
7641 .IP srcdir
7642 The directory containing the source file linked to this file
7643 through BuildDir.  If this file isn't linked, it just returns the
7644 directory part of the filename.
7645
7646 .IP rsrcpath
7647 The directory and file name to the source file linked to this file
7648 through BuildDir.  If the file does not exist locally but exists in
7649 a Repository, the path in the Repository is returned.
7650 If this file isn't linked, it just returns the
7651 directory and filename unchanged.
7652
7653 .IP rsrcdir
7654 The Repository directory containing the source file linked to this file
7655 through BuildDir.  If this file isn't linked, it just returns the
7656 directory part of the filename.
7657
7658 .LP
7659 For example, the specified target will
7660 expand as follows for the corresponding modifiers:
7661
7662 .ES
7663 $TARGET              => sub/dir/file.x
7664 ${TARGET.base}       => sub/dir/file
7665 ${TARGET.dir}        => sub/dir
7666 ${TARGET.file}       => file.x
7667 ${TARGET.filebase}   => file
7668 ${TARGET.suffix}     => .x
7669 ${TARGET.abspath}    => /top/dir/sub/dir/file.x
7670
7671 BuildDir('sub/dir','src')
7672 $SOURCE              => sub/dir/file.x
7673 ${SOURCE.srcpath}    => src/file.x
7674 ${SOURCE.srcdir}     => src
7675
7676 Repository('/usr/repository')
7677 $SOURCE              => sub/dir/file.x
7678 ${SOURCE.rsrcpath}   => /usr/repository/src/file.x
7679 ${SOURCE.rsrcdir}    => /usr/repository/src
7680 .EE
7681
7682 Lastly, a variable name
7683 may be a callable Python function
7684 associated with a
7685 construction variable in the environment.
7686 The function should
7687 take four arguments:
7688 .I target
7689 - a list of target nodes,
7690 .I source 
7691 - a list of source nodes, 
7692 .I env
7693 - the construction environment,
7694 .I for_signature
7695 - a Boolean value that specifies
7696 whether the function is being called
7697 for generating a build signature.
7698 SCons will insert whatever
7699 the called function returns
7700 into the expanded string:
7701
7702 .ES
7703 def foo(target, source, env, for_signature):
7704     return "bar"
7705
7706 # Will expand $BAR to "bar baz"
7707 env=Environment(FOO=foo, BAR="$FOO baz")
7708 .EE
7709
7710 You can use this feature to pass arguments to a
7711 Python function by creating a callable class
7712 that stores one or more arguments in an object,
7713 and then uses them when the
7714 .B __call__()
7715 method is called.
7716 Note that in this case,
7717 the entire variable expansion must
7718 be enclosed by curly braces
7719 so that the arguments will
7720 be associated with the
7721 instantiation of the class:
7722
7723 .ES
7724 class foo:
7725     def __init__(self, arg):
7726         self.arg = arg
7727
7728     def __call__(self, target, source, env, for_signature):
7729         return arg + " bar"
7730
7731 # Will expand $BAR to "my argument bar baz"
7732 env=Environment(FOO=foo, BAR="${FOO('my argument')} baz")
7733 .EE
7734
7735 .LP
7736 The special pseudo-variables
7737 .B "$("
7738 and
7739 .B "$)"
7740 may be used to surround parts of a command line
7741 that may change
7742 .I without
7743 causing a rebuild--that is,
7744 which are not included in the signature
7745 of target files built with this command.
7746 All text between
7747 .B "$("
7748 and
7749 .B "$)"
7750 will be removed from the command line
7751 before it is added to file signatures,
7752 and the
7753 .B "$("
7754 and
7755 .B "$)"
7756 will be removed before the command is executed.
7757 For example, the command line:
7758
7759 .ES
7760 echo Last build occurred $( $TODAY $). > $TARGET
7761 .EE
7762
7763 .LP
7764 would execute the command:
7765
7766 .ES
7767 echo Last build occurred $TODAY. > $TARGET
7768 .EE
7769
7770 .LP
7771 but the command signature added to any target files would be:
7772
7773 .ES
7774 echo Last build occurred  . > $TARGET
7775 .EE
7776
7777 SCons uses the following rules when converting construction variables into
7778 command lines:
7779
7780 .IP String
7781 When the value is a string it is interpreted as a space delimited list of
7782 command line arguments. 
7783
7784 .IP List
7785 When the value is a list it is interpreted as a list of command line
7786 arguments. Each element of the list is converted to a string.
7787
7788 .IP Other
7789 Anything that is not a list or string is converted to a string and
7790 interpreted as a single command line argument.
7791
7792 .IP Newline
7793 Newline characters (\\n) delimit lines. The newline parsing is done after
7794 all other parsing, so it is not possible for arguments (e.g. file names) to
7795 contain embedded newline characters. This limitation will likely go away in
7796 a future version of SCons.
7797
7798 .SS Scanner Objects
7799
7800 You can use the
7801 .B Scanner
7802 function to define
7803 objects to scan
7804 new file types for implicit dependencies.
7805 Scanner accepts the following arguments:
7806
7807 .IP function
7808 A Python function that will process
7809 the Node (file)
7810 and return a list of strings (file names)
7811 representing the implicit
7812 dependencies found in the contents.
7813 The function takes three or four arguments:
7814
7815     def scanner_function(node, env, path):
7816
7817     def scanner_function(node, env, path, arg):
7818
7819 The
7820 .B node
7821 argument is the internal
7822 SCons node representing the file.
7823 Use
7824 .B str(node)
7825 to fetch the name of the file, and
7826 .B node.get_contents()
7827 to fetch contents of the file.
7828
7829 The
7830 .B env
7831 argument is the construction environment for the scan.
7832 Fetch values from it using the
7833 .B env.Dictionary()
7834 method.
7835
7836 The
7837 .B path
7838 argument is a tuple (or list)
7839 of directories that can be searched
7840 for files.
7841 This will usually be the tuple returned by the
7842 .B path_function
7843 argument (see below).
7844
7845 The
7846 .B arg
7847 argument is the argument supplied
7848 when the scanner was created, if any.
7849
7850 .IP name
7851 The name of the Scanner.
7852 This is mainly used
7853 to identify the Scanner internally.
7854
7855 .IP argument
7856 An optional argument that, if specified,
7857 will be passed to the scanner function
7858 (described above)
7859 and the path function
7860 (specified below).
7861
7862 .IP skeys
7863 An optional list that can be used to
7864 determine which scanner should be used for
7865 a given Node.
7866 In the usual case of scanning for file names,
7867 this argument will be a list of suffixes
7868 for the different file types that this
7869 Scanner knows how to scan.
7870 If the argument is a string,
7871 then it will be expanded 
7872 into a list by the current environment.
7873
7874 .IP path_function
7875 A Python function that takes
7876 two or three arguments:
7877 a construction environment, directory Node,
7878 and optional argument supplied
7879 when the scanner was created.
7880 The
7881 .B path_function
7882 returns a tuple of directories
7883 that can be searched for files to be returned
7884 by this Scanner object.
7885
7886 .IP node_class
7887 The class of Node that should be returned
7888 by this Scanner object.
7889 Any strings or other objects returned
7890 by the scanner function
7891 that are not of this class
7892 will be run through the
7893 .B node_factory
7894 function.
7895
7896 .IP node_factory
7897 A Python function that will take a string
7898 or other object
7899 and turn it into the appropriate class of Node
7900 to be returned by this Scanner object.
7901
7902 .IP scan_check
7903 An optional Python function that takes two arguments,
7904 a Node (file) and a construction environment,
7905 and returns whether the
7906 Node should, in fact,
7907 be scanned for dependencies.
7908 This check can be used to eliminate unnecessary
7909 calls to the scanner function when,
7910 for example, the underlying file
7911 represented by a Node does not yet exist.
7912
7913 .IP recursive
7914 An optional flag that
7915 specifies whether this scanner should be re-invoked
7916 on the dependency files returned by the scanner.
7917 When this flag is not set,
7918 the Node subsystem will
7919 only invoke the scanner on the file being scanned,
7920 and not (for example) also on the files
7921 specified by the #include lines
7922 in the file being scanned.
7923
7924 .SH SYSTEM-SPECIFIC BEHAVIOR
7925 SCons and its configuration files are very portable,
7926 due largely to its implementation in Python.
7927 There are, however, a few portability
7928 issues waiting to trap the unwary.
7929 .SS .C file suffix
7930 SCons handles the upper-case
7931 .B .C
7932 file suffix differently,
7933 depending on the capabilities of
7934 the underlying system.
7935 On a case-sensitive system
7936 such as Linux or UNIX,
7937 SCons treats a file with a 
7938 .B .C
7939 suffix as a C++ source file.
7940 On a case-insensitive system
7941 such as Windows,
7942 SCons treats a file with a 
7943 .B .C
7944 suffix as a C source file.
7945 .SS .F file suffix
7946 SCons handles the upper-case
7947 .B .F
7948 file suffix differently,
7949 depending on the capabilities of
7950 the underlying system.
7951 On a case-sensitive system
7952 such as Linux or UNIX,
7953 SCons treats a file with a 
7954 .B .F
7955 suffix as a Fortran source file
7956 that is to be first run through
7957 the standard C preprocessor.
7958 On a case-insensitive system
7959 such as Windows,
7960 SCons treats a file with a 
7961 .B .F
7962 suffix as a Fortran source file that should
7963 .I not
7964 be run through the C preprocessor.
7965 .SS WIN32:  Cygwin Tools and Cygwin Python vs. Windows Pythons
7966 Cygwin supplies a set of tools and utilities
7967 that let users work on a
7968 Windows system using a more POSIX-like environment.
7969 The Cygwin tools, including Cygwin Python,
7970 do this, in part,
7971 by sharing an ability to interpret UNIX-like path names.
7972 For example, the Cygwin tools
7973 will internally translate a Cygwin path name
7974 like /cygdrive/c/mydir
7975 to an equivalent Windows pathname
7976 of C:/mydir (equivalent to C:\\mydir).
7977
7978 Versions of Python
7979 that are built for native Windows execution,
7980 such as the python.org and ActiveState versions,
7981 do not have the Cygwin path name semantics.
7982 This means that using a native Windows version of Python
7983 to build compiled programs using Cygwin tools
7984 (such as gcc, bison, and flex)
7985 may yield unpredictable results.
7986 "Mixing and matching" in this way
7987 can be made to work,
7988 but it requires careful attention to the use of path names
7989 in your SConscript files.
7990
7991 In practice, users can sidestep
7992 the issue by adopting the following rules:
7993 When using gcc,
7994 use the Cygwin-supplied Python interpreter
7995 to run SCons;
7996 when using Microsoft Visual C/C++
7997 (or some other Windows compiler)
7998 use the python.org or ActiveState version of Python
7999 to run SCons.
8000 .SS WIN32:  scons.bat file
8001 On WIN32 systems,
8002 SCons is executed via a wrapper
8003 .B scons.bat
8004 file.
8005 This has (at least) two ramifications:
8006
8007 First, Windows command-line users
8008 that want to use variable assignment
8009 on the command line
8010 may have to put double quotes
8011 around the assignments:
8012
8013 .ES
8014 scons "FOO=BAR" "BAZ=BLEH"
8015 .EE
8016
8017 Second, the Cygwin shell does not
8018 recognize this file as being the same
8019 as an
8020 .B scons
8021 command issued at the command-line prompt.
8022 You can work around this either by
8023 executing
8024 .B scons.bat
8025 from the Cygwin command line,
8026 or by creating a wrapper shell
8027 script named
8028 .B scons .
8029
8030 .SS MinGW
8031
8032 The MinGW bin directory must be in your PATH environment variable or the
8033 PATH variable under the ENV construction variable for SCons
8034 to detect and use the MinGW tools. When running under the native Windows
8035 Python interpreter, SCons will prefer the MinGW tools over the Cygwin
8036 tools, if they are both installed, regardless of the order of the bin
8037 directories in the PATH variable. If you have both MSVC and MinGW
8038 installed and you want to use MinGW instead of MSVC,
8039 then you must explictly tell SCons to use MinGW by passing 
8040
8041 .ES
8042 tools=['mingw']
8043 .EE
8044
8045 to the Environment() function, because SCons will prefer the MSVC tools
8046 over the MinGW tools.
8047
8048 .SH EXAMPLES
8049
8050 To help you get started using SCons,
8051 this section contains a brief overview of some common tasks.
8052
8053 .SS Basic Compilation From a Single Source File
8054
8055 .ES
8056 env = Environment()
8057 env.Program(target = 'foo', source = 'foo.c')
8058 .EE
8059
8060 Note:  Build the file by specifying
8061 the target as an argument
8062 ("scons foo" or "scons foo.exe").
8063 or by specifying a dot ("scons .").
8064
8065 .SS Basic Compilation From Multiple Source Files
8066
8067 .ES
8068 env = Environment()
8069 env.Program(target = 'foo', source = Split('f1.c f2.c f3.c'))
8070 .EE
8071
8072 .SS Setting a Compilation Flag
8073
8074 .ES
8075 env = Environment(CCFLAGS = '-g')
8076 env.Program(target = 'foo', source = 'foo.c')
8077 .EE
8078
8079 .SS Search The Local Directory For .h Files
8080
8081 Note:  You do
8082 .I not
8083 need to set CCFLAGS to specify -I options by hand.
8084 SCons will construct the right -I options from CPPPATH.
8085
8086 .ES
8087 env = Environment(CPPPATH = ['.'])
8088 env.Program(target = 'foo', source = 'foo.c')
8089 .EE
8090
8091 .SS Search Multiple Directories For .h Files
8092
8093 .ES
8094 env = Environment(CPPPATH = ['include1', 'include2'])
8095 env.Program(target = 'foo', source = 'foo.c')
8096 .EE
8097
8098 .SS Building a Static Library
8099
8100 .ES
8101 env = Environment()
8102 env.StaticLibrary(target = 'foo', source = Split('l1.c l2.c'))
8103 env.StaticLibrary(target = 'bar', source = ['l3.c', 'l4.c'])
8104 .EE
8105
8106 .SS Building a Shared Library
8107
8108 .ES
8109 env = Environment()
8110 env.SharedLibrary(target = 'foo', source = ['l5.c', 'l6.c'])
8111 env.SharedLibrary(target = 'bar', source = Split('l7.c l8.c'))
8112 .EE
8113
8114 .SS Linking a Local Library Into a Program
8115
8116 .ES
8117 env = Environment(LIBS = 'mylib', LIBPATH = ['.'])
8118 env.Library(target = 'mylib', source = Split('l1.c l2.c'))
8119 env.Program(target = 'prog', source = ['p1.c', 'p2.c'])
8120 .EE
8121
8122 .SS Defining Your Own Builder Object
8123
8124 Notice that when you invoke the Builder,
8125 you can leave off the target file suffix,
8126 and SCons will add it automatically.
8127
8128 .ES
8129 bld = Builder(action = 'pdftex < $SOURCES > $TARGET'
8130               suffix = '.pdf',
8131               src_suffix = '.tex')
8132 env = Environment(BUILDERS = {'PDFBuilder' : bld})
8133 env.PDFBuilder(target = 'foo.pdf', source = 'foo.tex')
8134
8135 # The following creates "bar.pdf" from "bar.tex"
8136 env.PDFBuilder(target = 'bar', source = 'bar')
8137 .EE
8138
8139 Note also that the above initialization
8140 overwrites the default Builder objects,
8141 so the Environment created above
8142 can not be used call Builders like env.Program(),
8143 env.Object(), env.StaticLibrary(), etc.
8144
8145 .SS Adding Your Own Builder Object to an Environment
8146
8147 .ES
8148 bld = Builder(action = 'pdftex < $SOURCES > $TARGET'
8149               suffix = '.pdf',
8150               src_suffix = '.tex')
8151 env = Environment()
8152 env.Append(BUILDERS = {'PDFBuilder' : bld})
8153 env.PDFBuilder(target = 'foo.pdf', source = 'foo.tex')
8154 env.Program(target = 'bar', source = 'bar.c')
8155 .EE
8156
8157 You also can use other Pythonic techniques to add
8158 to the BUILDERS construction variable, such as:
8159
8160 .ES
8161 env = Environment()
8162 env['BUILDERS]['PDFBuilder'] = bld
8163 .EE
8164
8165 .SS Defining Your Own Scanner Object
8166
8167 .ES
8168 import re
8169
8170 include_re = re.compile(r'^include\\s+(\\S+)$', re.M)
8171
8172 def kfile_scan(node, env, path, arg):
8173     contents = node.get_contents()
8174     includes = include_re.findall(contents)
8175     return includes
8176
8177 kscan = Scanner(name = 'kfile',
8178                 function = kfile_scan,
8179                 argument = None,
8180                 skeys = ['.k'])
8181 scanners = Environment().Dictionary('SCANNERS')
8182 env = Environment(SCANNERS = scanners + [kscan])
8183
8184 env.Command('foo', 'foo.k', 'kprocess < $SOURCES > $TARGET')
8185
8186 bar_in = File('bar.in')
8187 env.Command('bar', bar_in, 'kprocess $SOURCES > $TARGET')
8188 bar_in.target_scanner = kscan
8189 .EE
8190
8191 .SS Creating a Hierarchical Build
8192
8193 Notice that the file names specified in a subdirectory's
8194 SConscript
8195 file are relative to that subdirectory.
8196
8197 .ES
8198 SConstruct:
8199
8200     env = Environment()
8201     env.Program(target = 'foo', source = 'foo.c')
8202
8203     SConscript('sub/SConscript')
8204
8205 sub/SConscript:
8206
8207     env = Environment()
8208     # Builds sub/foo from sub/foo.c
8209     env.Program(target = 'foo', source = 'foo.c')
8210
8211     SConscript('dir/SConscript')
8212
8213 sub/dir/SConscript:
8214
8215     env = Environment()
8216     # Builds sub/dir/foo from sub/dir/foo.c
8217     env.Program(target = 'foo', source = 'foo.c')
8218 .EE
8219
8220 .SS Sharing Variables Between SConscript Files
8221
8222 You must explicitly Export() and Import() variables that
8223 you want to share between SConscript files.
8224
8225 .ES
8226 SConstruct:
8227
8228     env = Environment()
8229     env.Program(target = 'foo', source = 'foo.c')
8230
8231     Export("env")
8232     SConscript('subdirectory/SConscript')
8233
8234 subdirectory/SConscript:
8235
8236     Import("env")
8237     env.Program(target = 'foo', source = 'foo.c')
8238 .EE
8239
8240 .SS Building Multiple Variants From the Same Source
8241
8242 Use the BuildDir() method to establish
8243 one or more separate build directories for
8244 a given source directory,
8245 then use the SConscript() method
8246 to specify the SConscript files
8247 in the build directories:
8248
8249 .ES
8250 SConstruct:
8251
8252     ccflags = '-DFOO'
8253     Export("ccflags")
8254     BuildDir('foo', 'src')
8255     SConscript('foo/SConscript')
8256
8257     ccflags = '-DBAR'
8258     Export("ccflags")
8259     BuildDir('bar', 'src')
8260     SConscript('bar/SConscript')
8261
8262 src/SConscript:
8263
8264     Import("ccflags")
8265     env = Environment(CCFLAGS = ccflags)
8266     env.Program(target = 'src', source = 'src.c')
8267 .EE
8268
8269 Note the use of the Export() method
8270 to set the "ccflags" variable to a different
8271 value for each variant build.
8272
8273 .SS Hierarchical Build of Two Libraries Linked With a Program
8274
8275 .ES
8276 SConstruct:
8277
8278     env = Environment(LIBPATH = ['#libA', '#libB'])
8279     Export('env')
8280     SConscript('libA/SConscript')
8281     SConscript('libB/SConscript')
8282     SConscript('Main/SConscript')
8283
8284 libA/SConscript:
8285
8286     Import('env')
8287     env.Library('a', Split('a1.c a2.c a3.c'))
8288
8289 libB/SConscript:                                                  
8290
8291     Import('env')
8292     env.Library('b', Split('b1.c b2.c b3.c'))
8293
8294 Main/SConscript:
8295
8296     Import('env')
8297     e = env.Copy(LIBS = ['a', ','b'])
8298     e.Program('foo', Split('m1.c m2.c m3.c'))
8299 .EE
8300
8301 The '#' in the LIBPATH directories specify that they're relative to the
8302 top-level directory, so they don't turn into "Main/libA" when they're
8303 used in Main/SConscript.
8304
8305 Specifying only 'a' and 'b' for the library names
8306 allows SCons to append the appropriate library
8307 prefix and suffix for the current platform
8308 (for example, 'liba.a' on POSIX systems,
8309 'a.lib' on Windows).
8310
8311 .SS Customizing contruction variables from the command line.
8312
8313 The following would allow the C compiler to be specified on the command
8314 line or in the file custom.py. 
8315
8316 .ES
8317 opts = Options('custom.py')
8318 opts.Add('CC', 'The C compiler.')
8319 env = Environment(options=opts)
8320 Help(opts.GenerateHelpText(env))
8321 .EE
8322
8323 The user could specify the C compiler on the command line:
8324
8325 .ES
8326 scons "CC=my_cc"
8327 .EE
8328
8329 or in the custom.py file:
8330
8331 .ES
8332 CC = 'my_cc'
8333 .EE
8334
8335 or get documentation on the options:
8336
8337 .ES
8338 $ scons -h
8339
8340 CC: The C compiler.
8341     default: None
8342     actual: cc
8343
8344 .EE
8345
8346 .SS Using Microsoft Visual C++ precompiled headers
8347
8348 Since windows.h includes everything and the kitchen sink, it can take quite
8349 some time to compile it over and over again for a bunch of object files, so
8350 Microsoft provides a mechanism to compile a set of headers once and then
8351 include the previously compiled headers in any object file. This
8352 technology is called precompiled headers. The general recipe is to create a
8353 file named "StdAfx.cpp" that includes a single header named "StdAfx.h", and
8354 then include every header you want to precompile in "StdAfx.h", and finally
8355 include "StdAfx.h" as the first header in all the source files you are
8356 compiling to object files. For example:
8357
8358 StdAfx.h:
8359 .ES
8360 #include <windows.h>
8361 #include <my_big_header.h>
8362 .EE
8363
8364 StdAfx.cpp:
8365 .ES
8366 #include <StdAfx.h>
8367 .EE
8368
8369 Foo.cpp:
8370 .ES
8371 #include <StdAfx.h>
8372
8373 /* do some stuff */
8374 .EE
8375
8376 Bar.cpp:
8377 .ES
8378 #include <StdAfx.h>
8379
8380 /* do some other stuff */
8381 .EE
8382
8383 SConstruct:
8384 .ES
8385 env=Environment()
8386 env['PCHSTOP'] = 'StdAfx.h'
8387 env['PCH'] = env.PCH('StdAfx.cpp')[0]
8388 env.Program('MyApp', ['Foo.cpp', 'Bar.cpp'])
8389 .EE
8390
8391 For more information see the document for the PCH builder, and the PCH and
8392 PCHSTOP construction variables. To learn about the details of precompiled
8393 headers consult the MSDN documention for /Yc, /Yu, and /Yp.
8394
8395 .SS Using Microsoft Visual C++ external debugging information
8396
8397 Since including debugging information in programs and shared libraries can
8398 cause their size to increase significantly, Microsoft provides a mechanism
8399 for including the debugging information in an external file called a PDB
8400 file. SCons supports PDB files through the PDB construction
8401 variable. 
8402
8403 SConstruct:
8404 .ES
8405 env=Environment()
8406 env['PDB'] = 'MyApp.pdb'
8407 env.Program('MyApp', ['Foo.cpp', 'Bar.cpp'])
8408 .EE
8409
8410 For more information see the document for the PDB construction variable.
8411
8412 .SH ENVIRONMENT
8413
8414 .IP SCONS_LIB_DIR
8415 Specifies the directory that contains the SCons Python module directory
8416 (e.g. /home/aroach/scons-src-0.01/src/engine).
8417
8418 .IP SCONSFLAGS
8419 A string of options that will be used by scons in addition to those passed
8420 on the command line.
8421
8422 .SH "SEE ALSO"
8423 .B scons
8424 User Manual,
8425 .B scons
8426 Design Document,
8427 .B scons
8428 source code.
8429
8430 .SH AUTHORS
8431 Steven Knight <knight@baldmt.com>
8432 .br
8433 Anthony Roach <aroach@electriceyeball.com>
8434