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