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