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