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