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