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