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