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