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