Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: scons-2.0.1/scons.1

Issue 6711079: Added an unmodified copy of SCons to third_party. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/third_party/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scons-2.0.1/os_spawnv_fix.diff ('k') | scons-2.0.1/scons-time.1 » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 .\" Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
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 .\" doc/man/scons.1 5134 2010/08/16 23:02:40 bdeegan
23 .\"
24 .TH SCONS 1 "August 2010"
25 .\" ES - Example Start - indents and turns off line fill
26 .rm ES
27 .de ES
28 .RS
29 .nf
30 ..
31 .\" EE - Example End - ends indent and turns line fill back on
32 .rm EE
33 .de EE
34 .fi
35 .RE
36 ..
37 .SH NAME
38 scons \- a software construction tool
39 .SH SYNOPSIS
40 .B scons
41 [
42 .IR options ...
43 ]
44 [
45 .IR name = val ...
46 ]
47 [
48 .IR targets ...
49 ]
50 .SH DESCRIPTION
51
52 The
53 .B scons
54 utility builds software (or other files) by determining which
55 component pieces must be rebuilt and executing the necessary commands to
56 rebuild them.
57
58 By default,
59 .B scons
60 searches for a file named
61 .IR SConstruct ,
62 .IR Sconstruct ,
63 or
64 .I sconstruct
65 (in that order) in the current directory and reads its
66 configuration from the first file found.
67 An alternate file name may be
68 specified via the
69 .B -f
70 option.
71
72 The
73 .I SConstruct
74 file can specify subsidiary
75 configuration files using the
76 .BR SConscript ()
77 function.
78 By convention,
79 these subsidiary files are named
80 .IR SConscript ,
81 although any name may be used.
82 (Because of this naming convention,
83 the term "SConscript files"
84 is sometimes used to refer
85 generically to all
86 .B scons
87 configuration files,
88 regardless of actual file name.)
89
90 The configuration files
91 specify the target files to be built, and
92 (optionally) the rules to build those targets. Reasonable default
93 rules exist for building common software components (executable
94 programs, object files, libraries), so that for most software
95 projects, only the target and input files need be specified.
96
97 Before reading the
98 .I SConstruct
99 file,
100 .B scons
101 looks for a directory named
102 .I site_scons
103 in the directory containing the
104 .I SConstruct
105 file; if it exists,
106 .I site_scons
107 is added to sys.path,
108 the file
109 .IR site_scons/site_init.py ,
110 is evaluated if it exists,
111 and the directory
112 .I site_scons/site_tools
113 is added to the default toolpath if it exist.
114 See the
115 .I --no-site-dir
116 and
117 .I --site-dir
118 options for more details.
119
120 .B scons
121 reads and executes the SConscript files as Python scripts,
122 so you may use normal Python scripting capabilities
123 (such as flow control, data manipulation, and imported Python libraries)
124 to handle complicated build situations.
125 .BR scons ,
126 however, reads and executes all of the SConscript files
127 .I before
128 it begins building any targets.
129 To make this obvious,
130 .B scons
131 prints the following messages about what it is doing:
132
133 .ES
134 $ scons foo.out
135 scons: Reading SConscript files ...
136 scons: done reading SConscript files.
137 scons: Building targets ...
138 cp foo.in foo.out
139 scons: done building targets.
140 $
141 .EE
142
143 The status messages
144 (everything except the line that reads "cp foo.in foo.out")
145 may be suppressed using the
146 .B -Q
147 option.
148
149 .B scons
150 does not automatically propagate
151 the external environment used to execute
152 .B scons
153 to the commands used to build target files.
154 This is so that builds will be guaranteed
155 repeatable regardless of the environment
156 variables set at the time
157 .B scons
158 is invoked.
159 This also means that if the compiler or other commands
160 that you want to use to build your target files
161 are not in standard system locations,
162 .B scons
163 will not find them unless
164 you explicitly set the PATH
165 to include those locations.
166 Whenever you create an
167 .B scons
168 construction environment,
169 you can propagate the value of PATH
170 from your external environment as follows:
171
172 .ES
173 import os
174 env = Environment(ENV = {'PATH' : os.environ['PATH']})
175 .EE
176
177 Similarly, if the commands use external environment variables
178 like $PATH, $HOME, $JAVA_HOME, $LANG, $SHELL, $TERM, etc.,
179 these variables can also be explicitly propagated:
180
181 .ES
182 import os
183 env = Environment(ENV = {'PATH' : os.environ['PATH'],
184 'HOME' : os.environ['HOME']})
185 .EE
186
187 Or you may explicitly propagate the invoking user's
188 complete external environment:
189
190 .ES
191 import os
192 env = Environment(ENV = os.environ)
193 .EE
194
195 This comes at the expense of making your build
196 dependent on the user's environment being set correctly,
197 but it may be more convenient for many configurations.
198
199 .B scons
200 can scan known input files automatically for dependency
201 information (for example, #include statements
202 in C or C++ files) and will rebuild dependent files appropriately
203 whenever any "included" input file changes.
204 .B scons
205 supports the
206 ability to define new scanners for unknown input file types.
207
208 .B scons
209 knows how to fetch files automatically from
210 SCCS or RCS subdirectories
211 using SCCS, RCS or BitKeeper.
212
213 .B scons
214 is normally executed in a top-level directory containing a
215 .I SConstruct
216 file, optionally specifying
217 as command-line arguments
218 the target file or files to be built.
219
220 By default, the command
221
222 .ES
223 scons
224 .EE
225
226 will build all target files in or below the current directory.
227 Explicit default targets
228 (to be built when no targets are specified on the command line)
229 may be defined the SConscript file(s)
230 using the
231 .B Default()
232 function, described below.
233
234 Even when
235 .B Default()
236 targets are specified in the SConscript file(s),
237 all target files in or below the current directory
238 may be built by explicitly specifying
239 the current directory (.)
240 as a command-line target:
241
242 .ES
243 scons .
244 .EE
245
246 Building all target files,
247 including any files outside of the current directory,
248 may be specified by supplying a command-line target
249 of the root directory (on POSIX systems):
250
251 .ES
252 scons /
253 .EE
254
255 or the path name(s) of the volume(s) in which all the targets
256 should be built (on Windows systems):
257
258 .ES
259 scons C:\\ D:\\
260 .EE
261
262 To build only specific targets,
263 supply them as command-line arguments:
264
265 .ES
266 scons foo bar
267 .EE
268
269 in which case only the specified targets will be built
270 (along with any derived files on which they depend).
271
272 Specifying "cleanup" targets in SConscript files is not usually necessary.
273 The
274 .B -c
275 flag removes all files
276 necessary to build the specified target:
277
278 .ES
279 scons -c .
280 .EE
281
282 to remove all target files, or:
283
284 .ES
285 scons -c build export
286 .EE
287
288 to remove target files under build and export.
289 Additional files or directories to remove can be specified using the
290 .BR Clean()
291 function.
292 Conversely, targets that would normally be removed by the
293 .B -c
294 invocation
295 can be prevented from being removed by using the
296 .BR NoClean ()
297 function.
298
299 A subset of a hierarchical tree may be built by
300 remaining at the top-level directory (where the
301 .I SConstruct
302 file lives) and specifying the subdirectory as the target to be
303 built:
304
305 .ES
306 scons src/subdir
307 .EE
308
309 or by changing directory and invoking scons with the
310 .B -u
311 option, which traverses up the directory
312 hierarchy until it finds the
313 .I SConstruct
314 file, and then builds
315 targets relatively to the current subdirectory:
316
317 .ES
318 cd src/subdir
319 scons -u .
320 .EE
321
322 .B scons
323 supports building multiple targets in parallel via a
324 .B -j
325 option that takes, as its argument, the number
326 of simultaneous tasks that may be spawned:
327
328 .ES
329 scons -j 4
330 .EE
331
332 builds four targets in parallel, for example.
333
334 .B scons
335 can maintain a cache of target (derived) files that can
336 be shared between multiple builds. When caching is enabled in a
337 SConscript file, any target files built by
338 .B scons
339 will be copied
340 to the cache. If an up-to-date target file is found in the cache, it
341 will be retrieved from the cache instead of being rebuilt locally.
342 Caching behavior may be disabled and controlled in other ways by the
343 .BR --cache-force ,
344 .BR --cache-disable ,
345 and
346 .B --cache-show
347 command-line options. The
348 .B --random
349 option is useful to prevent multiple builds
350 from trying to update the cache simultaneously.
351
352 Values of variables to be passed to the SConscript file(s)
353 may be specified on the command line:
354
355 .ES
356 scons debug=1 .
357 .EE
358
359 These variables are available in SConscript files
360 through the ARGUMENTS dictionary,
361 and can be used in the SConscript file(s) to modify
362 the build in any way:
363
364 .ES
365 if ARGUMENTS.get('debug', 0):
366 env = Environment(CCFLAGS = '-g')
367 else:
368 env = Environment()
369 .EE
370
371 The command-line variable arguments are also available
372 in the ARGLIST list,
373 indexed by their order on the command line.
374 This allows you to process them in order rather than by name,
375 if necessary.
376 ARGLIST[0] returns a tuple
377 containing (argname, argvalue).
378 A Python exception is thrown if you
379 try to access a list member that
380 does not exist.
381
382 .B scons
383 requires Python version 2.4 or later.
384 There should be no other dependencies or requirements to run
385 .B scons.
386
387 .\" The following paragraph reflects the default tool search orders
388 .\" currently in SCons/Tool/__init__.py. If any of those search orders
389 .\" change, this documentation should change, too.
390 By default,
391 .B scons
392 knows how to search for available programming tools
393 on various systems.
394 On Windows systems,
395 .B scons
396 searches in order for the
397 Microsoft Visual C++ tools,
398 the MinGW tool chain,
399 the Intel compiler tools,
400 and the PharLap ETS compiler.
401 On OS/2 systems,
402 .B scons
403 searches in order for the
404 OS/2 compiler,
405 the GCC tool chain,
406 and the Microsoft Visual C++ tools,
407 On SGI IRIX, IBM AIX, Hewlett Packard HP-UX, and Sun Solaris systems,
408 .B scons
409 searches for the native compiler tools
410 (MIPSpro, Visual Age, aCC, and Forte tools respectively)
411 and the GCC tool chain.
412 On all other platforms,
413 including POSIX (Linux and UNIX) platforms,
414 .B scons
415 searches in order
416 for the GCC tool chain,
417 the Microsoft Visual C++ tools,
418 and the Intel compiler tools.
419 You may, of course, override these default values
420 by appropriate configuration of
421 Environment construction variables.
422
423 .SH OPTIONS
424 In general,
425 .B scons
426 supports the same command-line options as GNU
427 .BR make ,
428 and many of those supported by
429 .BR cons .
430
431 .TP
432 -b
433 Ignored for compatibility with non-GNU versions of
434 .BR make.
435
436 .TP
437 -c, --clean, --remove
438 Clean up by removing all target files for which a construction
439 command is specified.
440 Also remove any files or directories associated to the construction command
441 using the
442 .BR Clean ()
443 function.
444 Will not remove any targets specified by the
445 .BR NoClean ()
446 function.
447
448 .TP
449 .RI --cache-debug= file
450 Print debug information about the
451 .BR CacheDir ()
452 derived-file caching
453 to the specified
454 .IR file .
455 If
456 .I file
457 is
458 .B \-
459 (a hyphen),
460 the debug information are printed to the standard output.
461 The printed messages describe what signature file names are
462 being looked for in, retrieved from, or written to the
463 .BR CacheDir ()
464 directory tree.
465
466 .TP
467 --cache-disable, --no-cache
468 Disable the derived-file caching specified by
469 .BR CacheDir ().
470 .B scons
471 will neither retrieve files from the cache
472 nor copy files to the cache.
473
474 .TP
475 --cache-force, --cache-populate
476 When using
477 .BR CacheDir (),
478 populate a cache by copying any already-existing, up-to-date
479 derived files to the cache,
480 in addition to files built by this invocation.
481 This is useful to populate a new cache with
482 all the current derived files,
483 or to add to the cache any derived files
484 recently built with caching disabled via the
485 .B --cache-disable
486 option.
487
488 .TP
489 --cache-show
490 When using
491 .BR CacheDir ()
492 and retrieving a derived file from the cache,
493 show the command
494 that would have been executed to build the file,
495 instead of the usual report,
496 "Retrieved `file' from cache."
497 This will produce consistent output for build logs,
498 regardless of whether a target
499 file was rebuilt or retrieved from the cache.
500
501 .TP
502 .RI --config= mode
503 This specifies how the
504 .B Configure
505 call should use or generate the
506 results of configuration tests.
507 The option should be specified from
508 among the following choices:
509
510 .TP
511 --config=auto
512 scons will use its normal dependency mechanisms
513 to decide if a test must be rebuilt or not.
514 This saves time by not running the same configuration tests
515 every time you invoke scons,
516 but will overlook changes in system header files
517 or external commands (such as compilers)
518 if you don't specify those dependecies explicitly.
519 This is the default behavior.
520
521 .TP
522 --config=force
523 If this option is specified,
524 all configuration tests will be re-run
525 regardless of whether the
526 cached results are out of date.
527 This can be used to explicitly
528 force the configuration tests to be updated
529 in response to an otherwise unconfigured change
530 in a system header file or compiler.
531
532 .TP
533 --config=cache
534 If this option is specified,
535 no configuration tests will be rerun
536 and all results will be taken from cache.
537 Note that scons will still consider it an error
538 if --config=cache is specified
539 and a necessary test does not
540 yet have any results in the cache.
541
542 .TP
543 .RI "-C" " directory" ", --directory=" directory
544 Change to the specified
545 .I directory
546 before searching for the
547 .IR SConstruct ,
548 .IR Sconstruct ,
549 or
550 .I sconstruct
551 file, or doing anything
552 else. Multiple
553 .B -C
554 options are interpreted
555 relative to the previous one, and the right-most
556 .B -C
557 option wins. (This option is nearly
558 equivalent to
559 .BR "-f directory/SConstruct" ,
560 except that it will search for
561 .IR SConstruct ,
562 .IR Sconstruct ,
563 or
564 .I sconstruct
565 in the specified directory.)
566
567 .\" .TP
568 .\" -d
569 .\" Display dependencies while building target files. Useful for
570 .\" figuring out why a specific file is being rebuilt, as well as
571 .\" general debugging of the build process.
572
573 .TP
574 -D
575 Works exactly the same way as the
576 .B -u
577 option except for the way default targets are handled.
578 When this option is used and no targets are specified on the command line,
579 all default targets are built, whether or not they are below the current
580 directory.
581
582 .TP
583 .RI --debug= type
584 Debug the build process.
585 .I type
586 specifies what type of debugging:
587
588 .TP
589 --debug=count
590 Print how many objects are created
591 of the various classes used internally by SCons
592 before and after reading the SConscript files
593 and before and after building targets.
594 This is not supported when SCons is executed with the Python
595 .B -O
596 (optimized) option
597 or when the SCons modules
598 have been compiled with optimization
599 (that is, when executing from
600 .B *.pyo
601 files).
602
603 .TP
604 --debug=dtree
605 A synonym for the newer
606 .B --tree=derived
607 option.
608 This will be deprecated in some future release
609 and ultimately removed.
610
611 .TP
612 --debug=explain
613 Print an explanation of precisely why
614 .B scons
615 is deciding to (re-)build any targets.
616 (Note: this does not print anything
617 for targets that are
618 .I not
619 rebuilt.)
620
621 .TP
622 --debug=findlibs
623 Instruct the scanner that searches for libraries
624 to print a message about each potential library
625 name it is searching for,
626 and about the actual libraries it finds.
627
628 .TP
629 --debug=includes
630 Print the include tree after each top-level target is built.
631 This is generally used to find out what files are included by the sources
632 of a given derived file:
633
634 .ES
635 $ scons --debug=includes foo.o
636 .EE
637
638 .TP
639 --debug=memoizer
640 Prints a summary of hits and misses using the Memoizer,
641 an internal subsystem that counts
642 how often SCons uses cached values in memory
643 instead of recomputing them each time they're needed.
644
645 .TP
646 --debug=memory
647 Prints how much memory SCons uses
648 before and after reading the SConscript files
649 and before and after building targets.
650
651 .TP
652 --debug=nomemoizer
653 A deprecated option preserved for backwards compatibility.
654
655 .TP
656 --debug=objects
657 Prints a list of the various objects
658 of the various classes used internally by SCons.
659
660 .TP
661 --debug=pdb
662 Re-run SCons under the control of the
663 .RI pdb
664 Python debugger.
665
666 .TP
667 --debug=presub
668 Print the raw command line used to build each target
669 before the construction environment variables are substituted.
670 Also shows which targets are being built by this command.
671 Output looks something like this:
672 .ES
673 $ scons --debug=presub
674 Building myprog.o with action(s):
675 $SHCC $SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
676 \&...
677 .EE
678
679 .TP
680 --debug=stacktrace
681 Prints an internal Python stack trace
682 when encountering an otherwise unexplained error.
683
684 .TP
685 --debug=stree
686 A synonym for the newer
687 .B --tree=all,status
688 option.
689 This will be deprecated in some future release
690 and ultimately removed.
691
692 .TP
693 --debug=time
694 Prints various time profiling information:
695 the time spent executing each individual build command;
696 the total build time (time SCons ran from beginning to end);
697 the total time spent reading and executing SConscript files;
698 the total time spent SCons itself spend running
699 (that is, not counting reading and executing SConscript files);
700 and both the total time spent executing all build commands
701 and the elapsed wall-clock time spent executing those build commands.
702 (When
703 .B scons
704 is executed without the
705 .B -j
706 option,
707 the elapsed wall-clock time will typically
708 be slightly longer than the total time spent
709 executing all the build commands,
710 due to the SCons processing that takes place
711 in between executing each command.
712 When
713 .B scons
714 is executed
715 .I with
716 the
717 .B -j
718 option,
719 and your build configuration allows good parallelization,
720 the elapsed wall-clock time should
721 be significantly smaller than the
722 total time spent executing all the build commands,
723 since multiple build commands and
724 intervening SCons processing
725 should take place in parallel.)
726
727 .TP
728 --debug=tree
729 A synonym for the newer
730 .B --tree=all
731 option.
732 This will be deprecated in some future release
733 and ultimately removed.
734
735 .TP
736 .RI --diskcheck= types
737 Enable specific checks for
738 whether or not there is a file on disk
739 where the SCons configuration expects a directory
740 (or vice versa),
741 and whether or not RCS or SCCS sources exist
742 when searching for source and include files.
743 The
744 .I types
745 argument can be set to:
746 .BR all ,
747 to enable all checks explicitly
748 (the default behavior);
749 .BR none ,
750 to disable all such checks;
751 .BR match ,
752 to check that files and directories on disk
753 match SCons' expected configuration;
754 .BR rcs ,
755 to check for the existence of an RCS source
756 for any missing source or include files;
757 .BR sccs ,
758 to check for the existence of an SCCS source
759 for any missing source or include files.
760 Multiple checks can be specified separated by commas;
761 for example,
762 .B --diskcheck=sccs,rcs
763 would still check for SCCS and RCS sources,
764 but disable the check for on-disk matches of files and directories.
765 Disabling some or all of these checks
766 can provide a performance boost for large configurations,
767 or when the configuration will check for files and/or directories
768 across networked or shared file systems,
769 at the slight increased risk of an incorrect build
770 or of not handling errors gracefully
771 (if include files really should be
772 found in SCCS or RCS, for example,
773 or if a file really does exist
774 where the SCons configuration expects a directory).
775
776 .TP
777 .RI --duplicate= ORDER
778 There are three ways to duplicate files in a build tree: hard links,
779 soft (symbolic) links and copies. The default behaviour of SCons is to
780 prefer hard links to soft links to copies. You can specify different
781 behaviours with this option.
782 .IR ORDER
783 must be one of
784 .IR hard-soft-copy
785 (the default),
786 .IR soft-hard-copy ,
787 .IR hard-copy ,
788 .IR soft-copy
789 or
790 .IR copy .
791 SCons will attempt to duplicate files using
792 the mechanisms in the specified order.
793
794 .\" .TP
795 .\" -e, --environment-overrides
796 .\" Variables from the execution environment override construction
797 .\" variables from the SConscript files.
798
799 .TP
800 .RI -f " file" ", --file=" file ", --makefile=" file ", --sconstruct=" file
801 Use
802 .I file
803 as the initial SConscript file.
804 Multiple
805 .B -f
806 options may be specified,
807 in which case
808 .B scons
809 will read all of the specified files.
810
811 .TP
812 -h, --help
813 Print a local help message for this build, if one is defined in
814 the SConscript file(s), plus a line that describes the
815 .B -H
816 option for command-line option help. If no local help message
817 is defined, prints the standard help message about command-line
818 options. Exits after displaying the appropriate message.
819
820 .TP
821 -H, --help-options
822 Print the standard help message about command-line options and
823 exit.
824
825 .TP
826 -i, --ignore-errors
827 Ignore all errors from commands executed to rebuild files.
828
829 .TP
830 .RI -I " directory" ", --include-dir=" directory
831 Specifies a
832 .I directory
833 to search for
834 imported Python modules. If several
835 .B -I
836 options
837 are used, the directories are searched in the order specified.
838
839 .TP
840 --implicit-cache
841 Cache implicit dependencies.
842 This causes
843 .B scons
844 to use the implicit (scanned) dependencies
845 from the last time it was run
846 instead of scanning the files for implicit dependencies.
847 This can significantly speed up SCons,
848 but with the following limitations:
849 .IP
850 .B scons
851 will not detect changes to implicit dependency search paths
852 (e.g.
853 .BR CPPPATH ", " LIBPATH )
854 that would ordinarily
855 cause different versions of same-named files to be used.
856 .IP
857 .B scons
858 will miss changes in the implicit dependencies
859 in cases where a new implicit
860 dependency is added earlier in the implicit dependency search path
861 (e.g.
862 .BR CPPPATH ", " LIBPATH )
863 than a current implicit dependency with the same name.
864
865 .TP
866 --implicit-deps-changed
867 Forces SCons to ignore the cached implicit dependencies. This causes the
868 implicit dependencies to be rescanned and recached. This implies
869 .BR --implicit-cache .
870
871 .TP
872 --implicit-deps-unchanged
873 Force SCons to ignore changes in the implicit dependencies.
874 This causes cached implicit dependencies to always be used.
875 This implies
876 .BR --implicit-cache .
877
878 .TP
879 --interactive
880 Starts SCons in interactive mode.
881 The SConscript files are read once and a
882 .B "scons>>>"
883 prompt is printed.
884 Targets may now be rebuilt by typing commands at interactive prompt
885 without having to re-read the SConscript files
886 and re-initialize the dependency graph from scratch.
887
888 SCons interactive mode supports the following commands:
889
890 .RS 10
891 .TP 6
892 .BI build "[OPTIONS] [TARGETS] ..."
893 Builds the specified
894 .I TARGETS
895 (and their dependencies)
896 with the specified
897 SCons command-line
898 .IR OPTIONS .
899 .B b
900 and
901 .B scons
902 are synonyms.
903
904 The following SCons command-line options affect the
905 .B build
906 command:
907
908 .ES
909 --cache-debug=FILE
910 --cache-disable, --no-cache
911 --cache-force, --cache-populate
912 --cache-show
913 --debug=TYPE
914 -i, --ignore-errors
915 -j N, --jobs=N
916 -k, --keep-going
917 -n, --no-exec, --just-print, --dry-run, --recon
918 -Q
919 -s, --silent, --quiet
920 --taskmastertrace=FILE
921 --tree=OPTIONS
922 .EE
923
924 .IP "" 6
925 Any other SCons command-line options that are specified
926 do not cause errors
927 but have no effect on the
928 .B build
929 command
930 (mainly because they affect how the SConscript files are read,
931 which only happens once at the beginning of interactive mode).
932
933 .TP 6
934 .BI clean "[OPTIONS] [TARGETS] ..."
935 Cleans the specified
936 .I TARGETS
937 (and their dependencies)
938 with the specified options.
939 .B c
940 is a synonym.
941 This command is itself a synonym for
942 .B "build --clean"
943
944 .TP 6
945 .BI exit
946 Exits SCons interactive mode.
947 You can also exit by terminating input
948 (CTRL+D on UNIX or Linux systems,
949 CTRL+Z on Windows systems).
950
951 .TP 6
952 .BI help "[COMMAND]"
953 Provides a help message about
954 the commands available in SCons interactive mode.
955 If
956 .I COMMAND
957 is specified,
958 .B h
959 and
960 .B ?
961 are synonyms.
962
963 .TP 6
964 .BI shell "[COMMANDLINE]"
965 Executes the specified
966 .I COMMANDLINE
967 in a subshell.
968 If no
969 .I COMMANDLINE
970 is specified,
971 executes the interactive command interpreter
972 specified in the
973 .B SHELL
974 environment variable
975 (on UNIX and Linux systems)
976 or the
977 .B COMSPEC
978 environment variable
979 (on Windows systems).
980 .B sh
981 and
982 .B !
983 are synonyms.
984
985 .TP 6
986 .B version
987 Prints SCons version information.
988 .RE
989
990 .IP
991 An empty line repeats the last typed command.
992 Command-line editing can be used if the
993 .B readline
994 module is available.
995
996 .ES
997 $ scons --interactive
998 scons: Reading SConscript files ...
999 scons: done reading SConscript files.
1000 scons>>> build -n prog
1001 scons>>> exit
1002 .EE
1003
1004 .TP
1005 .RI -j " N" ", --jobs=" N
1006 Specifies the number of jobs (commands) to run simultaneously.
1007 If there is more than one
1008 .B -j
1009 option, the last one is effective.
1010 .\" ??? If the
1011 .\" .B -j
1012 .\" option
1013 .\" is specified without an argument,
1014 .\" .B scons
1015 .\" will not limit the number of
1016 .\" simultaneous jobs.
1017
1018 .TP
1019 -k, --keep-going
1020 Continue as much as possible after an error. The target that
1021 failed and those that depend on it will not be remade, but other
1022 targets specified on the command line will still be processed.
1023
1024 .\" .TP
1025 .\" .RI -l " N" ", --load-average=" N ", --max-load=" N
1026 .\" No new jobs (commands) will be started if
1027 .\" there are other jobs running and the system load
1028 .\" average is at least
1029 .\" .I N
1030 .\" (a floating-point number).
1031
1032 .\"
1033 .\" .TP
1034 .\" --list-derived
1035 .\" List derived files (targets, dependencies) that would be built,
1036 .\" but do not build them.
1037 .\" [XXX This can probably go away with the right
1038 .\" combination of other options. Revisit this issue.]
1039 .\"
1040 .\" .TP
1041 .\" --list-actions
1042 .\" List derived files that would be built, with the actions
1043 .\" (commands) that build them. Does not build the files.
1044 .\" [XXX This can probably go away with the right
1045 .\" combination of other options. Revisit this issue.]
1046 .\"
1047 .\" .TP
1048 .\" --list-where
1049 .\" List derived files that would be built, plus where the file is
1050 .\" defined (file name and line number). Does not build the files.
1051 .\" [XXX This can probably go away with the right
1052 .\" combination of other options. Revisit this issue.]
1053
1054 .TP
1055 -m
1056 Ignored for compatibility with non-GNU versions of
1057 .BR make .
1058
1059 .TP
1060 .RI --max-drift= SECONDS
1061 Set the maximum expected drift in the modification time of files to
1062 .IR SECONDS .
1063 This value determines how long a file must be unmodified
1064 before its cached content signature
1065 will be used instead of
1066 calculating a new content signature (MD5 checksum)
1067 of the file's contents.
1068 The default value is 2 days, which means a file must have a
1069 modification time of at least two days ago in order to have its
1070 cached content signature used.
1071 A negative value means to never cache the content
1072 signature and to ignore the cached value if there already is one. A value
1073 of 0 means to always use the cached signature,
1074 no matter how old the file is.
1075
1076 .TP
1077 .RI --md5-chunksize= KILOBYTES
1078 Set the block size used to compute MD5 signatures to
1079 .IR KILOBYTES .
1080 This value determines the size of the chunks which are read in at once when
1081 computing MD5 signatures. Files below that size are fully stored in memory
1082 before performing the signature computation while bigger files are read in
1083 block-by-block. A huge block-size leads to high memory consumption while a very
1084 small block-size slows down the build considerably.
1085
1086 The default value is to use a chunk size of 64 kilobytes, which should
1087 be appropriate for most uses.
1088
1089 .TP
1090 -n, --just-print, --dry-run, --recon
1091 No execute. Print the commands that would be executed to build
1092 any out-of-date target files, but do not execute the commands.
1093
1094 .TP
1095 .RI --no-site-dir
1096 Prevents the automatic addition of the standard
1097 .I site_scons
1098 dir to
1099 .IR sys.path .
1100 Also prevents loading the
1101 .I site_scons/site_init.py
1102 module if it exists, and prevents adding
1103 .I site_scons/site_tools
1104 to the toolpath.
1105
1106 .\" .TP
1107 .\" .RI -o " file" ", --old-file=" file ", --assume-old=" file
1108 .\" Do not rebuild
1109 .\" .IR file ,
1110 .\" and do
1111 .\" not rebuild anything due to changes in the contents of
1112 .\" .IR file .
1113 .\" .TP
1114 .\" .RI --override " file"
1115 .\" Read values to override specific build environment variables
1116 .\" from the specified
1117 .\" .IR file .
1118 .\" .TP
1119 .\" -p
1120 .\" Print the data base (construction environments,
1121 .\" Builder and Scanner objects) that are defined
1122 .\" after reading the SConscript files.
1123 .\" After printing, a normal build is performed
1124 .\" as usual, as specified by other command-line options.
1125 .\" This also prints version information
1126 .\" printed by the
1127 .\" .B -v
1128 .\" option.
1129 .\"
1130 .\" To print the database without performing a build do:
1131 .\"
1132 .\" .ES
1133 .\" scons -p -q
1134 .\" .EE
1135
1136 .TP
1137 .RI --profile= file
1138 Run SCons under the Python profiler
1139 and save the results in the specified
1140 .IR file .
1141 The results may be analyzed using the Python
1142 pstats module.
1143
1144 .TP
1145 -q, --question
1146 Do not run any commands, or print anything. Just return an exit
1147 status that is zero if the specified targets are already up to
1148 date, non-zero otherwise.
1149 .TP
1150 -Q
1151 Quiets SCons status messages about
1152 reading SConscript files,
1153 building targets
1154 and entering directories.
1155 Commands that are executed
1156 to rebuild target files are still printed.
1157
1158 .\" .TP
1159 .\" -r, -R, --no-builtin-rules, --no-builtin-variables
1160 .\" Clear the default construction variables. Construction
1161 .\" environments that are created will be completely empty.
1162
1163 .TP
1164 --random
1165 Build dependencies in a random order. This is useful when
1166 building multiple trees simultaneously with caching enabled,
1167 to prevent multiple builds from simultaneously trying to build
1168 or retrieve the same target files.
1169
1170 .TP
1171 -s, --silent, --quiet
1172 Silent. Do not print commands that are executed to rebuild
1173 target files.
1174 Also suppresses SCons status messages.
1175
1176 .TP
1177 -S, --no-keep-going, --stop
1178 Ignored for compatibility with GNU
1179 .BR make .
1180
1181 .TP
1182 .RI --site-dir= dir
1183 Uses the named dir as the site dir rather than the default
1184 .I site_scons
1185 dir. This dir will get prepended to
1186 .IR sys.path ,
1187 the module
1188 .IR dir /site_init.py
1189 will get loaded if it exists, and
1190 .IR dir /site_tools
1191 will get added to the default toolpath.
1192
1193 .TP
1194 .RI --stack-size= KILOBYTES
1195 Set the size stack used to run threads to
1196 .IR KILOBYTES .
1197 This value determines the stack size of the threads used to run jobs.
1198 These are the threads that execute the actions of the builders for the
1199 nodes that are out-of-date.
1200 Note that this option has no effect unless the
1201 .B num_jobs
1202 option, which corresponds to -j and --jobs, is larger than one. Using
1203 a stack size that is too small may cause stack overflow errors. This
1204 usually shows up as segmentation faults that cause scons to abort
1205 before building anything. Using a stack size that is too large will
1206 cause scons to use more memory than required and may slow down the entire
1207 build process.
1208
1209 The default value is to use a stack size of 256 kilobytes, which should
1210 be appropriate for most uses. You should not need to increase this value
1211 unless you encounter stack overflow errors.
1212
1213 .TP
1214 -t, --touch
1215 Ignored for compatibility with GNU
1216 .BR make .
1217 (Touching a file to make it
1218 appear up-to-date is unnecessary when using
1219 .BR scons .)
1220
1221 .TP
1222 .RI --taskmastertrace= file
1223 Prints trace information to the specified
1224 .I file
1225 about how the internal Taskmaster object
1226 evaluates and controls the order in which Nodes are built.
1227 A file name of
1228 .B -
1229 may be used to specify the standard output.
1230
1231 .TP
1232 .RI -tree= options
1233 Prints a tree of the dependencies
1234 after each top-level target is built.
1235 This prints out some or all of the tree,
1236 in various formats,
1237 depending on the
1238 .I options
1239 specified:
1240
1241 .TP
1242 --tree=all
1243 Print the entire dependency tree
1244 after each top-level target is built.
1245 This prints out the complete dependency tree,
1246 including implicit dependencies and ignored dependencies.
1247
1248 .TP
1249 --tree=derived
1250 Restricts the tree output to only derived (target) files,
1251 not source files.
1252
1253 .TP
1254 --tree=status
1255 Prints status information for each displayed node.
1256
1257 .TP
1258 --tree=prune
1259 Prunes the tree to avoid repeating dependency information
1260 for nodes that have already been displayed.
1261 Any node that has already been displayed
1262 will have its name printed in
1263 .BR "[square brackets]" ,
1264 as an indication that the dependencies
1265 for that node can be found by searching
1266 for the relevant output higher up in the tree.
1267
1268 .IP
1269 Multiple options may be specified,
1270 separated by commas:
1271
1272 .ES
1273 # Prints only derived files, with status information:
1274 scons --tree=derived,status
1275
1276 # Prints all dependencies of target, with status information
1277 # and pruning dependencies of already-visited Nodes:
1278 scons --tree=all,prune,status target
1279 .EE
1280
1281 .TP
1282 -u, --up, --search-up
1283 Walks up the directory structure until an
1284 .I SConstruct ,
1285 .I Sconstruct
1286 or
1287 .I sconstruct
1288 file is found, and uses that
1289 as the top of the directory tree.
1290 If no targets are specified on the command line,
1291 only targets at or below the
1292 current directory will be built.
1293
1294 .TP
1295 -U
1296 Works exactly the same way as the
1297 .B -u
1298 option except for the way default targets are handled.
1299 When this option is used and no targets are specified on the command line,
1300 all default targets that are defined in the SConscript(s) in the current
1301 directory are built, regardless of what directory the resultant targets end
1302 up in.
1303
1304 .TP
1305 -v, --version
1306 Print the
1307 .B scons
1308 version, copyright information,
1309 list of authors, and any other relevant information.
1310 Then exit.
1311
1312 .TP
1313 -w, --print-directory
1314 Print a message containing the working directory before and
1315 after other processing.
1316
1317 .TP
1318 --no-print-directory
1319 Turn off -w, even if it was turned on implicitly.
1320
1321 .TP
1322 .RI --warn= type ", --warn=no-" type
1323 Enable or disable warnings.
1324 .I type
1325 specifies the type of warnings to be enabled or disabled:
1326
1327 .TP
1328 --warn=all, --warn=no-all
1329 Enables or disables all warnings.
1330
1331 .TP
1332 --warn=cache-write-error, --warn=no-cache-write-error
1333 Enables or disables warnings about errors trying to
1334 write a copy of a built file to a specified
1335 .BR CacheDir ().
1336 These warnings are disabled by default.
1337
1338 .TP
1339 --warn=corrupt-sconsign, --warn=no-corrupt-sconsign
1340 Enables or disables warnings about unfamiliar signature data in
1341 .B .sconsign
1342 files.
1343 These warnings are enabled by default.
1344
1345 .TP
1346 --warn=dependency, --warn=no-dependency
1347 Enables or disables warnings about dependencies.
1348 These warnings are disabled by default.
1349
1350 .TP
1351 --warn=deprecated, --warn=no-deprecated
1352 Enables or disables all warnings about use of
1353 currently deprecated features.
1354 These warnings are enabled by default.
1355 Note that the
1356 .B --warn=no-deprecated
1357 option does not disable warnings about absolutely all deprecated features.
1358 Warnings for some deprecated features that have already been through
1359 several releases with deprecation warnings
1360 may be mandatory for a release or two
1361 before they are officially no longer supported by SCons.
1362 Warnings for some specific deprecated features
1363 may be enabled or disabled individually;
1364 see below.
1365
1366 .RS
1367 .TP
1368 --warn=deprecated-copy, --warn=no-deprecated-copy
1369 Enables or disables warnings about use of the deprecated
1370 .B env.Copy()
1371 method.
1372
1373 .TP
1374 --warn=deprecated-source-signatures, --warn=no-deprecated-source-signatures
1375 Enables or disables warnings about use of the deprecated
1376 .B SourceSignatures()
1377 function or
1378 .B env.SourceSignatures()
1379 method.
1380
1381 .TP
1382 --warn=deprecated-target-signatures, --warn=no-deprecated-target-signatures
1383 Enables or disables warnings about use of the deprecated
1384 .B TargetSignatures()
1385 function or
1386 .B env.TargetSignatures()
1387 method.
1388 .RE
1389
1390 .TP
1391 --warn=duplicate-environment, --warn=no-duplicate-environment
1392 Enables or disables warnings about attempts to specify a build
1393 of a target with two different construction environments
1394 that use the same action.
1395 These warnings are enabled by default.
1396
1397 .TP
1398 --warn=fortran-cxx-mix, --warn=no-fortran-cxx-mix
1399 Enables or disables the specific warning about linking
1400 Fortran and C++ object files in a single executable,
1401 which can yield unpredictable behavior with some compilers.
1402
1403 .TP
1404 --warn=future-deprecated, --warn=no-future-deprecated
1405 Enables or disables warnings about features
1406 that will be deprecated in the future.
1407 These warnings are disabled by default.
1408 Enabling this warning is especially
1409 recommended for projects that redistribute
1410 SCons configurations for other users to build,
1411 so that the project can be warned as soon as possible
1412 about to-be-deprecated features
1413 that may require changes to the configuration.
1414
1415 .TP
1416 --warn=link, --warn=no-link
1417 Enables or disables warnings about link steps.
1418
1419 .TP
1420 --warn=misleading-keywords, --warn=no-misleading-keywords
1421 Enables or disables warnings about use of the misspelled keywords
1422 .B targets
1423 and
1424 .B sources
1425 when calling Builders.
1426 (Note the last
1427 .B s
1428 characters, the correct spellings are
1429 .B target
1430 and
1431 .B source.)
1432 These warnings are enabled by default.
1433
1434 .TP
1435 --warn=missing-sconscript, --warn=no-missing-sconscript
1436 Enables or disables warnings about missing SConscript files.
1437 These warnings are enabled by default.
1438
1439 .TP
1440 --warn=no-md5-module, --warn=no-no-md5-module
1441 Enables or disables warnings about the version of Python
1442 not having an MD5 checksum module available.
1443 These warnings are enabled by default.
1444
1445 .TP
1446 --warn=no-metaclass-support, --warn=no-no-metaclass-support
1447 Enables or disables warnings about the version of Python
1448 not supporting metaclasses when the
1449 .B --debug=memoizer
1450 option is used.
1451 These warnings are enabled by default.
1452
1453 .TP
1454 --warn=no-object-count, --warn=no-no-object-count
1455 Enables or disables warnings about the
1456 .B --debug=object
1457 feature not working when
1458 .B scons
1459 is run with the python
1460 .B \-O
1461 option or from optimized Python (.pyo) modules.
1462
1463 .TP
1464 --warn=no-parallel-support, --warn=no-no-parallel-support
1465 Enables or disables warnings about the version of Python
1466 not being able to support parallel builds when the
1467 .B -j
1468 option is used.
1469 These warnings are enabled by default.
1470
1471 .TP
1472 --warn=python-version, --warn=no-python-version
1473 Enables or disables the warning about running
1474 SCons with a deprecated version of Python.
1475 These warnings are enabled by default.
1476
1477 .TP
1478 --warn=reserved-variable, --warn=no-reserved-variable
1479 Enables or disables warnings about attempts to set the
1480 reserved construction variable names
1481 .BR CHANGED_SOURCES ,
1482 .BR CHANGED_TARGETS ,
1483 .BR TARGET ,
1484 .BR TARGETS ,
1485 .BR SOURCE ,
1486 .BR SOURCES ,
1487 .BR UNCHANGED_SOURCES
1488 or
1489 .BR UNCHANGED_TARGETS .
1490 These warnings are disabled by default.
1491
1492 .TP
1493 --warn=stack-size, --warn=no-stack-size
1494 Enables or disables warnings about requests to set the stack size
1495 that could not be honored.
1496 These warnings are enabled by default.
1497
1498 .\" .TP
1499 .\" .RI --write-filenames= file
1500 .\" Write all filenames considered into
1501 .\" .IR file .
1502 .\"
1503 .\" .TP
1504 .\" .RI -W " file" ", --what-if=" file ", --new-file=" file ", --assume-new=" fi le
1505 .\" Pretend that the target
1506 .\" .I file
1507 .\" has been
1508 .\" modified. When used with the
1509 .\" .B -n
1510 .\" option, this
1511 .\" show you what would be rebuilt if you were to modify that file.
1512 .\" Without
1513 .\" .B -n
1514 .\" ... what? XXX
1515 .\"
1516 .\" .TP
1517 .\" --warn-undefined-variables
1518 .\" Warn when an undefined variable is referenced.
1519
1520 .TP
1521 .RI -Y " repository" ", --repository=" repository ", --srcdir=" repository
1522 Search the specified repository for any input and target
1523 files not found in the local directory hierarchy. Multiple
1524 .B -Y
1525 options may be specified, in which case the
1526 repositories are searched in the order specified.
1527
1528 .SH CONFIGURATION FILE REFERENCE
1529 .\" .SS Python Basics
1530 .\" XXX Adding this in the future would be a help.
1531 .SS Construction Environments
1532 A construction environment is the basic means by which the SConscript
1533 files communicate build information to
1534 .BR scons .
1535 A new construction environment is created using the
1536 .B Environment
1537 function:
1538
1539 .ES
1540 env = Environment()
1541 .EE
1542
1543 Variables, called
1544 .I construction
1545 .IR variables ,
1546 may be set in a construction environment
1547 either by specifying them as keywords when the object is created
1548 or by assigning them a value after the object is created:
1549
1550 .ES
1551 env = Environment(FOO = 'foo')
1552 env['BAR'] = 'bar'
1553 .EE
1554
1555 As a convenience,
1556 construction variables may also be set or modified by the
1557 .I parse_flags
1558 keyword argument, which applies the
1559 .B ParseFlags
1560 method (described below) to the argument value
1561 after all other processing is completed.
1562 This is useful either if the exact content of the flags is unknown
1563 (for example, read from a control file)
1564 or if the flags are distributed to a number of construction variables.
1565
1566 .ES
1567 env = Environment(parse_flags = '-Iinclude -DEBUG -lm')
1568 .EE
1569
1570 This example adds 'include' to
1571 .BR CPPPATH ,
1572 \&'EBUG' to
1573 .BR CPPDEFINES ,
1574 and 'm' to
1575 .BR LIBS .
1576
1577 By default, a new construction environment is
1578 initialized with a set of builder methods
1579 and construction variables that are appropriate
1580 for the current platform.
1581 An optional platform keyword argument may be
1582 used to specify that an environment should
1583 be initialized for a different platform:
1584
1585 .ES
1586 env = Environment(platform = 'cygwin')
1587 env = Environment(platform = 'os2')
1588 env = Environment(platform = 'posix')
1589 env = Environment(platform = 'win32')
1590 .EE
1591
1592 Specifying a platform initializes the appropriate
1593 construction variables in the environment
1594 to use and generate file names with prefixes
1595 and suffixes appropriate for the platform.
1596
1597 Note that the
1598 .B win32
1599 platform adds the
1600 .B SystemDrive
1601 and
1602 .B SystemRoot
1603 variables from the user's external environment
1604 to the construction environment's
1605 .B ENV
1606 dictionary.
1607 This is so that any executed commands
1608 that use sockets to connect with other systems
1609 (such as fetching source files from
1610 external CVS repository specifications like
1611 .BR :pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons )
1612 will work on Windows systems.
1613
1614 The platform argument may be function or callable object,
1615 in which case the Environment() method
1616 will call the specified argument to update
1617 the new construction environment:
1618
1619 .ES
1620 def my_platform(env):
1621 env['VAR'] = 'xyzzy'
1622
1623 env = Environment(platform = my_platform)
1624 .EE
1625
1626 Additionally, a specific set of tools
1627 with which to initialize the environment
1628 may be specified as an optional keyword argument:
1629
1630 .ES
1631 env = Environment(tools = ['msvc', 'lex'])
1632 .EE
1633
1634 Non-built-in tools may be specified using the toolpath argument:
1635
1636 .ES
1637 env = Environment(tools = ['default', 'foo'], toolpath = ['tools'])
1638 .EE
1639
1640 This looks for a tool specification in tools/foo.py (as well as
1641 using the ordinary default tools for the platform). foo.py should
1642 have two functions: generate(env, **kw) and exists(env).
1643 The
1644 .B generate()
1645 function
1646 modifies the passed-in environment
1647 to set up variables so that the tool
1648 can be executed;
1649 it may use any keyword arguments
1650 that the user supplies (see below)
1651 to vary its initialization.
1652 The
1653 .B exists()
1654 function should return a true
1655 value if the tool is available.
1656 Tools in the toolpath are used before
1657 any of the built-in ones. For example, adding gcc.py to the toolpath
1658 would override the built-in gcc tool.
1659 Also note that the toolpath is
1660 stored in the environment for use
1661 by later calls to
1662 .BR Clone ()
1663 and
1664 .BR Tool ()
1665 methods:
1666
1667 .ES
1668 base = Environment(toolpath=['custom_path'])
1669 derived = base.Clone(tools=['custom_tool'])
1670 derived.CustomBuilder()
1671 .EE
1672
1673 The elements of the tools list may also
1674 be functions or callable objects,
1675 in which case the Environment() method
1676 will call the specified elements
1677 to update the new construction environment:
1678
1679 .ES
1680 def my_tool(env):
1681 env['XYZZY'] = 'xyzzy'
1682
1683 env = Environment(tools = [my_tool])
1684 .EE
1685
1686 The individual elements of the tools list
1687 may also themselves be two-element lists of the form
1688 .RI ( toolname ", " kw_dict ).
1689 SCons searches for the
1690 .I toolname
1691 specification file as described above, and
1692 passes
1693 .IR kw_dict ,
1694 which must be a dictionary, as keyword arguments to the tool's
1695 .B generate
1696 function.
1697 The
1698 .B generate
1699 function can use the arguments to modify the tool's behavior
1700 by setting up the environment in different ways
1701 or otherwise changing its initialization.
1702
1703 .ES
1704 # in tools/my_tool.py:
1705 def generate(env, **kw):
1706 # Sets MY_TOOL to the value of keyword argument 'arg1' or 1.
1707 env['MY_TOOL'] = kw.get('arg1', '1')
1708 def exists(env):
1709 return 1
1710
1711 # in SConstruct:
1712 env = Environment(tools = ['default', ('my_tool', {'arg1': 'abc'})],
1713 toolpath=['tools'])
1714 .EE
1715
1716 The tool definition (i.e. my_tool()) can use the PLATFORM variable from
1717 the environment it receives to customize the tool for different platforms.
1718
1719 If no tool list is specified, then SCons will auto-detect the installed
1720 tools using the PATH variable in the ENV construction variable and the
1721 platform name when the Environment is constructed. Changing the PATH
1722 variable after the Environment is constructed will not cause the tools to
1723 be redetected.
1724
1725 SCons supports the following tool specifications out of the box:
1726
1727 .ES
1728 386asm
1729 aixc++
1730 aixcc
1731 aixf77
1732 aixlink
1733 ar
1734 as
1735 bcc32
1736 c++
1737 cc
1738 cvf
1739 dmd
1740 dvipdf
1741 dvips
1742 f77
1743 f90
1744 f95
1745 fortran
1746 g++
1747 g77
1748 gas
1749 gcc
1750 gfortran
1751 gnulink
1752 gs
1753 hpc++
1754 hpcc
1755 hplink
1756 icc
1757 icl
1758 ifl
1759 ifort
1760 ilink
1761 ilink32
1762 intelc
1763 jar
1764 javac
1765 javah
1766 latex
1767 lex
1768 link
1769 linkloc
1770 m4
1771 masm
1772 midl
1773 mingw
1774 mslib
1775 mslink
1776 mssdk
1777 msvc
1778 msvs
1779 mwcc
1780 mwld
1781 nasm
1782 pdflatex
1783 pdftex
1784 qt
1785 rmic
1786 rpcgen
1787 sgiar
1788 sgic++
1789 sgicc
1790 sgilink
1791 sunar
1792 sunc++
1793 suncc
1794 sunf77
1795 sunf90
1796 sunf95
1797 sunlink
1798 swig
1799 tar
1800 tex
1801 textfile
1802 tlib
1803 yacc
1804 zip
1805 .EE
1806
1807 Additionally, there is a "tool" named
1808 .B default
1809 which configures the
1810 environment with a default set of tools for the current platform.
1811
1812 On posix and cygwin platforms
1813 the GNU tools (e.g. gcc) are preferred by SCons,
1814 on Windows the Microsoft tools (e.g. msvc)
1815 followed by MinGW are preferred by SCons,
1816 and in OS/2 the IBM tools (e.g. icc) are preferred by SCons.
1817
1818 .SS Builder Methods
1819
1820 Build rules are specified by calling a construction
1821 environment's builder methods.
1822 The arguments to the builder methods are
1823 .B target
1824 (a list of targets to be built,
1825 usually file names)
1826 and
1827 .B source
1828 (a list of sources to be built,
1829 usually file names).
1830
1831 Because long lists of file names
1832 can lead to a lot of quoting,
1833 .B scons
1834 supplies a
1835 .B Split()
1836 global function
1837 and a same-named environment method
1838 that split a single string
1839 into a list, separated on
1840 strings of white-space characters.
1841 (These are similar to the split() member function of Python strings
1842 but work even if the input isn't a string.)
1843
1844 Like all Python arguments,
1845 the target and source arguments to a builder method
1846 can be specified either with or without
1847 the "target" and "source" keywords.
1848 When the keywords are omitted,
1849 the target is first,
1850 followed by the source.
1851 The following are equivalent examples of calling the Program builder method:
1852
1853 .ES
1854 env.Program('bar', ['bar.c', 'foo.c'])
1855 env.Program('bar', Split('bar.c foo.c'))
1856 env.Program('bar', env.Split('bar.c foo.c'))
1857 env.Program(source = ['bar.c', 'foo.c'], target = 'bar')
1858 env.Program(target = 'bar', Split('bar.c foo.c'))
1859 env.Program(target = 'bar', env.Split('bar.c foo.c'))
1860 env.Program('bar', source = 'bar.c foo.c'.split())
1861 .EE
1862
1863 Target and source file names
1864 that are not absolute path names
1865 (that is, do not begin with
1866 .B /
1867 on POSIX systems
1868 or
1869 .B \\
1870 on Windows systems,
1871 with or without
1872 an optional drive letter)
1873 are interpreted relative to the directory containing the
1874 .B SConscript
1875 file being read.
1876 An initial
1877 .B #
1878 (hash mark)
1879 on a path name means that the rest of the file name
1880 is interpreted relative to
1881 the directory containing
1882 the top-level
1883 .B SConstruct
1884 file,
1885 even if the
1886 .B #
1887 is followed by a directory separator character
1888 (slash or backslash).
1889
1890 Examples:
1891
1892 .ES
1893 # The comments describing the targets that will be built
1894 # assume these calls are in a SConscript file in the
1895 # a subdirectory named "subdir".
1896
1897 # Builds the program "subdir/foo" from "subdir/foo.c":
1898 env.Program('foo', 'foo.c')
1899
1900 # Builds the program "/tmp/bar" from "subdir/bar.c":
1901 env.Program('/tmp/bar', 'bar.c')
1902
1903 # An initial '#' or '#/' are equivalent; the following
1904 # calls build the programs "foo" and "bar" (in the
1905 # top-level SConstruct directory) from "subdir/foo.c" and
1906 # "subdir/bar.c", respectively:
1907 env.Program('#foo', 'foo.c')
1908 env.Program('#/bar', 'bar.c')
1909
1910 # Builds the program "other/foo" (relative to the top-level
1911 # SConstruct directory) from "subdir/foo.c":
1912 env.Program('#other/foo', 'foo.c')
1913 .EE
1914
1915 When the target shares the same base name
1916 as the source and only the suffix varies,
1917 and if the builder method has a suffix defined for the target file type,
1918 then the target argument may be omitted completely,
1919 and
1920 .B scons
1921 will deduce the target file name from
1922 the source file name.
1923 The following examples all build the
1924 executable program
1925 .B bar
1926 (on POSIX systems)
1927 or
1928 .B bar.exe
1929 (on Windows systems)
1930 from the bar.c source file:
1931
1932 .ES
1933 env.Program(target = 'bar', source = 'bar.c')
1934 env.Program('bar', source = 'bar.c')
1935 env.Program(source = 'bar.c')
1936 env.Program('bar.c')
1937 .EE
1938
1939 As a convenience, a
1940 .B srcdir
1941 keyword argument may be specified
1942 when calling a Builder.
1943 When specified,
1944 all source file strings that are not absolute paths
1945 will be interpreted relative to the specified
1946 .BR srcdir .
1947 The following example will build the
1948 .B build/prog
1949 (or
1950 .B build/prog.exe
1951 on Windows)
1952 program from the files
1953 .B src/f1.c
1954 and
1955 .BR src/f2.c :
1956
1957 .ES
1958 env.Program('build/prog', ['f1.c', 'f2.c'], srcdir='src')
1959 .EE
1960
1961 It is possible to override or add construction variables when calling a
1962 builder method by passing additional keyword arguments.
1963 These overridden or added
1964 variables will only be in effect when building the target, so they will not
1965 affect other parts of the build. For example, if you want to add additional
1966 libraries for just one program:
1967
1968 .ES
1969 env.Program('hello', 'hello.c', LIBS=['gl', 'glut'])
1970 .EE
1971
1972 or generate a shared library with a non-standard suffix:
1973
1974 .ES
1975 env.SharedLibrary('word', 'word.cpp',
1976 SHLIBSUFFIX='.ocx',
1977 LIBSUFFIXES=['.ocx'])
1978 .EE
1979
1980 (Note that both the $SHLIBSUFFIX and $LIBSUFFIXES variables must be set
1981 if you want SCons to search automatically
1982 for dependencies on the non-standard library names;
1983 see the descriptions of these variables, below, for more information.)
1984
1985 It is also possible to use the
1986 .I parse_flags
1987 keyword argument in an override:
1988
1989 .ES
1990 env = Program('hello', 'hello.c', parse_flags = '-Iinclude -DEBUG -lm')
1991 .EE
1992
1993 This example adds 'include' to
1994 .BR CPPPATH ,
1995 \&'EBUG' to
1996 .BR CPPDEFINES ,
1997 and 'm' to
1998 .BR LIBS .
1999
2000 Although the builder methods defined by
2001 .B scons
2002 are, in fact,
2003 methods of a construction environment object,
2004 they may also be called without an explicit environment:
2005
2006 .ES
2007 Program('hello', 'hello.c')
2008 SharedLibrary('word', 'word.cpp')
2009 .EE
2010
2011 In this case,
2012 the methods are called internally using a default construction
2013 environment that consists of the tools and values that
2014 .B scons
2015 has determined are appropriate for the local system.
2016
2017 Builder methods that can be called without an explicit
2018 environment may be called from custom Python modules that you
2019 import into an SConscript file by adding the following
2020 to the Python module:
2021
2022 .ES
2023 from SCons.Script import *
2024 .EE
2025
2026 All builder methods return a list-like object
2027 containing Nodes that
2028 represent the target or targets that will be built.
2029 A
2030 .I Node
2031 is an internal SCons object
2032 which represents
2033 build targets or sources.
2034
2035 The returned Node-list object
2036 can be passed to other builder methods as source(s)
2037 or passed to any SCons function or method
2038 where a filename would normally be accepted.
2039 For example, if it were necessary
2040 to add a specific
2041 .B -D
2042 flag when compiling one specific object file:
2043
2044 .ES
2045 bar_obj_list = env.StaticObject('bar.c', CPPDEFINES='-DBAR')
2046 env.Program(source = ['foo.c', bar_obj_list, 'main.c'])
2047 .EE
2048
2049 Using a Node in this way
2050 makes for a more portable build
2051 by avoiding having to specify
2052 a platform-specific object suffix
2053 when calling the Program() builder method.
2054
2055 Note that Builder calls will automatically "flatten"
2056 the source and target file lists,
2057 so it's all right to have the bar_obj list
2058 return by the StaticObject() call
2059 in the middle of the source file list.
2060 If you need to manipulate a list of lists returned by Builders
2061 directly using Python,
2062 you can either build the list by hand:
2063
2064 .ES
2065 foo = Object('foo.c')
2066 bar = Object('bar.c')
2067 objects = ['begin.o'] + foo + ['middle.o'] + bar + ['end.o']
2068 for object in objects:
2069 print str(object)
2070 .EE
2071
2072 Or you can use the
2073 .BR Flatten ()
2074 function supplied by scons
2075 to create a list containing just the Nodes,
2076 which may be more convenient:
2077
2078 .ES
2079 foo = Object('foo.c')
2080 bar = Object('bar.c')
2081 objects = Flatten(['begin.o', foo, 'middle.o', bar, 'end.o'])
2082 for object in objects:
2083 print str(object)
2084 .EE
2085
2086 Note also that because Builder calls return
2087 a list-like object, not an actual Python list,
2088 you should
2089 .I not
2090 use the Python
2091 .B +=
2092 operator to append Builder results to a Python list.
2093 Because the list and the object are different types,
2094 Python will not update the original list in place,
2095 but will instead create a new Node-list object
2096 containing the concatenation of the list
2097 elements and the Builder results.
2098 This will cause problems for any other Python variables
2099 in your SCons configuration
2100 that still hold on to a reference to the original list.
2101 Instead, use the Python
2102 .B .extend()
2103 method to make sure the list is updated in-place.
2104 Example:
2105
2106 .ES
2107 object_files = []
2108
2109 # Do NOT use += as follows:
2110 #
2111 # object_files += Object('bar.c')
2112 #
2113 # It will not update the object_files list in place.
2114 #
2115 # Instead, use the .extend() method:
2116 object_files.extend(Object('bar.c'))
2117
2118 .EE
2119
2120 The path name for a Node's file may be used
2121 by passing the Node to the Python-builtin
2122 .B str()
2123 function:
2124
2125 .ES
2126 bar_obj_list = env.StaticObject('bar.c', CPPDEFINES='-DBAR')
2127 print "The path to bar_obj is:", str(bar_obj_list[0])
2128 .EE
2129
2130 Note again that because the Builder call returns a list,
2131 we have to access the first element in the list
2132 .B (bar_obj_list[0])
2133 to get at the Node that actually represents
2134 the object file.
2135
2136 Builder calls support a
2137 .B chdir
2138 keyword argument that
2139 specifies that the Builder's action(s)
2140 should be executed
2141 after changing directory.
2142 If the
2143 .B chdir
2144 argument is
2145 a string or a directory Node,
2146 scons will change to the specified directory.
2147 If the
2148 .B chdir
2149 is not a string or Node
2150 and is non-zero,
2151 then scons will change to the
2152 target file's directory.
2153
2154 .ES
2155 # scons will change to the "sub" subdirectory
2156 # before executing the "cp" command.
2157 env.Command('sub/dir/foo.out', 'sub/dir/foo.in',
2158 "cp dir/foo.in dir/foo.out",
2159 chdir='sub')
2160
2161 # Because chdir is not a string, scons will change to the
2162 # target's directory ("sub/dir") before executing the
2163 # "cp" command.
2164 env.Command('sub/dir/foo.out', 'sub/dir/foo.in',
2165 "cp foo.in foo.out",
2166 chdir=1)
2167 .EE
2168
2169 Note that scons will
2170 .I not
2171 automatically modify
2172 its expansion of
2173 construction variables like
2174 .B $TARGET
2175 and
2176 .B $SOURCE
2177 when using the chdir
2178 keyword argument--that is,
2179 the expanded file names
2180 will still be relative to
2181 the top-level SConstruct directory,
2182 and consequently incorrect
2183 relative to the chdir directory.
2184 If you use the chdir keyword argument,
2185 you will typically need to supply a different
2186 command line using
2187 expansions like
2188 .B ${TARGET.file}
2189 and
2190 .B ${SOURCE.file}
2191 to use just the filename portion of the
2192 targets and source.
2193
2194 .B scons
2195 provides the following builder methods:
2196
2197 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2198 '\" BEGIN GENERATED BUILDER DESCRIPTIONS
2199 '\"
2200 '\" The descriptions below of the various SCons Builders are generated
2201 '\" from the .xml files that live next to the various Python modules in
2202 '\" the build enginer library. If you're reading this [gnt]roff file
2203 '\" with an eye towards patching this man page, you can still submit
2204 '\" a diff against this text, but it will have to be translated to a
2205 '\" diff against the underlying .xml file before the patch is actually
2206 '\" accepted. If you do that yourself, it will make it easier to
2207 '\" integrate the patch.
2208 '\"
2209 '\" BEGIN GENERATED BUILDER DESCRIPTIONS
2210 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2211
2212 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2213 .IP CFile()
2214 .IP env.CFile()
2215 Builds a C source file given a lex (\fB.l\fP)
2216 or yacc (\fB.y\fP) input file.
2217 The suffix specified by the $CFILESUFFIX construction variable
2218 (\fB.c\fP by default)
2219 is automatically added to the target
2220 if it is not already present.
2221 Example:
2222
2223 .ES
2224 # builds foo.c
2225 env.CFile(target = 'foo.c', source = 'foo.l')
2226 # builds bar.c
2227 env.CFile(target = 'bar', source = 'bar.y')
2228 .EE
2229
2230 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2231 .IP CXXFile()
2232 .IP env.CXXFile()
2233 Builds a C++ source file given a lex (\fB.ll\fP)
2234 or yacc (\fB.yy\fP)
2235 input file.
2236 The suffix specified by the $CXXFILESUFFIX construction variable
2237 (\fB.cc\fP by default)
2238 is automatically added to the target
2239 if it is not already present.
2240 Example:
2241
2242 .ES
2243 # builds foo.cc
2244 env.CXXFile(target = 'foo.cc', source = 'foo.ll')
2245 # builds bar.cc
2246 env.CXXFile(target = 'bar', source = 'bar.yy')
2247 .EE
2248
2249 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2250 .IP DVI()
2251 .IP env.DVI()
2252 Builds a \fB.dvi\fP file
2253 from a \fB.tex\fP,
2254 \fB.ltx\fP or \fB.latex\fP input file.
2255 If the source file suffix is \fB.tex\fP,
2256 .B scons
2257 will examine the contents of the file;
2258 if the string
2259 .B \\documentclass
2260 or
2261 .B \\documentstyle
2262 is found, the file is assumed to be a LaTeX file and
2263 the target is built by invoking the $LATEXCOM command line;
2264 otherwise, the $TEXCOM command line is used.
2265 If the file is a LaTeX file,
2266 the
2267 .BR DVI ()
2268 builder method will also examine the contents
2269 of the
2270 .B .aux
2271 file and invoke the $BIBTEX command line
2272 if the string
2273 .B bibdata
2274 is found,
2275 start $MAKEINDEX to generate an index if a
2276 .B .ind
2277 file is found
2278 and will examine the contents
2279 .B .log
2280 file and re-run the $LATEXCOM command
2281 if the log file says it is necessary.
2282
2283 The suffix \fB.dvi\fP
2284 (hard-coded within TeX itself)
2285 is automatically added to the target
2286 if it is not already present.
2287 Examples:
2288
2289 .ES
2290 # builds from aaa.tex
2291 env.DVI(target = 'aaa.dvi', source = 'aaa.tex')
2292 # builds bbb.dvi
2293 env.DVI(target = 'bbb', source = 'bbb.ltx')
2294 # builds from ccc.latex
2295 env.DVI(target = 'ccc.dvi', source = 'ccc.latex')
2296 .EE
2297
2298 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2299 .IP Install()
2300 .IP env.Install()
2301 Installs one or more source files or directories
2302 in the specified target,
2303 which must be a directory.
2304 The names of the specified source files or directories
2305 remain the same within the destination directory.
2306
2307 .ES
2308 env.Install('/usr/local/bin', source = ['foo', 'bar'])
2309 .EE
2310
2311 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2312 .IP InstallAs()
2313 .IP env.InstallAs()
2314 Installs one or more source files or directories
2315 to specific names,
2316 allowing changing a file or directory name
2317 as part of the installation.
2318 It is an error if the
2319 target
2320 and
2321 source
2322 arguments list different numbers of files or directories.
2323
2324 .ES
2325 env.InstallAs(target = '/usr/local/bin/foo',
2326 source = 'foo_debug')
2327 env.InstallAs(target = ['../lib/libfoo.a', '../lib/libbar.a'],
2328 source = ['libFOO.a', 'libBAR.a'])
2329 .EE
2330
2331 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2332 .IP Jar()
2333 .IP env.Jar()
2334 Builds a Java archive (\fB.jar\fP) file
2335 from the specified list of sources.
2336 Any directories in the source list
2337 will be searched for \fB.class\fP files).
2338 Any \fB.java\fP files in the source list
2339 will be compiled to \fB.class\fP files
2340 by calling the \fBJava\fP() Builder.
2341
2342 If the $JARCHDIR value is set, the
2343 .B jar
2344 command will change to the specified directory using the
2345 .B \-C
2346 option.
2347 If $JARCHDIR is not set explicitly,
2348 &SCons; will use the top of any subdirectory tree
2349 in which Java \fB.class\fP
2350 were built by the \fBJava\fP() Builder.
2351
2352 If the contents any of the source files begin with the string
2353 .BR Manifest-Version ,
2354 the file is assumed to be a manifest
2355 and is passed to the
2356 .B jar
2357 command with the
2358 .B m
2359 option set.
2360
2361 .ES
2362 env.Jar(target = 'foo.jar', source = 'classes')
2363
2364 env.Jar(target = 'bar.jar',
2365 source = ['bar1.java', 'bar2.java'])
2366 .EE
2367
2368 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2369 .IP Java()
2370 .IP env.Java()
2371 Builds one or more Java class files.
2372 The sources may be any combination of explicit
2373 \fB.java\fP files,
2374 or directory trees which will be scanned
2375 for \fB.java\fP files.
2376
2377 SCons will parse each source \fB.java\fP file
2378 to find the classes
2379 (including inner classes)
2380 defined within that file,
2381 and from that figure out the
2382 target \fB.class\fP files that will be created.
2383 The class files will be placed underneath
2384 the specified target directory.
2385
2386 SCons will also search each Java file
2387 for the Java package name,
2388 which it assumes can be found on a line
2389 beginning with the string
2390 .B package
2391 in the first column;
2392 the resulting \fB.class\fP files
2393 will be placed in a directory reflecting
2394 the specified package name.
2395 For example,
2396 the file
2397 .B Foo.java
2398 defining a single public
2399 .I Foo
2400 class and
2401 containing a package name of
2402 .I sub.dir
2403 will generate a corresponding
2404 .B sub/dir/Foo.class
2405 class file.
2406
2407 Examples:
2408
2409 .ES
2410 env.Java(target = 'classes', source = 'src')
2411 env.Java(target = 'classes', source = ['src1', 'src2'])
2412 env.Java(target = 'classes', source = ['File1.java', 'File2.java'])
2413 .EE
2414 .IP
2415 Java source files can use the native encoding for the underlying OS.
2416 Since SCons compiles in simple ASCII mode by default,
2417 the compiler will generate warnings about unmappable characters,
2418 which may lead to errors as the file is processed further.
2419 In this case, the user must specify the \fBLANG\fP
2420 environment variable to tell the compiler what encoding is used.
2421 For portibility, it's best if the encoding is hard-coded
2422 so that the compile will work if it is done on a system
2423 with a different encoding.
2424
2425 .ES
2426 env = Environment()
2427 env['ENV']['LANG'] = 'en_GB.UTF-8'
2428 .EE
2429
2430 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2431 .IP JavaH()
2432 .IP env.JavaH()
2433 Builds C header and source files for
2434 implementing Java native methods.
2435 The target can be either a directory
2436 in which the header files will be written,
2437 or a header file name which
2438 will contain all of the definitions.
2439 The source can be the names of \fB.class\fP files,
2440 the names of \fB.java\fP files
2441 to be compiled into \fB.class\fP files
2442 by calling the \fBJava\fP() builder method,
2443 or the objects returned from the
2444 .BR Java ()
2445 builder method.
2446
2447 If the construction variable
2448 $JAVACLASSDIR
2449 is set, either in the environment
2450 or in the call to the
2451 .BR JavaH ()
2452 builder method itself,
2453 then the value of the variable
2454 will be stripped from the
2455 beginning of any \fB.class\fP file names.
2456
2457 Examples:
2458
2459 .ES
2460 # builds java_native.h
2461 classes = env.Java(target = 'classdir', source = 'src')
2462 env.JavaH(target = 'java_native.h', source = classes)
2463
2464 # builds include/package_foo.h and include/package_bar.h
2465 env.JavaH(target = 'include',
2466 source = ['package/foo.class', 'package/bar.class'])
2467
2468 # builds export/foo.h and export/bar.h
2469 env.JavaH(target = 'export',
2470 source = ['classes/foo.class', 'classes/bar.class'],
2471 JAVACLASSDIR = 'classes')
2472 .EE
2473
2474 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2475 .IP Library()
2476 .IP env.Library()
2477 A synonym for the
2478 .BR StaticLibrary ()
2479 builder method.
2480
2481 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2482 .IP LoadableModule()
2483 .IP env.LoadableModule()
2484 On most systems,
2485 this is the same as
2486 .BR SharedLibrary ().
2487 On Mac OS X (Darwin) platforms,
2488 this creates a loadable module bundle.
2489
2490 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2491 .IP M4()
2492 .IP env.M4()
2493 Builds an output file from an M4 input file.
2494 This uses a default $M4FLAGS value of
2495 .BR \-E ,
2496 which considers all warnings to be fatal
2497 and stops on the first warning
2498 when using the GNU version of m4.
2499 Example:
2500
2501 .ES
2502 env.M4(target = 'foo.c', source = 'foo.c.m4')
2503 .EE
2504
2505 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2506 .IP Moc()
2507 .IP env.Moc()
2508 Builds an output file from a moc input file. Moc input files are either
2509 header files or cxx files. This builder is only available after using the
2510 tool 'qt'. See the $QTDIR variable for more information.
2511 Example:
2512
2513 .ES
2514 env.Moc('foo.h') # generates moc_foo.cc
2515 env.Moc('foo.cpp') # generates foo.moc
2516 .EE
2517
2518 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2519 .IP MSVSProject()
2520 .IP env.MSVSProject()
2521 Builds a Microsoft Visual Studio project file,
2522 and by default builds a solution file as well.
2523
2524 This builds a Visual Studio project file, based on the version of
2525 Visual Studio that is configured (either the latest installed version,
2526 or the version specified by
2527 $MSVS_VERSION
2528 in the Environment constructor).
2529 For Visual Studio 6, it will generate a
2530 .B .dsp
2531 file.
2532 For Visual Studio 7 (.NET) and later versions, it will generate a
2533 .B .vcproj
2534 file.
2535
2536 By default,
2537 this also generates a solution file
2538 for the specified project,
2539 a
2540 .B .dsw
2541 file for Visual Studio 6
2542 or a
2543 .B .sln
2544 file for Visual Studio 7 (.NET).
2545 This behavior may be disabled by specifying
2546 .B auto_build_solution=0
2547 when you call
2548 .BR MSVSProject (),
2549 in which case you presumably want to
2550 build the solution file(s)
2551 by calling the
2552 .BR MSVSSolution ()
2553 Builder (see below).
2554
2555 The \fBMSVSProject\fP() builder
2556 takes several lists of filenames
2557 to be placed into the project file.
2558 These are currently limited to
2559 .BR srcs ,
2560 .BR incs ,
2561 .BR localincs ,
2562 .BR resources ,
2563 and
2564 .BR misc .
2565 These are pretty self-explanatory, but it should be noted that these
2566 lists are added to the $SOURCES construction variable as strings,
2567 NOT as SCons File Nodes. This is because they represent file
2568 names to be added to the project file, not the source files used to
2569 build the project file.
2570
2571 The above filename lists are all optional,
2572 although at least one must be specified
2573 for the resulting project file to be non-empty.
2574
2575 In addition to the above lists of values,
2576 the following values may be specified:
2577
2578 .BR target :
2579 The name of the target
2580 .B .dsp
2581 or
2582 .B .vcproj
2583 file.
2584 The correct
2585 suffix for the version of Visual Studio must be used,
2586 but the
2587 $MSVSPROJECTSUFFIX
2588 construction variable
2589 will be defined to the correct value (see example below).
2590
2591 .BR variant :
2592 The name of this particular variant.
2593 For Visual Studio 7 projects,
2594 this can also be a list of variant names.
2595 These are typically things like "Debug" or "Release", but really
2596 can be anything you want.
2597 For Visual Studio 7 projects,
2598 they may also specify a target platform
2599 separated from the variant name by a
2600 .B |
2601 (vertical pipe)
2602 character:
2603 .BR Debug|Xbox .
2604 The default target platform is Win32.
2605 Multiple calls to
2606 .BR MSVSProject ()
2607 with different variants are allowed;
2608 all variants will be added to the project file with their appropriate
2609 build targets and sources.
2610
2611 .BR buildtarget :
2612 An optional string, node, or list of strings or nodes
2613 (one per build variant), to tell the Visual Studio debugger
2614 what output target to use in what build variant.
2615 The number of
2616 .B buildtarget
2617 entries must match the number of
2618 .B variant
2619 entries.
2620
2621 .BR runfile :
2622 The name of the file that Visual Studio 7 and later
2623 will run and debug.
2624 This appears as the value of the
2625 .B Output
2626 field in the resutling Visual Studio project file.
2627 If this is not specified,
2628 the default is the same as the specified
2629 .B buildtarget
2630 value.
2631
2632 Note that because &SCons; always executes its build commands
2633 from the directory in which the \fBSConstruct\fP file is located,
2634 if you generate a project file in a different directory
2635 than the \fBSConstruct\fP directory,
2636 users will not be able to double-click
2637 on the file name in compilation error messages
2638 displayed in the Visual Studio console output window.
2639 This can be remedied by adding the
2640 Visual C/C++
2641 .B /FC
2642 compiler option to the $CCFLAGS variable
2643 so that the compiler will print
2644 the full path name of any
2645 files that cause compilation errors.
2646
2647 Example usage:
2648
2649 .ES
2650 barsrcs = ['bar.cpp'],
2651 barincs = ['bar.h'],
2652 barlocalincs = ['StdAfx.h']
2653 barresources = ['bar.rc','resource.h']
2654 barmisc = ['bar_readme.txt']
2655
2656 dll = env.SharedLibrary(target = 'bar.dll',
2657 source = barsrcs)
2658
2659 env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'],
2660 srcs = barsrcs,
2661 incs = barincs,
2662 localincs = barlocalincs,
2663 resources = barresources,
2664 misc = barmisc,
2665 buildtarget = dll,
2666 variant = 'Release')
2667 .EE
2668
2669 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2670 .IP MSVSSolution()
2671 .IP env.MSVSSolution()
2672 Builds a Microsoft Visual Studio solution file.
2673
2674 This builds a Visual Studio solution file,
2675 based on the version of Visual Studio that is configured
2676 (either the latest installed version,
2677 or the version specified by
2678 $MSVS_VERSION
2679 in the construction environment).
2680 For Visual Studio 6, it will generate a
2681 .B .dsw
2682 file.
2683 For Visual Studio 7 (.NET), it will
2684 generate a
2685 .B .sln
2686 file.
2687
2688 The following values must be specified:
2689
2690 .BR target :
2691 The name of the target .dsw or .sln file. The correct
2692 suffix for the version of Visual Studio must be used, but the value
2693 $MSVSSOLUTIONSUFFIX
2694 will be defined to the correct value (see example below).
2695
2696 .BR variant :
2697 The name of this particular variant, or a list of variant
2698 names (the latter is only supported for MSVS 7 solutions). These are
2699 typically things like "Debug" or "Release", but really can be anything
2700 you want. For MSVS 7 they may also specify target platform, like this
2701 "Debug|Xbox". Default platform is Win32.
2702
2703 .BR projects :
2704 A list of project file names, or Project nodes returned by calls to the
2705 .BR MSVSProject ()
2706 Builder,
2707 to be placed into the solution file.
2708 It should be noted that these file names are NOT added to the $SOURCES
2709 environment variable in form of files, but rather as strings. This
2710 is because they represent file names to be added to the solution file,
2711 not the source files used to build the solution file.
2712
2713 (NOTE: Currently only one project is supported per solution.)
2714
2715 Example Usage:
2716
2717 .ES
2718 env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'],
2719 projects = ['bar' + env['MSVSPROJECTSUFFIX']],
2720 variant = 'Release')
2721 .EE
2722
2723 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2724 .IP Object()
2725 .IP env.Object()
2726 A synonym for the
2727 .BR StaticObject ()
2728 builder method.
2729
2730 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2731 .IP Package()
2732 .IP env.Package()
2733 Builds software distribution packages.
2734 Packages consist of files to install and packaging information.
2735 The former may be specified with the \fIsource\fP parameter and may be left out,
2736 in which case the &FindInstalledFiles; function will collect
2737 all files that have an \fBInstall\fP() or \fBInstallAs\fP() Builder attached.
2738 If the \fItarget\fP is not specified
2739 it will be deduced from additional information given to this Builder.
2740
2741 The packaging information is specified
2742 with the help of construction variables documented below.
2743 This information is called a tag to stress that
2744 some of them can also be attached to files with the &Tag; function.
2745 The mandatory ones will complain if they were not specified.
2746 They vary depending on chosen target packager.
2747
2748 The target packager may be selected with the "PACKAGETYPE" command line
2749 option or with the $PACKAGETYPE construction variable. Currently
2750 the following packagers available:
2751
2752 * msi - Microsoft Installer
2753 * rpm - Redhat Package Manger
2754 * ipkg - Itsy Package Management System
2755 * tarbz2 - compressed tar
2756 * targz - compressed tar
2757 * zip - zip file
2758 * src_tarbz2 - compressed tar source
2759 * src_targz - compressed tar source
2760 * src_zip - zip file source
2761
2762 An updated list is always available under the "package_type" option when
2763 running "scons --help" on a project that has packaging activated.
2764 .ES
2765 env = Environment(tools=['default', 'packaging'])
2766 env.Install('/bin/', 'my_program')
2767 env.Package( NAME = 'foo',
2768 VERSION = '1.2.3',
2769 PACKAGEVERSION = 0,
2770 PACKAGETYPE = 'rpm',
2771 LICENSE = 'gpl',
2772 SUMMARY = 'balalalalal',
2773 DESCRIPTION = 'this should be really really long',
2774 X_RPM_GROUP = 'Application/fu',
2775 SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
2776 )
2777 .EE
2778
2779 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2780 .IP PCH()
2781 .IP env.PCH()
2782 Builds a Microsoft Visual C++ precompiled header.
2783 Calling this builder method
2784 returns a list of two targets: the PCH as the first element, and the object
2785 file as the second element. Normally the object file is ignored.
2786 This builder method is only
2787 provided when Microsoft Visual C++ is being used as the compiler.
2788 The PCH builder method is generally used in
2789 conjuction with the PCH construction variable to force object files to use
2790 the precompiled header:
2791
2792 .ES
2793 env['PCH'] = env.PCH('StdAfx.cpp')[0]
2794 .EE
2795
2796 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2797 .IP PDF()
2798 .IP env.PDF()
2799 Builds a \fB.pdf\fP file
2800 from a \fB.dvi\fP input file
2801 (or, by extension, a \fB.tex\fP,
2802 .BR .ltx ,
2803 or
2804 \fB.latex\fP input file).
2805 The suffix specified by the $PDFSUFFIX construction variable
2806 (\fB.pdf\fP by default)
2807 is added automatically to the target
2808 if it is not already present. Example:
2809
2810 .ES
2811 # builds from aaa.tex
2812 env.PDF(target = 'aaa.pdf', source = 'aaa.tex')
2813 # builds bbb.pdf from bbb.dvi
2814 env.PDF(target = 'bbb', source = 'bbb.dvi')
2815 .EE
2816
2817 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2818 .IP PostScript()
2819 .IP env.PostScript()
2820 Builds a \fB.ps\fP file
2821 from a \fB.dvi\fP input file
2822 (or, by extension, a \fB.tex\fP,
2823 .BR .ltx ,
2824 or
2825 \fB.latex\fP input file).
2826 The suffix specified by the $PSSUFFIX construction variable
2827 (\fB.ps\fP by default)
2828 is added automatically to the target
2829 if it is not already present. Example:
2830
2831 .ES
2832 # builds from aaa.tex
2833 env.PostScript(target = 'aaa.ps', source = 'aaa.tex')
2834 # builds bbb.ps from bbb.dvi
2835 env.PostScript(target = 'bbb', source = 'bbb.dvi')
2836 .EE
2837
2838 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2839 .IP Program()
2840 .IP env.Program()
2841 Builds an executable given one or more object files
2842 or C, C++, D, or Fortran source files.
2843 If any C, C++, D or Fortran source files are specified,
2844 then they will be automatically
2845 compiled to object files using the
2846 .BR Object ()
2847 builder method;
2848 see that builder method's description for
2849 a list of legal source file suffixes
2850 and how they are interpreted.
2851 The target executable file prefix
2852 (specified by the $PROGPREFIX construction variable; nothing by default)
2853 and suffix
2854 (specified by the $PROGSUFFIX construction variable;
2855 by default, \fB.exe\fP on Windows systems,
2856 nothing on POSIX systems)
2857 are automatically added to the target if not already present.
2858 Example:
2859
2860 .ES
2861 env.Program(target = 'foo', source = ['foo.o', 'bar.c', 'baz.f'])
2862 .EE
2863
2864 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2865 .IP RES()
2866 .IP env.RES()
2867 Builds a Microsoft Visual C++ resource file.
2868 This builder method is only provided
2869 when Microsoft Visual C++ or MinGW is being used as the compiler. The
2870 .B .res
2871 (or
2872 .B .o
2873 for MinGW) suffix is added to the target name if no other suffix is given.
2874 The source
2875 file is scanned for implicit dependencies as though it were a C file.
2876 Example:
2877
2878 .ES
2879 env.RES('resource.rc')
2880 .EE
2881
2882 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2883 .IP RMIC()
2884 .IP env.RMIC()
2885 Builds stub and skeleton class files
2886 for remote objects
2887 from Java \fB.class\fP files.
2888 The target is a directory
2889 relative to which the stub
2890 and skeleton class files will be written.
2891 The source can be the names of \fB.class\fP files,
2892 or the objects return from the
2893 .BR Java ()
2894 builder method.
2895
2896 If the construction variable
2897 $JAVACLASSDIR
2898 is set, either in the environment
2899 or in the call to the
2900 .BR RMIC ()
2901 builder method itself,
2902 then the value of the variable
2903 will be stripped from the
2904 beginning of any \fB.class \fP
2905 file names.
2906
2907 .ES
2908 classes = env.Java(target = 'classdir', source = 'src')
2909 env.RMIC(target = 'outdir1', source = classes)
2910
2911 env.RMIC(target = 'outdir2',
2912 source = ['package/foo.class', 'package/bar.class'])
2913
2914 env.RMIC(target = 'outdir3',
2915 source = ['classes/foo.class', 'classes/bar.class'],
2916 JAVACLASSDIR = 'classes')
2917 .EE
2918
2919 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2920 .IP RPCGenClient()
2921 .IP env.RPCGenClient()
2922 Generates an RPC client stub (\fB_clnt.c\fP) file
2923 from a specified RPC (\fB.x\fP) source file.
2924 Because rpcgen only builds output files
2925 in the local directory,
2926 the command will be executed
2927 in the source file's directory by default.
2928
2929 .ES
2930 # Builds src/rpcif_clnt.c
2931 env.RPCGenClient('src/rpcif.x')
2932 .EE
2933
2934 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2935 .IP RPCGenHeader()
2936 .IP env.RPCGenHeader()
2937 Generates an RPC header (\fB.h\fP) file
2938 from a specified RPC (\fB.x\fP) source file.
2939 Because rpcgen only builds output files
2940 in the local directory,
2941 the command will be executed
2942 in the source file's directory by default.
2943
2944 .ES
2945 # Builds src/rpcif.h
2946 env.RPCGenHeader('src/rpcif.x')
2947 .EE
2948
2949 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2950 .IP RPCGenService()
2951 .IP env.RPCGenService()
2952 Generates an RPC server-skeleton (\fB_svc.c\fP) file
2953 from a specified RPC (\fB.x\fP) source file.
2954 Because rpcgen only builds output files
2955 in the local directory,
2956 the command will be executed
2957 in the source file's directory by default.
2958
2959 .ES
2960 # Builds src/rpcif_svc.c
2961 env.RPCGenClient('src/rpcif.x')
2962 .EE
2963
2964 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2965 .IP RPCGenXDR()
2966 .IP env.RPCGenXDR()
2967 Generates an RPC XDR routine (\fB_xdr.c\fP) file
2968 from a specified RPC (\fB.x\fP) source file.
2969 Because rpcgen only builds output files
2970 in the local directory,
2971 the command will be executed
2972 in the source file's directory by default.
2973
2974 .ES
2975 # Builds src/rpcif_xdr.c
2976 env.RPCGenClient('src/rpcif.x')
2977 .EE
2978
2979 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2980 .IP SharedLibrary()
2981 .IP env.SharedLibrary()
2982 Builds a shared library
2983 (\fB.so\fP on a POSIX system,
2984 \fB.dll\fP on Windows)
2985 given one or more object files
2986 or C, C++, D or Fortran source files.
2987 If any source files are given,
2988 then they will be automatically
2989 compiled to object files.
2990 The static library prefix and suffix (if any)
2991 are automatically added to the target.
2992 The target library file prefix
2993 (specified by the $SHLIBPREFIX construction variable;
2994 by default, \fBlib\fP on POSIX systems,
2995 nothing on Windows systems)
2996 and suffix
2997 (specified by the $SHLIBSUFFIX construction variable;
2998 by default, \fB.dll\fP on Windows systems,
2999 \fB.so\fP on POSIX systems)
3000 are automatically added to the target if not already present.
3001 Example:
3002
3003 .ES
3004 env.SharedLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
3005 .EE
3006 .IP
3007 On Windows systems, the
3008 .BR SharedLibrary ()
3009 builder method will always build an import
3010 (\fB.lib\fP) library
3011 in addition to the shared (\fB.dll\fP) library,
3012 adding a \fB.lib\fP library with the same basename
3013 if there is not already a \fB.lib\fP file explicitly
3014 listed in the targets.
3015
3016 Any object files listed in the
3017 .B source
3018 must have been built for a shared library
3019 (that is, using the
3020 .BR SharedObject ()
3021 builder method).
3022 .B scons
3023 will raise an error if there is any mismatch.
3024
3025 On some platforms, there is a distinction between a shared library
3026 (loaded automatically by the system to resolve external references)
3027 and a loadable module (explicitly loaded by user action).
3028 For maximum portability, use the \fBLoadableModule\fP() builder for the latter.
3029
3030 On Windows systems, specifying
3031 .B register=1
3032 will cause the \fB.dll\fP to be
3033 registered after it is built using REGSVR32.
3034 The command that is run
3035 ("regsvr32" by default) is determined by $REGSVR construction
3036 variable, and the flags passed are determined by $REGSVRFLAGS. By
3037 default, $REGSVRFLAGS includes the \fB/s\fP option,
3038 to prevent dialogs from popping
3039 up and requiring user attention when it is run. If you change
3040 $REGSVRFLAGS, be sure to include the \fB/s\fP option.
3041 For example,
3042
3043 .ES
3044 env.SharedLibrary(target = 'bar',
3045 source = ['bar.cxx', 'foo.obj'],
3046 register=1)
3047 .EE
3048 .IP
3049 will register \fBbar.dll\fP as a COM object
3050 when it is done linking it.
3051
3052 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3053 .IP SharedObject()
3054 .IP env.SharedObject()
3055 Builds an object file for
3056 inclusion in a shared library.
3057 Source files must have one of the same set of extensions
3058 specified above for the
3059 .BR StaticObject ()
3060 builder method.
3061 On some platforms building a shared object requires additional
3062 compiler option
3063 (e.g. \fB\-fPIC\fP for gcc)
3064 in addition to those needed to build a
3065 normal (static) object, but on some platforms there is no difference between a
3066 shared object and a normal (static) one. When there is a difference, SCons
3067 will only allow shared objects to be linked into a shared library, and will
3068 use a different suffix for shared objects. On platforms where there is no
3069 difference, SCons will allow both normal (static)
3070 and shared objects to be linked into a
3071 shared library, and will use the same suffix for shared and normal
3072 (static) objects.
3073 The target object file prefix
3074 (specified by the $SHOBJPREFIX construction variable;
3075 by default, the same as $OBJPREFIX)
3076 and suffix
3077 (specified by the $SHOBJSUFFIX construction variable)
3078 are automatically added to the target if not already present.
3079 Examples:
3080
3081 .ES
3082 env.SharedObject(target = 'ddd', source = 'ddd.c')
3083 env.SharedObject(target = 'eee.o', source = 'eee.cpp')
3084 env.SharedObject(target = 'fff.obj', source = 'fff.for')
3085 .EE
3086 .IP
3087 Note that the source files will be scanned
3088 according to the suffix mappings in the
3089 .B SourceFileScanner
3090 object.
3091 See the section "Scanner Objects,"
3092 below, for more information.
3093
3094 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3095 .IP StaticLibrary()
3096 .IP env.StaticLibrary()
3097 Builds a static library given one or more object files
3098 or C, C++, D or Fortran source files.
3099 If any source files are given,
3100 then they will be automatically
3101 compiled to object files.
3102 The static library prefix and suffix (if any)
3103 are automatically added to the target.
3104 The target library file prefix
3105 (specified by the $LIBPREFIX construction variable;
3106 by default, \fBlib\fP on POSIX systems,
3107 nothing on Windows systems)
3108 and suffix
3109 (specified by the $LIBSUFFIX construction variable;
3110 by default, \fB.lib\fP on Windows systems,
3111 \fB.a\fP on POSIX systems)
3112 are automatically added to the target if not already present.
3113 Example:
3114
3115 .ES
3116 env.StaticLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
3117 .EE
3118 .IP
3119 Any object files listed in the
3120 .B source
3121 must have been built for a static library
3122 (that is, using the
3123 .BR StaticObject ()
3124 builder method).
3125 .B scons
3126 will raise an error if there is any mismatch.
3127
3128 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3129 .IP StaticObject()
3130 .IP env.StaticObject()
3131 Builds a static object file
3132 from one or more C, C++, D, or Fortran source files.
3133 Source files must have one of the following extensions:
3134
3135 .ES
3136 .asm assembly language file
3137 .ASM assembly language file
3138 .c C file
3139 .C Windows: C file
3140 POSIX: C++ file
3141 .cc C++ file
3142 .cpp C++ file
3143 .cxx C++ file
3144 .cxx C++ file
3145 .c++ C++ file
3146 .C++ C++ file
3147 .d D file
3148 .f Fortran file
3149 .F Windows: Fortran file
3150 POSIX: Fortran file + C pre-processor
3151 .for Fortran file
3152 .FOR Fortran file
3153 .fpp Fortran file + C pre-processor
3154 .FPP Fortran file + C pre-processor
3155 .m Object C file
3156 .mm Object C++ file
3157 .s assembly language file
3158 .S Windows: assembly language file
3159 ARM: CodeSourcery Sourcery Lite
3160 .sx assembly language file + C pre-processor
3161 POSIX: assembly language file + C pre-processor
3162 .spp assembly language file + C pre-processor
3163 .SPP assembly language file + C pre-processor
3164 .EE
3165 .IP
3166 The target object file prefix
3167 (specified by the $OBJPREFIX construction variable; nothing by default)
3168 and suffix
3169 (specified by the $OBJSUFFIX construction variable;
3170 \fB.obj\fP on Windows systems,
3171 \fB.o\fP on POSIX systems)
3172 are automatically added to the target if not already present.
3173 Examples:
3174
3175 .ES
3176 env.StaticObject(target = 'aaa', source = 'aaa.c')
3177 env.StaticObject(target = 'bbb.o', source = 'bbb.c++')
3178 env.StaticObject(target = 'ccc.obj', source = 'ccc.f')
3179 .EE
3180 .IP
3181 Note that the source files will be scanned
3182 according to the suffix mappings in
3183 .B SourceFileScanner
3184 object.
3185 See the section "Scanner Objects,"
3186 below, for more information.
3187
3188 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3189 .IP Substfile()
3190 .IP env.Substfile()
3191 The \fBSubstfile\fP() builder generates a single text file
3192 by concatenating the source files.
3193 Nested lists of sources are flattened.
3194 $LINESEPARATOR is used to separate the source files;
3195 see the description of \fBTextfile\fP() for details.
3196
3197 If a single source file is present with an \fB.in\fP suffix,
3198 the suffix is stripped and the remainder is used as the default target name.
3199
3200 The prefix and suffix specified by the $SUBSTFILEPREFIX
3201 and $SUBSTFILESUFFIX construction variables
3202 (the null string by default in both cases)
3203 are automatically added to the target if they are not already present.
3204
3205 If a construction variable named $SUBST_DICT is present,
3206 it may be either a Python dictionary or a sequence of (key,value) tuples.
3207 If the former,
3208 the dictionary is converted into a list of tuples in an arbitrary order,
3209 so if one key is a prefix of another key
3210 or if one substitution could be further expanded by another subsitition,
3211 it is unpredictible whether the expansion will occur.
3212
3213 Any occurences in the source of a key
3214 are replaced by the corresponding value,
3215 which may be a Python callable function or a string.
3216 If a value is a function,
3217 it is first called (with no arguments) to produce a string.
3218 The string is \fIsubst\fP-expanded
3219 and the result replaces the key.
3220
3221 .ES
3222 env = Environment(tools = ['default', 'textfile'])
3223
3224 env['prefix'] = '/usr/bin'
3225 script_dict = {'@prefix@': '/bin', @exec_prefix@: '$prefix'}
3226 env.Substfile('script.in', SUBST_DICT = script_dict)
3227
3228 conf_dict = {'%VERSION%': '1.2.3', '%BASE%': 'MyProg'}
3229 env.Substfile('config.h.in', conf_dict, SUBST_DICT = conf_dict)
3230
3231 # UNPREDICTABLE - one key is a prefix of another
3232 bad_foo = {'$foo': '$foo', '$foobar': '$foobar'}
3233 env.Substfile('foo.in', SUBST_DICT = bad_foo)
3234
3235 # PREDICTABLE - keys are applied longest first
3236 good_foo = [('$foobar', '$foobar'), ('$foo', '$foo')]
3237 env.Substfile('foo.in', SUBST_DICT = good_foo)
3238
3239 # UNPREDICTABLE - one substitution could be futher expanded
3240 bad_bar = {'@bar@': '@soap@', '@soap@': 'lye'}
3241 env.Substfile('bar.in', SUBST_DICT = bad_bar)
3242
3243 # PREDICTABLE - substitutions are expanded in order
3244 good_bar = (('@bar@', '@soap@'), ('@soap@', 'lye'))
3245 env.Substfile('bar.in', SUBST_DICT = good_bar)
3246
3247 # the SUBST_DICT may be in common (and not an override)
3248 substutions = {}
3249 subst = Environment(tools = ['textfile', SUBST_DICT = substitutions)
3250 substitutions['@foo@'] = 'foo'
3251 subst['SUBST_DICT']['@bar@'] = 'bar'
3252 subst.Substfile('pgm1.c', [Value('#include "@foo@.h"'),
3253 Value('#include "@bar@.h"'),
3254 "common.in",
3255 "pgm1.in"
3256 ])
3257 subst.Substfile('pgm2.c', [Value('#include "@foo@.h"'),
3258 Value('#include "@bar@.h"'),
3259 "common.in",
3260 "pgm2.in"
3261 ])
3262
3263 .EE
3264
3265 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3266 .IP Tar()
3267 .IP env.Tar()
3268 Builds a tar archive of the specified files
3269 and/or directories.
3270 Unlike most builder methods,
3271 the
3272 .BR Tar ()
3273 builder method may be called multiple times
3274 for a given target;
3275 each additional call
3276 adds to the list of entries
3277 that will be built into the archive.
3278 Any source directories will
3279 be scanned for changes to
3280 any on-disk files,
3281 regardless of whether or not
3282 .B scons
3283 knows about them from other Builder or function calls.
3284
3285 .ES
3286 env.Tar('src.tar', 'src')
3287
3288 # Create the stuff.tar file.
3289 env.Tar('stuff', ['subdir1', 'subdir2'])
3290 # Also add "another" to the stuff.tar file.
3291 env.Tar('stuff', 'another')
3292
3293 # Set TARFLAGS to create a gzip-filtered archive.
3294 env = Environment(TARFLAGS = '-c -z')
3295 env.Tar('foo.tar.gz', 'foo')
3296
3297 # Also set the suffix to .tgz.
3298 env = Environment(TARFLAGS = '-c -z',
3299 TARSUFFIX = '.tgz')
3300 env.Tar('foo')
3301 .EE
3302
3303 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3304 .IP Textfile()
3305 .IP env.Textfile()
3306 The \fBTextfile\fP() builder generates a single text file.
3307 The source strings constitute the lines;
3308 nested lists of sources are flattened.
3309 $LINESEPARATOR is used to separate the strings.
3310
3311 If present, the $SUBST_DICT construction variable
3312 is used to modify the strings before they are written;
3313 see the \fBSubstfile\fP() description for details.
3314
3315 The prefix and suffix specified by the $TEXTFILEPREFIX
3316 and $TEXTFILESUFFIX construction variables
3317 (the null string and \fB.txt\fP by default, respectively)
3318 are automatically added to the target if they are not already present.
3319 Examples:
3320
3321 .ES
3322 # builds/writes foo.txt
3323 env.Textfile(target = 'foo.txt', source = ['Goethe', 42, 'Schiller'])
3324
3325 # builds/writes bar.txt
3326 env.Textfile(target = 'bar',
3327 source = ['lalala', 'tanteratei'],
3328 LINESEPARATOR='|*')
3329
3330 # nested lists are flattened automatically
3331 env.Textfile(target = 'blob',
3332 source = ['lalala', ['Goethe', 42 'Schiller'], 'tanteratei'])
3333
3334 # files may be used as input by wraping them in File()
3335 env.Textfile(target = 'concat', # concatenate files with a marker between
3336 source = [File('concat1'), File('concat2')],
3337 LINESEPARATOR = '====================\\n')
3338
3339 Results are:
3340 foo.txt
3341 ....8<----
3342 Goethe
3343 42
3344 Schiller
3345 ....8<---- (no linefeed at the end)
3346
3347 bar.txt:
3348 ....8<----
3349 lalala|*tanteratei
3350 ....8<---- (no linefeed at the end)
3351
3352 blob.txt
3353 ....8<----
3354 lalala
3355 Goethe
3356 42
3357 Schiller
3358 tanteratei
3359 ....8<---- (no linefeed at the end)
3360 .EE
3361
3362 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3363 .IP TypeLibrary()
3364 .IP env.TypeLibrary()
3365 Builds a Windows type library (\fB.tlb\fP)
3366 file from an input IDL file (\fB.idl\fP).
3367 In addition, it will build the associated inteface stub and
3368 proxy source files,
3369 naming them according to the base name of the \fB.idl\fP file.
3370 For example,
3371
3372 .ES
3373 env.TypeLibrary(source="foo.idl")
3374 .EE
3375 .IP
3376 Will create \fBfoo.tlb\fP,
3377 .BR foo.h ,
3378 .BR foo_i.c ,
3379 .B foo_p.c
3380 and
3381 .B foo_data.c
3382 files.
3383
3384 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3385 .IP Uic()
3386 .IP env.Uic()
3387 Builds a header file, an implementation file and a moc file from an ui file.
3388 and returns the corresponding nodes in the above order.
3389 This builder is only available after using the tool 'qt'. Note: you can
3390 specify \fB.ui\fP files directly as source
3391 files to the \fBProgram\fP(),
3392 \fBLibrary\fP() and \fBSharedLibrary\fP() builders
3393 without using this builder. Using this builder lets you override the standard
3394 naming conventions (be careful: prefixes are always prepended to names of
3395 built files; if you don't want prefixes, you may set them to ``).
3396 See the $QTDIR variable for more information.
3397 Example:
3398
3399 .ES
3400 env.Uic('foo.ui') # -> ['foo.h', 'uic_foo.cc', 'moc_foo.cc']
3401 env.Uic(target = Split('include/foo.h gen/uicfoo.cc gen/mocfoo.cc'),
3402 source = 'foo.ui') # -> ['include/foo.h', 'gen/uicfoo.cc', 'gen/mocfoo.c c']
3403 .EE
3404
3405 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3406 .IP Zip()
3407 .IP env.Zip()
3408 Builds a zip archive of the specified files
3409 and/or directories.
3410 Unlike most builder methods,
3411 the
3412 .BR Zip ()
3413 builder method may be called multiple times
3414 for a given target;
3415 each additional call
3416 adds to the list of entries
3417 that will be built into the archive.
3418 Any source directories will
3419 be scanned for changes to
3420 any on-disk files,
3421 regardless of whether or not
3422 .B scons
3423 knows about them from other Builder or function calls.
3424
3425 .ES
3426 env.Zip('src.zip', 'src')
3427
3428 # Create the stuff.zip file.
3429 env.Zip('stuff', ['subdir1', 'subdir2'])
3430 # Also add "another" to the stuff.tar file.
3431 env.Zip('stuff', 'another')
3432 .EE
3433 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3434 '\" END GENERATED BUILDER DESCRIPTIONS
3435 '\"
3436 '\" The descriptions above of the various SCons Builders are generated
3437 '\" from the .xml files that live next to the various Python modules in
3438 '\" the build enginer library. If you're reading this [gnt]roff file
3439 '\" with an eye towards patching this man page, you can still submit
3440 '\" a diff against this text, but it will have to be translated to a
3441 '\" diff against the underlying .xml file before the patch is actually
3442 '\" accepted. If you do that yourself, it will make it easier to
3443 '\" integrate the patch.
3444 '\"
3445 '\" END GENERATED BUILDER DESCRIPTIONS
3446 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3447
3448 .P
3449 All
3450 targets of builder methods automatically depend on their sources.
3451 An explicit dependency can
3452 be specified using the
3453 .B Depends
3454 method of a construction environment (see below).
3455
3456 In addition,
3457 .B scons
3458 automatically scans
3459 source files for various programming languages,
3460 so the dependencies do not need to be specified explicitly.
3461 By default, SCons can
3462 C source files,
3463 C++ source files,
3464 Fortran source files with
3465 .B .F
3466 (POSIX systems only),
3467 .B .fpp,
3468 or
3469 .B .FPP
3470 file extensions,
3471 and assembly language files with
3472 .B .S
3473 (POSIX systems only),
3474 .B .spp,
3475 or
3476 .B .SPP
3477 files extensions
3478 for C preprocessor dependencies.
3479 SCons also has default support
3480 for scanning D source files,
3481 You can also write your own Scanners
3482 to add support for additional source file types.
3483 These can be added to the default
3484 Scanner object used by the
3485 .BR Object (),
3486 .BR StaticObject (),
3487 and
3488 .BR SharedObject ()
3489 Builders by adding them
3490 to the
3491 .B SourceFileScanner
3492 object.
3493 See the section "Scanner Objects,"
3494 below, for more information about
3495 defining your own Scanner objects
3496 and using the
3497 .B SourceFileScanner
3498 object.
3499
3500 .SS Methods and Functions to Do Things
3501 In addition to Builder methods,
3502 .B scons
3503 provides a number of other construction environment methods
3504 and global functions to
3505 manipulate the build configuration.
3506
3507 Usually, a construction environment method
3508 and global function with the same name both exist
3509 so that you don't have to remember whether
3510 to a specific bit of functionality
3511 must be called with or without a construction environment.
3512 In the following list,
3513 if you call something as a global function
3514 it looks like:
3515 .ES
3516 .RI Function( arguments )
3517 .EE
3518 and if you call something through a construction
3519 environment it looks like:
3520 .ES
3521 .RI env.Function( arguments )
3522 .EE
3523 If you can call the functionality in both ways,
3524 then both forms are listed.
3525
3526 Global functions may be called from custom Python modules that you
3527 import into an SConscript file by adding the following
3528 to the Python module:
3529
3530 .ES
3531 from SCons.Script import *
3532 .EE
3533
3534 Except where otherwise noted,
3535 the same-named
3536 construction environment method
3537 and global function
3538 provide the exact same functionality.
3539 The only difference is that,
3540 where appropriate,
3541 calling the functionality through a construction environment will
3542 substitute construction variables into
3543 any supplied strings.
3544 For example:
3545
3546 .ES
3547 env = Environment(FOO = 'foo')
3548 Default('$FOO')
3549 env.Default('$FOO')
3550 .EE
3551
3552 In the above example,
3553 the first call to the global
3554 .B Default()
3555 function will actually add a target named
3556 .B $FOO
3557 to the list of default targets,
3558 while the second call to the
3559 .B env.Default()
3560 construction environment method
3561 will expand the value
3562 and add a target named
3563 .B foo
3564 to the list of default targets.
3565 For more on construction variable expansion,
3566 see the next section on
3567 construction variables.
3568
3569 Construction environment methods
3570 and global functions supported by
3571 .B scons
3572 include:
3573
3574 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3575 .TP
3576 .RI Action( action ", [" cmd/str/fun ", [" var ", ...]] [" option = value ", ... ])"
3577 .TP
3578 .IR env .Action( action ", [" cmd/str/fun ", [" var ", ...]] [" option = value " , ...])"
3579 Creates an Action object for
3580 the specified
3581 .IR action .
3582 See the section "Action Objects,"
3583 below, for a complete explanation of the arguments and behavior.
3584
3585 Note that the
3586 .BR env.Action ()
3587 form of the invocation will expand
3588 construction variables in any argument strings,
3589 including the
3590 .I action
3591 argument, at the time it is called
3592 using the construction variables in the
3593 .I env
3594 construction environment through which
3595 .BR env.Action ()
3596 was called.
3597 The
3598 .BR Action ()
3599 form delays all variable expansion
3600 until the Action object is actually used.
3601
3602 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3603 .TP
3604 .RI AddMethod( object, function ", [" name ])
3605 .TP
3606 .RI env.AddMethod( function ", [" name ])
3607 When called with the
3608 .BR AddMethod ()
3609 form,
3610 adds the specified
3611 .I function
3612 to the specified
3613 .I object
3614 as the specified method
3615 .IR name .
3616 When called with the
3617 .BR env.AddMethod ()
3618 form,
3619 adds the specified
3620 .I function
3621 to the construction environment
3622 .I env
3623 as the specified method
3624 .IR name .
3625 In both cases, if
3626 .I name
3627 is omitted or
3628 .BR None ,
3629 the name of the
3630 specified
3631 .I function
3632 itself is used for the method name.
3633
3634 Examples:
3635
3636 .ES
3637 # Note that the first argument to the function to
3638 # be attached as a method must be the object through
3639 # which the method will be called; the Python
3640 # convention is to call it 'self'.
3641 def my_method(self, arg):
3642 print "my_method() got", arg
3643
3644 # Use the global AddMethod() function to add a method
3645 # to the Environment class. This
3646 AddMethod(Environment, my_method)
3647 env = Environment()
3648 env.my_method('arg')
3649
3650 # Add the function as a method, using the function
3651 # name for the method call.
3652 env = Environment()
3653 env.AddMethod(my_method, 'other_method_name')
3654 env.other_method_name('another arg')
3655 .EE
3656
3657 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3658 .TP
3659 .RI AddOption( arguments )
3660 This function adds a new command-line option to be recognized.
3661 The specified
3662 .I arguments
3663 are the same as supported by the standard Python
3664 .BR optparse.add_option ()
3665 method (with a few additional capabilities noted below);
3666 see the documentation for
3667 .B optparse
3668 for a thorough discussion of its option-processing capabities.
3669
3670 In addition to the arguments and values supported by the
3671 .B optparse.add_option ()
3672 method,
3673 the SCons
3674 .BR AddOption ()
3675 function allows you to set the
3676 .B nargs
3677 keyword value to
3678 .B '?'
3679 (a string with just the question mark)
3680 to indicate that the specified long option(s) take(s) an
3681 .I optional
3682 argument.
3683 When
3684 .B "nargs = '?'"
3685 is passed to the
3686 .BR AddOption ()
3687 function, the
3688 .B const
3689 keyword argument
3690 may be used to supply the "default"
3691 value that should be used when the
3692 option is specified on the command line
3693 without an explicit argument.
3694
3695 If no
3696 .B default=
3697 keyword argument is supplied when calling
3698 .BR AddOption (),
3699 the option will have a default value of
3700 .BR None .
3701
3702 Once a new command-line option has been added with
3703 .BR AddOption (),
3704 the option value may be accessed using
3705 .BR GetOption ()
3706 or
3707 .BR env.GetOption ().
3708 \" NOTE: in SCons 1.x or 2.0, user options will be settable, but not yet.
3709 \" Uncomment this when that works. See tigris issue 2105.
3710 \" The value may also be set, using
3711 \" .BR SetOption ()
3712 \" or
3713 \" .BR env.SetOption (),
3714 \" if conditions in a
3715 \" .B SConscript
3716 \" require overriding any default value.
3717 \" Note, however, that a
3718 \" value specified on the command line will
3719 \" .I always
3720 \" override a value set by any SConscript file.
3721
3722 Any specified
3723 .B help=
3724 strings for the new option(s)
3725 will be displayed by the
3726 .B -H
3727 or
3728 .B -h
3729 options
3730 (the latter only if no other help text is
3731 specified in the SConscript files).
3732 The help text for the local options specified by
3733 .BR AddOption ()
3734 will appear below the SCons options themselves,
3735 under a separate
3736 .B "Local Options"
3737 heading.
3738 The options will appear in the help text
3739 in the order in which the
3740 .BR AddOption ()
3741 calls occur.
3742
3743 Example:
3744
3745 .ES
3746 AddOption('--prefix',
3747 dest='prefix',
3748 nargs=1, type='string',
3749 action='store',
3750 metavar='DIR',
3751 help='installation prefix')
3752 env = Environment(PREFIX = GetOption('prefix'))
3753 .EE
3754
3755 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3756 .TP
3757 .RI AddPostAction( target ", " action )
3758 .TP
3759 .RI env.AddPostAction( target ", " action )
3760 Arranges for the specified
3761 .I action
3762 to be performed
3763 after the specified
3764 .I target
3765 has been built.
3766 The specified action(s) may be
3767 an Action object, or anything that
3768 can be converted into an Action object
3769 (see below).
3770
3771 When multiple targets are supplied,
3772 the action may be called multiple times,
3773 once after each action that generates
3774 one or more targets in the list.
3775
3776 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3777 .TP
3778 .RI AddPreAction( target ", " action )
3779 .TP
3780 .RI env.AddPreAction( target ", " action )
3781 Arranges for the specified
3782 .I action
3783 to be performed
3784 before the specified
3785 .I target
3786 is built.
3787 The specified action(s) may be
3788 an Action object, or anything that
3789 can be converted into an Action object
3790 (see below).
3791
3792 When multiple targets are specified,
3793 the action(s) may be called multiple times,
3794 once before each action that generates
3795 one or more targets in the list.
3796
3797 Note that if any of the targets are built in multiple steps,
3798 the action will be invoked just
3799 before the "final" action that specifically
3800 generates the specified target(s).
3801 For example, when building an executable program
3802 from a specified source
3803 .B .c
3804 file via an intermediate object file:
3805
3806 .ES
3807 foo = Program('foo.c')
3808 AddPreAction(foo, 'pre_action')
3809 .EE
3810
3811 The specified
3812 .B pre_action
3813 would be executed before
3814 .B scons
3815 calls the link command that actually
3816 generates the executable program binary
3817 .BR foo ,
3818 not before compiling the
3819 .B foo.c
3820 file into an object file.
3821
3822 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3823 .TP
3824 .RI Alias( alias ", [" targets ", [" action ]])
3825 .TP
3826 .RI env.Alias( alias ", [" targets ", [" action ]])
3827 Creates one or more phony targets that
3828 expand to one or more other targets.
3829 An optional
3830 .I action
3831 (command)
3832 or list of actions
3833 can be specified that will be executed
3834 whenever the any of the alias targets are out-of-date.
3835 Returns the Node object representing the alias,
3836 which exists outside of any file system.
3837 This Node object, or the alias name,
3838 may be used as a dependency of any other target,
3839 including another alias.
3840 .B Alias
3841 can be called multiple times for the same
3842 alias to add additional targets to the alias,
3843 or additional actions to the list for this alias.
3844
3845 Examples:
3846
3847 .ES
3848 Alias('install')
3849 Alias('install', '/usr/bin')
3850 Alias(['install', 'install-lib'], '/usr/local/lib')
3851
3852 env.Alias('install', ['/usr/local/bin', '/usr/local/lib'])
3853 env.Alias('install', ['/usr/local/man'])
3854
3855 env.Alias('update', ['file1', 'file2'], "update_database $SOURCES")
3856 .EE
3857
3858 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3859 .TP
3860 .RI AllowSubstExceptions([ exception ", ...])"
3861 Specifies the exceptions that will be allowed
3862 when expanding construction variables.
3863 By default,
3864 any construction variable expansions that generate a
3865 .B NameError
3866 or
3867 .BR IndexError
3868 exception will expand to a
3869 .B ''
3870 (a null string) and not cause scons to fail.
3871 All exceptions not in the specified list
3872 will generate an error message
3873 and terminate processing.
3874
3875 If
3876 .B AllowSubstExceptions
3877 is called multiple times,
3878 each call completely overwrites the previous list
3879 of allowed exceptions.
3880
3881 Example:
3882
3883 .ES
3884 # Requires that all construction variable names exist.
3885 # (You may wish to do this if you want to enforce strictly
3886 # that all construction variables must be defined before use.)
3887 AllowSubstExceptions()
3888
3889 # Also allow a string containing a zero-division expansion
3890 # like '${1 / 0}' to evalute to ''.
3891 AllowSubstExceptions(IndexError, NameError, ZeroDivisionError)
3892 .EE
3893
3894 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3895 .TP
3896 .RI AlwaysBuild( target ", ...)"
3897 .TP
3898 .RI env.AlwaysBuild( target ", ...)"
3899 Marks each given
3900 .I target
3901 so that it is always assumed to be out of date,
3902 and will always be rebuilt if needed.
3903 Note, however, that
3904 .BR AlwaysBuild ()
3905 does not add its target(s) to the default target list,
3906 so the targets will only be built
3907 if they are specified on the command line,
3908 or are a dependent of a target specified on the command line--but
3909 they will
3910 .I always
3911 be built if so specified.
3912 Multiple targets can be passed in to a single call to
3913 .BR AlwaysBuild ().
3914
3915 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3916 .TP
3917 .RI env.Append( key = val ", [...])"
3918 Appends the specified keyword arguments
3919 to the end of construction variables in the environment.
3920 If the Environment does not have
3921 the specified construction variable,
3922 it is simply added to the environment.
3923 If the values of the construction variable
3924 and the keyword argument are the same type,
3925 then the two values will be simply added together.
3926 Otherwise, the construction variable
3927 and the value of the keyword argument
3928 are both coerced to lists,
3929 and the lists are added together.
3930 (See also the Prepend method, below.)
3931
3932 Example:
3933
3934 .ES
3935 env.Append(CCFLAGS = ' -g', FOO = ['foo.yyy'])
3936 .EE
3937
3938 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3939 .TP
3940 .RI env.AppendENVPath( name ", " newpath ", [" envname ", " sep ", " delete_exis ting ])
3941 This appends new path elements to the given path in the
3942 specified external environment
3943 .RB ( ENV
3944 by default).
3945 This will only add
3946 any particular path once (leaving the last one it encounters and
3947 ignoring the rest, to preserve path order),
3948 and to help assure this,
3949 will normalize all paths (using
3950 .B os.path.normpath
3951 and
3952 .BR os.path.normcase ).
3953 This can also handle the
3954 case where the given old path variable is a list instead of a
3955 string, in which case a list will be returned instead of a string.
3956
3957 If
3958 .I delete_existing
3959 is 0, then adding a path that already exists
3960 will not move it to the end; it will stay where it is in the list.
3961
3962 Example:
3963
3964 .ES
3965 print 'before:',env['ENV']['INCLUDE']
3966 include_path = '/foo/bar:/foo'
3967 env.AppendENVPath('INCLUDE', include_path)
3968 print 'after:',env['ENV']['INCLUDE']
3969
3970 yields:
3971 before: /foo:/biz
3972 after: /biz:/foo/bar:/foo
3973 .EE
3974
3975 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3976 .TP
3977 .RI env.AppendUnique( key = val ", [...], delete_existing=0)"
3978 Appends the specified keyword arguments
3979 to the end of construction variables in the environment.
3980 If the Environment does not have
3981 the specified construction variable,
3982 it is simply added to the environment.
3983 If the construction variable being appended to is a list,
3984 then any value(s) that already exist in the
3985 construction variable will
3986 .I not
3987 be added again to the list.
3988 However, if delete_existing is 1,
3989 existing matching values are removed first, so
3990 existing values in the arg list move to the end of the list.
3991
3992 Example:
3993
3994 .ES
3995 env.AppendUnique(CCFLAGS = '-g', FOO = ['foo.yyy'])
3996 .EE
3997
3998 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3999 .TP
4000 env.BitKeeper()
4001 A factory function that
4002 returns a Builder object
4003 to be used to fetch source files
4004 using BitKeeper.
4005 The returned Builder
4006 is intended to be passed to the
4007 .B SourceCode
4008 function.
4009
4010 This function is deprecated. For details, see the entry for the
4011 .B SourceCode
4012 function.
4013
4014 Example:
4015
4016 .ES
4017 env.SourceCode('.', env.BitKeeper())
4018 .EE
4019
4020 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4021 .TP
4022 .RI BuildDir( build_dir ", " src_dir ", [" duplicate ])
4023 .TP
4024 .RI env.BuildDir( build_dir ", " src_dir ", [" duplicate ])
4025 Deprecated synonyms for
4026 .BR VariantDir ()
4027 and
4028 .BR env.VariantDir ().
4029 The
4030 .I build_dir
4031 argument becomes the
4032 .I variant_dir
4033 argument of
4034 .BR VariantDir ()
4035 or
4036 .BR env.VariantDir ().
4037
4038 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4039 .TP
4040 .RI Builder( action ", [" arguments ])
4041 .TP
4042 .RI env.Builder( action ", [" arguments ])
4043 Creates a Builder object for
4044 the specified
4045 .IR action .
4046 See the section "Builder Objects,"
4047 below, for a complete explanation of the arguments and behavior.
4048
4049 Note that the
4050 .BR env.Builder ()
4051 form of the invocation will expand
4052 construction variables in any arguments strings,
4053 including the
4054 .I action
4055 argument,
4056 at the time it is called
4057 using the construction variables in the
4058 .B env
4059 construction environment through which
4060 .BR env.Builder ()
4061 was called.
4062 The
4063 .BR Builder ()
4064 form delays all variable expansion
4065 until after the Builder object is actually called.
4066
4067 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4068 .TP
4069 .RI CacheDir( cache_dir )
4070 .TP
4071 .RI env.CacheDir( cache_dir )
4072 Specifies that
4073 .B scons
4074 will maintain a cache of derived files in
4075 .I cache_dir .
4076 The derived files in the cache will be shared
4077 among all the builds using the same
4078 .BR CacheDir ()
4079 call.
4080 Specifying a
4081 .I cache_dir
4082 of
4083 .B None
4084 disables derived file caching.
4085
4086 Calling
4087 .BR env.CacheDir ()
4088 will only affect targets built
4089 through the specified construction environment.
4090 Calling
4091 .BR CacheDir ()
4092 sets a global default
4093 that will be used by all targets built
4094 through construction environments
4095 that do
4096 .I not
4097 have an
4098 .BR env.CacheDir ()
4099 specified.
4100
4101 When a
4102 .BR CacheDir ()
4103 is being used and
4104 .B scons
4105 finds a derived file that needs to be rebuilt,
4106 it will first look in the cache to see if a
4107 derived file has already been built
4108 from identical input files and an identical build action
4109 (as incorporated into the MD5 build signature).
4110 If so,
4111 .B scons
4112 will retrieve the file from the cache.
4113 If the derived file is not present in the cache,
4114 .B scons
4115 will rebuild it and
4116 then place a copy of the built file in the cache
4117 (identified by its MD5 build signature),
4118 so that it may be retrieved by other
4119 builds that need to build the same derived file
4120 from identical inputs.
4121
4122 Use of a specified
4123 .BR CacheDir()
4124 may be disabled for any invocation
4125 by using the
4126 .B --cache-disable
4127 option.
4128
4129 If the
4130 .B --cache-force
4131 option is used,
4132 .B scons
4133 will place a copy of
4134 .I all
4135 derived files in the cache,
4136 even if they already existed
4137 and were not built by this invocation.
4138 This is useful to populate a cache
4139 the first time
4140 .BR CacheDir ()
4141 is added to a build,
4142 or after using the
4143 .B --cache-disable
4144 option.
4145
4146 When using
4147 .BR CacheDir (),
4148 .B scons
4149 will report,
4150 "Retrieved `file' from cache,"
4151 unless the
4152 .B --cache-show
4153 option is being used.
4154 When the
4155 .B --cache-show
4156 option is used,
4157 .B scons
4158 will print the action that
4159 .I would
4160 have been used to build the file,
4161 without any indication that
4162 the file was actually retrieved from the cache.
4163 This is useful to generate build logs
4164 that are equivalent regardless of whether
4165 a given derived file has been built in-place
4166 or retrieved from the cache.
4167
4168 The
4169 .BR NoCache ()
4170 method can be used to disable caching of specific files. This can be
4171 useful if inputs and/or outputs of some tool are impossible to
4172 predict or prohibitively large.
4173
4174 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4175 .TP
4176 .RI Clean( targets ", " files_or_dirs )
4177 .TP
4178 .RI env.Clean( targets ", " files_or_dirs )
4179 This specifies a list of files or directories which should be removed
4180 whenever the targets are specified with the
4181 .B -c
4182 command line option.
4183 The specified targets may be a list
4184 or an individual target.
4185 Multiple calls to
4186 .BR Clean ()
4187 are legal,
4188 and create new targets or add files and directories to the
4189 clean list for the specified targets.
4190
4191 Multiple files or directories should be specified
4192 either as separate arguments to the
4193 .BR Clean ()
4194 method, or as a list.
4195 .BR Clean ()
4196 will also accept the return value of any of the construction environment
4197 Builder methods.
4198 Examples:
4199
4200 The related
4201 .BR NoClean ()
4202 function overrides calling
4203 .BR Clean ()
4204 for the same target,
4205 and any targets passed to both functions will
4206 .I not
4207 be removed by the
4208 .B -c
4209 option.
4210
4211 Examples:
4212
4213 .ES
4214 Clean('foo', ['bar', 'baz'])
4215 Clean('dist', env.Program('hello', 'hello.c'))
4216 Clean(['foo', 'bar'], 'something_else_to_clean')
4217 .EE
4218
4219 In this example,
4220 installing the project creates a subdirectory for the documentation.
4221 This statement causes the subdirectory to be removed
4222 if the project is deinstalled.
4223 .ES
4224 Clean(docdir, os.path.join(docdir, projectname))
4225 .EE
4226
4227 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4228 .TP
4229 .RI Command( target ", " source ", " action ", [" key = val ", ...])"
4230 .TP
4231 .RI env.Command( target ", " source ", " action ", [" key = val ", ...])"
4232 Executes a specific action
4233 (or list of actions)
4234 to build a target file or files.
4235 This is more convenient
4236 than defining a separate Builder object
4237 for a single special-case build.
4238
4239 As a special case, the
4240 .B source_scanner
4241 keyword argument can
4242 be used to specify
4243 a Scanner object
4244 that will be used to scan the sources.
4245 (The global
4246 .B DirScanner
4247 object can be used
4248 if any of the sources will be directories
4249 that must be scanned on-disk for
4250 changes to files that aren't
4251 already specified in other Builder of function calls.)
4252
4253 Any other keyword arguments specified override any
4254 same-named existing construction variables.
4255
4256 An action can be an external command,
4257 specified as a string,
4258 or a callable Python object;
4259 see "Action Objects," below,
4260 for more complete information.
4261 Also note that a string specifying an external command
4262 may be preceded by an
4263 .B @
4264 (at-sign)
4265 to suppress printing the command in question,
4266 or by a
4267 .B \-
4268 (hyphen)
4269 to ignore the exit status of the external command.
4270
4271 Examples:
4272
4273 .ES
4274 env.Command('foo.out', 'foo.in',
4275 "$FOO_BUILD < $SOURCES > $TARGET")
4276
4277 env.Command('bar.out', 'bar.in',
4278 ["rm -f $TARGET",
4279 "$BAR_BUILD < $SOURCES > $TARGET"],
4280 ENV = {'PATH' : '/usr/local/bin/'})
4281
4282 def rename(env, target, source):
4283 import os
4284 os.rename('.tmp', str(target[0]))
4285
4286 env.Command('baz.out', 'baz.in',
4287 ["$BAZ_BUILD < $SOURCES > .tmp",
4288 rename ])
4289 .EE
4290
4291 .IP
4292 Note that the
4293 .BR Command ()
4294 function will usually assume, by default,
4295 that the specified targets and/or sources are Files,
4296 if no other part of the configuration
4297 identifies what type of entry it is.
4298 If necessary, you can explicitly specify
4299 that targets or source nodes should
4300 be treated as directoriese
4301 by using the
4302 .BR Dir ()
4303 or
4304 .BR env.Dir ()
4305 functions.
4306
4307 Examples:
4308
4309 .ES
4310 env.Command('ddd.list', Dir('ddd'), 'ls -l $SOURCE > $TARGET')
4311
4312 env['DISTDIR'] = 'destination/directory'
4313 env.Command(env.Dir('$DISTDIR')), None, make_distdir)
4314 .EE
4315
4316 .IP
4317 (Also note that SCons will usually
4318 automatically create any directory necessary to hold a target file,
4319 so you normally don't need to create directories by hand.)
4320
4321 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4322 .TP
4323 .RI Configure( env ", [" custom_tests ", " conf_dir ", " log_file ", " config_h ])
4324 .TP
4325 .RI env.Configure([ custom_tests ", " conf_dir ", " log_file ", " config_h ])
4326 Creates a Configure object for integrated
4327 functionality similar to GNU autoconf.
4328 See the section "Configure Contexts,"
4329 below, for a complete explanation of the arguments and behavior.
4330
4331 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4332 .TP
4333 .RI env.Clone([ key = val ", ...])"
4334 Return a separate copy of a construction environment.
4335 If there are any keyword arguments specified,
4336 they are added to the returned copy,
4337 overwriting any existing values
4338 for the keywords.
4339
4340 Example:
4341
4342 .ES
4343 env2 = env.Clone()
4344 env3 = env.Clone(CCFLAGS = '-g')
4345 .EE
4346 .IP
4347 Additionally, a list of tools and a toolpath may be specified, as in
4348 the Environment constructor:
4349
4350 .ES
4351 def MyTool(env): env['FOO'] = 'bar'
4352 env4 = env.Clone(tools = ['msvc', MyTool])
4353 .EE
4354
4355 The
4356 .I parse_flags
4357 keyword argument is also recognized:
4358
4359 .ES
4360 # create an environment for compiling programs that use wxWidgets
4361 wx_env = env.Clone(parse_flags = '!wx-config --cflags --cxxflags')
4362 .EE
4363
4364 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4365 .TP
4366 .RI env.Copy([ key = val ", ...])"
4367 A now-deprecated synonym for
4368 .BR env.Clone() .
4369
4370 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4371 .TP
4372 .RI env.CVS( repository ", " module )
4373 A factory function that
4374 returns a Builder object
4375 to be used to fetch source files
4376 from the specified
4377 CVS
4378 .IR repository .
4379 The returned Builder
4380 is intended to be passed to the
4381 .B SourceCode
4382 function.
4383
4384 The optional specified
4385 .I module
4386 will be added to the beginning
4387 of all repository path names;
4388 this can be used, in essence,
4389 to strip initial directory names
4390 from the repository path names,
4391 so that you only have to
4392 replicate part of the repository
4393 directory hierarchy in your
4394 local build directory.
4395
4396 This function is deprecated. For details, see the entry for the
4397 .B SourceCode
4398 function.
4399
4400 Examples:
4401
4402 .ES
4403 # Will fetch foo/bar/src.c
4404 # from /usr/local/CVSROOT/foo/bar/src.c.
4405 env.SourceCode('.', env.CVS('/usr/local/CVSROOT'))
4406
4407 # Will fetch bar/src.c
4408 # from /usr/local/CVSROOT/foo/bar/src.c.
4409 env.SourceCode('.', env.CVS('/usr/local/CVSROOT', 'foo'))
4410
4411 # Will fetch src.c
4412 # from /usr/local/CVSROOT/foo/bar/src.c.
4413 env.SourceCode('.', env.CVS('/usr/local/CVSROOT', 'foo/bar'))
4414 .EE
4415
4416 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4417 .TP
4418 .RI Decider( function )
4419 .TP
4420 .RI env.Decider( function )
4421 Specifies that all up-to-date decisions for
4422 targets built through this construction environment
4423 will be handled by the specified
4424 .IR function .
4425 The
4426 .I function
4427 can be one of the following strings
4428 that specify the type of decision function
4429 to be performed:
4430
4431 .RS 10
4432 .HP 6
4433 .B timestamp-newer
4434 Specifies that a target shall be considered out of date and rebuilt
4435 if the dependency's timestamp is newer than the target file's timestamp.
4436 This is the behavior of the classic Make utility,
4437 and
4438 .B make
4439 can be used a synonym for
4440 .BR timestamp-newer .
4441
4442 .HP 6
4443 .B timestamp-match
4444 Specifies that a target shall be considered out of date and rebuilt
4445 if the dependency's timestamp is different than the
4446 timestamp recorded the last time the target was built.
4447 This provides behavior very similar to the classic Make utility
4448 (in particular, files are not opened up so that their
4449 contents can be checksummed)
4450 except that the target will also be rebuilt if a
4451 dependency file has been restored to a version with an
4452 .I earlier
4453 timestamp, such as can happen when restoring files from backup archives.
4454
4455 .HP 6
4456 .B MD5
4457 Specifies that a target shall be considered out of date and rebuilt
4458 if the dependency's content has changed sine the last time
4459 the target was built,
4460 as determined be performing an MD5 checksum
4461 on the dependency's contents
4462 and comparing it to the checksum recorded the
4463 last time the target was built.
4464 .B content
4465 can be used as a synonym for
4466 .BR MD5 .
4467
4468 .HP 6
4469 .B MD5-timestamp
4470 Specifies that a target shall be considered out of date and rebuilt
4471 if the dependency's content has changed sine the last time
4472 the target was built,
4473 except that dependencies with a timestamp that matches
4474 the last time the target was rebuilt will be
4475 assumed to be up-to-date and
4476 .I not
4477 rebuilt.
4478 This provides behavior very similar
4479 to the
4480 .B MD5
4481 behavior of always checksumming file contents,
4482 with an optimization of not checking
4483 the contents of files whose timestamps haven't changed.
4484 The drawback is that SCons will
4485 .I not
4486 detect if a file's content has changed
4487 but its timestamp is the same,
4488 as might happen in an automated script
4489 that runs a build,
4490 updates a file,
4491 and runs the build again,
4492 all within a single second.
4493 .RE
4494
4495 .IP
4496 Examples:
4497
4498 .ES
4499 # Use exact timestamp matches by default.
4500 Decider('timestamp-match')
4501
4502 # Use MD5 content signatures for any targets built
4503 # with the attached construction environment.
4504 env.Decider('content')
4505 .EE
4506
4507 .IP
4508 In addition to the above already-available functions,
4509 the
4510 .I function
4511 argument may be an actual Python function
4512 that takes the following three arguments:
4513
4514 .RS 10
4515 .IP dependency
4516 The Node (file) which
4517 should cause the
4518 .I target
4519 to be rebuilt
4520 if it has "changed" since the last tme
4521 .I target was built.
4522
4523 .IP target
4524 The Node (file) being built.
4525 In the normal case,
4526 this is what should get rebuilt
4527 if the
4528 .I dependency
4529 has "changed."
4530
4531 .IP prev_ni
4532 Stored information about the state of the
4533 .I dependency
4534 the last time the
4535 .I target
4536 was built.
4537 This can be consulted to match various
4538 file characteristics
4539 such as the timestamp,
4540 size, or content signature.
4541 .RE
4542
4543 .IP
4544 The
4545 .I function
4546 should return a
4547 .B True
4548 (non-zero)
4549 value if the
4550 .I dependency
4551 has "changed" since the last time
4552 the
4553 .I target
4554 was built
4555 (indicating that the target
4556 .I should
4557 be rebuilt),
4558 and
4559 .B False
4560 (zero)
4561 otherwise
4562 (indicating that the target should
4563 .I not
4564 be rebuilt).
4565 Note that the decision can be made
4566 using whatever criteria are appopriate.
4567 Ignoring some or all of the function arguments
4568 is perfectly normal.
4569
4570 Example:
4571
4572 .ES
4573 def my_decider(dependency, target, prev_ni):
4574 return not os.path.exists(str(target))
4575
4576 env.Decider(my_decider)
4577 .EE
4578
4579 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4580 .TP
4581 .RI Default( targets )
4582 .TP
4583 .RI env.Default( targets )
4584 This specifies a list of default targets,
4585 which will be built by
4586 .B scons
4587 if no explicit targets are given on the command line.
4588 Multiple calls to
4589 .BR Default ()
4590 are legal,
4591 and add to the list of default targets.
4592
4593 Multiple targets should be specified as
4594 separate arguments to the
4595 .BR Default ()
4596 method, or as a list.
4597 .BR Default ()
4598 will also accept the Node returned by any
4599 of a construction environment's
4600 builder methods.
4601
4602 Examples:
4603
4604 .ES
4605 Default('foo', 'bar', 'baz')
4606 env.Default(['a', 'b', 'c'])
4607 hello = env.Program('hello', 'hello.c')
4608 env.Default(hello)
4609 .EE
4610 .IP
4611 An argument to
4612 .BR Default ()
4613 of
4614 .B None
4615 will clear all default targets.
4616 Later calls to
4617 .BR Default ()
4618 will add to the (now empty) default-target list
4619 like normal.
4620
4621 The current list of targets added using the
4622 .BR Default ()
4623 function or method is available in the
4624 .B DEFAULT_TARGETS
4625 list;
4626 see below.
4627
4628 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4629 .TP
4630 .RI DefaultEnvironment([ args ])
4631 Creates and returns a default construction environment object.
4632 This construction environment is used internally by SCons
4633 in order to execute many of the global functions in this list,
4634 and to fetch source files transparently
4635 from source code management systems.
4636
4637 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4638 .TP
4639 .RI Depends( target ", " dependency )
4640 .TP
4641 .RI env.Depends( target ", " dependency )
4642 Specifies an explicit dependency;
4643 the
4644 .I target
4645 will be rebuilt
4646 whenever the
4647 .I dependency
4648 has changed.
4649 Both the specified
4650 .I target
4651 and
4652 .I dependency
4653 can be a string
4654 (usually the path name of a file or directory)
4655 or Node objects,
4656 or a list of strings or Node objects
4657 (such as returned by a Builder call).
4658 This should only be necessary
4659 for cases where the dependency
4660 is not caught by a Scanner
4661 for the file.
4662
4663 Example:
4664
4665 .ES
4666 env.Depends('foo', 'other-input-file-for-foo')
4667
4668 mylib = env.Library('mylib.c')
4669 installed_lib = env.Install('lib', mylib)
4670 bar = env.Program('bar.c')
4671
4672 # Arrange for the library to be copied into the installation
4673 # directory before trying to build the "bar" program.
4674 # (Note that this is for example only. A "real" library
4675 # dependency would normally be configured through the $LIBS
4676 # and $LIBPATH variables, not using an env.Depends() call.)
4677
4678 env.Depends(bar, installed_lib)
4679 .EE
4680
4681 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4682 .TP
4683 .RI env.Dictionary([ vars ])
4684 Returns a dictionary object
4685 containing copies of all of the
4686 construction variables in the environment.
4687 If there are any variable names specified,
4688 only the specified construction
4689 variables are returned in the dictionary.
4690
4691 Example:
4692
4693 .ES
4694 dict = env.Dictionary()
4695 cc_dict = env.Dictionary('CC', 'CCFLAGS', 'CCCOM')
4696 .EE
4697
4698 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4699 .TP
4700 .RI Dir( name ", [" directory ])
4701 .TP
4702 .RI env.Dir( name ", [" directory ])
4703 This returns a Directory Node,
4704 an object that represents the specified directory
4705 .IR name .
4706 .I name
4707 can be a relative or absolute path.
4708 .I directory
4709 is an optional directory that will be used as the parent directory.
4710 If no
4711 .I directory
4712 is specified, the current script's directory is used as the parent.
4713
4714 If
4715 .I name
4716 is a list, SCons returns a list of Dir nodes.
4717 Construction variables are expanded in
4718 .IR name .
4719
4720 Directory Nodes can be used anywhere you
4721 would supply a string as a directory name
4722 to a Builder method or function.
4723 Directory Nodes have attributes and methods
4724 that are useful in many situations;
4725 see "File and Directory Nodes," below.
4726
4727 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4728 .TP
4729 .RI env.Dump([ key ])
4730 Returns a pretty printable representation of the environment.
4731 .IR key ,
4732 if not
4733 .IR None ,
4734 should be a string containing the name of the variable of interest.
4735
4736 This SConstruct:
4737 .ES
4738 env=Environment()
4739 print env.Dump('CCCOM')
4740 .EE
4741 .IP
4742 will print:
4743 .ES
4744 \&'$CC -c -o $TARGET $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $SOURCES'
4745 .EE
4746
4747 .ES
4748 env=Environment()
4749 print env.Dump()
4750 .EE
4751 .IP
4752 will print:
4753 .ES
4754 { 'AR': 'ar',
4755 'ARCOM': '$AR $ARFLAGS $TARGET $SOURCES\n$RANLIB $RANLIBFLAGS $TARGET',
4756 'ARFLAGS': ['r'],
4757 'AS': 'as',
4758 'ASCOM': '$AS $ASFLAGS -o $TARGET $SOURCES',
4759 'ASFLAGS': [],
4760 ...
4761 .EE
4762
4763 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4764 .TP
4765 .RI EnsurePythonVersion( major ", " minor )
4766 .TP
4767 .RI env.EnsurePythonVersion( major ", " minor )
4768 Ensure that the Python version is at least
4769 .IR major . minor .
4770 This function will
4771 print out an error message and exit SCons with a non-zero exit code if the
4772 actual Python version is not late enough.
4773
4774 Example:
4775
4776 .ES
4777 EnsurePythonVersion(2,2)
4778 .EE
4779
4780 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4781 .TP
4782 .RI EnsureSConsVersion( major ", " minor ", [" revision ])
4783 .TP
4784 .RI env.EnsureSConsVersion( major ", " minor ", [" revision ])
4785 Ensure that the SCons version is at least
4786 .IR major.minor ,
4787 or
4788 .IR major.minor.revision .
4789 if
4790 .I revision
4791 is specified.
4792 This function will
4793 print out an error message and exit SCons with a non-zero exit code if the
4794 actual SCons version is not late enough.
4795
4796 Examples:
4797
4798 .ES
4799 EnsureSConsVersion(0,14)
4800
4801 EnsureSConsVersion(0,96,90)
4802 .EE
4803
4804 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4805 .TP
4806 .RI Environment([ key = value ", ...])"
4807 .TP
4808 .RI env.Environment([ key = value ", ...])"
4809 Return a new construction environment
4810 initialized with the specified
4811 .IR key = value
4812 pairs.
4813
4814 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4815 .TP
4816 .RI Execute( action ", [" strfunction ", " varlist ])
4817 .TP
4818 .RI env.Execute( action ", [" strfunction ", " varlist ])
4819 Executes an Action object.
4820 The specified
4821 .IR action
4822 may be an Action object
4823 (see the section "Action Objects,"
4824 below, for a complete explanation of the arguments and behavior),
4825 or it may be a command-line string,
4826 list of commands,
4827 or executable Python function,
4828 each of which will be converted
4829 into an Action object
4830 and then executed.
4831 The exit value of the command
4832 or return value of the Python function
4833 will be returned.
4834
4835 Note that
4836 .B scons
4837 will print an error message if the executed
4838 .I action
4839 fails--that is,
4840 exits with or returns a non-zero value.
4841 .B scons
4842 will
4843 .I not ,
4844 however,
4845 automatically terminate the build
4846 if the specified
4847 .I action
4848 fails.
4849 If you want the build to stop in response to a failed
4850 .BR Execute ()
4851 call,
4852 you must explicitly check for a non-zero return value:
4853
4854 .ES
4855 Execute(Copy('file.out', 'file.in'))
4856
4857 if Execute("mkdir sub/dir/ectory"):
4858 # The mkdir failed, don't try to build.
4859 Exit(1)
4860 .EE
4861
4862 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4863 .TP
4864 .RI Exit([ value ])
4865 .TP
4866 .RI env.Exit([ value ])
4867 This tells
4868 .B scons
4869 to exit immediately
4870 with the specified
4871 .IR value .
4872 A default exit value of
4873 .B 0
4874 (zero)
4875 is used if no value is specified.
4876
4877 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4878 .TP
4879 .RI Export( vars )
4880 .TP
4881 .RI env.Export( vars )
4882 This tells
4883 .B scons
4884 to export a list of variables from the current
4885 SConscript file to all other SConscript files.
4886 The exported variables are kept in a global collection,
4887 so subsequent calls to
4888 .BR Export ()
4889 will over-write previous exports that have the same name.
4890 Multiple variable names can be passed to
4891 .BR Export ()
4892 as separate arguments or as a list.
4893 Keyword arguments can be used to provide names and their values.
4894 A dictionary can be used to map variables to a different name when exported.
4895 Both local variables and global variables can be exported.
4896
4897 Examples:
4898
4899 .ES
4900 env = Environment()
4901 # Make env available for all SConscript files to Import().
4902 Export("env")
4903
4904 package = 'my_name'
4905 # Make env and package available for all SConscript files:.
4906 Export("env", "package")
4907
4908 # Make env and package available for all SConscript files:
4909 Export(["env", "package"])
4910
4911 # Make env available using the name debug:
4912 Export(debug = env)
4913
4914 # Make env available using the name debug:
4915 Export({"debug":env})
4916 .EE
4917
4918 .IP
4919 Note that the
4920 .BR SConscript ()
4921 function supports an
4922 .I exports
4923 argument that makes it easier to to export a variable or
4924 set of variables to a single SConscript file.
4925 See the description of the
4926 .BR SConscript ()
4927 function, below.
4928
4929 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4930 .TP
4931 .RI File( name ", [" directory ])
4932 .TP
4933 .RI env.File( name ", [" directory ])
4934 This returns a
4935 File Node,
4936 an object that represents the specified file
4937 .IR name .
4938 .I name
4939 can be a relative or absolute path.
4940 .I directory
4941 is an optional directory that will be used as the parent directory.
4942
4943 If
4944 .I name
4945 is a list, SCons returns a list of File nodes.
4946 Construction variables are expanded in
4947 .IR name .
4948
4949 File Nodes can be used anywhere you
4950 would supply a string as a file name
4951 to a Builder method or function.
4952 File Nodes have attributes and methods
4953 that are useful in many situations;
4954 see "File and Directory Nodes," below.
4955
4956 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4957 .TP
4958 .RI FindFile( file ", " dirs )
4959 .TP
4960 .RI env.FindFile( file ", " dirs )
4961 Search for
4962 .I file
4963 in the path specified by
4964 .IR dirs .
4965 .I dirs
4966 may be a list of directory names or a single directory name.
4967 In addition to searching for files that exist in the filesystem,
4968 this function also searches for derived files
4969 that have not yet been built.
4970
4971 Example:
4972
4973 .ES
4974 foo = env.FindFile('foo', ['dir1', 'dir2'])
4975 .EE
4976
4977 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4978 .TP
4979 .RI FindInstalledFiles( )
4980 .TP
4981 .RI env.FindInstalledFiles( )
4982 Returns the list of targets set up by the
4983 .B Install()
4984 or
4985 .B InstallAs()
4986 builders.
4987
4988 This function serves as a convenient method to select the contents of
4989 a binary package.
4990
4991 Example:
4992
4993 .ES
4994 Install( '/bin', [ 'executable_a', 'executable_b' ] )
4995
4996 # will return the file node list
4997 # [ '/bin/executable_a', '/bin/executable_b' ]
4998 FindInstalledFiles()
4999
5000 Install( '/lib', [ 'some_library' ] )
5001
5002 # will return the file node list
5003 # [ '/bin/executable_a', '/bin/executable_b', '/lib/some_library' ]
5004 FindInstalledFiles()
5005 .EE
5006
5007 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5008 .TP
5009 .RI FindSourceFiles( node = '"."' )
5010 .TP
5011 .RI env.FindSourceFiles( node = '"."' )
5012
5013 Returns the list of nodes which serve as the source of the built files.
5014 It does so by inspecting the dependency tree starting at the optional
5015 argument
5016 .B node
5017 which defaults to the '"."'-node. It will then return all leaves of
5018 .B node.
5019 These are all children which have no further children.
5020
5021 This function is a convenient method to select the contents of a Source
5022 Package.
5023
5024 Example:
5025
5026 .ES
5027 Program( 'src/main_a.c' )
5028 Program( 'src/main_b.c' )
5029 Program( 'main_c.c' )
5030
5031 # returns ['main_c.c', 'src/main_a.c', 'SConstruct', 'src/main_b.c']
5032 FindSourceFiles()
5033
5034 # returns ['src/main_b.c', 'src/main_a.c' ]
5035 FindSourceFiles( 'src' )
5036 .EE
5037
5038 .IP
5039 As you can see build support files (SConstruct in the above example)
5040 will also be returned by this function.
5041
5042 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5043 .TP
5044 .RI FindPathDirs( variable )
5045 Returns a function
5046 (actually a callable Python object)
5047 intended to be used as the
5048 .B path_function
5049 of a Scanner object.
5050 The returned object will look up the specified
5051 .I variable
5052 in a construction environment
5053 and treat the construction variable's value as a list of
5054 directory paths that should be searched
5055 (like
5056 .BR CPPPATH ,
5057 .BR LIBPATH ,
5058 etc.).
5059
5060 Note that use of
5061 .BR FindPathDirs ()
5062 is generally preferable to
5063 writing your own
5064 .B path_function
5065 for the following reasons:
5066 1) The returned list will contain all appropriate directories
5067 found in source trees
5068 (when
5069 .BR VariantDir ()
5070 is used)
5071 or in code repositories
5072 (when
5073 .BR Repository ()
5074 or the
5075 .B \-Y
5076 option are used).
5077 2) scons will identify expansions of
5078 .I variable
5079 that evaluate to the same list of directories as,
5080 in fact, the same list,
5081 and avoid re-scanning the directories for files,
5082 when possible.
5083
5084 Example:
5085
5086 .ES
5087 def my_scan(node, env, path, arg):
5088 # Code to scan file contents goes here...
5089 return include_files
5090
5091 scanner = Scanner(name = 'myscanner',
5092 function = my_scan,
5093 path_function = FindPathDirs('MYPATH'))
5094 .EE
5095
5096 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5097 .TP
5098 .RI Flatten( sequence )
5099 .TP
5100 .RI env.Flatten( sequence )
5101 Takes a sequence (that is, a Python list or tuple)
5102 that may contain nested sequences
5103 and returns a flattened list containing
5104 all of the individual elements in any sequence.
5105 This can be helpful for collecting
5106 the lists returned by calls to Builders;
5107 other Builders will automatically
5108 flatten lists specified as input,
5109 but direct Python manipulation of
5110 these lists does not.
5111
5112 Examples:
5113
5114 .ES
5115 foo = Object('foo.c')
5116 bar = Object('bar.c')
5117
5118 # Because `foo' and `bar' are lists returned by the Object() Builder,
5119 # `objects' will be a list containing nested lists:
5120 objects = ['f1.o', foo, 'f2.o', bar, 'f3.o']
5121
5122 # Passing such a list to another Builder is all right because
5123 # the Builder will flatten the list automatically:
5124 Program(source = objects)
5125
5126 # If you need to manipulate the list directly using Python, you need to
5127 # call Flatten() yourself, or otherwise handle nested lists:
5128 for object in Flatten(objects):
5129 print str(object)
5130 .EE
5131
5132 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5133 .TP
5134 .RI GetBuildFailures()
5135 Returns a list of exceptions for the
5136 actions that failed while
5137 attempting to build targets.
5138 Each element in the returned list is a
5139 .B BuildError
5140 object
5141 with the following attributes
5142 that record various aspects
5143 of the build failure:
5144
5145 .B .node
5146 The node that was being built
5147 when the build failure occurred.
5148
5149 .B .status
5150 The numeric exit status
5151 returned by the command or Python function
5152 that failed when trying to build the
5153 specified Node.
5154
5155 .B .errstr
5156 The SCons error string
5157 describing the build failure.
5158 (This is often a generic
5159 message like "Error 2"
5160 to indicate that an executed
5161 command exited with a status of 2.)
5162
5163 .B .filename
5164 The name of the file or
5165 directory that actually caused the failure.
5166 This may be different from the
5167 .B .node
5168 attribute.
5169 For example,
5170 if an attempt to build a target named
5171 .B sub/dir/target
5172 fails because the
5173 .B sub/dir
5174 directory could not be created,
5175 then the
5176 .B .node
5177 attribute will be
5178 .B sub/dir/target
5179 but the
5180 .B .filename
5181 attribute will be
5182 .BR sub/dir .
5183
5184 .B .executor
5185 The SCons Executor object
5186 for the target Node
5187 being built.
5188 This can be used to retrieve
5189 the construction environment used
5190 for the failed action.
5191
5192 .B .action
5193 The actual SCons Action object that failed.
5194 This will be one specific action
5195 out of the possible list of
5196 actions that would have been
5197 executed to build the target.
5198
5199 .B .command
5200 The actual expanded command that was executed and failed,
5201 after expansion of
5202 .BR $TARGET ,
5203 .BR $SOURCE ,
5204 and other construction variables.
5205
5206 Note that the
5207 .BR GetBuildFailures ()
5208 function
5209 will always return an empty list
5210 until any build failure has occurred,
5211 which means that
5212 .BR GetBuildFailures ()
5213 will always return an empty list
5214 while the
5215 .B SConscript
5216 files are being read.
5217 Its primary intended use is
5218 for functions that will be
5219 executed before SCons exits
5220 by passing them to the
5221 standard Python
5222 .BR atexit.register ()
5223 function.
5224 Example:
5225
5226 .ES
5227 import atexit
5228
5229 def print_build_failures():
5230 from SCons.Script import GetBuildFailures
5231 for bf in GetBuildFailures():
5232 print "%s failed: %s" % (bf.node, bf.errstr)
5233
5234 atexit.register(print_build_failures)
5235 .EE
5236
5237 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5238 .TP
5239 .RI GetBuildPath( file ", [" ... ])
5240 .TP
5241 .RI env.GetBuildPath( file ", [" ... ])
5242 Returns the
5243 .B scons
5244 path name (or names) for the specified
5245 .I file
5246 (or files).
5247 The specified
5248 .I file
5249 or files
5250 may be
5251 .B scons
5252 Nodes or strings representing path names.
5253
5254 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5255 .TP
5256 .RI GetLaunchDir()
5257 .TP
5258 .RI env.GetLaunchDir()
5259 Returns the absolute path name of the directory from which
5260 .B scons
5261 was initially invoked.
5262 This can be useful when using the
5263 .BR \-u ,
5264 .BR \-U
5265 or
5266 .BR \-D
5267 options, which internally
5268 change to the directory in which the
5269 .B SConstruct
5270 file is found.
5271
5272 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5273 .TP
5274 .RI GetOption( name )
5275 .TP
5276 .RI env.GetOption( name )
5277 This function provides a way to query the value of
5278 SCons options set on scons command line
5279 (or set using the
5280 .IR SetOption ()
5281 function).
5282 The options supported are:
5283
5284 .RS 10
5285 .TP 6
5286 .B cache_debug
5287 which corresponds to --cache-debug;
5288 .TP 6
5289 .B cache_disable
5290 which corresponds to --cache-disable;
5291 .TP 6
5292 .B cache_force
5293 which corresponds to --cache-force;
5294 .TP 6
5295 .B cache_show
5296 which corresponds to --cache-show;
5297 .TP 6
5298 .B clean
5299 which corresponds to -c, --clean and --remove;
5300 .TP 6
5301 .B config
5302 which corresponds to --config;
5303 .TP 6
5304 .B directory
5305 which corresponds to -C and --directory;
5306 .TP 6
5307 .B diskcheck
5308 which corresponds to --diskcheck
5309 .TP 6
5310 .B duplicate
5311 which corresponds to --duplicate;
5312 .TP 6
5313 .B file
5314 which corresponds to -f, --file, --makefile and --sconstruct;
5315 .TP 6
5316 .B help
5317 which corresponds to -h and --help;
5318 .TP 6
5319 .B ignore_errors
5320 which corresponds to --ignore-errors;
5321 .TP 6
5322 .B implicit_cache
5323 which corresponds to --implicit-cache;
5324 .TP 6
5325 .B implicit_deps_changed
5326 which corresponds to --implicit-deps-changed;
5327 .TP 6
5328 .B implicit_deps_unchanged
5329 which corresponds to --implicit-deps-unchanged;
5330 .TP 6
5331 .B interactive
5332 which corresponds to --interact and --interactive;
5333 .TP 6
5334 .B keep_going
5335 which corresponds to -k and --keep-going;
5336 .TP 6
5337 .B max_drift
5338 which corresponds to --max-drift;
5339 .TP 6
5340 .B no_exec
5341 which corresponds to -n, --no-exec, --just-print, --dry-run and --recon;
5342 .TP 6
5343 .B no_site_dir
5344 which corresponds to --no-site-dir;
5345 .TP 6
5346 .B num_jobs
5347 which corresponds to -j and --jobs;
5348 .TP 6
5349 .B profile_file
5350 which corresponds to --profile;
5351 .TP 6
5352 .B question
5353 which corresponds to -q and --question;
5354 .TP 6
5355 .B random
5356 which corresponds to --random;
5357 .TP 6
5358 .B repository
5359 which corresponds to -Y, --repository and --srcdir;
5360 .TP 6
5361 .B silent
5362 which corresponds to -s, --silent and --quiet;
5363 .TP 6
5364 .B site_dir
5365 which corresponds to --site-dir;
5366 .TP 6
5367 .B stack_size
5368 which corresponds to --stack-size;
5369 .TP 6
5370 .B taskmastertrace_file
5371 which corresponds to --taskmastertrace; and
5372 .TP 6
5373 .B warn
5374 which corresponds to --warn and --warning.
5375 .RE
5376
5377 .IP
5378 See the documentation for the
5379 corresponding command line object for information about each specific
5380 option.
5381
5382 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5383 .TP
5384 .RI Glob( pattern ", [" ondisk ", " source ", " strings ])
5385 .TP
5386 .RI env.Glob( pattern ", [" ondisk ", " source ", " strings ])
5387 Returns Nodes (or strings) that match the specified
5388 .IR pattern ,
5389 relative to the directory of the current
5390 .B SConscript
5391 file.
5392 The
5393 .BR env.Glob ()
5394 form performs string substition on
5395 .I pattern
5396 and returns whatever matches
5397 the resulting expanded pattern.
5398
5399 The specified
5400 .I pattern
5401 uses Unix shell style metacharacters for matching:
5402
5403 .ES
5404 * matches everything
5405 ? matches any single character
5406 [seq] matches any character in seq
5407 [!seq] matches any char not in seq
5408 .EE
5409
5410 .IP
5411 If the first character of a filename is a dot,
5412 it must be matched explicitly.
5413 Character matches do
5414 .I not
5415 span directory separators.
5416
5417 The
5418 .BR Glob ()
5419 knows about
5420 repositories
5421 (see the
5422 .BR Repository ()
5423 function)
5424 and source directories
5425 (see the
5426 .BR VariantDir ()
5427 function)
5428 and
5429 returns a Node (or string, if so configured)
5430 in the local (SConscript) directory
5431 if matching Node is found
5432 anywhere in a corresponding
5433 repository or source directory.
5434
5435 The
5436 .B ondisk
5437 argument may be set to
5438 .B False
5439 (or any other non-true value)
5440 to disable the search for matches on disk,
5441 thereby only returning matches among
5442 already-configured File or Dir Nodes.
5443 The default behavior is to
5444 return corresponding Nodes
5445 for any on-disk matches found.
5446
5447 The
5448 .B source
5449 argument may be set to
5450 .B True
5451 (or any equivalent value)
5452 to specify that,
5453 when the local directory is a
5454 .BR VariantDir (),
5455 the returned Nodes should be from the
5456 corresponding source directory,
5457 not the local directory.
5458
5459 The
5460 .B strings
5461 argument may be set to
5462 .B True
5463 (or any equivalent value)
5464 to have the
5465 .BR Glob ()
5466 function return strings, not Nodes,
5467 that represent the matched files or directories.
5468 The returned strings will be relative to
5469 the local (SConscript) directory.
5470 (Note that This may make it easier to perform
5471 arbitrary manipulation of file names,
5472 but if the returned strings are
5473 passed to a different
5474 .B SConscript
5475 file,
5476 any Node translation will be relative
5477 to the other
5478 .B SConscript
5479 directory,
5480 not the original
5481 .B SConscript
5482 directory.)
5483
5484 Examples:
5485
5486 .ES
5487 Program('foo', Glob('*.c'))
5488 Zip('/tmp/everything', Glob('.??*') + Glob('*'))
5489 .EE
5490
5491 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5492 '\".TP
5493 '\".RI GlobalBuilders( flag )
5494 '\"When
5495 '\".B flag
5496 '\"is non-zero,
5497 '\"adds the names of the default builders
5498 '\"(Program, Library, etc.)
5499 '\"to the global name space
5500 '\"so they can be called without an explicit construction environment.
5501 '\"(This is the default.)
5502 '\"When
5503 '\".B
5504 '\"flag is zero,
5505 '\"the names of the default builders are removed
5506 '\"from the global name space
5507 '\"so that an explicit construction environment is required
5508 '\"to call all builders.
5509
5510 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5511 .TP
5512 .RI Help( text )
5513 .TP
5514 .RI env.Help( text )
5515 This specifies help text to be printed if the
5516 .B -h
5517 argument is given to
5518 .BR scons .
5519 If
5520 .BR Help
5521 is called multiple times, the text is appended together in the order
5522 that
5523 .BR Help
5524 is called.
5525
5526 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5527 .TP
5528 .RI Ignore( target ", " dependency )
5529 .TP
5530 .RI env.Ignore( target ", " dependency )
5531 The specified dependency file(s)
5532 will be ignored when deciding if
5533 the target file(s) need to be rebuilt.
5534
5535 You can also use
5536 .BR Ignore()
5537 to remove a target from the default build.
5538 In order to do this you must specify the directory the target will
5539 be built in as the target, and the file you want to skip building
5540 as the dependency.
5541
5542 Note that this will only remove the dependencies listed from
5543 the files built by default. It will still be built if that
5544 dependency is needed by another object being built.
5545 See the third and forth examples below.
5546
5547 Examples:
5548
5549 .ES
5550 env.Ignore('foo', 'foo.c')
5551 env.Ignore('bar', ['bar1.h', 'bar2.h'])
5552 env.Ignore('.','foobar.obj')
5553 env.Ignore('bar','bar/foobar.obj')
5554 .EE
5555
5556 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5557 .TP
5558 .RI Import( vars )
5559 .TP
5560 .RI env.Import( vars )
5561 This tells
5562 .B scons
5563 to import a list of variables into the current SConscript file. This
5564 will import variables that were exported with
5565 .BR Export ()
5566 or in the
5567 .I exports
5568 argument to
5569 .BR SConscript ().
5570 Variables exported by
5571 .BR SConscript ()
5572 have precedence.
5573 Multiple variable names can be passed to
5574 .BR Import ()
5575 as separate arguments or as a list. The variable "*" can be used
5576 to import all variables.
5577
5578 Examples:
5579
5580 .ES
5581 Import("env")
5582 Import("env", "variable")
5583 Import(["env", "variable"])
5584 Import("*")
5585 .EE
5586
5587 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5588 .TP
5589 .RI Literal( string )
5590 .TP
5591 .RI env.Literal( string )
5592 The specified
5593 .I string
5594 will be preserved as-is
5595 and not have construction variables expanded.
5596
5597 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5598 .TP
5599 .RI Local( targets )
5600 .TP
5601 .RI env.Local( targets )
5602 The specified
5603 .I targets
5604 will have copies made in the local tree,
5605 even if an already up-to-date copy
5606 exists in a repository.
5607 Returns a list of the target Node or Nodes.
5608
5609 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5610 \" .TP
5611 \" .RI env.MergeShellPaths( arg ", [" prepend ])
5612 \" Merges the elements of the specified
5613 \" .IR arg ,
5614 \" which must be a dictionary, to the construction
5615 \" environment's copy of the shell environment
5616 \" in env['ENV'].
5617 \" (This is the environment which is passed
5618 \" to subshells spawned by SCons.)
5619 \" Note that
5620 \" .I arg
5621 \" must be a single value,
5622 \" so multiple strings must
5623 \" be passed in as a list,
5624 \" not as separate arguments to
5625 \" .BR env.MergeShellPaths ().
5626
5627 \" New values are prepended to the environment variable by default,
5628 \" unless prepend=0 is specified.
5629 \" Duplicate values are always eliminated,
5630 \" since this function calls
5631 \" .B AppendENVPath
5632 \" or
5633 \" .B PrependENVPath
5634 \" depending on the
5635 \" .I prepend
5636 \" argument. See those functions for more details.
5637
5638 \" Examples:
5639
5640 \" .ES
5641 \" # Prepend a path to the shell PATH.
5642 \" env.MergeShellPaths({'PATH':'/usr/local/bin'} )
5643 \" # Append two dirs to the shell INCLUDE.
5644 \" env.MergeShellPaths({'INCLUDE':['c:/inc1', 'c:/inc2']}, prepend=0 )
5645
5646 .EE
5647
5648 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5649 .TP
5650 .RI env.MergeFlags( arg ", [" unique ])
5651 Merges the specified
5652 .I arg
5653 values to the construction environment's construction variables.
5654 If the
5655 .I arg
5656 argument is not a dictionary,
5657 it is converted to one by calling
5658 .B env.ParseFlags()
5659 on the argument
5660 before the values are merged.
5661 Note that
5662 .I arg
5663 must be a single value,
5664 so multiple strings must
5665 be passed in as a list,
5666 not as separate arguments to
5667 .BR env.MergeFlags ().
5668
5669 By default,
5670 duplicate values are eliminated;
5671 you can, however, specify
5672 .B unique=0
5673 to allow duplicate
5674 values to be added.
5675 When eliminating duplicate values,
5676 any construction variables that end with
5677 the string
5678 .B PATH
5679 keep the left-most unique value.
5680 All other construction variables keep
5681 the right-most unique value.
5682
5683 Examples:
5684
5685 .ES
5686 # Add an optimization flag to $CCFLAGS.
5687 env.MergeFlags('-O3')
5688
5689 # Combine the flags returned from running pkg-config with an optimization
5690 # flag and merge the result into the construction variables.
5691 env.MergeFlags(['!pkg-config gtk+-2.0 --cflags', '-O3'])
5692
5693 # Combine an optimization flag with the flags returned from running pkg-config
5694 # twice and merge the result into the construction variables.
5695 env.MergeFlags(['-O3',
5696 '!pkg-config gtk+-2.0 --cflags --libs',
5697 '!pkg-config libpng12 --cflags --libs'])
5698 .EE
5699
5700 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5701 .TP
5702 .RI NoCache( target ", ...)"
5703 .TP
5704 .RI env.NoCache( target ", ...)"
5705 Specifies a list of files which should
5706 .I not
5707 be cached whenever the
5708 .BR CacheDir ()
5709 method has been activated.
5710 The specified targets may be a list
5711 or an individual target.
5712
5713 Multiple files should be specified
5714 either as separate arguments to the
5715 .BR NoCache ()
5716 method, or as a list.
5717 .BR NoCache ()
5718 will also accept the return value of any of the construction environment
5719 Builder methods.
5720
5721 Calling
5722 .BR NoCache ()
5723 on directories and other non-File Node types has no effect because
5724 only File Nodes are cached.
5725
5726 Examples:
5727
5728 .ES
5729 NoCache('foo.elf')
5730 NoCache(env.Program('hello', 'hello.c'))
5731 .EE
5732
5733 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5734 .TP
5735 .RI NoClean( target ", ...)"
5736 .TP
5737 .RI env.NoClean( target ", ...)"
5738 Specifies a list of files or directories which should
5739 .I not
5740 be removed whenever the targets (or their dependencies)
5741 are specified with the
5742 .B -c
5743 command line option.
5744 The specified targets may be a list
5745 or an individual target.
5746 Multiple calls to
5747 .BR NoClean ()
5748 are legal,
5749 and prevent each specified target
5750 from being removed by calls to the
5751 .B -c
5752 option.
5753
5754 Multiple files or directories should be specified
5755 either as separate arguments to the
5756 .BR NoClean ()
5757 method, or as a list.
5758 .BR NoClean ()
5759 will also accept the return value of any of the construction environment
5760 Builder methods.
5761
5762 Calling
5763 .BR NoClean ()
5764 for a target overrides calling
5765 .BR Clean ()
5766 for the same target,
5767 and any targets passed to both functions will
5768 .I not
5769 be removed by the
5770 .B -c
5771 option.
5772
5773 Examples:
5774
5775 .ES
5776 NoClean('foo.elf')
5777 NoClean(env.Program('hello', 'hello.c'))
5778 .EE
5779
5780 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5781 .TP
5782 .RI env.ParseConfig( command ", [" function ", " unique ])
5783 Calls the specified
5784 .I function
5785 to modify the environment as specified by the output of
5786 .I command .
5787 The default
5788 .I function
5789 is
5790 .BR env.MergeFlags (),
5791 which expects the output of a typical
5792 .I *-config command
5793 (for example,
5794 .BR gtk-config )
5795 and adds the options
5796 to the appropriate construction variables.
5797 By default,
5798 duplicate values are not
5799 added to any construction variables;
5800 you can specify
5801 .B unique=0
5802 to allow duplicate
5803 values to be added.
5804
5805 Interpreted options
5806 and the construction variables they affect
5807 are as specified for the
5808 .BR env.ParseFlags ()
5809 method (which this method calls).
5810 See that method's description, below,
5811 for a table of options and construction variables.
5812
5813 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5814 .TP
5815 .RI ParseDepends( filename ", [" must_exist ", " only_one ])
5816 .TP
5817 .RI env.ParseDepends( filename ", [" must_exist ", " only_one ])
5818 Parses the contents of the specified
5819 .I filename
5820 as a list of dependencies in the style of
5821 .BR Make
5822 or
5823 .BR mkdep ,
5824 and explicitly establishes all of the listed dependencies.
5825
5826 By default,
5827 it is not an error
5828 if the specified
5829 .I filename
5830 does not exist.
5831 The optional
5832 .I must_exist
5833 argument may be set to a non-zero
5834 value to have
5835 scons
5836 throw an exception and
5837 generate an error if the file does not exist,
5838 or is otherwise inaccessible.
5839
5840 The optional
5841 .I only_one
5842 argument may be set to a non-zero
5843 value to have
5844 scons
5845 thrown an exception and
5846 generate an error
5847 if the file contains dependency
5848 information for more than one target.
5849 This can provide a small sanity check
5850 for files intended to be generated
5851 by, for example, the
5852 .B gcc -M
5853 flag,
5854 which should typically only
5855 write dependency information for
5856 one output file into a corresponding
5857 .B .d
5858 file.
5859
5860 The
5861 .I filename
5862 and all of the files listed therein
5863 will be interpreted relative to
5864 the directory of the
5865 .I SConscript
5866 file which calls the
5867 .B ParseDepends
5868 function.
5869
5870 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5871 .TP
5872 .RI env.ParseFlags( flags ", ...)"
5873 Parses one or more strings containing
5874 typical command-line flags for GCC tool chains
5875 and returns a dictionary with the flag values
5876 separated into the appropriate SCons construction variables.
5877 This is intended as a companion to the
5878 .BR env.MergeFlags ()
5879 method, but allows for the values in the returned dictionary
5880 to be modified, if necessary,
5881 before merging them into the construction environment.
5882 (Note that
5883 .BR env.MergeFlags ()
5884 will call this method if its argument is not a dictionary,
5885 so it is usually not necessary to call
5886 .BR env.ParseFlags ()
5887 directly unless you want to manipulate the values.)
5888
5889 If the first character in any string is
5890 an exclamation mark (!),
5891 the rest of the string is executed as a command,
5892 and the output from the command is
5893 parsed as GCC tool chain command-line flags
5894 and added to the resulting dictionary.
5895
5896 Flag values are translated accordig to the prefix found,
5897 and added to the following construction variables:
5898
5899 .ES
5900 -arch CCFLAGS, LINKFLAGS
5901 -D CPPDEFINES
5902 -framework FRAMEWORKS
5903 -frameworkdir= FRAMEWORKPATH
5904 -include CCFLAGS
5905 -isysroot CCFLAGS, LINKFLAGS
5906 -I CPPPATH
5907 -l LIBS
5908 -L LIBPATH
5909 -mno-cygwin CCFLAGS, LINKFLAGS
5910 -mwindows LINKFLAGS
5911 -pthread CCFLAGS, LINKFLAGS
5912 -std= CFLAGS
5913 -Wa, ASFLAGS, CCFLAGS
5914 -Wl,-rpath= RPATH
5915 -Wl,-R, RPATH
5916 -Wl,-R RPATH
5917 -Wl, LINKFLAGS
5918 -Wp, CPPFLAGS
5919 - CCFLAGS
5920 + CCFLAGS, LINKFLAGS
5921 .EE
5922
5923 .IP
5924 Any other strings not associated with options
5925 are assumed to be the names of libraries
5926 and added to the
5927 .B LIBS
5928 construction variable.
5929
5930 Examples (all of which produce the same result):
5931
5932 .ES
5933 dict = env.ParseFlags('-O2 -Dfoo -Dbar=1')
5934 dict = env.ParseFlags('-O2', '-Dfoo', '-Dbar=1')
5935 dict = env.ParseFlags(['-O2', '-Dfoo -Dbar=1'])
5936 dict = env.ParseFlags('-O2', '!echo -Dfoo -Dbar=1')
5937 .EE
5938
5939 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5940 .TP
5941 env.Perforce()
5942 A factory function that
5943 returns a Builder object
5944 to be used to fetch source files
5945 from the Perforce source code management system.
5946 The returned Builder
5947 is intended to be passed to the
5948 .B SourceCode
5949 function.
5950
5951 This function is deprecated. For details, see the entry for the
5952 .B SourceCode
5953 function.
5954
5955 Example:
5956
5957 .ES
5958 env.SourceCode('.', env.Perforce())
5959 .EE
5960 .IP
5961 Perforce uses a number of external
5962 environment variables for its operation.
5963 Consequently, this function adds the
5964 following variables from the user's external environment
5965 to the construction environment's
5966 ENV dictionary:
5967 P4CHARSET,
5968 P4CLIENT,
5969 P4LANGUAGE,
5970 P4PASSWD,
5971 P4PORT,
5972 P4USER,
5973 SystemRoot,
5974 USER,
5975 and
5976 USERNAME.
5977
5978 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5979 .TP
5980 .RI Platform( string )
5981 Returns a callable object
5982 that can be used to initialize
5983 a construction environment using the
5984 platform keyword of the Environment() method.
5985
5986 Example:
5987
5988 .ES
5989 env = Environment(platform = Platform('win32'))
5990 .EE
5991 .TP
5992 .RI env.Platform( string )
5993 Applies the callable object for the specified platform
5994 .I string
5995 to the environment through which the method was called.
5996
5997 .ES
5998 env.Platform('posix')
5999 .EE
6000 .IP
6001 Note that the
6002 .B win32
6003 platform adds the
6004 .B SystemDrive
6005 and
6006 .B SystemRoot
6007 variables from the user's external environment
6008 to the construction environment's
6009 .B ENV
6010 dictionary.
6011 This is so that any executed commands
6012 that use sockets to connect with other systems
6013 (such as fetching source files from
6014 external CVS repository specifications like
6015 .BR :pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons )
6016 will work on Windows systems.
6017
6018 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6019 .TP
6020 .RI Progress( callable ", [" interval ])
6021 .TP
6022 .RI Progress( string ", [" interval ", " file ", " overwrite ])
6023 .TP
6024 .RI Progress( list_of_strings ", [" interval ", " file ", " overwrite ])
6025 Allows SCons to show progress made during the build
6026 by displaying a string or calling a function while
6027 evaluating Nodes (e.g. files).
6028
6029 If the first specified argument is a Python callable
6030 (a function or an object that has a
6031 .BR __call__ ()
6032 method),
6033 the function will be called
6034 once every
6035 .I interval
6036 times a Node is evaluated.
6037 The callable will be passed the evaluated Node
6038 as its only argument.
6039 (For future compatibility,
6040 it's a good idea to also add
6041 .B *args
6042 and
6043 .B **kw
6044 as arguments to your function or method.
6045 This will prevent the code from breaking
6046 if SCons ever changes the interface
6047 to call the function with additional arguments in the future.)
6048
6049 An example of a simple custom progress function
6050 that prints a string containing the Node name
6051 every 10 Nodes:
6052
6053 .ES
6054 def my_progress_function(node, *args, **kw):
6055 print 'Evaluating node %s!' % node
6056 Progress(my_progress_function, interval=10)
6057 .EE
6058 .IP
6059 A more complicated example of a custom progress display object
6060 that prints a string containing a count
6061 every 100 evaluated Nodes.
6062 Note the use of
6063 .B \\\\r
6064 (a carriage return)
6065 at the end so that the string
6066 will overwrite itself on a display:
6067
6068 .ES
6069 import sys
6070 class ProgressCounter(object):
6071 count = 0
6072 def __call__(self, node, *args, **kw):
6073 self.count += 100
6074 sys.stderr.write('Evaluated %s nodes\\r' % self.count)
6075 Progress(ProgressCounter(), interval=100)
6076 .EE
6077 .IP
6078 If the first argument
6079 .BR Progress ()
6080 is a string,
6081 the string will be displayed
6082 every
6083 .I interval
6084 evaluated Nodes.
6085 The default is to print the string on standard output;
6086 an alternate output stream
6087 may be specified with the
6088 .B file=
6089 argument.
6090 The following will print a series of dots
6091 on the error output,
6092 one dot for every 100 evaluated Nodes:
6093
6094 .ES
6095 import sys
6096 Progress('.', interval=100, file=sys.stderr)
6097 .EE
6098 .IP
6099 If the string contains the verbatim substring
6100 .B $TARGET,
6101 it will be replaced with the Node.
6102 Note that, for performance reasons, this is
6103 .I not
6104 a regular SCons variable substition,
6105 so you can not use other variables
6106 or use curly braces.
6107 The following example will print the name of
6108 every evaluated Node,
6109 using a
6110 .B \\\\r
6111 (carriage return) to cause each line to overwritten by the next line,
6112 and the
6113 .B overwrite=
6114 keyword argument to make sure the previously-printed
6115 file name is overwritten with blank spaces:
6116
6117 .ES
6118 import sys
6119 Progress('$TARGET\\r', overwrite=True)
6120 .EE
6121 .IP
6122 If the first argument to
6123 .BR Progress ()
6124 is a list of strings,
6125 then each string in the list will be displayed
6126 in rotating fashion every
6127 .I interval
6128 evaluated Nodes.
6129 This can be used to implement a "spinner"
6130 on the user's screen as follows:
6131
6132 .ES
6133 Progress(['-\\r', '\\\\\\r', '|\\r', '/\\r'], interval=5)
6134 .EE
6135
6136 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6137 .TP
6138 .RI Precious( target ", ...)"
6139 .TP
6140 .RI env.Precious( target ", ...)"
6141 Marks each given
6142 .I target
6143 as precious so it is not deleted before it is rebuilt. Normally
6144 .B scons
6145 deletes a target before building it.
6146 Multiple targets can be passed in to a single call to
6147 .BR Precious ().
6148
6149 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6150 .TP
6151 .RI env.Prepend( key = val ", [...])"
6152 Appends the specified keyword arguments
6153 to the beginning of construction variables in the environment.
6154 If the Environment does not have
6155 the specified construction variable,
6156 it is simply added to the environment.
6157 If the values of the construction variable
6158 and the keyword argument are the same type,
6159 then the two values will be simply added together.
6160 Otherwise, the construction variable
6161 and the value of the keyword argument
6162 are both coerced to lists,
6163 and the lists are added together.
6164 (See also the Append method, above.)
6165
6166 Example:
6167
6168 .ES
6169 env.Prepend(CCFLAGS = '-g ', FOO = ['foo.yyy'])
6170 .EE
6171
6172 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6173 .TP
6174 .RI env.PrependENVPath( name ", " newpath ", [" envname ", " sep ", " delete_exi sting ])
6175 This appends new path elements to the given path in the
6176 specified external environment
6177 .RB ( ENV
6178 by default).
6179 This will only add
6180 any particular path once (leaving the first one it encounters and
6181 ignoring the rest, to preserve path order),
6182 and to help assure this,
6183 will normalize all paths (using
6184 .B os.path.normpath
6185 and
6186 .BR os.path.normcase ).
6187 This can also handle the
6188 case where the given old path variable is a list instead of a
6189 string, in which case a list will be returned instead of a string.
6190
6191 If
6192 .I delete_existing
6193 is 0, then adding a path that already exists
6194 will not move it to the beginning;
6195 it will stay where it is in the list.
6196
6197 Example:
6198
6199 .ES
6200 print 'before:',env['ENV']['INCLUDE']
6201 include_path = '/foo/bar:/foo'
6202 env.PrependENVPath('INCLUDE', include_path)
6203 print 'after:',env['ENV']['INCLUDE']
6204 .EE
6205
6206 The above exmaple will print:
6207
6208 .ES
6209 before: /biz:/foo
6210 after: /foo/bar:/foo:/biz
6211 .EE
6212
6213 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6214 .TP
6215 .RI env.PrependUnique( key = val ", delete_existing=0, [...])"
6216 Appends the specified keyword arguments
6217 to the beginning of construction variables in the environment.
6218 If the Environment does not have
6219 the specified construction variable,
6220 it is simply added to the environment.
6221 If the construction variable being appended to is a list,
6222 then any value(s) that already exist in the
6223 construction variable will
6224 .I not
6225 be added again to the list.
6226 However, if delete_existing is 1,
6227 existing matching values are removed first, so
6228 existing values in the arg list move to the front of the list.
6229
6230 Example:
6231
6232 .ES
6233 env.PrependUnique(CCFLAGS = '-g', FOO = ['foo.yyy'])
6234 .EE
6235
6236 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6237 .TP
6238 env.RCS()
6239 A factory function that
6240 returns a Builder object
6241 to be used to fetch source files
6242 from RCS.
6243 The returned Builder
6244 is intended to be passed to the
6245 .B SourceCode
6246 function:
6247
6248 This function is deprecated. For details, see the entry for the
6249 .B SourceCode
6250 function.
6251
6252 Examples:
6253
6254 .ES
6255 env.SourceCode('.', env.RCS())
6256 .EE
6257 .IP
6258 Note that
6259 .B scons
6260 will fetch source files
6261 from RCS subdirectories automatically,
6262 so configuring RCS
6263 as demonstrated in the above example
6264 should only be necessary if
6265 you are fetching from
6266 RCS,v
6267 files in the same
6268 directory as the source files,
6269 or if you need to explicitly specify RCS
6270 for a specific subdirectory.
6271
6272 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6273 .TP
6274 .RI env.Replace( key = val ", [...])"
6275 Replaces construction variables in the Environment
6276 with the specified keyword arguments.
6277
6278 Example:
6279
6280 .ES
6281 env.Replace(CCFLAGS = '-g', FOO = 'foo.xxx')
6282 .EE
6283
6284 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6285 .TP
6286 .RI Repository( directory )
6287 .TP
6288 .RI env.Repository( directory )
6289 Specifies that
6290 .I directory
6291 is a repository to be searched for files.
6292 Multiple calls to
6293 .BR Repository ()
6294 are legal,
6295 and each one adds to the list of
6296 repositories that will be searched.
6297
6298 To
6299 .BR scons ,
6300 a repository is a copy of the source tree,
6301 from the top-level directory on down,
6302 which may contain
6303 both source files and derived files
6304 that can be used to build targets in
6305 the local source tree.
6306 The canonical example would be an
6307 official source tree maintained by an integrator.
6308 If the repository contains derived files,
6309 then the derived files should have been built using
6310 .BR scons ,
6311 so that the repository contains the necessary
6312 signature information to allow
6313 .B scons
6314 to figure out when it is appropriate to
6315 use the repository copy of a derived file,
6316 instead of building one locally.
6317
6318 Note that if an up-to-date derived file
6319 already exists in a repository,
6320 .B scons
6321 will
6322 .I not
6323 make a copy in the local directory tree.
6324 In order to guarantee that a local copy
6325 will be made,
6326 use the
6327 .B Local()
6328 method.
6329
6330 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6331 .TP
6332 .RI Requires( target ", " prerequisite )
6333 .TP
6334 .RI env.Requires( target ", " prerequisite )
6335 Specifies an order-only relationship
6336 between the specified target file(s)
6337 and the specified prerequisite file(s).
6338 The prerequisite file(s)
6339 will be (re)built, if necessary,
6340 .I before
6341 the target file(s),
6342 but the target file(s) do not actually
6343 depend on the prerequisites
6344 and will not be rebuilt simply because
6345 the prerequisite file(s) change.
6346
6347 Example:
6348
6349 .ES
6350 env.Requires('foo', 'file-that-must-be-built-before-foo')
6351 .EE
6352
6353 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6354 .TP
6355 .RI Return([ vars "... , " stop= ])
6356 By default,
6357 this stops processing the current SConscript
6358 file and returns to the calling SConscript file
6359 the values of the variables named in the
6360 .I vars
6361 string arguments.
6362 Multiple strings contaning variable names may be passed to
6363 .BR Return ().
6364 Any strings that contain white space
6365
6366 The optional
6367 .B stop=
6368 keyword argument may be set to a false value
6369 to continue processing the rest of the SConscript
6370 file after the
6371 .BR Return ()
6372 call.
6373 This was the default behavior prior to SCons 0.98.
6374 However, the values returned
6375 are still the values of the variables in the named
6376 .I vars
6377 at the point
6378 .BR Return ()
6379 is called.
6380
6381 Examples:
6382
6383 .ES
6384 # Returns without returning a value.
6385 Return()
6386
6387 # Returns the value of the 'foo' Python variable.
6388 Return("foo")
6389
6390 # Returns the values of the Python variables 'foo' and 'bar'.
6391 Return("foo", "bar")
6392
6393 # Returns the values of Python variables 'val1' and 'val2'.
6394 Return('val1 val2')
6395 .EE
6396
6397 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6398 .TP
6399 .RI Scanner( function ", [" argument ", " keys ", " path_function ", " node_clas s ", " node_factory ", " scan_check ", " recursive ])
6400 .TP
6401 .RI env.Scanner( function ", [" argument ", " keys ", " path_function ", " node_ class ", " node_factory ", " scan_check ", " recursive ])
6402 Creates a Scanner object for
6403 the specified
6404 .IR function .
6405 See the section "Scanner Objects,"
6406 below, for a complete explanation of the arguments and behavior.
6407
6408 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6409 .TP
6410 env.SCCS()
6411 A factory function that
6412 returns a Builder object
6413 to be used to fetch source files
6414 from SCCS.
6415 The returned Builder
6416 is intended to be passed to the
6417 .B SourceCode
6418 function.
6419
6420 This function is deprecated. For details, see the entry for the
6421 .B SourceCode
6422 function.
6423
6424 Example:
6425
6426 .ES
6427 env.SourceCode('.', env.SCCS())
6428 .EE
6429 .IP
6430 Note that
6431 .B scons
6432 will fetch source files
6433 from SCCS subdirectories automatically,
6434 so configuring SCCS
6435 as demonstrated in the above example
6436 should only be necessary if
6437 you are fetching from
6438 .I s.SCCS
6439 files in the same
6440 directory as the source files,
6441 or if you need to explicitly specify SCCS
6442 for a specific subdirectory.
6443
6444 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6445 .TP
6446 .RI SConscript( scripts ", [" exports ", " variant_dir ", " duplicate ])
6447 '\" .RI SConscript( scripts ", [" exports ", " variant_dir ", " src_dir ", " dup licate ])
6448 .TP
6449 .RI env.SConscript( scripts ", [" exports ", " variant_dir ", " duplicate ])
6450 '\" .RI env.SConscript( scripts ", [" exports ", " variant_dir ", " src_dir ", " duplicate ])
6451 .TP
6452 .RI SConscript(dirs= subdirs ", [name=" script ", " exports ", " variant_dir ", " duplicate ])
6453 '\" .RI SConscript(dirs= subdirs ", [name=" script ", " exports ", " variant_dir ", " src_dir ", " duplicate ])
6454 .TP
6455 .RI env.SConscript(dirs= subdirs ", [name=" script ", " exports ", " variant_dir ", " duplicate ])
6456 '\" .RI env.SConscript(dirs= subdirs ", [name=" script ", " exports ", " variant _dir ", " src_dir ", " duplicate ])
6457 This tells
6458 .B scons
6459 to execute
6460 one or more subsidiary SConscript (configuration) files.
6461 Any variables returned by a called script using
6462 .BR Return ()
6463 will be returned by the call to
6464 .BR SConscript ().
6465 There are two ways to call the
6466 .BR SConscript ()
6467 function.
6468
6469 The first way you can call
6470 .BR SConscript ()
6471 is to explicitly specify one or more
6472 .I scripts
6473 as the first argument.
6474 A single script may be specified as a string;
6475 multiple scripts must be specified as a list
6476 (either explicitly or as created by
6477 a function like
6478 .BR Split ()).
6479 Examples:
6480 .ES
6481 SConscript('SConscript') # run SConscript in the current directory
6482 SConscript('src/SConscript') # run SConscript in the src directory
6483 SConscript(['src/SConscript', 'doc/SConscript'])
6484 config = SConscript('MyConfig.py')
6485 .EE
6486
6487 The second way you can call
6488 .BR SConscript ()
6489 is to specify a list of (sub)directory names
6490 as a
6491 .RI dirs= subdirs
6492 keyword argument.
6493 In this case,
6494 .B scons
6495 will, by default,
6496 execute a subsidiary configuration file named
6497 .B SConscript
6498 in each of the specified directories.
6499 You may specify a name other than
6500 .B SConscript
6501 by supplying an optional
6502 .RI name= script
6503 keyword argument.
6504 The first three examples below have the same effect
6505 as the first three examples above:
6506 .ES
6507 SConscript(dirs='.') # run SConscript in the current directory
6508 SConscript(dirs='src') # run SConscript in the src directory
6509 SConscript(dirs=['src', 'doc'])
6510 SConscript(dirs=['sub1', 'sub2'], name='MySConscript')
6511 .EE
6512
6513 The optional
6514 .I exports
6515 argument provides a list of variable names or a dictionary of
6516 named values to export to the
6517 .IR script(s) .
6518 These variables are locally exported only to the specified
6519 .IR script(s) ,
6520 and do not affect the global pool of variables used by the
6521 .BR Export ()
6522 function.
6523 '\"If multiple dirs are provided, each script gets a fresh export.
6524 The subsidiary
6525 .I script(s)
6526 must use the
6527 .BR Import ()
6528 function to import the variables.
6529 Examples:
6530 .ES
6531 foo = SConscript('sub/SConscript', exports='env')
6532 SConscript('dir/SConscript', exports=['env', 'variable'])
6533 SConscript(dirs='subdir', exports='env variable')
6534 SConscript(dirs=['one', 'two', 'three'], exports='shared_info')
6535 .EE
6536
6537 If the optional
6538 .I variant_dir
6539 argument is present, it causes an effect equivalent to the
6540 .BR VariantDir ()
6541 method described below.
6542 (If
6543 .I variant_dir
6544 is not present, the
6545 '\" .IR src_dir and
6546 .I duplicate
6547 '\" arguments are ignored.)
6548 argument is ignored.)
6549 The
6550 .I variant_dir
6551 '\" and
6552 '\" .I src_dir
6553 '\" arguments are interpreted relative to the directory of the calling
6554 argument is interpreted relative to the directory of the calling
6555 .B SConscript
6556 file.
6557 See the description of the
6558 .BR VariantDir ()
6559 function below for additional details and restrictions.
6560
6561 If
6562 .I variant_dir
6563 is present,
6564 '\" but
6565 '\" .IR src_dir " is not,"
6566 the source directory is the directory in which the
6567 .B SConscript
6568 file resides and the
6569 .B SConscript
6570 file is evaluated as if it were in the
6571 .I variant_dir
6572 directory:
6573 .ES
6574 SConscript('src/SConscript', variant_dir = 'build')
6575 .EE
6576 is equivalent to
6577 .ES
6578 VariantDir('build', 'src')
6579 SConscript('build/SConscript')
6580 .EE
6581 This later paradigm is often used when the sources are
6582 in the same directory as the
6583 .BR SConstruct:
6584 .ES
6585 SConscript('SConscript', variant_dir = 'build')
6586 .EE
6587 is equivalent to
6588 .ES
6589 VariantDir('build', '.')
6590 SConscript('build/SConscript')
6591 .EE
6592
6593 '\" If
6594 '\" .IR variant_dir " and"
6595 '\" .IR src_dir " are both present,"
6596 '\" xxxxx everything is in a state of confusion.
6597 '\" .ES
6598 '\" SConscript(dirs = 'src', variant_dir = 'build', src_dir = '.')
6599 '\" runs src/SConscript in build/src, but
6600 '\" SConscript(dirs = 'lib', variant_dir = 'build', src_dir = 'src')
6601 '\" runs lib/SConscript (in lib!). However,
6602 '\" SConscript(dirs = 'src', variant_dir = 'build', src_dir = 'src')
6603 '\" runs src/SConscript in build. Moreover,
6604 '\" SConscript(dirs = 'src/lib', variant_dir = 'build', src_dir = 'src')
6605 '\" runs src/lib/SConscript in build/lib. Moreover,
6606 '\" SConscript(dirs = 'build/src/lib', variant_dir = 'build', src_dir = 'src')
6607 '\" can't find build/src/lib/SConscript, even though it ought to exist.
6608 '\" .EE
6609 '\" is equivalent to
6610 '\" .ES
6611 '\" ????????????????
6612 '\" .EE
6613 '\" and what about this alternative?
6614 '\"TODO??? SConscript('build/SConscript', src_dir='src')
6615
6616 Here are some composite examples:
6617
6618 .ES
6619 # collect the configuration information and use it to build src and doc
6620 shared_info = SConscript('MyConfig.py')
6621 SConscript('src/SConscript', exports='shared_info')
6622 SConscript('doc/SConscript', exports='shared_info')
6623 .EE
6624
6625 .ES
6626 # build debugging and production versions. SConscript
6627 # can use Dir('.').path to determine variant.
6628 SConscript('SConscript', variant_dir='debug', duplicate=0)
6629 SConscript('SConscript', variant_dir='prod', duplicate=0)
6630 .EE
6631
6632 .ES
6633 # build debugging and production versions. SConscript
6634 # is passed flags to use.
6635 opts = { 'CPPDEFINES' : ['DEBUG'], 'CCFLAGS' : '-pgdb' }
6636 SConscript('SConscript', variant_dir='debug', duplicate=0, exports=opts)
6637 opts = { 'CPPDEFINES' : ['NODEBUG'], 'CCFLAGS' : '-O' }
6638 SConscript('SConscript', variant_dir='prod', duplicate=0, exports=opts)
6639 .EE
6640
6641 .ES
6642 # build common documentation and compile for different architectures
6643 SConscript('doc/SConscript', variant_dir='build/doc', duplicate=0)
6644 SConscript('src/SConscript', variant_dir='build/x86', duplicate=0)
6645 SConscript('src/SConscript', variant_dir='build/ppc', duplicate=0)
6646 .EE
6647
6648 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6649 .TP
6650 .RI SConscriptChdir( value )
6651 .TP
6652 .RI env.SConscriptChdir( value )
6653 By default,
6654 .B scons
6655 changes its working directory
6656 to the directory in which each
6657 subsidiary SConscript file lives.
6658 This behavior may be disabled
6659 by specifying either:
6660
6661 .ES
6662 SConscriptChdir(0)
6663 env.SConscriptChdir(0)
6664 .EE
6665 .IP
6666 in which case
6667 .B scons
6668 will stay in the top-level directory
6669 while reading all SConscript files.
6670 (This may be necessary when building from repositories,
6671 when all the directories in which SConscript files may be found
6672 don't necessarily exist locally.)
6673 You may enable and disable
6674 this ability by calling
6675 SConscriptChdir()
6676 multiple times.
6677
6678 Example:
6679
6680 .ES
6681 env = Environment()
6682 SConscriptChdir(0)
6683 SConscript('foo/SConscript') # will not chdir to foo
6684 env.SConscriptChdir(1)
6685 SConscript('bar/SConscript') # will chdir to bar
6686 .EE
6687
6688 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6689 .TP
6690 .RI SConsignFile([ file , dbm_module ])
6691 .TP
6692 .RI env.SConsignFile([ file , dbm_module ])
6693 This tells
6694 .B scons
6695 to store all file signatures
6696 in the specified database
6697 .IR file .
6698 If the
6699 .I file
6700 name is omitted,
6701 .B .sconsign
6702 is used by default.
6703 (The actual file name(s) stored on disk
6704 may have an appropriated suffix appended
6705 by the
6706 .IR dbm_module .)
6707 If
6708 .I file
6709 is not an absolute path name,
6710 the file is placed in the same directory as the top-level
6711 .B SConstruct
6712 file.
6713
6714 If
6715 .I file
6716 is
6717 .BR None ,
6718 then
6719 .B scons
6720 will store file signatures
6721 in a separate
6722 .B .sconsign
6723 file in each directory,
6724 not in one global database file.
6725 (This was the default behavior
6726 prior to SCons 0.96.91 and 0.97.)
6727
6728 The optional
6729 .I dbm_module
6730 argument can be used to specify
6731 which Python database module
6732 The default is to use a custom
6733 .B SCons.dblite
6734 module that uses pickled
6735 Python data structures,
6736 and which works on all Python versions.
6737
6738 Examples:
6739
6740 .ES
6741 # Explicitly stores signatures in ".sconsign.dblite"
6742 # in the top-level SConstruct directory (the
6743 # default behavior).
6744 SConsignFile()
6745
6746 # Stores signatures in the file "etc/scons-signatures"
6747 # relative to the top-level SConstruct directory.
6748 SConsignFile("etc/scons-signatures")
6749
6750 # Stores signatures in the specified absolute file name.
6751 SConsignFile("/home/me/SCons/signatures")
6752
6753 # Stores signatures in a separate .sconsign file
6754 # in each directory.
6755 SConsignFile(None)
6756 .EE
6757
6758 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6759 .TP
6760 .RI env.SetDefault(key = val ", [...])"
6761 Sets construction variables to default values specified with the keyword
6762 arguments if (and only if) the variables are not already set.
6763 The following statements are equivalent:
6764
6765 .ES
6766 env.SetDefault(FOO = 'foo')
6767
6768 if 'FOO' not in env: env['FOO'] = 'foo'
6769 .EE
6770
6771 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6772 .TP
6773 .RI SetOption( name ", " value )
6774 .TP
6775 .RI env.SetOption( name ", " value )
6776 This function provides a way to set a select subset of the scons command
6777 line options from a SConscript file. The options supported are:
6778
6779 .RS 10
6780 .TP 6
6781 .B clean
6782 which corresponds to -c, --clean and --remove;
6783 .TP 6
6784 .B duplicate
6785 which corresponds to --duplicate;
6786 .TP 6
6787 .B help
6788 which corresponds to -h and --help;
6789 .TP 6
6790 .B implicit_cache
6791 which corresponds to --implicit-cache;
6792 .TP 6
6793 .B max_drift
6794 which corresponds to --max-drift;
6795 .TP 6
6796 .B no_exec
6797 which corresponds to -n, --no-exec, --just-print, --dry-run and --recon;
6798 .TP 6
6799 .B num_jobs
6800 which corresponds to -j and --jobs;
6801 .TP 6
6802 .B random
6803 which corresponds to --random; and
6804 .TP 6
6805 .B stack_size
6806 which corresponds to --stack-size.
6807 .RE
6808
6809 .IP
6810 See the documentation for the
6811 corresponding command line object for information about each specific
6812 option.
6813
6814 Example:
6815
6816 .ES
6817 SetOption('max_drift', 1)
6818 .EE
6819
6820 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6821 .TP
6822 .RI SideEffect( side_effect ", " target )
6823 .TP
6824 .RI env.SideEffect( side_effect ", " target )
6825 Declares
6826 .I side_effect
6827 as a side effect of building
6828 .IR target .
6829 Both
6830 .I side_effect
6831 and
6832 .I target
6833 can be a list, a file name, or a node.
6834 A side effect is a target file that is created or updated
6835 as a side effect of building other targets.
6836 For example, a Windows PDB
6837 file is created as a side effect of building the .obj
6838 files for a static library,
6839 and various log files are created updated
6840 as side effects of various TeX commands.
6841 If a target is a side effect of multiple build commands,
6842 .B scons
6843 will ensure that only one set of commands
6844 is executed at a time.
6845 Consequently, you only need to use this method
6846 for side-effect targets that are built as a result of
6847 multiple build commands.
6848
6849 Because multiple build commands may update
6850 the same side effect file,
6851 by default the
6852 .I side_effect
6853 target is
6854 .I not
6855 automatically removed
6856 when the
6857 .I target
6858 is removed by the
6859 .B -c
6860 option.
6861 (Note, however, that the
6862 .I side_effect
6863 might be removed as part of
6864 cleaning the directory in which it lives.)
6865 If you want to make sure the
6866 .I side_effect
6867 is cleaned whenever a specific
6868 .I target
6869 is cleaned,
6870 you must specify this explicitly
6871 with the
6872 .BR Clean ()
6873 or
6874 .BR env.Clean ()
6875 function.
6876
6877 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6878 .TP
6879 .RI SourceCode( entries ", " builder )
6880 .TP
6881 .RI env.SourceCode( entries ", " builder )
6882 This function and its associate factory functions are deprecated.
6883 There is no replacement.
6884 The intended use was to keep a local tree in sync with an archive,
6885 but in actuality the function only causes the archive
6886 to be fetched on the first run.
6887 Synchronizing with the archive is best done external to SCons.
6888
6889 Arrange for non-existent source files to
6890 be fetched from a source code management system
6891 using the specified
6892 .IR builder .
6893 The specified
6894 .I entries
6895 may be a Node, string or list of both,
6896 and may represent either individual
6897 source files or directories in which
6898 source files can be found.
6899
6900 For any non-existent source files,
6901 .B scons
6902 will search up the directory tree
6903 and use the first
6904 .B SourceCode
6905 builder it finds.
6906 The specified
6907 .I builder
6908 may be
6909 .BR None ,
6910 in which case
6911 .B scons
6912 will not use a builder to fetch
6913 source files for the specified
6914 .IR entries ,
6915 even if a
6916 .B SourceCode
6917 builder has been specified
6918 for a directory higher up the tree.
6919
6920 .B scons
6921 will, by default,
6922 fetch files from SCCS or RCS subdirectories
6923 without explicit configuration.
6924 This takes some extra processing time
6925 to search for the necessary
6926 source code management files on disk.
6927 You can avoid these extra searches
6928 and speed up your build a little
6929 by disabling these searches as follows:
6930
6931 .ES
6932 env.SourceCode('.', None)
6933 .EE
6934
6935 .IP
6936 Note that if the specified
6937 .I builder
6938 is one you create by hand,
6939 it must have an associated
6940 construction environment to use
6941 when fetching a source file.
6942
6943 .B scons
6944 provides a set of canned factory
6945 functions that return appropriate
6946 Builders for various popular
6947 source code management systems.
6948 Canonical examples of invocation include:
6949
6950 .ES
6951 env.SourceCode('.', env.BitKeeper('/usr/local/BKsources'))
6952 env.SourceCode('src', env.CVS('/usr/local/CVSROOT'))
6953 env.SourceCode('/', env.RCS())
6954 env.SourceCode(['f1.c', 'f2.c'], env.SCCS())
6955 env.SourceCode('no_source.c', None)
6956 .EE
6957 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion'))
6958
6959 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6960 .TP
6961 .RI env.subst( input ", [" raw ", " target ", " source ", " conv ])
6962 Performs construction variable interpolation
6963 on the specified string or sequence argument
6964 .IR input .
6965
6966 By default,
6967 leading or trailing white space will
6968 be removed from the result.
6969 and all sequences of white space
6970 will be compressed to a single space character.
6971 Additionally, any
6972 .B $(
6973 and
6974 .B $)
6975 character sequences will be stripped from the returned string,
6976 The optional
6977 .I raw
6978 argument may be set to
6979 .B 1
6980 if you want to preserve white space and
6981 .BR $( - $)
6982 sequences.
6983 The
6984 .I raw
6985 argument may be set to
6986 .B 2
6987 if you want to strip
6988 all characters between
6989 any
6990 .B $(
6991 and
6992 .B $)
6993 pairs
6994 (as is done for signature calculation).
6995
6996 If the input is a sequence
6997 (list or tuple),
6998 the individual elements of
6999 the sequence will be expanded,
7000 and the results will be returned as a list.
7001
7002 The optional
7003 .I target
7004 and
7005 .I source
7006 keyword arguments
7007 must be set to lists of
7008 target and source nodes, respectively,
7009 if you want the
7010 .BR $TARGET ,
7011 .BR $TARGETS ,
7012 .BR $SOURCE
7013 and
7014 .BR $SOURCES
7015 to be available for expansion.
7016 This is usually necessary if you are
7017 calling
7018 .BR env.subst ()
7019 from within a Python function used
7020 as an SCons action.
7021
7022 Returned string values or sequence elements
7023 are converted to their string representation by default.
7024 The optional
7025 .I conv
7026 argument
7027 may specify a conversion function
7028 that will be used in place of
7029 the default.
7030 For example, if you want Python objects
7031 (including SCons Nodes)
7032 to be returned as Python objects,
7033 you can use the Python
7034 .B lambda
7035 idiom to pass in an unnamed function
7036 that simply returns its unconverted argument.
7037
7038 Example:
7039
7040 .ES
7041 print env.subst("The C compiler is: $CC")
7042
7043 def compile(target, source, env):
7044 sourceDir = env.subst("${SOURCE.srcdir}",
7045 target=target,
7046 source=source)
7047
7048 source_nodes = env.subst('$EXPAND_TO_NODELIST',
7049 conv=lambda x: x)
7050 .EE
7051
7052 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7053 '\".TP
7054 '\".RI Subversion( repository ", " module )
7055 '\"A factory function that
7056 '\"returns a Builder object
7057 '\"to be used to fetch source files
7058 '\"from the specified Subversion
7059 '\".IR repository .
7060 '\"The returned Builder
7061 '\"is intended to be passed to the
7062 '\".B SourceCode
7063 '\"function.
7064 '\"
7065 '\"The optional specified
7066 '\".I module
7067 '\"will be added to the beginning
7068 '\"of all repository path names;
7069 '\"this can be used, in essence,
7070 '\"to strip initial directory names
7071 '\"from the repository path names,
7072 '\"so that you only have to
7073 '\"replicate part of the repository
7074 '\"directory hierarchy in your
7075 '\"local build directory.
7076 '\"
7077 '\"This function is deprecated. For details, see the entry for the
7078 '\".B SourceCode
7079 '\"function.
7080 '\"
7081 '\"Example:
7082 '\"
7083 '\".ES
7084 '\"# Will fetch foo/bar/src.c
7085 '\"# from /usr/local/Subversion/foo/bar/src.c.
7086 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion'))
7087 '\"
7088 '\"# Will fetch bar/src.c
7089 '\"# from /usr/local/Subversion/foo/bar/src.c.
7090 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion', 'foo'))
7091 '\"
7092 '\"# Will fetch src.c
7093 '\"# from /usr/local/Subversion/foo/bar/src.c.
7094 '\"env.SourceCode('.', env.Subversion('file:///usr/local/Subversion', 'foo/bar') )
7095 '\".EE
7096
7097 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7098 .TP
7099 .RI SourceSignatures( type )
7100 .TP
7101 .RI env.SourceSignatures( type )
7102 Note: Although it is not yet officially deprecated,
7103 use of this function is discouraged.
7104 See the
7105 .BR Decider ()
7106 function for a more flexible and straightforward way
7107 to configure SCons' decision-making.
7108
7109 The
7110 .BR SourceSignatures ()
7111 function tells
7112 .B scons
7113 how to decide if a source file
7114 (a file that is not built from any other files)
7115 has changed since the last time it
7116 was used to build a particular target file.
7117 Legal values are
7118 .B "MD5"
7119 or
7120 .BR "timestamp" .
7121
7122 If the environment method is used,
7123 the specified type of source signature
7124 is only used when deciding whether targets
7125 built with that environment are up-to-date or must be rebuilt.
7126 If the global function is used,
7127 the specified type of source signature becomes the default
7128 used for all decisions
7129 about whether targets are up-to-date.
7130
7131 .B "MD5"
7132 means
7133 .B scons
7134 decides that a source file has changed
7135 if the MD5 checksum of its contents has changed since
7136 the last time it was used to rebuild a particular target file.
7137
7138 .B "timestamp"
7139 means
7140 .B scons
7141 decides that a source file has changed
7142 if its timestamp (modification time) has changed since
7143 the last time it was used to rebuild a particular target file.
7144 (Note that although this is similar to the behavior of Make,
7145 by default it will also rebuild if the dependency is
7146 .I older
7147 than the last time it was used to rebuild the target file.)
7148
7149 There is no different between the two behaviors
7150 for Python
7151 .BR Value ()
7152 node objects.
7153
7154 .B "MD5"
7155 signatures take longer to compute,
7156 but are more accurate than
7157 .B "timestamp"
7158 signatures.
7159 The default value is
7160 .BR "MD5" .
7161
7162 Note that the default
7163 .BR TargetSignatures ()
7164 setting (see below)
7165 is to use this
7166 .BR SourceSignatures ()
7167 setting for any target files that are used
7168 to build other target files.
7169 Consequently, changing the value of
7170 .BR SourceSignatures ()
7171 will, by default,
7172 affect the up-to-date decision for all files in the build
7173 (or all files built with a specific construction environment
7174 when
7175 .BR env.SourceSignatures ()
7176 is used).
7177
7178 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7179 .TP
7180 .RI Split( arg )
7181 .TP
7182 .RI env.Split( arg )
7183 Returns a list of file names or other objects.
7184 If arg is a string,
7185 it will be split on strings of white-space characters
7186 within the string,
7187 making it easier to write long lists of file names.
7188 If arg is already a list,
7189 the list will be returned untouched.
7190 If arg is any other type of object,
7191 it will be returned as a list
7192 containing just the object.
7193
7194 Example:
7195
7196 .ES
7197 files = Split("f1.c f2.c f3.c")
7198 files = env.Split("f4.c f5.c f6.c")
7199 files = Split("""
7200 f7.c
7201 f8.c
7202 f9.c
7203 """)
7204 .EE
7205
7206 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7207 .TP
7208 .RI Tag( node ", " tags )
7209 Annotates file or directory Nodes with
7210 information about how the
7211 .BR Package ()
7212 Builder should package those files or directories.
7213 All tags are optional.
7214
7215 Examples:
7216
7217 .ES
7218 # makes sure the built library will be installed with 0644 file
7219 # access mode
7220 Tag( Library( 'lib.c' ), UNIX_ATTR="0644" )
7221
7222 # marks file2.txt to be a documentation file
7223 Tag( 'file2.txt', DOC )
7224 .EE
7225
7226 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7227 .TP
7228 .RI TargetSignatures( type )
7229 .TP
7230 .RI env.TargetSignatures( type )
7231 Note: Although it is not yet officially deprecated,
7232 use of this function is discouraged.
7233 See the
7234 .BR Decider ()
7235 function for a more flexible and straightforward way
7236 to configure SCons' decision-making.
7237
7238 The
7239 .BR TargetSignatures ()
7240 function tells
7241 .B scons
7242 how to decide if a target file
7243 (a file that
7244 .I is
7245 built from any other files)
7246 has changed since the last time it
7247 was used to build some other target file.
7248 Legal values are
7249 .BR "build" ;
7250 .BR "content"
7251 (or its synonym
7252 .BR "MD5" );
7253 .BR "timestamp" ;
7254 or
7255 .BR "source" .
7256
7257 If the environment method is used,
7258 the specified type of target signature is only used
7259 for targets built with that environment.
7260 If the global function is used,
7261 the specified type of signature becomes the default
7262 used for all target files that
7263 don't have an explicit target signature type
7264 specified for their environments.
7265
7266 .B "content"
7267 (or its synonym
7268 .BR "MD5" )
7269 means
7270 .B scons
7271 decides that a target file has changed
7272 if the MD5 checksum of its contents has changed since
7273 the last time it was used to rebuild some other target file.
7274 This means
7275 .B scons
7276 will open up
7277 MD5 sum the contents
7278 of target files after they're built,
7279 and may decide that it does not need to rebuild
7280 "downstream" target files if a file was
7281 rebuilt with exactly the same contents as the last time.
7282
7283 .B "timestamp"
7284 means
7285 .B scons
7286 decides that a target file has changed
7287 if its timestamp (modification time) has changed since
7288 the last time it was used to rebuild some other target file.
7289 (Note that although this is similar to the behavior of Make,
7290 by default it will also rebuild if the dependency is
7291 .I older
7292 than the last time it was used to rebuild the target file.)
7293
7294 .B "source"
7295 means
7296 .B scons
7297 decides that a target file has changed
7298 as specified by the corresponding
7299 .BR SourceSignatures ()
7300 setting
7301 .BR "" ( "MD5"
7302 or
7303 .BR "timestamp" ).
7304 This means that
7305 .B scons
7306 will treat all input files to a target the same way,
7307 regardless of whether they are source files
7308 or have been built from other files.
7309
7310 .B "build"
7311 means
7312 .B scons
7313 decides that a target file has changed
7314 if it has been rebuilt in this invocation
7315 or if its content or timestamp have changed
7316 as specified by the corresponding
7317 .BR SourceSignatures ()
7318 setting.
7319 This "propagates" the status of a rebuilt file
7320 so that other "downstream" target files
7321 will always be rebuilt,
7322 even if the contents or the timestamp
7323 have not changed.
7324
7325 .B "build"
7326 signatures are fastest because
7327 .B "content"
7328 (or
7329 .BR "MD5" )
7330 signatures take longer to compute,
7331 but are more accurate than
7332 .B "timestamp"
7333 signatures,
7334 and can prevent unnecessary "downstream" rebuilds
7335 when a target file is rebuilt to the exact same contents
7336 as the previous build.
7337 The
7338 .B "source"
7339 setting provides the most consistent behavior
7340 when other target files may be rebuilt from
7341 both source and target input files.
7342 The default value is
7343 .BR "source" .
7344
7345 Because the default setting is
7346 .BR "source" ,
7347 using
7348 .BR SourceSignatures ()
7349 is generally preferable to
7350 .BR TargetSignatures () ,
7351 so that the up-to-date decision
7352 will be consistent for all files
7353 (or all files built with a specific construction environment).
7354 Use of
7355 .BR TargetSignatures ()
7356 provides specific control for how built target files
7357 affect their "downstream" dependencies.
7358
7359 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7360 .TP
7361 .RI Tool( string [, toolpath ", " **kw ])
7362 Returns a callable object
7363 that can be used to initialize
7364 a construction environment using the
7365 tools keyword of the Environment() method.
7366 The object may be called with a construction
7367 environment as an argument,
7368 in which case the object will
7369 add the necessary variables
7370 to the construction environment
7371 and the name of the tool will be added to the
7372 .B $TOOLS
7373 construction variable.
7374
7375 Additional keyword arguments are passed to the tool's
7376 .B generate()
7377 method.
7378
7379 Examples:
7380
7381 .ES
7382 env = Environment(tools = [ Tool('msvc') ])
7383
7384 env = Environment()
7385 t = Tool('msvc')
7386 t(env) # adds 'msvc' to the TOOLS variable
7387 u = Tool('opengl', toolpath = ['tools'])
7388 u(env) # adds 'opengl' to the TOOLS variable
7389 .EE
7390 .TP
7391 .RI env.Tool( string [, toolpath ", " **kw ])
7392 Applies the callable object for the specified tool
7393 .I string
7394 to the environment through which the method was called.
7395
7396 Additional keyword arguments are passed to the tool's
7397 .B generate()
7398 method.
7399
7400 .ES
7401 env.Tool('gcc')
7402 env.Tool('opengl', toolpath = ['build/tools'])
7403 .EE
7404
7405 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7406 .TP
7407 .RI Value( value ", [" built_value ])
7408 .TP
7409 .RI env.Value( value ", [" built_value ])
7410 Returns a Node object representing the specified Python value. Value
7411 Nodes can be used as dependencies of targets. If the result of
7412 calling
7413 .BR str( value )
7414 changes between SCons runs, any targets depending on
7415 .BR Value( value )
7416 will be rebuilt.
7417 (This is true even when using timestamps to decide if
7418 files are up-to-date.)
7419 When using timestamp source signatures, Value Nodes'
7420 timestamps are equal to the system time when the Node is created.
7421
7422 The returned Value Node object has a
7423 .BR write ()
7424 method that can be used to "build" a Value Node
7425 by setting a new value.
7426 The optional
7427 .I built_value
7428 argument can be specified
7429 when the Value Node is created
7430 to indicate the Node should already be considered
7431 "built."
7432 There is a corresponding
7433 .BR read ()
7434 method that will return the built value of the Node.
7435
7436 Examples:
7437
7438 .ES
7439 env = Environment()
7440
7441 def create(target, source, env):
7442 # A function that will write a 'prefix=$SOURCE'
7443 # string into the file name specified as the
7444 # $TARGET.
7445 f = open(str(target[0]), 'wb')
7446 f.write('prefix=' + source[0].get_contents())
7447
7448 # Fetch the prefix= argument, if any, from the command
7449 # line, and use /usr/local as the default.
7450 prefix = ARGUMENTS.get('prefix', '/usr/local')
7451
7452 # Attach a .Config() builder for the above function action
7453 # to the construction environment.
7454 env['BUILDERS']['Config'] = Builder(action = create)
7455 env.Config(target = 'package-config', source = Value(prefix))
7456
7457 def build_value(target, source, env):
7458 # A function that "builds" a Python Value by updating
7459 # the the Python value with the contents of the file
7460 # specified as the source of the Builder call ($SOURCE).
7461 target[0].write(source[0].get_contents())
7462
7463 output = env.Value('before')
7464 input = env.Value('after')
7465
7466 # Attach a .UpdateValue() builder for the above function
7467 # action to the construction environment.
7468 env['BUILDERS']['UpdateValue'] = Builder(action = build_value)
7469 env.UpdateValue(target = Value(output), source = Value(input))
7470 .EE
7471
7472 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7473 .TP
7474 .RI VariantDir( variant_dir ", " src_dir ", [" duplicate ])
7475 .TP
7476 .RI env.VariantDir( variant_dir ", " src_dir ", [" duplicate ])
7477 Use the
7478 .BR VariantDir ()
7479 function to create a copy of your sources in another location:
7480 if a name under
7481 .IR variant_dir
7482 is not found but exists under
7483 .IR src_dir ,
7484 the file or directory is copied to
7485 .IR variant_dir .
7486 Target files can be built in a different directory
7487 than the original sources by simply refering to the sources (and targets)
7488 within the variant tree.
7489
7490 .BR VariantDir ()
7491 can be called multiple times with the same
7492 .I src_dir
7493 to set up multiple builds with different options
7494 .RI ( variants ).
7495 The
7496 .I src_dir
7497 location must be in or underneath the SConstruct file's directory, and
7498 .I variant_dir
7499 may not be underneath
7500 .IR src_dir .
7501 '\"TODO: Can the above restrictions be clarified or relaxed?
7502 '\"TODO: The latter restriction is clearly not completely right;
7503 '\"TODO: src_dir = '.' works fine with a build dir under it.
7504
7505 The default behavior is for
7506 .B scons
7507 to physically duplicate the source files in the variant tree.
7508 Thus, a build performed in the variant tree is guaranteed to be identical
7509 to a build performed in the source tree even if
7510 intermediate source files are generated during the build,
7511 or preprocessors or other scanners search for included files
7512 relative to the source file,
7513 or individual compilers or other invoked tools are hard-coded
7514 to put derived files in the same directory as source files.
7515
7516 If possible on the platform,
7517 the duplication is performed by linking rather than copying;
7518 see also the
7519 .IR --duplicate
7520 command-line option.
7521 Moreover, only the files needed for the build are duplicated;
7522 files and directories that are not used are not present in
7523 .IR variant_dir .
7524
7525 Duplicating the source tree may be disabled by setting the
7526 .I duplicate
7527 argument to 0 (zero).
7528 This will cause
7529 .B scons
7530 to invoke Builders using the path names of source files in
7531 .I src_dir
7532 and the path names of derived files within
7533 .IR variant_dir .
7534 This is always more efficient than
7535 .IR duplicate =1,
7536 and is usually safe for most builds
7537 (but see above for cases that may cause problems).
7538
7539 Note that
7540 .BR VariantDir ()
7541 works most naturally with a subsidiary SConscript file.
7542 However, you would then call the subsidiary SConscript file
7543 not in the source directory, but in the
7544 .I variant_dir ,
7545 regardless of the value of
7546 .IR duplicate .
7547 This is how you tell
7548 .B scons
7549 which variant of a source tree to build:
7550
7551 .ES
7552 # run src/SConscript in two variant directories
7553 VariantDir('build/variant1', 'src')
7554 SConscript('build/variant1/SConscript')
7555 VariantDir('build/variant2', 'src')
7556 SConscript('build/variant2/SConscript')
7557 .EE
7558
7559 .IP
7560 See also the
7561 .BR SConscript ()
7562 function, described above,
7563 for another way to specify a variant directory
7564 in conjunction with calling a subsidiary SConscript file.
7565
7566 Examples:
7567
7568 .ES
7569 # use names in the build directory, not the source directory
7570 VariantDir('build', 'src', duplicate=0)
7571 Program('build/prog', 'build/source.c')
7572 .EE
7573
7574 .ES
7575 # this builds both the source and docs in a separate subtree
7576 VariantDir('build', '.', duplicate=0)
7577 SConscript(dirs=['build/src','build/doc'])
7578 .EE
7579
7580 .ES
7581 # same as previous example, but only uses SConscript
7582 SConscript(dirs='src', variant_dir='build/src', duplicate=0)
7583 SConscript(dirs='doc', variant_dir='build/doc', duplicate=0)
7584 .EE
7585
7586 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7587 .TP
7588 .RI WhereIs( program ", [" path ", " pathext ", " reject ])
7589 .TP
7590 .RI env.WhereIs( program ", [" path ", " pathext ", " reject ])
7591
7592 Searches for the specified executable
7593 .I program,
7594 returning the full path name to the program
7595 if it is found,
7596 and returning None if not.
7597 Searches the specified
7598 .I path,
7599 the value of the calling environment's PATH
7600 (env['ENV']['PATH']),
7601 or the user's current external PATH
7602 (os.environ['PATH'])
7603 by default.
7604 On Windows systems, searches for executable
7605 programs with any of the file extensions
7606 listed in the specified
7607 .I pathext,
7608 the calling environment's PATHEXT
7609 (env['ENV']['PATHEXT'])
7610 or the user's current PATHEXT
7611 (os.environ['PATHEXT'])
7612 by default.
7613 Will not select any
7614 path name or names
7615 in the specified
7616 .I reject
7617 list, if any.
7618
7619 .SS SConscript Variables
7620 In addition to the global functions and methods,
7621 .B scons
7622 supports a number of Python variables
7623 that can be used in SConscript files
7624 to affect how you want the build to be performed.
7625 These variables may be accessed from custom Python modules that you
7626 import into an SConscript file by adding the following
7627 to the Python module:
7628
7629 .ES
7630 from SCons.Script import *
7631 .EE
7632
7633 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7634 .TP
7635 ARGLIST
7636 A list
7637 .IR keyword = value
7638 arguments specified on the command line.
7639 Each element in the list is a tuple
7640 containing the
7641 .RI ( keyword , value )
7642 of the argument.
7643 The separate
7644 .I keyword
7645 and
7646 .I value
7647 elements of the tuple
7648 can be accessed by
7649 subscripting for element
7650 .B [0]
7651 and
7652 .B [1]
7653 of the tuple, respectively.
7654
7655 Example:
7656
7657 .ES
7658 print "first keyword, value =", ARGLIST[0][0], ARGLIST[0][1]
7659 print "second keyword, value =", ARGLIST[1][0], ARGLIST[1][1]
7660 third_tuple = ARGLIST[2]
7661 print "third keyword, value =", third_tuple[0], third_tuple[1]
7662 for key, value in ARGLIST:
7663 # process key and value
7664 .EE
7665
7666 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7667 .TP
7668 ARGUMENTS
7669 A dictionary of all the
7670 .IR keyword = value
7671 arguments specified on the command line.
7672 The dictionary is not in order,
7673 and if a given keyword has
7674 more than one value assigned to it
7675 on the command line,
7676 the last (right-most) value is
7677 the one in the
7678 .B ARGUMENTS
7679 dictionary.
7680
7681 Example:
7682
7683 .ES
7684 if ARGUMENTS.get('debug', 0):
7685 env = Environment(CCFLAGS = '-g')
7686 else:
7687 env = Environment()
7688 .EE
7689
7690 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7691 .TP
7692 BUILD_TARGETS
7693 A list of the targets which
7694 .B scons
7695 will actually try to build,
7696 regardless of whether they were specified on
7697 the command line or via the
7698 .BR Default ()
7699 function or method.
7700 The elements of this list may be strings
7701 .I or
7702 nodes, so you should run the list through the Python
7703 .B str
7704 function to make sure any Node path names
7705 are converted to strings.
7706
7707 Because this list may be taken from the
7708 list of targets specified using the
7709 .BR Default ()
7710 function or method,
7711 the contents of the list may change
7712 on each successive call to
7713 .BR Default ().
7714 See the
7715 .B DEFAULT_TARGETS
7716 list, below,
7717 for additional information.
7718
7719 Example:
7720
7721 .ES
7722 if 'foo' in BUILD_TARGETS:
7723 print "Don't forget to test the `foo' program!"
7724 if 'special/program' in BUILD_TARGETS:
7725 SConscript('special')
7726 .EE
7727 .IP
7728 Note that the
7729 .B BUILD_TARGETS
7730 list only contains targets expected listed
7731 on the command line or via calls to the
7732 .BR Default ()
7733 function or method.
7734 It does
7735 .I not
7736 contain all dependent targets that will be built as
7737 a result of making the sure the explicitly-specified
7738 targets are up to date.
7739
7740 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7741 .TP
7742 COMMAND_LINE_TARGETS
7743 A list of the targets explicitly specified on
7744 the command line.
7745 If there are no targets specified on the command line,
7746 the list is empty.
7747 This can be used, for example,
7748 to take specific actions only
7749 when a certain target or targets
7750 is explicitly being built.
7751
7752 Example:
7753
7754 .ES
7755 if 'foo' in COMMAND_LINE_TARGETS:
7756 print "Don't forget to test the `foo' program!"
7757 if 'special/program' in COMMAND_LINE_TARGETS:
7758 SConscript('special')
7759 .EE
7760
7761 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7762 .TP
7763 DEFAULT_TARGETS
7764 A list of the target
7765 .I nodes
7766 that have been specified using the
7767 .BR Default ()
7768 function or method.
7769 The elements of the list are nodes,
7770 so you need to run them through the Python
7771 .B str
7772 function to get at the path name for each Node.
7773
7774 Example:
7775
7776 .ES
7777 print str(DEFAULT_TARGETS[0])
7778 if 'foo' in map(str, DEFAULT_TARGETS):
7779 print "Don't forget to test the `foo' program!"
7780 .EE
7781 .IP
7782 The contents of the
7783 .B DEFAULT_TARGETS
7784 list change on on each successive call to the
7785 .BR Default ()
7786 function:
7787
7788 .ES
7789 print map(str, DEFAULT_TARGETS) # originally []
7790 Default('foo')
7791 print map(str, DEFAULT_TARGETS) # now a node ['foo']
7792 Default('bar')
7793 print map(str, DEFAULT_TARGETS) # now a node ['foo', 'bar']
7794 Default(None)
7795 print map(str, DEFAULT_TARGETS) # back to []
7796 .EE
7797 .IP
7798 Consequently, be sure to use
7799 .B DEFAULT_TARGETS
7800 only after you've made all of your
7801 .BR Default ()
7802 calls,
7803 or else simply be careful of the order
7804 of these statements in your SConscript files
7805 so that you don't look for a specific
7806 default target before it's actually been added to the list.
7807
7808 .SS Construction Variables
7809 .\" XXX From Gary Ruben, 23 April 2002:
7810 .\" I think it would be good to have an example with each construction
7811 .\" variable description in the documentation.
7812 .\" eg.
7813 .\" CC The C compiler
7814 .\" Example: env["CC"] = "c68x"
7815 .\" Default: env["CC"] = "cc"
7816 .\"
7817 .\" CCCOM The command line ...
7818 .\" Example:
7819 .\" To generate the compiler line c68x -ps -qq -mr -o $TARGET $SOURCES
7820 .\" env["CC"] = "c68x"
7821 .\" env["CFLAGS"] = "-ps -qq -mr"
7822 .\" env["CCCOM"] = "$CC $CFLAGS -o $TARGET $SOURCES
7823 .\" Default:
7824 .\" (I dunno what this is ;-)
7825 A construction environment has an associated dictionary of
7826 .I construction variables
7827 that are used by built-in or user-supplied build rules.
7828 Construction variables must follow the same rules for
7829 Python identifiers:
7830 the initial character must be an underscore or letter,
7831 followed by any number of underscores, letters, or digits.
7832
7833 A number of useful construction variables are automatically defined by
7834 scons for each supported platform, and additional construction variables
7835 can be defined by the user. The following is a list of the automatically
7836 defined construction variables:
7837
7838 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7839 '\" BEGIN GENERATED CONSTRUCTION VARIABLE DESCRIPTIONS
7840 '\"
7841 '\" The descriptions below of the various SCons construction variables
7842 '\" are generated from the .xml files that live next to the various
7843 '\" Python modules in the build enginer library. If you're reading
7844 '\" this [gnt]roff file with an eye towards patching this man page,
7845 '\" you can still submit a diff against this text, but it will have to
7846 '\" be translated to a diff against the underlying .xml file before the
7847 '\" patch is actually accepted. If you do that yourself, it will make
7848 '\" it easier to integrate the patch.
7849 '\"
7850 '\" BEGIN GENERATED CONSTRUCTION VARIABLE DESCRIPTIONS
7851 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
7852
7853 .IP AR
7854 The static library archiver.
7855
7856 .IP ARCHITECTURE
7857 Specifies the system architecture for which
7858 the package is being built.
7859 The default is the system architecture
7860 of the machine on which SCons is running.
7861 This is used to fill in the
7862 .B Architecture:
7863 field in an Ipkg
7864 \fBcontrol\fP file,
7865 and as part of the name of a generated RPM file.
7866
7867 .IP ARCOM
7868 The command line used to generate a static library from object files.
7869
7870 .IP ARCOMSTR
7871 The string displayed when an object file
7872 is generated from an assembly-language source file.
7873 If this is not set, then $ARCOM (the command line) is displayed.
7874
7875 .ES
7876 env = Environment(ARCOMSTR = "Archiving $TARGET")
7877 .EE
7878
7879 .IP ARFLAGS
7880 General options passed to the static library archiver.
7881
7882 .IP AS
7883 The assembler.
7884
7885 .IP ASCOM
7886 The command line used to generate an object file
7887 from an assembly-language source file.
7888
7889 .IP ASCOMSTR
7890 The string displayed when an object file
7891 is generated from an assembly-language source file.
7892 If this is not set, then $ASCOM (the command line) is displayed.
7893
7894 .ES
7895 env = Environment(ASCOMSTR = "Assembling $TARGET")
7896 .EE
7897
7898 .IP ASFLAGS
7899 General options passed to the assembler.
7900
7901 .IP ASPPCOM
7902 The command line used to assemble an assembly-language
7903 source file into an object file
7904 after first running the file through the C preprocessor.
7905 Any options specified
7906 in the $ASFLAGS and $CPPFLAGS construction variables
7907 are included on this command line.
7908
7909 .IP ASPPCOMSTR
7910 The string displayed when an object file
7911 is generated from an assembly-language source file
7912 after first running the file through the C preprocessor.
7913 If this is not set, then $ASPPCOM (the command line) is displayed.
7914
7915 .ES
7916 env = Environment(ASPPCOMSTR = "Assembling $TARGET")
7917 .EE
7918
7919 .IP ASPPFLAGS
7920 General options when an assembling an assembly-language
7921 source file into an object file
7922 after first running the file through the C preprocessor.
7923 The default is to use the value of $ASFLAGS.
7924
7925 .IP BIBTEX
7926 The bibliography generator for the TeX formatter and typesetter and the
7927 LaTeX structured formatter and typesetter.
7928
7929 .IP BIBTEXCOM
7930 The command line used to call the bibliography generator for the
7931 TeX formatter and typesetter and the LaTeX structured formatter and
7932 typesetter.
7933
7934 .IP BIBTEXCOMSTR
7935 The string displayed when generating a bibliography
7936 for TeX or LaTeX.
7937 If this is not set, then $BIBTEXCOM (the command line) is displayed.
7938
7939 .ES
7940 env = Environment(BIBTEXCOMSTR = "Generating bibliography $TARGET")
7941 .EE
7942
7943 .IP BIBTEXFLAGS
7944 General options passed to the bibliography generator for the TeX formatter
7945 and typesetter and the LaTeX structured formatter and typesetter.
7946
7947 .IP BITKEEPER
7948 The BitKeeper executable.
7949
7950 .IP BITKEEPERCOM
7951 The command line for
7952 fetching source files using BitKeeper.
7953
7954 .IP BITKEEPERCOMSTR
7955 The string displayed when fetching
7956 a source file using BitKeeper.
7957 If this is not set, then $BITKEEPERCOM
7958 (the command line) is displayed.
7959
7960 .IP BITKEEPERGET
7961 The command ($BITKEEPER) and subcommand
7962 for fetching source files using BitKeeper.
7963
7964 .IP BITKEEPERGETFLAGS
7965 Options that are passed to the BitKeeper
7966 .B get
7967 subcommand.
7968
7969 .IP BUILDERS
7970 A dictionary mapping the names of the builders
7971 available through this environment
7972 to underlying Builder objects.
7973 Builders named
7974 Alias, CFile, CXXFile, DVI, Library, Object, PDF, PostScript, and Program
7975 are available by default.
7976 If you initialize this variable when an
7977 Environment is created:
7978
7979 .ES
7980 env = Environment(BUILDERS = {'NewBuilder' : foo})
7981 .EE
7982 .IP
7983 the default Builders will no longer be available.
7984 To use a new Builder object in addition to the default Builders,
7985 add your new Builder object like this:
7986
7987 .ES
7988 env = Environment()
7989 env.Append(BUILDERS = {'NewBuilder' : foo})
7990 .EE
7991 .IP
7992 or this:
7993
7994 .ES
7995 env = Environment()
7996 env['BUILDERS]['NewBuilder'] = foo
7997 .EE
7998
7999 .IP CC
8000 The C compiler.
8001
8002 .IP CCCOM
8003 The command line used to compile a C source file to a (static) object
8004 file. Any options specified in the $CFLAGS, $CCFLAGS and
8005 $CPPFLAGS construction variables are included on this command
8006 line.
8007
8008 .IP CCCOMSTR
8009 The string displayed when a C source file
8010 is compiled to a (static) object file.
8011 If this is not set, then $CCCOM (the command line) is displayed.
8012
8013 .ES
8014 env = Environment(CCCOMSTR = "Compiling static object $TARGET")
8015 .EE
8016
8017 .IP CCFLAGS
8018 General options that are passed to the C and C++ compilers.
8019
8020 .IP CCPCHFLAGS
8021 Options added to the compiler command line
8022 to support building with precompiled headers.
8023 The default value expands expands to the appropriate
8024 Microsoft Visual C++ command-line options
8025 when the $PCH construction variable is set.
8026
8027 .IP CCPDBFLAGS
8028 Options added to the compiler command line
8029 to support storing debugging information in a
8030 Microsoft Visual C++ PDB file.
8031 The default value expands expands to appropriate
8032 Microsoft Visual C++ command-line options
8033 when the $PDB construction variable is set.
8034
8035 The Visual C++ compiler option that SCons uses by default
8036 to generate PDB information is \fB/Z7\fP.
8037 This works correctly with parallel (\fB\-j\fP) builds
8038 because it embeds the debug information in the intermediate object files,
8039 as opposed to sharing a single PDB file between multiple object files.
8040 This is also the only way to get debug information
8041 embedded into a static library.
8042 Using the \fB/Zi\fP instead may yield improved
8043 link-time performance,
8044 although parallel builds will no longer work.
8045
8046 You can generate PDB files with the \fB/Zi\fP
8047 switch by overriding the default $CCPDBFLAGS variable as follows:
8048
8049 .ES
8050 env['CCPDBFLAGS'] = ['${(PDB and "/Zi /Fd%s" % File(PDB)) or ""}']
8051 .EE
8052 .IP
8053 An alternative would be to use the \fB/Zi\fP
8054 to put the debugging information in a separate \fB.pdb\fP
8055 file for each object file by overriding
8056 the $CCPDBFLAGS variable as follows:
8057
8058 .ES
8059 env['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
8060 .EE
8061
8062 .IP CCVERSION
8063 The version number of the C compiler.
8064 This may or may not be set,
8065 depending on the specific C compiler being used.
8066
8067 .IP CFILESUFFIX
8068 The suffix for C source files.
8069 This is used by the internal CFile builder
8070 when generating C files from Lex (.l) or YACC (.y) input files.
8071 The default suffix, of course, is
8072 .B .c
8073 (lower case).
8074 On case-insensitive systems (like Windows),
8075 SCons also treats
8076 .B .C
8077 (upper case) files
8078 as C files.
8079
8080 .IP CFLAGS
8081 General options that are passed to the C compiler (C only; not C++).
8082
8083 .IP CHANGE_SPECFILE
8084 A hook for modifying the file that controls the packaging build
8085 (the \fB.spec\fP for RPM,
8086 the \fBcontrol\fP for Ipkg,
8087 the \fB.wxs\fP for MSI).
8088 If set, the function will be called
8089 after the SCons template for the file has been written.
8090 XXX
8091
8092 .IP CHANGED_SOURCES
8093 A reserved variable name
8094 that may not be set or used in a construction environment.
8095 (See "Variable Substitution," below.)
8096
8097 .IP CHANGED_TARGETS
8098 A reserved variable name
8099 that may not be set or used in a construction environment.
8100 (See "Variable Substitution," below.)
8101
8102 .IP CHANGELOG
8103 The name of a file containing the change log text
8104 to be included in the package.
8105 This is included as the
8106 .B %changelog
8107 section of the RPM
8108 \fB.spec\fP file.
8109
8110 .IP _concat
8111 A function used to produce variables like $_CPPINCFLAGS. It takes
8112 four or five
8113 arguments: a prefix to concatenate onto each element, a list of
8114 elements, a suffix to concatenate onto each element, an environment
8115 for variable interpolation, and an optional function that will be
8116 called to transform the list before concatenation.
8117
8118 .ES
8119 env['_CPPINCFLAGS'] = '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDir s)} $)',
8120 .EE
8121
8122 .IP CONFIGUREDIR
8123 The name of the directory in which
8124 Configure context test files are written.
8125 The default is
8126 .B .sconf_temp
8127 in the top-level directory
8128 containing the
8129 .B SConstruct
8130 file.
8131
8132 .IP CONFIGURELOG
8133 The name of the Configure context log file.
8134 The default is
8135 .B config.log
8136 in the top-level directory
8137 containing the
8138 .B SConstruct
8139 file.
8140
8141 .IP _CPPDEFFLAGS
8142 An automatically-generated construction variable
8143 containing the C preprocessor command-line options
8144 to define values.
8145 The value of $_CPPDEFFLAGS is created
8146 by appending $CPPDEFPREFIX and $CPPDEFSUFFIX
8147 to the beginning and end
8148 of each definition in $CPPDEFINES.
8149
8150 .IP CPPDEFINES
8151 A platform independent specification of C preprocessor definitions.
8152 The definitions will be added to command lines
8153 through the automatically-generated
8154 $_CPPDEFFLAGS construction variable (see above),
8155 which is constructed according to
8156 the type of value of $CPPDEFINES:
8157
8158 If $CPPDEFINES is a string,
8159 the values of the
8160 $CPPDEFPREFIX and $CPPDEFSUFFIX
8161 construction variables
8162 will be added to the beginning and end.
8163
8164 .ES
8165 # Will add -Dxyz to POSIX compiler command lines,
8166 # and /Dxyz to Microsoft Visual C++ command lines.
8167 env = Environment(CPPDEFINES='xyz')
8168 .EE
8169 .IP
8170 If $CPPDEFINES is a list,
8171 the values of the
8172 $CPPDEFPREFIX and $CPPDEFSUFFIX
8173 construction variables
8174 will be appended to the beginning and end
8175 of each element in the list.
8176 If any element is a list or tuple,
8177 then the first item is the name being
8178 defined and the second item is its value:
8179
8180 .ES
8181 # Will add -DB=2 -DA to POSIX compiler command lines,
8182 # and /DB=2 /DA to Microsoft Visual C++ command lines.
8183 env = Environment(CPPDEFINES=[('B', 2), 'A'])
8184 .EE
8185 .IP
8186 If $CPPDEFINES is a dictionary,
8187 the values of the
8188 $CPPDEFPREFIX and $CPPDEFSUFFIX
8189 construction variables
8190 will be appended to the beginning and end
8191 of each item from the dictionary.
8192 The key of each dictionary item
8193 is a name being defined
8194 to the dictionary item's corresponding value;
8195 if the value is
8196 .BR None ,
8197 then the name is defined without an explicit value.
8198 Note that the resulting flags are sorted by keyword
8199 to ensure that the order of the options on the
8200 command line is consistent each time
8201 .B scons
8202 is run.
8203
8204 .ES
8205 # Will add -DA -DB=2 to POSIX compiler command lines,
8206 # and /DA /DB=2 to Microsoft Visual C++ command lines.
8207 env = Environment(CPPDEFINES={'B':2, 'A':None})
8208 .EE
8209
8210 .IP CPPDEFPREFIX
8211 The prefix used to specify preprocessor definitions
8212 on the C compiler command line.
8213 This will be appended to the beginning of each definition
8214 in the $CPPDEFINES construction variable
8215 when the $_CPPDEFFLAGS variable is automatically generated.
8216
8217 .IP CPPDEFSUFFIX
8218 The suffix used to specify preprocessor definitions
8219 on the C compiler command line.
8220 This will be appended to the end of each definition
8221 in the $CPPDEFINES construction variable
8222 when the $_CPPDEFFLAGS variable is automatically generated.
8223
8224 .IP CPPFLAGS
8225 User-specified C preprocessor options.
8226 These will be included in any command that uses the C preprocessor,
8227 including not just compilation of C and C++ source files
8228 via the $CCCOM,
8229 $SHCCCOM,
8230 $CXXCOM and
8231 $SHCXXCOM command lines,
8232 but also the $FORTRANPPCOM,
8233 $SHFORTRANPPCOM,
8234 $F77PPCOM and
8235 $SHF77PPCOM command lines
8236 used to compile a Fortran source file,
8237 and the $ASPPCOM command line
8238 used to assemble an assembly language source file,
8239 after first running each file through the C preprocessor.
8240 Note that this variable does
8241 .I not
8242 contain
8243 .B \-I
8244 (or similar) include search path options
8245 that scons generates automatically from $CPPPATH.
8246 See $_CPPINCFLAGS, below,
8247 for the variable that expands to those options.
8248
8249 .IP _CPPINCFLAGS
8250 An automatically-generated construction variable
8251 containing the C preprocessor command-line options
8252 for specifying directories to be searched for include files.
8253 The value of $_CPPINCFLAGS is created
8254 by appending $INCPREFIX and $INCSUFFIX
8255 to the beginning and end
8256 of each directory in $CPPPATH.
8257
8258 .IP CPPPATH
8259 The list of directories that the C preprocessor will search for include
8260 directories. The C/C++ implicit dependency scanner will search these
8261 directories for include files. Don't explicitly put include directory
8262 arguments in CCFLAGS or CXXFLAGS because the result will be non-portable
8263 and the directories will not be searched by the dependency scanner. Note:
8264 directory names in CPPPATH will be looked-up relative to the SConscript
8265 directory when they are used in a command. To force
8266 .B scons
8267 to look-up a directory relative to the root of the source tree use #:
8268
8269 .ES
8270 env = Environment(CPPPATH='#/include')
8271 .EE
8272 .IP
8273 The directory look-up can also be forced using the
8274 .BR Dir ()
8275 function:
8276
8277 .ES
8278 include = Dir('include')
8279 env = Environment(CPPPATH=include)
8280 .EE
8281 .IP
8282 The directory list will be added to command lines
8283 through the automatically-generated
8284 $_CPPINCFLAGS
8285 construction variable,
8286 which is constructed by
8287 appending the values of the
8288 $INCPREFIX and $INCSUFFIX
8289 construction variables
8290 to the beginning and end
8291 of each directory in $CPPPATH.
8292 Any command lines you define that need
8293 the CPPPATH directory list should
8294 include $_CPPINCFLAGS:
8295
8296 .ES
8297 env = Environment(CCCOM="my_compiler $_CPPINCFLAGS -c -o $TARGET $SOURCE")
8298 .EE
8299
8300 .IP CPPSUFFIXES
8301 The list of suffixes of files that will be scanned
8302 for C preprocessor implicit dependencies
8303 (#include lines).
8304 The default list is:
8305
8306 .ES
8307 [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
8308 ".h", ".H", ".hxx", ".hpp", ".hh",
8309 ".F", ".fpp", ".FPP",
8310 ".m", ".mm",
8311 ".S", ".spp", ".SPP"]
8312 .EE
8313
8314 .IP CVS
8315 The CVS executable.
8316
8317 .IP CVSCOFLAGS
8318 Options that are passed to the CVS checkout subcommand.
8319
8320 .IP CVSCOM
8321 The command line used to
8322 fetch source files from a CVS repository.
8323
8324 .IP CVSCOMSTR
8325 The string displayed when fetching
8326 a source file from a CVS repository.
8327 If this is not set, then $CVSCOM
8328 (the command line) is displayed.
8329
8330 .IP CVSFLAGS
8331 General options that are passed to CVS.
8332 By default, this is set to
8333 .B "-d $CVSREPOSITORY"
8334 to specify from where the files must be fetched.
8335
8336 .IP CVSREPOSITORY
8337 The path to the CVS repository.
8338 This is referenced in the default
8339 $CVSFLAGS value.
8340
8341 .IP CXX
8342 The C++ compiler.
8343
8344 .IP CXXCOM
8345 The command line used to compile a C++ source file to an object file.
8346 Any options specified in the $CXXFLAGS and
8347 $CPPFLAGS construction variables
8348 are included on this command line.
8349
8350 .IP CXXCOMSTR
8351 The string displayed when a C++ source file
8352 is compiled to a (static) object file.
8353 If this is not set, then $CXXCOM (the command line) is displayed.
8354
8355 .ES
8356 env = Environment(CXXCOMSTR = "Compiling static object $TARGET")
8357 .EE
8358
8359 .IP CXXFILESUFFIX
8360 The suffix for C++ source files.
8361 This is used by the internal CXXFile builder
8362 when generating C++ files from Lex (.ll) or YACC (.yy) input files.
8363 The default suffix is
8364 .BR .cc .
8365 SCons also treats files with the suffixes
8366 .BR .cpp ,
8367 .BR .cxx ,
8368 .BR .c++ ,
8369 and
8370 .B .C++
8371 as C++ files,
8372 and files with
8373 .B .mm
8374 suffixes as Objective C++ files.
8375 On case-sensitive systems (Linux, UNIX, and other POSIX-alikes),
8376 SCons also treats
8377 .B .C
8378 (upper case) files
8379 as C++ files.
8380
8381 .IP CXXFLAGS
8382 General options that are passed to the C++ compiler.
8383 By default, this includes the value of $CCFLAGS,
8384 so that setting $CCFLAGS affects both C and C++ compilation.
8385 If you want to add C++-specific flags,
8386 you must set or override the value of $CXXFLAGS.
8387
8388 .IP CXXVERSION
8389 The version number of the C++ compiler.
8390 This may or may not be set,
8391 depending on the specific C++ compiler being used.
8392
8393 .IP DESCRIPTION
8394 A long description of the project being packaged.
8395 This is included in the relevant section
8396 of the file that controls the packaging build.
8397
8398 .IP DESCRIPTION_lang
8399 A language-specific long description for
8400 the specified \fIlang\fP.
8401 This is used to populate a
8402 .B "%description -l"
8403 section of an RPM
8404 \fB.spec\fP file.
8405
8406 .IP Dir
8407 A function that converts a string
8408 into a Dir instance relative to the target being built.
8409
8410 .IP Dirs
8411 A function that converts a list of strings
8412 into a list of Dir instances relative to the target being built.
8413
8414 .IP DSUFFIXES
8415 The list of suffixes of files that will be scanned
8416 for imported D package files.
8417 The default list is:
8418
8419 .ES
8420 ['.d']
8421 .EE
8422
8423 .IP DVIPDF
8424 The TeX DVI file to PDF file converter.
8425
8426 .IP DVIPDFCOM
8427 The command line used to convert TeX DVI files into a PDF file.
8428
8429 .IP DVIPDFCOMSTR
8430 The string displayed when a TeX DVI file
8431 is converted into a PDF file.
8432 If this is not set, then $DVIPDFCOM (the command line) is displayed.
8433
8434 .IP DVIPDFFLAGS
8435 General options passed to the TeX DVI file to PDF file converter.
8436
8437 .IP DVIPS
8438 The TeX DVI file to PostScript converter.
8439
8440 .IP DVIPSFLAGS
8441 General options passed to the TeX DVI file to PostScript converter.
8442
8443 .IP ENV
8444 A dictionary of environment variables
8445 to use when invoking commands. When
8446 $ENV is used in a command all list
8447 values will be joined using the path separator and any other non-string
8448 values will simply be coerced to a string.
8449 Note that, by default,
8450 .B scons
8451 does
8452 .I not
8453 propagate the environment in force when you
8454 execute
8455 .B scons
8456 to the commands used to build target files.
8457 This is so that builds will be guaranteed
8458 repeatable regardless of the environment
8459 variables set at the time
8460 .B scons
8461 is invoked.
8462
8463 If you want to propagate your
8464 environment variables
8465 to the commands executed
8466 to build target files,
8467 you must do so explicitly:
8468
8469 .ES
8470 import os
8471 env = Environment(ENV = os.environ)
8472 .EE
8473 .IP
8474 Note that you can choose only to propagate
8475 certain environment variables.
8476 A common example is
8477 the system
8478 .B PATH
8479 environment variable,
8480 so that
8481 .B scons
8482 uses the same utilities
8483 as the invoking shell (or other process):
8484
8485 .ES
8486 import os
8487 env = Environment(ENV = {'PATH' : os.environ['PATH']})
8488 .EE
8489
8490 .IP ESCAPE
8491 A function that will be called to escape shell special characters in
8492 command lines. The function should take one argument: the command line
8493 string to escape; and should return the escaped command line.
8494
8495 .IP F77
8496 The Fortran 77 compiler.
8497 You should normally set the $FORTRAN variable,
8498 which specifies the default Fortran compiler
8499 for all Fortran versions.
8500 You only need to set $F77 if you need to use a specific compiler
8501 or compiler version for Fortran 77 files.
8502
8503 .IP F77COM
8504 The command line used to compile a Fortran 77 source file to an object file.
8505 You only need to set $F77COM if you need to use a specific
8506 command line for Fortran 77 files.
8507 You should normally set the $FORTRANCOM variable,
8508 which specifies the default command line
8509 for all Fortran versions.
8510
8511 .IP F77COMSTR
8512 The string displayed when a Fortran 77 source file
8513 is compiled to an object file.
8514 If this is not set, then $F77COM or $FORTRANCOM
8515 (the command line) is displayed.
8516
8517 .IP F77FILESUFFIXES
8518 The list of file extensions for which the F77 dialect will be used. By
8519 default, this is ['.f77']
8520
8521 .IP F77FLAGS
8522 General user-specified options that are passed to the Fortran 77 compiler.
8523 Note that this variable does
8524 .I not
8525 contain
8526 .B \-I
8527 (or similar) include search path options
8528 that scons generates automatically from $F77PATH.
8529 See
8530 $_F77INCFLAGS
8531 below,
8532 for the variable that expands to those options.
8533 You only need to set $F77FLAGS if you need to define specific
8534 user options for Fortran 77 files.
8535 You should normally set the $FORTRANFLAGS variable,
8536 which specifies the user-specified options
8537 passed to the default Fortran compiler
8538 for all Fortran versions.
8539
8540 .IP _F77INCFLAGS
8541 An automatically-generated construction variable
8542 containing the Fortran 77 compiler command-line options
8543 for specifying directories to be searched for include files.
8544 The value of $_F77INCFLAGS is created
8545 by appending $INCPREFIX and $INCSUFFIX
8546 to the beginning and end
8547 of each directory in $F77PATH.
8548
8549 .IP F77PATH
8550 The list of directories that the Fortran 77 compiler will search for include
8551 directories. The implicit dependency scanner will search these
8552 directories for include files. Don't explicitly put include directory
8553 arguments in $F77FLAGS because the result will be non-portable
8554 and the directories will not be searched by the dependency scanner. Note:
8555 directory names in $F77PATH will be looked-up relative to the SConscript
8556 directory when they are used in a command. To force
8557 .B scons
8558 to look-up a directory relative to the root of the source tree use #:
8559 You only need to set $F77PATH if you need to define a specific
8560 include path for Fortran 77 files.
8561 You should normally set the $FORTRANPATH variable,
8562 which specifies the include path
8563 for the default Fortran compiler
8564 for all Fortran versions.
8565
8566 .ES
8567 env = Environment(F77PATH='#/include')
8568 .EE
8569 .IP
8570 The directory look-up can also be forced using the
8571 .BR Dir ()
8572 function:
8573
8574 .ES
8575 include = Dir('include')
8576 env = Environment(F77PATH=include)
8577 .EE
8578 .IP
8579 The directory list will be added to command lines
8580 through the automatically-generated
8581 $_F77INCFLAGS
8582 construction variable,
8583 which is constructed by
8584 appending the values of the
8585 $INCPREFIX and $INCSUFFIX
8586 construction variables
8587 to the beginning and end
8588 of each directory in $F77PATH.
8589 Any command lines you define that need
8590 the F77PATH directory list should
8591 include $_F77INCFLAGS:
8592
8593 .ES
8594 env = Environment(F77COM="my_compiler $_F77INCFLAGS -c -o $TARGET $SOURCE")
8595 .EE
8596
8597 .IP F77PPCOM
8598 The command line used to compile a Fortran 77 source file to an object file
8599 after first running the file through the C preprocessor.
8600 Any options specified in the $F77FLAGS and $CPPFLAGS construction variables
8601 are included on this command line.
8602 You only need to set $F77PPCOM if you need to use a specific
8603 C-preprocessor command line for Fortran 77 files.
8604 You should normally set the $FORTRANPPCOM variable,
8605 which specifies the default C-preprocessor command line
8606 for all Fortran versions.
8607
8608 .IP F77PPCOMSTR
8609 The string displayed when a Fortran 77 source file
8610 is compiled to an object file
8611 after first running the file through the C preprocessor.
8612 If this is not set, then $F77PPCOM or $FORTRANPPCOM
8613 (the command line) is displayed.
8614
8615 .IP F77PPFILESUFFIXES
8616 The list of file extensions for which the compilation + preprocessor pass for
8617 F77 dialect will be used. By default, this is empty
8618
8619 .IP F90
8620 The Fortran 90 compiler.
8621 You should normally set the $FORTRAN variable,
8622 which specifies the default Fortran compiler
8623 for all Fortran versions.
8624 You only need to set $F90 if you need to use a specific compiler
8625 or compiler version for Fortran 90 files.
8626
8627 .IP F90COM
8628 The command line used to compile a Fortran 90 source file to an object file.
8629 You only need to set $F90COM if you need to use a specific
8630 command line for Fortran 90 files.
8631 You should normally set the $FORTRANCOM variable,
8632 which specifies the default command line
8633 for all Fortran versions.
8634
8635 .IP F90COMSTR
8636 The string displayed when a Fortran 90 source file
8637 is compiled to an object file.
8638 If this is not set, then $F90COM or $FORTRANCOM
8639 (the command line) is displayed.
8640
8641 .IP F90FILESUFFIXES
8642 The list of file extensions for which the F90 dialect will be used. By
8643 default, this is ['.f90']
8644
8645 .IP F90FLAGS
8646 General user-specified options that are passed to the Fortran 90 compiler.
8647 Note that this variable does
8648 .I not
8649 contain
8650 .B \-I
8651 (or similar) include search path options
8652 that scons generates automatically from $F90PATH.
8653 See
8654 $_F90INCFLAGS
8655 below,
8656 for the variable that expands to those options.
8657 You only need to set $F90FLAGS if you need to define specific
8658 user options for Fortran 90 files.
8659 You should normally set the $FORTRANFLAGS variable,
8660 which specifies the user-specified options
8661 passed to the default Fortran compiler
8662 for all Fortran versions.
8663
8664 .IP _F90INCFLAGS
8665 An automatically-generated construction variable
8666 containing the Fortran 90 compiler command-line options
8667 for specifying directories to be searched for include files.
8668 The value of $_F90INCFLAGS is created
8669 by appending $INCPREFIX and $INCSUFFIX
8670 to the beginning and end
8671 of each directory in $F90PATH.
8672
8673 .IP F90PATH
8674 The list of directories that the Fortran 90 compiler will search for include
8675 directories. The implicit dependency scanner will search these
8676 directories for include files. Don't explicitly put include directory
8677 arguments in $F90FLAGS because the result will be non-portable
8678 and the directories will not be searched by the dependency scanner. Note:
8679 directory names in $F90PATH will be looked-up relative to the SConscript
8680 directory when they are used in a command. To force
8681 .B scons
8682 to look-up a directory relative to the root of the source tree use #:
8683 You only need to set $F90PATH if you need to define a specific
8684 include path for Fortran 90 files.
8685 You should normally set the $FORTRANPATH variable,
8686 which specifies the include path
8687 for the default Fortran compiler
8688 for all Fortran versions.
8689
8690 .ES
8691 env = Environment(F90PATH='#/include')
8692 .EE
8693 .IP
8694 The directory look-up can also be forced using the
8695 .BR Dir ()
8696 function:
8697
8698 .ES
8699 include = Dir('include')
8700 env = Environment(F90PATH=include)
8701 .EE
8702 .IP
8703 The directory list will be added to command lines
8704 through the automatically-generated
8705 $_F90INCFLAGS
8706 construction variable,
8707 which is constructed by
8708 appending the values of the
8709 $INCPREFIX and $INCSUFFIX
8710 construction variables
8711 to the beginning and end
8712 of each directory in $F90PATH.
8713 Any command lines you define that need
8714 the F90PATH directory list should
8715 include $_F90INCFLAGS:
8716
8717 .ES
8718 env = Environment(F90COM="my_compiler $_F90INCFLAGS -c -o $TARGET $SOURCE")
8719 .EE
8720
8721 .IP F90PPCOM
8722 The command line used to compile a Fortran 90 source file to an object file
8723 after first running the file through the C preprocessor.
8724 Any options specified in the $F90FLAGS and $CPPFLAGS construction variables
8725 are included on this command line.
8726 You only need to set $F90PPCOM if you need to use a specific
8727 C-preprocessor command line for Fortran 90 files.
8728 You should normally set the $FORTRANPPCOM variable,
8729 which specifies the default C-preprocessor command line
8730 for all Fortran versions.
8731
8732 .IP F90PPCOMSTR
8733 The string displayed when a Fortran 90 source file
8734 is compiled after first running the file through the C preprocessor.
8735 If this is not set, then $F90PPCOM or $FORTRANPPCOM
8736 (the command line) is displayed.
8737
8738 .IP F90PPFILESUFFIXES
8739 The list of file extensions for which the compilation + preprocessor pass for
8740 F90 dialect will be used. By default, this is empty
8741
8742 .IP F95
8743 The Fortran 95 compiler.
8744 You should normally set the $FORTRAN variable,
8745 which specifies the default Fortran compiler
8746 for all Fortran versions.
8747 You only need to set $F95 if you need to use a specific compiler
8748 or compiler version for Fortran 95 files.
8749
8750 .IP F95COM
8751 The command line used to compile a Fortran 95 source file to an object file.
8752 You only need to set $F95COM if you need to use a specific
8753 command line for Fortran 95 files.
8754 You should normally set the $FORTRANCOM variable,
8755 which specifies the default command line
8756 for all Fortran versions.
8757
8758 .IP F95COMSTR
8759 The string displayed when a Fortran 95 source file
8760 is compiled to an object file.
8761 If this is not set, then $F95COM or $FORTRANCOM
8762 (the command line) is displayed.
8763
8764 .IP F95FILESUFFIXES
8765 The list of file extensions for which the F95 dialect will be used. By
8766 default, this is ['.f95']
8767
8768 .IP F95FLAGS
8769 General user-specified options that are passed to the Fortran 95 compiler.
8770 Note that this variable does
8771 .I not
8772 contain
8773 .B \-I
8774 (or similar) include search path options
8775 that scons generates automatically from $F95PATH.
8776 See
8777 $_F95INCFLAGS
8778 below,
8779 for the variable that expands to those options.
8780 You only need to set $F95FLAGS if you need to define specific
8781 user options for Fortran 95 files.
8782 You should normally set the $FORTRANFLAGS variable,
8783 which specifies the user-specified options
8784 passed to the default Fortran compiler
8785 for all Fortran versions.
8786
8787 .IP _F95INCFLAGS
8788 An automatically-generated construction variable
8789 containing the Fortran 95 compiler command-line options
8790 for specifying directories to be searched for include files.
8791 The value of $_F95INCFLAGS is created
8792 by appending $INCPREFIX and $INCSUFFIX
8793 to the beginning and end
8794 of each directory in $F95PATH.
8795
8796 .IP F95PATH
8797 The list of directories that the Fortran 95 compiler will search for include
8798 directories. The implicit dependency scanner will search these
8799 directories for include files. Don't explicitly put include directory
8800 arguments in $F95FLAGS because the result will be non-portable
8801 and the directories will not be searched by the dependency scanner. Note:
8802 directory names in $F95PATH will be looked-up relative to the SConscript
8803 directory when they are used in a command. To force
8804 .B scons
8805 to look-up a directory relative to the root of the source tree use #:
8806 You only need to set $F95PATH if you need to define a specific
8807 include path for Fortran 95 files.
8808 You should normally set the $FORTRANPATH variable,
8809 which specifies the include path
8810 for the default Fortran compiler
8811 for all Fortran versions.
8812
8813 .ES
8814 env = Environment(F95PATH='#/include')
8815 .EE
8816 .IP
8817 The directory look-up can also be forced using the
8818 .BR Dir ()
8819 function:
8820
8821 .ES
8822 include = Dir('include')
8823 env = Environment(F95PATH=include)
8824 .EE
8825 .IP
8826 The directory list will be added to command lines
8827 through the automatically-generated
8828 $_F95INCFLAGS
8829 construction variable,
8830 which is constructed by
8831 appending the values of the
8832 $INCPREFIX and $INCSUFFIX
8833 construction variables
8834 to the beginning and end
8835 of each directory in $F95PATH.
8836 Any command lines you define that need
8837 the F95PATH directory list should
8838 include $_F95INCFLAGS:
8839
8840 .ES
8841 env = Environment(F95COM="my_compiler $_F95INCFLAGS -c -o $TARGET $SOURCE")
8842 .EE
8843
8844 .IP F95PPCOM
8845 The command line used to compile a Fortran 95 source file to an object file
8846 after first running the file through the C preprocessor.
8847 Any options specified in the $F95FLAGS and $CPPFLAGS construction variables
8848 are included on this command line.
8849 You only need to set $F95PPCOM if you need to use a specific
8850 C-preprocessor command line for Fortran 95 files.
8851 You should normally set the $FORTRANPPCOM variable,
8852 which specifies the default C-preprocessor command line
8853 for all Fortran versions.
8854
8855 .IP F95PPCOMSTR
8856 The string displayed when a Fortran 95 source file
8857 is compiled to an object file
8858 after first running the file through the C preprocessor.
8859 If this is not set, then $F95PPCOM or $FORTRANPPCOM
8860 (the command line) is displayed.
8861
8862 .IP F95PPFILESUFFIXES
8863 The list of file extensions for which the compilation + preprocessor pass for
8864 F95 dialect will be used. By default, this is empty
8865
8866 .IP File
8867 A function that converts a string into a File instance relative to the
8868 target being built.
8869
8870 .IP FORTRAN
8871 The default Fortran compiler
8872 for all versions of Fortran.
8873
8874 .IP FORTRANCOM
8875 The command line used to compile a Fortran source file to an object file.
8876 By default, any options specified
8877 in the $FORTRANFLAGS,
8878 $CPPFLAGS,
8879 $_CPPDEFFLAGS,
8880 $_FORTRANMODFLAG, and
8881 $_FORTRANINCFLAGS construction variables
8882 are included on this command line.
8883
8884 .IP FORTRANCOMSTR
8885 The string displayed when a Fortran source file
8886 is compiled to an object file.
8887 If this is not set, then $FORTRANCOM
8888 (the command line) is displayed.
8889
8890 .IP FORTRANFILESUFFIXES
8891 The list of file extensions for which the FORTRAN dialect will be used. By
8892 default, this is ['.f', '.for', '.ftn']
8893
8894 .IP FORTRANFLAGS
8895 General user-specified options that are passed to the Fortran compiler.
8896 Note that this variable does
8897 .I not
8898 contain
8899 .B \-I
8900 (or similar) include or module search path options
8901 that scons generates automatically from $FORTRANPATH.
8902 See
8903 $_FORTRANINCFLAGS and $_FORTRANMODFLAG,
8904 below,
8905 for the variables that expand those options.
8906
8907 .IP _FORTRANINCFLAGS
8908 An automatically-generated construction variable
8909 containing the Fortran compiler command-line options
8910 for specifying directories to be searched for include
8911 files and module files.
8912 The value of $_FORTRANINCFLAGS is created
8913 by prepending/appending $INCPREFIX and $INCSUFFIX
8914 to the beginning and end
8915 of each directory in $FORTRANPATH.
8916
8917 .IP FORTRANMODDIR
8918 Directory location where the Fortran compiler should place
8919 any module files it generates. This variable is empty, by default. Some
8920 Fortran compilers will internally append this directory in the search path
8921 for module files, as well.
8922
8923 .IP FORTRANMODDIRPREFIX
8924 The prefix used to specify a module directory on the Fortran compiler command
8925 line.
8926 This will be appended to the beginning of the directory
8927 in the $FORTRANMODDIR construction variables
8928 when the $_FORTRANMODFLAG variables is automatically generated.
8929
8930 .IP FORTRANMODDIRSUFFIX
8931 The suffix used to specify a module directory on the Fortran compiler command
8932 line.
8933 This will be appended to the beginning of the directory
8934 in the $FORTRANMODDIR construction variables
8935 when the $_FORTRANMODFLAG variables is automatically generated.
8936
8937 .IP _FORTRANMODFLAG
8938 An automatically-generated construction variable
8939 containing the Fortran compiler command-line option
8940 for specifying the directory location where the Fortran
8941 compiler should place any module files that happen to get
8942 generated during compilation.
8943 The value of $_FORTRANMODFLAG is created
8944 by prepending/appending $FORTRANMODDIRPREFIX and
8945 $FORTRANMODDIRSUFFIX
8946 to the beginning and end of the directory in $FORTRANMODDIR.
8947
8948 .IP FORTRANMODPREFIX
8949 The module file prefix used by the Fortran compiler. SCons assumes that
8950 the Fortran compiler follows the quasi-standard naming convention for
8951 module files of
8952 .BR module_name.mod .
8953 As a result, this variable is left empty, by default. For situations in
8954 which the compiler does not necessarily follow the normal convention,
8955 the user may use this variable. Its value will be appended to every
8956 module file name as scons attempts to resolve dependencies.
8957
8958 .IP FORTRANMODSUFFIX
8959 The module file suffix used by the Fortran compiler. SCons assumes that
8960 the Fortran compiler follows the quasi-standard naming convention for
8961 module files of
8962 .BR module_name.mod .
8963 As a result, this variable is set to ".mod", by default. For situations
8964 in which the compiler does not necessarily follow the normal convention,
8965 the user may use this variable. Its value will be appended to every
8966 module file name as scons attempts to resolve dependencies.
8967
8968 .IP FORTRANPATH
8969 The list of directories that the Fortran compiler will search for
8970 include files and (for some compilers) module files. The Fortran implicit
8971 dependency scanner will search these directories for include files (but
8972 not module files since they are autogenerated and, as such, may not
8973 actually exist at the time the scan takes place). Don't explicitly put
8974 include directory arguments in FORTRANFLAGS because the result will be
8975 non-portable and the directories will not be searched by the dependency
8976 scanner. Note: directory names in FORTRANPATH will be looked-up relative
8977 to the SConscript directory when they are used in a command. To force
8978 .B scons
8979 to look-up a directory relative to the root of the source tree use #:
8980
8981 .ES
8982 env = Environment(FORTRANPATH='#/include')
8983 .EE
8984 .IP
8985 The directory look-up can also be forced using the
8986 .BR Dir ()
8987 function:
8988
8989 .ES
8990 include = Dir('include')
8991 env = Environment(FORTRANPATH=include)
8992 .EE
8993 .IP
8994 The directory list will be added to command lines
8995 through the automatically-generated
8996 $_FORTRANINCFLAGS
8997 construction variable,
8998 which is constructed by
8999 appending the values of the
9000 $INCPREFIX and $INCSUFFIX
9001 construction variables
9002 to the beginning and end
9003 of each directory in $FORTRANPATH.
9004 Any command lines you define that need
9005 the FORTRANPATH directory list should
9006 include $_FORTRANINCFLAGS:
9007
9008 .ES
9009 env = Environment(FORTRANCOM="my_compiler $_FORTRANINCFLAGS -c -o $TARGET $SOURC E")
9010 .EE
9011
9012 .IP FORTRANPPCOM
9013 The command line used to compile a Fortran source file to an object file
9014 after first running the file through the C preprocessor.
9015 By default, any options specified in the $FORTRANFLAGS,
9016 $CPPFLAGS,
9017 $_CPPDEFFLAGS,
9018 $_FORTRANMODFLAG, and
9019 $_FORTRANINCFLAGS
9020 construction variables are included on this command line.
9021
9022 .IP FORTRANPPCOMSTR
9023 The string displayed when a Fortran source file
9024 is compiled to an object file
9025 after first running the file through the C preprocessor.
9026 If this is not set, then $FORTRANPPCOM
9027 (the command line) is displayed.
9028
9029 .IP FORTRANPPFILESUFFIXES
9030 The list of file extensions for which the compilation + preprocessor pass for
9031 FORTRAN dialect will be used. By default, this is ['.fpp', '.FPP']
9032
9033 .IP FORTRANSUFFIXES
9034 The list of suffixes of files that will be scanned
9035 for Fortran implicit dependencies
9036 (INCLUDE lines and USE statements).
9037 The default list is:
9038
9039 .ES
9040 [".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
9041 ".f77", ".F77", ".f90", ".F90", ".f95", ".F95"]
9042 .EE
9043
9044 .IP FRAMEWORKPATH
9045 On Mac OS X with gcc,
9046 a list containing the paths to search for frameworks.
9047 Used by the compiler to find framework-style includes like
9048 #include <Fmwk/Header.h>.
9049 Used by the linker to find user-specified frameworks when linking (see
9050 $FRAMEWORKS).
9051 For example:
9052
9053 .ES
9054 env.AppendUnique(FRAMEWORKPATH='#myframeworkdir')
9055 .EE
9056 .IP
9057 will add
9058
9059 .ES
9060 ... -Fmyframeworkdir
9061 .EE
9062 .IP
9063 to the compiler and linker command lines.
9064
9065 .IP _FRAMEWORKPATH
9066 On Mac OS X with gcc, an automatically-generated construction variable
9067 containing the linker command-line options corresponding to
9068 $FRAMEWORKPATH.
9069
9070 .IP FRAMEWORKPATHPREFIX
9071 On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH entries.
9072 (see $FRAMEWORKPATH).
9073 The default value is
9074 .BR \-F .
9075
9076 .IP FRAMEWORKPREFIX
9077 On Mac OS X with gcc,
9078 the prefix to be used for linking in frameworks
9079 (see $FRAMEWORKS).
9080 The default value is
9081 .BR \-framework .
9082
9083 .IP _FRAMEWORKS
9084 On Mac OS X with gcc,
9085 an automatically-generated construction variable
9086 containing the linker command-line options
9087 for linking with FRAMEWORKS.
9088
9089 .IP FRAMEWORKS
9090 On Mac OS X with gcc, a list of the framework names to be linked into a
9091 program or shared library or bundle.
9092 The default value is the empty list.
9093 For example:
9094
9095 .ES
9096 env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration'))
9097 .EE
9098 .IP
9099
9100 .IP FRAMEWORKSFLAGS
9101 On Mac OS X with gcc,
9102 general user-supplied frameworks options to be added at
9103 the end of a command
9104 line building a loadable module.
9105 (This has been largely superseded by
9106 the $FRAMEWORKPATH, $FRAMEWORKPATHPREFIX,
9107 $FRAMEWORKPREFIX and $FRAMEWORKS variables
9108 described above.)
9109
9110 .IP GS
9111 The Ghostscript program used to convert PostScript to PDF files.
9112
9113 .IP GSCOM
9114 The Ghostscript command line used to convert PostScript to PDF files.
9115
9116 .IP GSCOMSTR
9117 The string displayed when
9118 Ghostscript is used to convert
9119 a PostScript file to a PDF file.
9120 If this is not set, then $GSCOM (the command line) is displayed.
9121
9122 .IP GSFLAGS
9123 General options passed to the Ghostscript program
9124 when converting PostScript to PDF files.
9125
9126 .IP HOST_ARCH
9127 Sets the host architecture for Visual Studio compiler. If not set,
9128 default to the detected host architecture: note that this may depend
9129 on the python you are using.
9130 This variable must be passed as an argument to the Environment()
9131 constructor; setting it later has no effect.
9132
9133 Valid values are the same as for $TARGET_ARCH.
9134
9135 This is currently only used on Windows, but in the future it will be
9136 used on other OSes as well.
9137
9138 .IP HOST_OS
9139 The name of the host operating system used to create the Environment.
9140 If a platform is specified when creating the Environment, then
9141 that Platform's logic will handle setting this value.
9142 This value is immutable, and should not be changed by the user after
9143 the Environment is initialized.
9144 Currently only set for Win32.
9145
9146 .IP IDLSUFFIXES
9147 The list of suffixes of files that will be scanned
9148 for IDL implicit dependencies
9149 (#include or import lines).
9150 The default list is:
9151
9152 .ES
9153 [".idl", ".IDL"]
9154 .EE
9155
9156 .IP IMPLICIT_COMMAND_DEPENDENCIES
9157 Controls whether or not SCons will
9158 add implicit dependencies for the commands
9159 executed to build targets.
9160
9161 By default, SCons will add
9162 to each target
9163 an implicit dependency on the command
9164 represented by the first argument on any
9165 command line it executes.
9166 The specific file for the dependency is
9167 found by searching the
9168 .I PATH
9169 variable in the
9170 .I ENV
9171 environment used to execute the command.
9172
9173 If the construction variable
9174 $IMPLICIT_COMMAND_DEPENDENCIES
9175 is set to a false value
9176 .RB ( None ,
9177 .BR False ,
9178 .BR 0 ,
9179 etc.),
9180 then the implicit dependency will
9181 not be added to the targets
9182 built with that construction environment.
9183
9184 .ES
9185 env = Environment(IMPLICIT_COMMAND_DEPENDENCIES = 0)
9186 .EE
9187
9188 .IP INCPREFIX
9189 The prefix used to specify an include directory on the C compiler command
9190 line.
9191 This will be appended to the beginning of each directory
9192 in the $CPPPATH and $FORTRANPATH construction variables
9193 when the $_CPPINCFLAGS and $_FORTRANINCFLAGS
9194 variables are automatically generated.
9195
9196 .IP INCSUFFIX
9197 The suffix used to specify an include directory on the C compiler command
9198 line.
9199 This will be appended to the end of each directory
9200 in the $CPPPATH and $FORTRANPATH construction variables
9201 when the $_CPPINCFLAGS and $_FORTRANINCFLAGS
9202 variables are automatically generated.
9203
9204 .IP INSTALL
9205 A function to be called to install a file into a
9206 destination file name.
9207 The default function copies the file into the destination
9208 (and sets the destination file's mode and permission bits
9209 to match the source file's).
9210 The function takes the following arguments:
9211
9212 .ES
9213 def install(dest, source, env):
9214 .EE
9215 .IP
9216 .I dest
9217 is the path name of the destination file.
9218 .I source
9219 is the path name of the source file.
9220 .I env
9221 is the construction environment
9222 (a dictionary of construction values)
9223 in force for this file installation.
9224
9225 .IP INSTALLSTR
9226 The string displayed when a file is
9227 installed into a destination file name.
9228 The default is:
9229 .ES
9230 Install file: "$SOURCE" as "$TARGET"
9231 .EE
9232
9233 .IP INTEL_C_COMPILER_VERSION
9234 Set by the "intelc" Tool
9235 to the major version number of the Intel C compiler
9236 selected for use.
9237
9238 .IP JAR
9239 The Java archive tool.
9240
9241 .IP JARCHDIR
9242 The directory to which the Java archive tool should change
9243 (using the
9244 .B \-C
9245 option).
9246
9247 .IP JARCOM
9248 The command line used to call the Java archive tool.
9249
9250 .IP JARCOMSTR
9251 The string displayed when the Java archive tool
9252 is called
9253 If this is not set, then $JARCOM (the command line) is displayed.
9254
9255 .ES
9256 env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET")
9257 .EE
9258
9259 .IP JARFLAGS
9260 General options passed to the Java archive tool.
9261 By default this is set to
9262 .B cf
9263 to create the necessary
9264 .B jar
9265 file.
9266
9267 .IP JARSUFFIX
9268 The suffix for Java archives:
9269 .B .jar
9270 by default.
9271
9272 .IP JAVABOOTCLASSPATH
9273 Specifies the list of directories that
9274 will be added to the
9275 &javac; command line
9276 via the \fB\-bootclasspath\fP option.
9277 The individual directory names will be
9278 separated by the operating system's path separate character
9279 (\fB:\fP on UNIX/Linux/POSIX,
9280 \fB;\fP on Windows).
9281
9282 .IP JAVAC
9283 The Java compiler.
9284
9285 .IP JAVACCOM
9286 The command line used to compile a directory tree containing
9287 Java source files to
9288 corresponding Java class files.
9289 Any options specified in the $JAVACFLAGS construction variable
9290 are included on this command line.
9291
9292 .IP JAVACCOMSTR
9293 The string displayed when compiling
9294 a directory tree of Java source files to
9295 corresponding Java class files.
9296 If this is not set, then $JAVACCOM (the command line) is displayed.
9297
9298 .ES
9299 env = Environment(JAVACCOMSTR = "Compiling class files $TARGETS from $SOURCES")
9300 .EE
9301
9302 .IP JAVACFLAGS
9303 General options that are passed to the Java compiler.
9304
9305 .IP JAVACLASSDIR
9306 The directory in which Java class files may be found.
9307 This is stripped from the beginning of any Java .class
9308 file names supplied to the
9309 .B JavaH
9310 builder.
9311
9312 .IP JAVACLASSPATH
9313 Specifies the list of directories that
9314 will be searched for Java
9315 \fB.class\fP file.
9316 The directories in this list will be added to the
9317 &javac; and &javah; command lines
9318 via the \fB\-classpath\fP option.
9319 The individual directory names will be
9320 separated by the operating system's path separate character
9321 (\fB:\fP on UNIX/Linux/POSIX,
9322 \fB;\fP on Windows).
9323
9324 Note that this currently just adds the specified
9325 directory via the \fB\-classpath\fP option.
9326 &SCons; does not currently search the
9327 $JAVACLASSPATH directories for dependency
9328 \fB.class\fP files.
9329
9330 .IP JAVACLASSSUFFIX
9331 The suffix for Java class files;
9332 .B .class
9333 by default.
9334
9335 .IP JAVAH
9336 The Java generator for C header and stub files.
9337
9338 .IP JAVAHCOM
9339 The command line used to generate C header and stub files
9340 from Java classes.
9341 Any options specified in the $JAVAHFLAGS construction variable
9342 are included on this command line.
9343
9344 .IP JAVAHCOMSTR
9345 The string displayed when C header and stub files
9346 are generated from Java classes.
9347 If this is not set, then $JAVAHCOM (the command line) is displayed.
9348
9349 .ES
9350 env = Environment(JAVAHCOMSTR = "Generating header/stub file(s) $TARGETS from $S OURCES")
9351 .EE
9352
9353 .IP JAVAHFLAGS
9354 General options passed to the C header and stub file generator
9355 for Java classes.
9356
9357 .IP JAVASOURCEPATH
9358 Specifies the list of directories that
9359 will be searched for input
9360 \fB.java\fP file.
9361 The directories in this list will be added to the
9362 &javac; command line
9363 via the \fB\-sourcepath\fP option.
9364 The individual directory names will be
9365 separated by the operating system's path separate character
9366 (\fB:\fP on UNIX/Linux/POSIX,
9367 \fB;\fP on Windows).
9368
9369 Note that this currently just adds the specified
9370 directory via the \fB\-sourcepath\fP option.
9371 &SCons; does not currently search the
9372 $JAVASOURCEPATH directories for dependency
9373 \fB.java\fP files.
9374
9375 .IP JAVASUFFIX
9376 The suffix for Java files;
9377 .B .java
9378 by default.
9379
9380 .IP JAVAVERSION
9381 Specifies the Java version being used by the \fBJava\fP() builder.
9382 This is \fInot\fP currently used to select one
9383 version of the Java compiler vs. another.
9384 Instead, you should set this to specify the version of Java
9385 supported by your &javac; compiler.
9386 The default is \fB1.4\fP.
9387
9388 This is sometimes necessary because
9389 Java 1.5 changed the file names that are created
9390 for nested anonymous inner classes,
9391 which can cause a mismatch with the files
9392 that &SCons; expects will be generated by the &javac; compiler.
9393 Setting $JAVAVERSION to \fB1.5\fP
9394 (or \fB1.6\fP, as appropriate)
9395 can make &SCons; realize that a Java 1.5 or 1.6
9396 build is actually up to date.
9397
9398 .IP LATEX
9399 The LaTeX structured formatter and typesetter.
9400
9401 .IP LATEXCOM
9402 The command line used to call the LaTeX structured formatter and typesetter.
9403
9404 .IP LATEXCOMSTR
9405 The string displayed when calling
9406 the LaTeX structured formatter and typesetter.
9407 If this is not set, then $LATEXCOM (the command line) is displayed.
9408
9409 .ES
9410 env = Environment(LATEXCOMSTR = "Building $TARGET from LaTeX input $SOURCES")
9411 .EE
9412
9413 .IP LATEXFLAGS
9414 General options passed to the LaTeX structured formatter and typesetter.
9415
9416 .IP LATEXRETRIES
9417 The maximum number of times that LaTeX
9418 will be re-run if the
9419 .B .log
9420 generated by the $LATEXCOM command
9421 indicates that there are undefined references.
9422 The default is to try to resolve undefined references
9423 by re-running LaTeX up to three times.
9424
9425 .IP LATEXSUFFIXES
9426 The list of suffixes of files that will be scanned
9427 for LaTeX implicit dependencies
9428 (\fB\\include\fP or \fB\\import\fP files).
9429 The default list is:
9430
9431 .ES
9432 [".tex", ".ltx", ".latex"]
9433 .EE
9434
9435 .IP LDMODULE
9436 The linker for building loadable modules.
9437 By default, this is the same as $SHLINK.
9438
9439 .IP LDMODULECOM
9440 The command line for building loadable modules.
9441 On Mac OS X, this uses the $LDMODULE,
9442 $LDMODULEFLAGS and
9443 $FRAMEWORKSFLAGS variables.
9444 On other systems, this is the same as $SHLINK.
9445
9446 .IP LDMODULECOMSTR
9447 The string displayed when building loadable modules.
9448 If this is not set, then $LDMODULECOM (the command line) is displayed.
9449
9450 .IP LDMODULEFLAGS
9451 General user options passed to the linker for building loadable modules.
9452
9453 .IP LDMODULEPREFIX
9454 The prefix used for loadable module file names.
9455 On Mac OS X, this is null;
9456 on other systems, this is
9457 the same as $SHLIBPREFIX.
9458
9459 .IP LDMODULESUFFIX
9460 The suffix used for loadable module file names.
9461 On Mac OS X, this is null;
9462 on other systems, this is
9463 the same as $SHLIBSUFFIX.
9464
9465 .IP LEX
9466 The lexical analyzer generator.
9467
9468 .IP LEXCOM
9469 The command line used to call the lexical analyzer generator
9470 to generate a source file.
9471
9472 .IP LEXCOMSTR
9473 The string displayed when generating a source file
9474 using the lexical analyzer generator.
9475 If this is not set, then $LEXCOM (the command line) is displayed.
9476
9477 .ES
9478 env = Environment(LEXCOMSTR = "Lex'ing $TARGET from $SOURCES")
9479 .EE
9480
9481 .IP LEXFLAGS
9482 General options passed to the lexical analyzer generator.
9483
9484 .IP _LIBDIRFLAGS
9485 An automatically-generated construction variable
9486 containing the linker command-line options
9487 for specifying directories to be searched for library.
9488 The value of $_LIBDIRFLAGS is created
9489 by appending $LIBDIRPREFIX and $LIBDIRSUFFIX
9490 to the beginning and end
9491 of each directory in $LIBPATH.
9492
9493 .IP LIBDIRPREFIX
9494 The prefix used to specify a library directory on the linker command line.
9495 This will be appended to the beginning of each directory
9496 in the $LIBPATH construction variable
9497 when the $_LIBDIRFLAGS variable is automatically generated.
9498
9499 .IP LIBDIRSUFFIX
9500 The suffix used to specify a library directory on the linker command line.
9501 This will be appended to the end of each directory
9502 in the $LIBPATH construction variable
9503 when the $_LIBDIRFLAGS variable is automatically generated.
9504
9505 .IP _LIBFLAGS
9506 An automatically-generated construction variable
9507 containing the linker command-line options
9508 for specifying libraries to be linked with the resulting target.
9509 The value of $_LIBFLAGS is created
9510 by appending $LIBLINKPREFIX and $LIBLINKSUFFIX
9511 to the beginning and end
9512 of each filename in $LIBS.
9513
9514 .IP LIBLINKPREFIX
9515 The prefix used to specify a library to link on the linker command line.
9516 This will be appended to the beginning of each library
9517 in the $LIBS construction variable
9518 when the $_LIBFLAGS variable is automatically generated.
9519
9520 .IP LIBLINKSUFFIX
9521 The suffix used to specify a library to link on the linker command line.
9522 This will be appended to the end of each library
9523 in the $LIBS construction variable
9524 when the $_LIBFLAGS variable is automatically generated.
9525
9526 .IP LIBPATH
9527 The list of directories that will be searched for libraries.
9528 The implicit dependency scanner will search these
9529 directories for include files. Don't explicitly put include directory
9530 arguments in $LINKFLAGS or $SHLINKFLAGS
9531 because the result will be non-portable
9532 and the directories will not be searched by the dependency scanner. Note:
9533 directory names in LIBPATH will be looked-up relative to the SConscript
9534 directory when they are used in a command. To force
9535 .B scons
9536 to look-up a directory relative to the root of the source tree use #:
9537
9538 .ES
9539 env = Environment(LIBPATH='#/libs')
9540 .EE
9541 .IP
9542 The directory look-up can also be forced using the
9543 .BR Dir ()
9544 function:
9545
9546 .ES
9547 libs = Dir('libs')
9548 env = Environment(LIBPATH=libs)
9549 .EE
9550 .IP
9551 The directory list will be added to command lines
9552 through the automatically-generated
9553 $_LIBDIRFLAGS
9554 construction variable,
9555 which is constructed by
9556 appending the values of the
9557 $LIBDIRPREFIX and $LIBDIRSUFFIX
9558 construction variables
9559 to the beginning and end
9560 of each directory in $LIBPATH.
9561 Any command lines you define that need
9562 the LIBPATH directory list should
9563 include $_LIBDIRFLAGS:
9564
9565 .ES
9566 env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE ")
9567 .EE
9568
9569 .IP LIBPREFIX
9570 The prefix used for (static) library file names.
9571 A default value is set for each platform
9572 (posix, win32, os2, etc.),
9573 but the value is overridden by individual tools
9574 (ar, mslib, sgiar, sunar, tlib, etc.)
9575 to reflect the names of the libraries they create.
9576
9577 .IP LIBPREFIXES
9578 A list of all legal prefixes for library file names.
9579 When searching for library dependencies,
9580 SCons will look for files with these prefixes,
9581 the base library name,
9582 and suffixes in the $LIBSUFFIXES list.
9583
9584 .IP LIBS
9585 A list of one or more libraries
9586 that will be linked with
9587 any executable programs
9588 created by this environment.
9589
9590 The library list will be added to command lines
9591 through the automatically-generated
9592 $_LIBFLAGS
9593 construction variable,
9594 which is constructed by
9595 appending the values of the
9596 $LIBLINKPREFIX and $LIBLINKSUFFIX
9597 construction variables
9598 to the beginning and end
9599 of each filename in $LIBS.
9600 Any command lines you define that need
9601 the LIBS library list should
9602 include $_LIBFLAGS:
9603
9604 .ES
9605 env = Environment(LINKCOM="my_linker $_LIBDIRFLAGS $_LIBFLAGS -o $TARGET $SOURCE ")
9606 .EE
9607 .IP
9608 If you add a
9609 File
9610 object to the
9611 $LIBS
9612 list, the name of that file will be added to
9613 $_LIBFLAGS,
9614 and thus the link line, as is, without
9615 $LIBLINKPREFIX
9616 or
9617 $LIBLINKSUFFIX.
9618 For example:
9619
9620 .ES
9621 env.Append(LIBS=File('/tmp/mylib.so'))
9622 .EE
9623 .IP
9624 In all cases, scons will add dependencies from the executable program to
9625 all the libraries in this list.
9626
9627 .IP LIBSUFFIX
9628 The suffix used for (static) library file names.
9629 A default value is set for each platform
9630 (posix, win32, os2, etc.),
9631 but the value is overridden by individual tools
9632 (ar, mslib, sgiar, sunar, tlib, etc.)
9633 to reflect the names of the libraries they create.
9634
9635 .IP LIBSUFFIXES
9636 A list of all legal suffixes for library file names.
9637 When searching for library dependencies,
9638 SCons will look for files with prefixes, in the $LIBPREFIXES list,
9639 the base library name,
9640 and these suffixes.
9641
9642 .IP LICENSE
9643 The abbreviated name of the license under which
9644 this project is released (gpl, lpgl, bsd etc.).
9645 See http://www.opensource.org/licenses/alphabetical
9646 for a list of license names.
9647
9648 .IP LINESEPARATOR
9649 The separator used by the \fBSubstfile\fP() and \fBTextfile\fP() builders.
9650 This value is used between sources when constructing the target.
9651 It defaults to the current system line separator.
9652
9653 .IP LINK
9654 The linker.
9655
9656 .IP LINKCOM
9657 The command line used to link object files into an executable.
9658
9659 .IP LINKCOMSTR
9660 The string displayed when object files
9661 are linked into an executable.
9662 If this is not set, then $LINKCOM (the command line) is displayed.
9663
9664 .ES
9665 env = Environment(LINKCOMSTR = "Linking $TARGET")
9666 .EE
9667
9668 .IP LINKFLAGS
9669 General user options passed to the linker.
9670 Note that this variable should
9671 .I not
9672 contain
9673 .B \-l
9674 (or similar) options for linking with the libraries listed in $LIBS,
9675 nor
9676 .B \-L
9677 (or similar) library search path options
9678 that scons generates automatically from $LIBPATH.
9679 See
9680 $_LIBFLAGS
9681 above,
9682 for the variable that expands to library-link options,
9683 and
9684 $_LIBDIRFLAGS
9685 above,
9686 for the variable that expands to library search path options.
9687
9688 .IP M4
9689 The M4 macro preprocessor.
9690
9691 .IP M4COM
9692 The command line used to pass files through the M4 macro preprocessor.
9693
9694 .IP M4COMSTR
9695 The string displayed when
9696 a file is passed through the M4 macro preprocessor.
9697 If this is not set, then $M4COM (the command line) is displayed.
9698
9699 .IP M4FLAGS
9700 General options passed to the M4 macro preprocessor.
9701
9702 .IP MAKEINDEX
9703 The makeindex generator for the TeX formatter and typesetter and the
9704 LaTeX structured formatter and typesetter.
9705
9706 .IP MAKEINDEXCOM
9707 The command line used to call the makeindex generator for the
9708 TeX formatter and typesetter and the LaTeX structured formatter and
9709 typesetter.
9710
9711 .IP MAKEINDEXCOMSTR
9712 The string displayed when calling the makeindex generator for the
9713 TeX formatter and typesetter
9714 and the LaTeX structured formatter and typesetter.
9715 If this is not set, then $MAKEINDEXCOM (the command line) is displayed.
9716
9717 .IP MAKEINDEXFLAGS
9718 General options passed to the makeindex generator for the TeX formatter
9719 and typesetter and the LaTeX structured formatter and typesetter.
9720
9721 .IP MAXLINELENGTH
9722 The maximum number of characters allowed on an external command line.
9723 On Win32 systems,
9724 link lines longer than this many characters
9725 are linked via a temporary file name.
9726
9727 .IP MIDL
9728 The Microsoft IDL compiler.
9729
9730 .IP MIDLCOM
9731 The command line used to pass files to the Microsoft IDL compiler.
9732
9733 .IP MIDLCOMSTR
9734 The string displayed when
9735 the Microsoft IDL copmiler is called.
9736 If this is not set, then $MIDLCOM (the command line) is displayed.
9737
9738 .IP MIDLFLAGS
9739 General options passed to the Microsoft IDL compiler.
9740
9741 .IP MSSDK_DIR
9742 The directory containing the Microsoft SDK
9743 (either Platform SDK or Windows SDK)
9744 to be used for compilation.
9745
9746 .IP MSSDK_VERSION
9747 The version string of the Microsoft SDK
9748 (either Platform SDK or Windows SDK)
9749 to be used for compilation.
9750 Supported versions include
9751 .BR 6.1 ,
9752 .BR 6.0A ,
9753 .BR 6.0 ,
9754 .B 2003R2
9755 and
9756 .BR 2003R1 .
9757
9758 .IP MSVC_BATCH
9759 When set to any true value,
9760 specifies that SCons should batch
9761 compilation of object files
9762 when calling the Microsoft Visual C/C++ compiler.
9763 All compilations of source files from the same source directory
9764 that generate target files in a same output directory
9765 and were configured in SCons using the same construction environment
9766 will be built in a single call to the compiler.
9767 Only source files that have changed since their
9768 object files were built will be passed to each compiler invocation
9769 (via the $CHANGED_SOURCES construction variable).
9770 Any compilations where the object (target) file base name
9771 (minus the \fB.obj\fP)
9772 does not match the source file base name
9773 will be compiled separately.
9774
9775 .IP MSVC_USE_SCRIPT
9776 Use a batch script to set up Microsoft Visual Studio compiler
9777
9778 $MSVC_USE_SCRIPT overrides $MSVC_VERSION and $TARGET_ARCH.
9779 If set to the name of a Visual Studio .bat file (e.g. vcvars.bat),
9780 SCons will run that bat file and extract the relevant variables from
9781 the result (typically %INCLUDE%, %LIB%, and %PATH%). Setting
9782 MSVC_USE_SCRIPT to None bypasses the Visual Studio autodetection
9783 entirely; use this if you are running SCons in a Visual Studio cmd
9784 window and importing the shell's environment variables.
9785
9786 .IP MSVC_VERSION
9787 Sets the preferred version of Microsoft Visual C/C++ to use.
9788
9789 If $MSVC_VERSION is not set, SCons will (by default) select the
9790 latest version of Visual C/C++ installed on your system. If the
9791 specified version isn't installed, tool initialization will fail.
9792 This variable must be passed as an argument to the Environment()
9793 constructor; setting it later has no effect. Set it to an unexpected
9794 value (e.g. "XXX") to see the valid values on your system.
9795
9796 .IP MSVS
9797 When the Microsoft Visual Studio tools are initialized, they set up
9798 this dictionary with the following keys:
9799
9800 .BR VERSION :
9801 the version of MSVS being used (can be set via
9802 $MSVS_VERSION)
9803
9804 .BR VERSIONS :
9805 the available versions of MSVS installed
9806
9807 .BR VCINSTALLDIR :
9808 installed directory of Visual C++
9809
9810 .BR VSINSTALLDIR :
9811 installed directory of Visual Studio
9812
9813 .BR FRAMEWORKDIR :
9814 installed directory of the .NET framework
9815
9816 .BR FRAMEWORKVERSIONS :
9817 list of installed versions of the .NET framework, sorted latest to oldest.
9818
9819 .BR FRAMEWORKVERSION :
9820 latest installed version of the .NET framework
9821
9822 .BR FRAMEWORKSDKDIR :
9823 installed location of the .NET SDK.
9824
9825 .BR PLATFORMSDKDIR :
9826 installed location of the Platform SDK.
9827
9828 .BR PLATFORMSDK_MODULES :
9829 dictionary of installed Platform SDK modules,
9830 where the dictionary keys are keywords for the various modules, and
9831 the values are 2-tuples where the first is the release date, and the
9832 second is the version number.
9833
9834 If a value isn't set, it wasn't available in the registry.
9835
9836 .IP MSVS_ARCH
9837 Sets the architecture for which the generated project(s) should build.
9838
9839 The default value is \fBx86\fP.
9840 \fBamd64\fP is also supported
9841 by &SCons; for some Visual Studio versions.
9842 Trying to set $MSVS_ARCH to an architecture that's not
9843 supported for a given Visual Studio version
9844 will generate an error.
9845
9846 .IP MSVS_PROJECT_BASE_PATH
9847 The string
9848 placed in a generated Microsoft Visual Studio solution file
9849 as the value of the
9850 .B SccProjectFilePathRelativizedFromConnection0
9851 and
9852 .B SccProjectFilePathRelativizedFromConnection1
9853 attributes of the
9854 .B GlobalSection(SourceCodeControl)
9855 section.
9856 There is no default value.
9857
9858 .IP MSVS_PROJECT_GUID
9859 The string
9860 placed in a generated Microsoft Visual Studio project file
9861 as the value of the
9862 .B ProjectGUID
9863 attribute.
9864 The string is also placed in the
9865 .B SolutionUniqueID
9866 attribute of the
9867 .B GlobalSection(SourceCodeControl)
9868 section of the Microsoft Visual Studio solution file.
9869 There is no default value.
9870
9871 .IP MSVS_SCC_AUX_PATH
9872 The path name
9873 placed in a generated Microsoft Visual Studio project file
9874 as the value of the
9875 .B SccAuxPath
9876 attribute
9877 if the
9878 .B MSVS_SCC_PROVIDER
9879 construction variable is also set.
9880 There is no default value.
9881
9882 .IP MSVS_SCC_LOCAL_PATH
9883 The path name
9884 placed in a generated Microsoft Visual Studio project file
9885 as the value of the
9886 .B SccLocalPath
9887 attribute
9888 if the
9889 .B MSVS_SCC_PROVIDER
9890 construction variable is also set.
9891 The path name is also placed in the
9892 .B SccLocalPath0
9893 and
9894 .B SccLocalPath1
9895 attributes of the
9896 .B GlobalSection(SourceCodeControl)
9897 section of the Microsoft Visual Studio solution file.
9898 There is no default value.
9899
9900 .IP MSVS_SCC_PROJECT_NAME
9901 The project name
9902 placed in a generated Microsoft Visual Studio project file
9903 as the value of the
9904 .B SccProjectName
9905 attribute.
9906 There is no default value.
9907
9908 .IP MSVS_SCC_PROVIDER
9909 The string
9910 placed in a generated Microsoft Visual Studio project file
9911 as the value of the
9912 .B SccProvider
9913 attribute.
9914 The string is also placed in the
9915 .B SccProvider1
9916 attribute of the
9917 .B GlobalSection(SourceCodeControl)
9918 section of the Microsoft Visual Studio solution file.
9919 There is no default value.
9920
9921 .IP MSVS_VERSION
9922 Sets the preferred version of Microsoft Visual Studio to use.
9923
9924 If $MSVS_VERSION is not set,
9925 &SCons; will (by default) select the latest version
9926 of Visual Studio installed on your system.
9927 So, if you have version 6 and version 7 (MSVS .NET) installed,
9928 it will prefer version 7.
9929 You can override this by
9930 specifying the
9931 .B MSVS_VERSION
9932 variable in the Environment initialization, setting it to the
9933 appropriate version ('6.0' or '7.0', for example).
9934 If the specified version isn't installed,
9935 tool initialization will fail.
9936
9937 This is obsolete: use $MSVC_VERSION instead. If $MSVS_VERSION is set and
9938 $MSVC_VERSION is not, $MSVC_VERSION will be set automatically to $MSVS_VERSION.
9939 If both are set to different values, scons will raise an error.
9940
9941 .IP MSVSBUILDCOM
9942 The build command line placed in
9943 a generated Microsoft Visual Studio project file.
9944 The default is to have Visual Studio invoke SCons with any specified
9945 build targets.
9946
9947 .IP MSVSCLEANCOM
9948 The clean command line placed in
9949 a generated Microsoft Visual Studio project file.
9950 The default is to have Visual Studio invoke SCons with the -c option
9951 to remove any specified targets.
9952
9953 .IP MSVSENCODING
9954 The encoding string placed in
9955 a generated Microsoft Visual Studio project file.
9956 The default is encoding
9957 .BR Windows-1252 .
9958
9959 .IP MSVSPROJECTCOM
9960 The action used to generate Microsoft Visual Studio project files.
9961
9962 .IP MSVSPROJECTSUFFIX
9963 The suffix used for Microsoft Visual Studio project (DSP) files.
9964 The default value is
9965 .B .vcproj
9966 when using Visual Studio version 7.x (.NET)
9967 or later version,
9968 and
9969 .B .dsp
9970 when using earlier versions of Visual Studio.
9971
9972 .IP MSVSREBUILDCOM
9973 The rebuild command line placed in
9974 a generated Microsoft Visual Studio project file.
9975 The default is to have Visual Studio invoke SCons with any specified
9976 rebuild targets.
9977
9978 .IP MSVSSCONS
9979 The SCons used in generated Microsoft Visual Studio project files.
9980 The default is the version of SCons being
9981 used to generate the project file.
9982
9983 .IP MSVSSCONSCOM
9984 The default SCons command used in generated Microsoft Visual Studio
9985 project files.
9986
9987 .IP MSVSSCONSCRIPT
9988 The sconscript file
9989 (that is,
9990 .B SConstruct
9991 or
9992 .B SConscript
9993 file)
9994 that will be invoked by Visual Studio
9995 project files
9996 (through the
9997 $MSVSSCONSCOM
9998 variable).
9999 The default is the same sconscript file
10000 that contains the call to
10001 .BR MSVSProject ()
10002 to build the project file.
10003
10004 .IP MSVSSCONSFLAGS
10005 The SCons flags used in generated Microsoft Visual Studio
10006 project files.
10007
10008 .IP MSVSSOLUTIONCOM
10009 The action used to generate Microsoft Visual Studio solution files.
10010
10011 .IP MSVSSOLUTIONSUFFIX
10012 The suffix used for Microsoft Visual Studio solution (DSW) files.
10013 The default value is
10014 .B .sln
10015 when using Visual Studio version 7.x (.NET),
10016 and
10017 .B .dsw
10018 when using earlier versions of Visual Studio.
10019
10020 .IP MWCW_VERSION
10021 The version number of the MetroWerks CodeWarrior C compiler
10022 to be used.
10023
10024 .IP MWCW_VERSIONS
10025 A list of installed versions of the MetroWerks CodeWarrior C compiler
10026 on this system.
10027
10028 .IP NAME
10029 Specfies the name of the project to package.
10030
10031 .IP no_import_lib
10032 When set to non-zero,
10033 suppresses creation of a corresponding Windows static import lib by the
10034 .B SharedLibrary
10035 builder when used with
10036 MinGW, Microsoft Visual Studio or Metrowerks.
10037 This also suppresses creation
10038 of an export (.exp) file
10039 when using Microsoft Visual Studio.
10040
10041 .IP OBJPREFIX
10042 The prefix used for (static) object file names.
10043
10044 .IP OBJSUFFIX
10045 The suffix used for (static) object file names.
10046
10047 .IP P4
10048 The Perforce executable.
10049
10050 .IP P4COM
10051 The command line used to
10052 fetch source files from Perforce.
10053
10054 .IP P4COMSTR
10055 The string displayed when
10056 fetching a source file from Perforce.
10057 If this is not set, then $P4COM (the command line) is displayed.
10058
10059 .IP P4FLAGS
10060 General options that are passed to Perforce.
10061
10062 .IP PACKAGEROOT
10063 Specifies the directory where all files in resulting archive will be
10064 placed if applicable. The default value is "$NAME-$VERSION".
10065
10066 .IP PACKAGETYPE
10067 Selects the package type to build. Currently these are available:
10068
10069 * msi - Microsoft Installer
10070 * rpm - Redhat Package Manger
10071 * ipkg - Itsy Package Management System
10072 * tarbz2 - compressed tar
10073 * targz - compressed tar
10074 * zip - zip file
10075 * src_tarbz2 - compressed tar source
10076 * src_targz - compressed tar source
10077 * src_zip - zip file source
10078
10079 This may be overridden with the "package_type" command line option.
10080
10081 .IP PACKAGEVERSION
10082 The version of the package (not the underlying project).
10083 This is currently only used by the rpm packager
10084 and should reflect changes in the packaging,
10085 not the underlying project code itself.
10086
10087 .IP PCH
10088 The Microsoft Visual C++ precompiled header that will be used when compiling
10089 object files. This variable is ignored by tools other than Microsoft Visual C++.
10090 When this variable is
10091 defined SCons will add options to the compiler command line to
10092 cause it to use the precompiled header, and will also set up the
10093 dependencies for the PCH file.
10094 Example:
10095
10096 .ES
10097 env['PCH'] = 'StdAfx.pch'
10098 .EE
10099
10100 .IP PCHCOM
10101 The command line used by the
10102 .BR PCH ()
10103 builder to generated a precompiled header.
10104
10105 .IP PCHCOMSTR
10106 The string displayed when generating a precompiled header.
10107 If this is not set, then $PCHCOM (the command line) is displayed.
10108
10109 .IP PCHPDBFLAGS
10110 A construction variable that, when expanded,
10111 adds the \fB/yD\fP flag to the command line
10112 only if the $PDB construction variable is set.
10113
10114 .IP PCHSTOP
10115 This variable specifies how much of a source file is precompiled. This
10116 variable is ignored by tools other than Microsoft Visual C++, or when
10117 the PCH variable is not being used. When this variable is define it
10118 must be a string that is the name of the header that
10119 is included at the end of the precompiled portion of the source files, or
10120 the empty string if the "#pragma hrdstop" construct is being used:
10121
10122 .ES
10123 env['PCHSTOP'] = 'StdAfx.h'
10124 .EE
10125
10126 .IP PDB
10127 The Microsoft Visual C++ PDB file that will store debugging information for
10128 object files, shared libraries, and programs. This variable is ignored by
10129 tools other than Microsoft Visual C++.
10130 When this variable is
10131 defined SCons will add options to the compiler and linker command line to
10132 cause them to generate external debugging information, and will also set up the
10133 dependencies for the PDB file.
10134 Example:
10135
10136 .ES
10137 env['PDB'] = 'hello.pdb'
10138 .EE
10139 .IP
10140 The Visual C++ compiler switch that SCons uses by default
10141 to generate PDB information is \fB/Z7\fP.
10142 This works correctly with parallel (\fB\-j\fP) builds
10143 because it embeds the debug information in the intermediate object files,
10144 as opposed to sharing a single PDB file between multiple object files.
10145 This is also the only way to get debug information
10146 embedded into a static library.
10147 Using the \fB/Zi\fP instead may yield improved
10148 link-time performance,
10149 although parallel builds will no longer work.
10150 You can generate PDB files with the \fB/Zi\fP
10151 switch by overriding the default $CCPDBFLAGS variable;
10152 see the entry for that variable for specific examples.
10153
10154 .IP PDFCOM
10155 A deprecated synonym for $DVIPDFCOM.
10156
10157 .IP PDFLATEX
10158 The &pdflatex; utility.
10159
10160 .IP PDFLATEXCOM
10161 The command line used to call the &pdflatex; utility.
10162
10163 .IP PDFLATEXCOMSTR
10164 The string displayed when calling the &pdflatex; utility.
10165 If this is not set, then $PDFLATEXCOM (the command line) is displayed.
10166
10167 .ES
10168 env = Environment(PDFLATEX;COMSTR = "Building $TARGET from LaTeX input $SOURCES" )
10169 .EE
10170
10171 .IP PDFLATEXFLAGS
10172 General options passed to the &pdflatex; utility.
10173
10174 .IP PDFPREFIX
10175 The prefix used for PDF file names.
10176
10177 .IP PDFSUFFIX
10178 The suffix used for PDF file names.
10179
10180 .IP PDFTEX
10181 The &pdftex; utility.
10182
10183 .IP PDFTEXCOM
10184 The command line used to call the &pdftex; utility.
10185
10186 .IP PDFTEXCOMSTR
10187 The string displayed when calling the &pdftex; utility.
10188 If this is not set, then $PDFTEXCOM (the command line) is displayed.
10189
10190 .ES
10191 env = Environment(PDFTEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
10192 .EE
10193
10194 .IP PDFTEXFLAGS
10195 General options passed to the &pdftex; utility.
10196
10197 .IP PKGCHK
10198 On Solaris systems,
10199 the package-checking program that will
10200 be used (along with $PKGINFO)
10201 to look for installed versions of
10202 the Sun PRO C++ compiler.
10203 The default is
10204 .BR /usr/sbin/pgkchk .
10205
10206 .IP PKGINFO
10207 On Solaris systems,
10208 the package information program that will
10209 be used (along with $PKGCHK)
10210 to look for installed versions of
10211 the Sun PRO C++ compiler.
10212 The default is
10213 .BR pkginfo .
10214
10215 .IP PLATFORM
10216 The name of the platform used to create the Environment. If no platform is
10217 specified when the Environment is created,
10218 .B scons
10219 autodetects the platform.
10220
10221 .ES
10222 env = Environment(tools = [])
10223 if env['PLATFORM'] == 'cygwin':
10224 Tool('mingw')(env)
10225 else:
10226 Tool('msvc')(env)
10227 .EE
10228
10229 .IP PRINT_CMD_LINE_FUNC
10230 A Python function used to print the command lines as they are executed
10231 (assuming command printing is not disabled by the
10232 .B \-q
10233 or
10234 .B \-s
10235 options or their equivalents).
10236 The function should take four arguments:
10237 .IR s ,
10238 the command being executed (a string),
10239 .IR target ,
10240 the target being built (file node, list, or string name(s)),
10241 .IR source ,
10242 the source(s) used (file node, list, or string name(s)), and
10243 .IR env ,
10244 the environment being used.
10245
10246 The function must do the printing itself. The default implementation,
10247 used if this variable is not set or is None, is:
10248 .ES
10249 def print_cmd_line(s, target, source, env):
10250 sys.stdout.write(s + "\\n")
10251 .EE
10252 .IP
10253 Here's an example of a more interesting function:
10254
10255 .ES
10256 def print_cmd_line(s, target, source, env):
10257 sys.stdout.write("Building %s -> %s...\\n" %
10258 (' and '.join([str(x) for x in source]),
10259 ' and '.join([str(x) for x in target])))
10260 env=Environment(PRINT_CMD_LINE_FUNC=print_cmd_line)
10261 env.Program('foo', 'foo.c')
10262 .EE
10263 .IP
10264 This just prints "Building \fItargetname\fP from \fIsourcename\fP..." instead
10265 of the actual commands.
10266 Such a function could also log the actual commands to a log file,
10267 for example.
10268
10269 .IP PROGPREFIX
10270 The prefix used for executable file names.
10271
10272 .IP PROGSUFFIX
10273 The suffix used for executable file names.
10274
10275 .IP PSCOM
10276 The command line used to convert TeX DVI files into a PostScript file.
10277
10278 .IP PSCOMSTR
10279 The string displayed when a TeX DVI file
10280 is converted into a PostScript file.
10281 If this is not set, then $PSCOM (the command line) is displayed.
10282
10283 .IP PSPREFIX
10284 The prefix used for PostScript file names.
10285
10286 .IP PSSUFFIX
10287 The prefix used for PostScript file names.
10288
10289 .IP QT_AUTOSCAN
10290 Turn off scanning for mocable files. Use the Moc Builder to explicitly
10291 specify files to run moc on.
10292
10293 .IP QT_BINPATH
10294 The path where the qt binaries are installed.
10295 The default value is '$QTDIR/bin'.
10296
10297 .IP QT_CPPPATH
10298 The path where the qt header files are installed.
10299 The default value is '$QTDIR/include'.
10300 Note: If you set this variable to None,
10301 the tool won't change the $CPPPATH
10302 construction variable.
10303
10304 .IP QT_DEBUG
10305 Prints lots of debugging information while scanning for moc files.
10306
10307 .IP QT_LIB
10308 Default value is 'qt'. You may want to set this to 'qt-mt'. Note: If you set
10309 this variable to None, the tool won't change the $LIBS variable.
10310
10311 .IP QT_LIBPATH
10312 The path where the qt libraries are installed.
10313 The default value is '$QTDIR/lib'.
10314 Note: If you set this variable to None,
10315 the tool won't change the $LIBPATH
10316 construction variable.
10317
10318 .IP QT_MOC
10319 Default value is '$QT_BINPATH/moc'.
10320
10321 .IP QT_MOCCXXPREFIX
10322 Default value is ''. Prefix for moc output files, when source is a cxx file.
10323
10324 .IP QT_MOCCXXSUFFIX
10325 Default value is '.moc'. Suffix for moc output files, when source is a cxx
10326 file.
10327
10328 .IP QT_MOCFROMCXXCOM
10329 Command to generate a moc file from a cpp file.
10330
10331 .IP QT_MOCFROMCXXCOMSTR
10332 The string displayed when generating a moc file from a cpp file.
10333 If this is not set, then $QT_MOCFROMCXXCOM (the command line) is displayed.
10334
10335 .IP QT_MOCFROMCXXFLAGS
10336 Default value is '-i'. These flags are passed to moc, when moccing a
10337 C++ file.
10338
10339 .IP QT_MOCFROMHCOM
10340 Command to generate a moc file from a header.
10341
10342 .IP QT_MOCFROMHCOMSTR
10343 The string displayed when generating a moc file from a cpp file.
10344 If this is not set, then $QT_MOCFROMHCOM (the command line) is displayed.
10345
10346 .IP QT_MOCFROMHFLAGS
10347 Default value is ''. These flags are passed to moc, when moccing a header
10348 file.
10349
10350 .IP QT_MOCHPREFIX
10351 Default value is 'moc_'. Prefix for moc output files, when source is a header.
10352
10353 .IP QT_MOCHSUFFIX
10354 Default value is '$CXXFILESUFFIX'. Suffix for moc output files, when source is
10355 a header.
10356
10357 .IP QT_UIC
10358 Default value is '$QT_BINPATH/uic'.
10359
10360 .IP QT_UICCOM
10361 Command to generate header files from .ui files.
10362
10363 .IP QT_UICCOMSTR
10364 The string displayed when generating header files from .ui files.
10365 If this is not set, then $QT_UICCOM (the command line) is displayed.
10366
10367 .IP QT_UICDECLFLAGS
10368 Default value is ''. These flags are passed to uic, when creating a a h
10369 file from a .ui file.
10370
10371 .IP QT_UICDECLPREFIX
10372 Default value is ''. Prefix for uic generated header files.
10373
10374 .IP QT_UICDECLSUFFIX
10375 Default value is '.h'. Suffix for uic generated header files.
10376
10377 .IP QT_UICIMPLFLAGS
10378 Default value is ''. These flags are passed to uic, when creating a cxx
10379 file from a .ui file.
10380
10381 .IP QT_UICIMPLPREFIX
10382 Default value is 'uic_'. Prefix for uic generated implementation files.
10383
10384 .IP QT_UICIMPLSUFFIX
10385 Default value is '$CXXFILESUFFIX'. Suffix for uic generated implementation
10386 files.
10387
10388 .IP QT_UISUFFIX
10389 Default value is '.ui'. Suffix of designer input files.
10390
10391 .IP QTDIR
10392 The qt tool tries to take this from os.environ.
10393 It also initializes all QT_*
10394 construction variables listed below.
10395 (Note that all paths are constructed
10396 with python's os.path.join() method,
10397 but are listed here with the '/' separator
10398 for easier reading.)
10399 In addition, the construction environment
10400 variables $CPPPATH,
10401 $LIBPATH and
10402 $LIBS may be modified
10403 and the variables
10404 PROGEMITTER, SHLIBEMITTER and LIBEMITTER
10405 are modified. Because the build-performance is affected when using this tool,
10406 you have to explicitly specify it at Environment creation:
10407
10408 .ES
10409 Environment(tools=['default','qt'])
10410 .EE
10411 .IP
10412 The qt tool supports the following operations:
10413
10414 .I "Automatic moc file generation from header files."
10415 You do not have to specify moc files explicitly, the tool does it for you.
10416 However, there are a few preconditions to do so: Your header file must have
10417 the same filebase as your implementation file and must stay in the same
10418 directory. It must have one of the suffixes .h, .hpp, .H, .hxx, .hh. You
10419 can turn off automatic moc file generation by setting QT_AUTOSCAN to 0.
10420 See also the corresponding builder method
10421 .B Moc()
10422
10423 .I "Automatic moc file generation from cxx files."
10424 As stated in the qt documentation, include the moc file at the end of
10425 the cxx file. Note that you have to include the file, which is generated
10426 by the transformation ${QT_MOCCXXPREFIX}<basename>${QT_MOCCXXSUFFIX}, by default
10427 <basename>.moc. A warning is generated after building the moc file, if you
10428 do not include the correct file. If you are using VariantDir, you may
10429 need to specify duplicate=1. You can turn off automatic moc file generation
10430 by setting QT_AUTOSCAN to 0. See also the corresponding
10431 .BR Moc ()
10432 builder method.
10433
10434 .I "Automatic handling of .ui files."
10435 The implementation files generated from .ui files are handled much the same
10436 as yacc or lex files. Each .ui file given as a source of Program, Library or
10437 SharedLibrary will generate three files, the declaration file, the
10438 implementation file and a moc file. Because there are also generated headers,
10439 you may need to specify duplicate=1 in calls to VariantDir.
10440 See also the corresponding
10441 .BR Uic ()
10442 builder method.
10443
10444 .IP RANLIB
10445 The archive indexer.
10446
10447 .IP RANLIBCOM
10448 The command line used to index a static library archive.
10449
10450 .IP RANLIBCOMSTR
10451 The string displayed when a static library archive is indexed.
10452 If this is not set, then $RANLIBCOM (the command line) is displayed.
10453
10454 .ES
10455 env = Environment(RANLIBCOMSTR = "Indexing $TARGET")
10456 .EE
10457
10458 .IP RANLIBFLAGS
10459 General options passed to the archive indexer.
10460
10461 .IP RC
10462 The resource compiler used to build
10463 a Microsoft Visual C++ resource file.
10464
10465 .IP RCCOM
10466 The command line used to build
10467 a Microsoft Visual C++ resource file.
10468
10469 .IP RCCOMSTR
10470 The string displayed when invoking the resource compiler
10471 to build a Microsoft Visual C++ resource file.
10472 If this is not set, then $RCCOM (the command line) is displayed.
10473
10474 .IP RCFLAGS
10475 The flags passed to the resource compiler by the RES builder.
10476
10477 .IP RCINCFLAGS
10478 An automatically-generated construction variable
10479 containing the command-line options
10480 for specifying directories to be searched
10481 by the resource compiler.
10482 The value of $RCINCFLAGS is created
10483 by appending $RCINCPREFIX and $RCINCSUFFIX
10484 to the beginning and end
10485 of each directory in $CPPPATH.
10486
10487 .IP RCINCPREFIX
10488 The prefix (flag) used to specify an include directory
10489 on the resource compiler command line.
10490 This will be appended to the beginning of each directory
10491 in the $CPPPATH construction variable
10492 when the $RCINCFLAGS variable is expanded.
10493
10494 .IP RCINCSUFFIX
10495 The suffix used to specify an include directory
10496 on the resource compiler command line.
10497 This will be appended to the end of each directory
10498 in the $CPPPATH construction variable
10499 when the $RCINCFLAGS variable is expanded.
10500
10501 .IP RCS
10502 The RCS executable.
10503 Note that this variable is not actually used
10504 for the command to fetch source files from RCS;
10505 see the
10506 $RCS_CO
10507 construction variable, below.
10508
10509 .IP RCS_CO
10510 The RCS "checkout" executable,
10511 used to fetch source files from RCS.
10512
10513 .IP RCS_COCOM
10514 The command line used to
10515 fetch (checkout) source files from RCS.
10516
10517 .IP RCS_COCOMSTR
10518 The string displayed when fetching
10519 a source file from RCS.
10520 If this is not set, then $RCS_COCOM
10521 (the command line) is displayed.
10522
10523 .IP RCS_COFLAGS
10524 Options that are passed to the $RCS_CO command.
10525
10526 .IP RDirs
10527 A function that converts a string into a list of Dir instances by
10528 searching the repositories.
10529
10530 .IP REGSVR
10531 The program used on Windows systems
10532 to register a newly-built DLL library
10533 whenever the \fBSharedLibrary\fP() builder
10534 is passed a keyword argument of \fBregister=1\fP.
10535
10536 .IP REGSVRCOM
10537 The command line used on Windows systems
10538 to register a newly-built DLL library
10539 whenever the \fBSharedLibrary\fP() builder
10540 is passed a keyword argument of \fBregister=1\fP.
10541
10542 .IP REGSVRCOMSTR
10543 The string displayed when registering a newly-built DLL file.
10544 If this is not set, then $REGSVRCOM (the command line) is displayed.
10545
10546 .IP REGSVRFLAGS
10547 Flags passed to the DLL registration program
10548 on Windows systems when a newly-built DLL library is registered.
10549 By default,
10550 this includes the \fB/s\fP
10551 that prevents dialog boxes from popping up
10552 and requiring user attention.
10553
10554 .IP RMIC
10555 The Java RMI stub compiler.
10556
10557 .IP RMICCOM
10558 The command line used to compile stub
10559 and skeleton class files
10560 from Java classes that contain RMI implementations.
10561 Any options specified in the $RMICFLAGS construction variable
10562 are included on this command line.
10563
10564 .IP RMICCOMSTR
10565 The string displayed when compiling
10566 stub and skeleton class files
10567 from Java classes that contain RMI implementations.
10568 If this is not set, then $RMICCOM (the command line) is displayed.
10569
10570 .ES
10571 env = Environment(RMICCOMSTR = "Generating stub/skeleton class files $TARGETS fr om $SOURCES")
10572 .EE
10573
10574 .IP RMICFLAGS
10575 General options passed to the Java RMI stub compiler.
10576
10577 .IP _RPATH
10578 An automatically-generated construction variable
10579 containing the rpath flags to be used when linking
10580 a program with shared libraries.
10581 The value of $_RPATH is created
10582 by appending $RPATHPREFIX and $RPATHSUFFIX
10583 to the beginning and end
10584 of each directory in $RPATH.
10585
10586 .IP RPATH
10587 A list of paths to search for shared libraries when running programs.
10588 Currently only used in the GNU (gnulink),
10589 IRIX (sgilink) and Sun (sunlink) linkers.
10590 Ignored on platforms and toolchains that don't support it.
10591 Note that the paths added to RPATH
10592 are not transformed by
10593 .B scons
10594 in any way: if you want an absolute
10595 path, you must make it absolute yourself.
10596
10597 .IP RPATHPREFIX
10598 The prefix used to specify a directory to be searched for
10599 shared libraries when running programs.
10600 This will be appended to the beginning of each directory
10601 in the $RPATH construction variable
10602 when the $_RPATH variable is automatically generated.
10603
10604 .IP RPATHSUFFIX
10605 The suffix used to specify a directory to be searched for
10606 shared libraries when running programs.
10607 This will be appended to the end of each directory
10608 in the $RPATH construction variable
10609 when the $_RPATH variable is automatically generated.
10610
10611 .IP RPCGEN
10612 The RPC protocol compiler.
10613
10614 .IP RPCGENCLIENTFLAGS
10615 Options passed to the RPC protocol compiler
10616 when generating client side stubs.
10617 These are in addition to any flags specified in the
10618 $RPCGENFLAGS
10619 construction variable.
10620
10621 .IP RPCGENFLAGS
10622 General options passed to the RPC protocol compiler.
10623
10624 .IP RPCGENHEADERFLAGS
10625 Options passed to the RPC protocol compiler
10626 when generating a header file.
10627 These are in addition to any flags specified in the
10628 $RPCGENFLAGS
10629 construction variable.
10630
10631 .IP RPCGENSERVICEFLAGS
10632 Options passed to the RPC protocol compiler
10633 when generating server side stubs.
10634 These are in addition to any flags specified in the
10635 $RPCGENFLAGS
10636 construction variable.
10637
10638 .IP RPCGENXDRFLAGS
10639 Options passed to the RPC protocol compiler
10640 when generating XDR routines.
10641 These are in addition to any flags specified in the
10642 $RPCGENFLAGS
10643 construction variable.
10644
10645 .IP SCANNERS
10646 A list of the available implicit dependency scanners.
10647 New file scanners may be added by
10648 appending to this list,
10649 although the more flexible approach
10650 is to associate scanners
10651 with a specific Builder.
10652 See the sections "Builder Objects"
10653 and "Scanner Objects,"
10654 below, for more information.
10655
10656 .IP SCCS
10657 The SCCS executable.
10658
10659 .IP SCCSCOM
10660 The command line used to
10661 fetch source files from SCCS.
10662
10663 .IP SCCSCOMSTR
10664 The string displayed when fetching
10665 a source file from a CVS repository.
10666 If this is not set, then $SCCSCOM
10667 (the command line) is displayed.
10668
10669 .IP SCCSFLAGS
10670 General options that are passed to SCCS.
10671
10672 .IP SCCSGETFLAGS
10673 Options that are passed specifically to the SCCS "get" subcommand.
10674 This can be set, for example, to
10675 .B \-e
10676 to check out editable files from SCCS.
10677
10678 .IP SCONS_HOME
10679 The (optional) path to the SCons library directory,
10680 initialized from the external environment.
10681 If set, this is used to construct a shorter and more
10682 efficient search path in the
10683 $MSVSSCONS
10684 command line executed
10685 from Microsoft Visual Studio project files.
10686
10687 .IP SHCC
10688 The C compiler used for generating shared-library objects.
10689
10690 .IP SHCCCOM
10691 The command line used to compile a C source file
10692 to a shared-library object file.
10693 Any options specified in the $SHCFLAGS,
10694 $SHCCFLAGS and
10695 $CPPFLAGS construction variables
10696 are included on this command line.
10697
10698 .IP SHCCCOMSTR
10699 The string displayed when a C source file
10700 is compiled to a shared object file.
10701 If this is not set, then $SHCCCOM (the command line) is displayed.
10702
10703 .ES
10704 env = Environment(SHCCCOMSTR = "Compiling shared object $TARGET")
10705 .EE
10706
10707 .IP SHCCFLAGS
10708 Options that are passed to the C and C++ compilers
10709 to generate shared-library objects.
10710
10711 .IP SHCFLAGS
10712 Options that are passed to the C compiler (only; not C++)
10713 to generate shared-library objects.
10714
10715 .IP SHCXX
10716 The C++ compiler used for generating shared-library objects.
10717
10718 .IP SHCXXCOM
10719 The command line used to compile a C++ source file
10720 to a shared-library object file.
10721 Any options specified in the $SHCXXFLAGS and
10722 $CPPFLAGS construction variables
10723 are included on this command line.
10724
10725 .IP SHCXXCOMSTR
10726 The string displayed when a C++ source file
10727 is compiled to a shared object file.
10728 If this is not set, then $SHCXXCOM (the command line) is displayed.
10729
10730 .ES
10731 env = Environment(SHCXXCOMSTR = "Compiling shared object $TARGET")
10732 .EE
10733
10734 .IP SHCXXFLAGS
10735 Options that are passed to the C++ compiler
10736 to generate shared-library objects.
10737
10738 .IP SHELL
10739 A string naming the shell program that will be passed to the
10740 $SPAWN
10741 function.
10742 See the
10743 $SPAWN
10744 construction variable for more information.
10745
10746 .IP SHF77
10747 The Fortran 77 compiler used for generating shared-library objects.
10748 You should normally set the $SHFORTRAN variable,
10749 which specifies the default Fortran compiler
10750 for all Fortran versions.
10751 You only need to set $SHF77 if you need to use a specific compiler
10752 or compiler version for Fortran 77 files.
10753
10754 .IP SHF77COM
10755 The command line used to compile a Fortran 77 source file
10756 to a shared-library object file.
10757 You only need to set $SHF77COM if you need to use a specific
10758 command line for Fortran 77 files.
10759 You should normally set the $SHFORTRANCOM variable,
10760 which specifies the default command line
10761 for all Fortran versions.
10762
10763 .IP SHF77COMSTR
10764 The string displayed when a Fortran 77 source file
10765 is compiled to a shared-library object file.
10766 If this is not set, then $SHF77COM or $SHFORTRANCOM
10767 (the command line) is displayed.
10768
10769 .IP SHF77FLAGS
10770 Options that are passed to the Fortran 77 compiler
10771 to generated shared-library objects.
10772 You only need to set $SHF77FLAGS if you need to define specific
10773 user options for Fortran 77 files.
10774 You should normally set the $SHFORTRANFLAGS variable,
10775 which specifies the user-specified options
10776 passed to the default Fortran compiler
10777 for all Fortran versions.
10778
10779 .IP SHF77PPCOM
10780 The command line used to compile a Fortran 77 source file to a
10781 shared-library object file
10782 after first running the file through the C preprocessor.
10783 Any options specified in the $SHF77FLAGS and $CPPFLAGS construction variables
10784 are included on this command line.
10785 You only need to set $SHF77PPCOM if you need to use a specific
10786 C-preprocessor command line for Fortran 77 files.
10787 You should normally set the $SHFORTRANPPCOM variable,
10788 which specifies the default C-preprocessor command line
10789 for all Fortran versions.
10790
10791 .IP SHF77PPCOMSTR
10792 The string displayed when a Fortran 77 source file
10793 is compiled to a shared-library object file
10794 after first running the file through the C preprocessor.
10795 If this is not set, then $SHF77PPCOM or $SHFORTRANPPCOM
10796 (the command line) is displayed.
10797
10798 .IP SHF90
10799 The Fortran 90 compiler used for generating shared-library objects.
10800 You should normally set the $SHFORTRAN variable,
10801 which specifies the default Fortran compiler
10802 for all Fortran versions.
10803 You only need to set $SHF90 if you need to use a specific compiler
10804 or compiler version for Fortran 90 files.
10805
10806 .IP SHF90COM
10807 The command line used to compile a Fortran 90 source file
10808 to a shared-library object file.
10809 You only need to set $SHF90COM if you need to use a specific
10810 command line for Fortran 90 files.
10811 You should normally set the $SHFORTRANCOM variable,
10812 which specifies the default command line
10813 for all Fortran versions.
10814
10815 .IP SHF90COMSTR
10816 The string displayed when a Fortran 90 source file
10817 is compiled to a shared-library object file.
10818 If this is not set, then $SHF90COM or $SHFORTRANCOM
10819 (the command line) is displayed.
10820
10821 .IP SHF90FLAGS
10822 Options that are passed to the Fortran 90 compiler
10823 to generated shared-library objects.
10824 You only need to set $SHF90FLAGS if you need to define specific
10825 user options for Fortran 90 files.
10826 You should normally set the $SHFORTRANFLAGS variable,
10827 which specifies the user-specified options
10828 passed to the default Fortran compiler
10829 for all Fortran versions.
10830
10831 .IP SHF90PPCOM
10832 The command line used to compile a Fortran 90 source file to a
10833 shared-library object file
10834 after first running the file through the C preprocessor.
10835 Any options specified in the $SHF90FLAGS and $CPPFLAGS construction variables
10836 are included on this command line.
10837 You only need to set $SHF90PPCOM if you need to use a specific
10838 C-preprocessor command line for Fortran 90 files.
10839 You should normally set the $SHFORTRANPPCOM variable,
10840 which specifies the default C-preprocessor command line
10841 for all Fortran versions.
10842
10843 .IP SHF90PPCOMSTR
10844 The string displayed when a Fortran 90 source file
10845 is compiled to a shared-library object file
10846 after first running the file through the C preprocessor.
10847 If this is not set, then $SHF90PPCOM or $SHFORTRANPPCOM
10848 (the command line) is displayed.
10849
10850 .IP SHF95
10851 The Fortran 95 compiler used for generating shared-library objects.
10852 You should normally set the $SHFORTRAN variable,
10853 which specifies the default Fortran compiler
10854 for all Fortran versions.
10855 You only need to set $SHF95 if you need to use a specific compiler
10856 or compiler version for Fortran 95 files.
10857
10858 .IP SHF95COM
10859 The command line used to compile a Fortran 95 source file
10860 to a shared-library object file.
10861 You only need to set $SHF95COM if you need to use a specific
10862 command line for Fortran 95 files.
10863 You should normally set the $SHFORTRANCOM variable,
10864 which specifies the default command line
10865 for all Fortran versions.
10866
10867 .IP SHF95COMSTR
10868 The string displayed when a Fortran 95 source file
10869 is compiled to a shared-library object file.
10870 If this is not set, then $SHF95COM or $SHFORTRANCOM
10871 (the command line) is displayed.
10872
10873 .IP SHF95FLAGS
10874 Options that are passed to the Fortran 95 compiler
10875 to generated shared-library objects.
10876 You only need to set $SHF95FLAGS if you need to define specific
10877 user options for Fortran 95 files.
10878 You should normally set the $SHFORTRANFLAGS variable,
10879 which specifies the user-specified options
10880 passed to the default Fortran compiler
10881 for all Fortran versions.
10882
10883 .IP SHF95PPCOM
10884 The command line used to compile a Fortran 95 source file to a
10885 shared-library object file
10886 after first running the file through the C preprocessor.
10887 Any options specified in the $SHF95FLAGS and $CPPFLAGS construction variables
10888 are included on this command line.
10889 You only need to set $SHF95PPCOM if you need to use a specific
10890 C-preprocessor command line for Fortran 95 files.
10891 You should normally set the $SHFORTRANPPCOM variable,
10892 which specifies the default C-preprocessor command line
10893 for all Fortran versions.
10894
10895 .IP SHF95PPCOMSTR
10896 The string displayed when a Fortran 95 source file
10897 is compiled to a shared-library object file
10898 after first running the file through the C preprocessor.
10899 If this is not set, then $SHF95PPCOM or $SHFORTRANPPCOM
10900 (the command line) is displayed.
10901
10902 .IP SHFORTRAN
10903 The default Fortran compiler used for generating shared-library objects.
10904
10905 .IP SHFORTRANCOM
10906 The command line used to compile a Fortran source file
10907 to a shared-library object file.
10908
10909 .IP SHFORTRANCOMSTR
10910 The string displayed when a Fortran source file
10911 is compiled to a shared-library object file.
10912 If this is not set, then $SHFORTRANCOM
10913 (the command line) is displayed.
10914
10915 .IP SHFORTRANFLAGS
10916 Options that are passed to the Fortran compiler
10917 to generate shared-library objects.
10918
10919 .IP SHFORTRANPPCOM
10920 The command line used to compile a Fortran source file to a
10921 shared-library object file
10922 after first running the file through the C preprocessor.
10923 Any options specified
10924 in the $SHFORTRANFLAGS and
10925 $CPPFLAGS construction variables
10926 are included on this command line.
10927
10928 .IP SHFORTRANPPCOMSTR
10929 The string displayed when a Fortran source file
10930 is compiled to a shared-library object file
10931 after first running the file through the C preprocessor.
10932 If this is not set, then $SHFORTRANPPCOM
10933 (the command line) is displayed.
10934
10935 .IP SHLIBPREFIX
10936 The prefix used for shared library file names.
10937
10938 .IP SHLIBSUFFIX
10939 The suffix used for shared library file names.
10940
10941 .IP SHLINK
10942 The linker for programs that use shared libraries.
10943
10944 .IP SHLINKCOM
10945 The command line used to link programs using shared libraries.
10946
10947 .IP SHLINKCOMSTR
10948 The string displayed when programs using shared libraries are linked.
10949 If this is not set, then $SHLINKCOM (the command line) is displayed.
10950
10951 .ES
10952 env = Environment(SHLINKCOMSTR = "Linking shared $TARGET")
10953 .EE
10954
10955 .IP SHLINKFLAGS
10956 General user options passed to the linker for programs using shared libraries.
10957 Note that this variable should
10958 .I not
10959 contain
10960 .B \-l
10961 (or similar) options for linking with the libraries listed in $LIBS,
10962 nor
10963 .B \-L
10964 (or similar) include search path options
10965 that scons generates automatically from $LIBPATH.
10966 See
10967 $_LIBFLAGS
10968 above,
10969 for the variable that expands to library-link options,
10970 and
10971 $_LIBDIRFLAGS
10972 above,
10973 for the variable that expands to library search path options.
10974
10975 .IP SHOBJPREFIX
10976 The prefix used for shared object file names.
10977
10978 .IP SHOBJSUFFIX
10979 The suffix used for shared object file names.
10980
10981 .IP SOURCE
10982 A reserved variable name
10983 that may not be set or used in a construction environment.
10984 (See "Variable Substitution," below.)
10985
10986 .IP SOURCE_URL
10987 The URL
10988 (web address)
10989 of the location from which the project was retrieved.
10990 This is used to fill in the
10991 .B Source:
10992 field in the controlling information for Ipkg and RPM packages.
10993
10994 .IP SOURCES
10995 A reserved variable name
10996 that may not be set or used in a construction environment.
10997 (See "Variable Substitution," below.)
10998
10999 .IP SPAWN
11000 A command interpreter function that will be called to execute command line
11001 strings. The function must expect the following arguments:
11002
11003 .ES
11004 def spawn(shell, escape, cmd, args, env):
11005 .EE
11006 .IP
11007 .I sh
11008 is a string naming the shell program to use.
11009 .I escape
11010 is a function that can be called to escape shell special characters in
11011 the command line.
11012 .I cmd
11013 is the path to the command to be executed.
11014 .I args
11015 is the arguments to the command.
11016 .I env
11017 is a dictionary of the environment variables
11018 in which the command should be executed.
11019
11020 .IP SUBST_DICT
11021 The dictionary used by the \fBSubstfile\fP() or \fBTextfile\fP() builders
11022 for substitution values.
11023 It can be anything acceptable to the dict() constructor,
11024 so in addition to a dictionary,
11025 lists of tuples are also acceptable.
11026
11027 .IP SUBSTFILEPREFIX
11028 The prefix used for \fBSubstfile\fP() file names,
11029 the null string by default.
11030
11031 .IP SUBSTFILESUFFIX
11032 The suffix used for \fBSubstfile\fP() file names,
11033 the null string by default.
11034
11035 .IP SUMMARY
11036 A short summary of what the project is about.
11037 This is used to fill in the
11038 .B Summary:
11039 field in the controlling information for Ipkg and RPM packages,
11040 and as the
11041 .B Description:
11042 field in MSI packages.
11043
11044 .IP SWIG
11045 The scripting language wrapper and interface generator.
11046
11047 .IP SWIGCFILESUFFIX
11048 The suffix that will be used for intermediate C
11049 source files generated by
11050 the scripting language wrapper and interface generator.
11051 The default value is
11052 .BR _wrap $CFILESUFFIX.
11053 By default, this value is used whenever the
11054 .B \-c++
11055 option is
11056 .I not
11057 specified as part of the
11058 $SWIGFLAGS
11059 construction variable.
11060
11061 .IP SWIGCOM
11062 The command line used to call
11063 the scripting language wrapper and interface generator.
11064
11065 .IP SWIGCOMSTR
11066 The string displayed when calling
11067 the scripting language wrapper and interface generator.
11068 If this is not set, then $SWIGCOM (the command line) is displayed.
11069
11070 .IP SWIGCXXFILESUFFIX
11071 The suffix that will be used for intermediate C++
11072 source files generated by
11073 the scripting language wrapper and interface generator.
11074 The default value is
11075 .BR _wrap $CFILESUFFIX.
11076 By default, this value is used whenever the
11077 .B \-c++
11078 option is specified as part of the
11079 $SWIGFLAGS
11080 construction variable.
11081
11082 .IP SWIGDIRECTORSUFFIX
11083 The suffix that will be used for intermediate C++ header
11084 files generated by the scripting language wrapper and interface generator.
11085 These are only generated for C++ code when the SWIG 'directors' feature is
11086 turned on.
11087 The default value is
11088 .BR _wrap.h .
11089
11090 .IP SWIGFLAGS
11091 General options passed to
11092 the scripting language wrapper and interface generator.
11093 This is where you should set
11094 .BR \-python ,
11095 .BR \-perl5 ,
11096 .BR \-tcl ,
11097 or whatever other options you want to specify to SWIG.
11098 If you set the
11099 .B \-c++
11100 option in this variable,
11101 .B scons
11102 will, by default,
11103 generate a C++ intermediate source file
11104 with the extension that is specified as the
11105 $CXXFILESUFFIX
11106 variable.
11107
11108 .IP _SWIGINCFLAGS
11109 An automatically-generated construction variable
11110 containing the SWIG command-line options
11111 for specifying directories to be searched for included files.
11112 The value of $_SWIGINCFLAGS is created
11113 by appending $SWIGINCPREFIX and $SWIGINCSUFFIX
11114 to the beginning and end
11115 of each directory in $SWIGPATH.
11116
11117 .IP SWIGINCPREFIX
11118 The prefix used to specify an include directory on the SWIG command line.
11119 This will be appended to the beginning of each directory
11120 in the $SWIGPATH construction variable
11121 when the $_SWIGINCFLAGS variable is automatically generated.
11122
11123 .IP SWIGINCSUFFIX
11124 The suffix used to specify an include directory on the SWIG command line.
11125 This will be appended to the end of each directory
11126 in the $SWIGPATH construction variable
11127 when the $_SWIGINCFLAGS variable is automatically generated.
11128
11129 .IP SWIGOUTDIR
11130 Specifies the output directory in which
11131 the scripting language wrapper and interface generator
11132 should place generated language-specific files.
11133 This will be used by SCons to identify
11134 the files that will be generated by the &swig; call,
11135 and translated into the
11136 \fBswig -outdir\fP option on the command line.
11137
11138 .IP SWIGPATH
11139 The list of directories that the scripting language wrapper
11140 and interface generate will search for included files.
11141 The SWIG implicit dependency scanner will search these
11142 directories for include files.
11143 The default is to use the same path
11144 specified as $CPPPATH.
11145
11146 Don't explicitly put include directory
11147 arguments in SWIGFLAGS;
11148 the result will be non-portable
11149 and the directories will not be searched by the dependency scanner.
11150 Note: directory names in SWIGPATH will be looked-up relative to the SConscript
11151 directory when they are used in a command.
11152 To force
11153 .B scons
11154 to look-up a directory relative to the root of the source tree use #:
11155
11156 .ES
11157 env = Environment(SWIGPATH='#/include')
11158 .EE
11159 .IP
11160 The directory look-up can also be forced using the
11161 .BR Dir ()
11162 function:
11163
11164 .ES
11165 include = Dir('include')
11166 env = Environment(SWIGPATH=include)
11167 .EE
11168 .IP
11169 The directory list will be added to command lines
11170 through the automatically-generated
11171 $_SWIGINCFLAGS
11172 construction variable,
11173 which is constructed by
11174 appending the values of the
11175 $SWIGINCPREFIX and $SWIGINCSUFFIX
11176 construction variables
11177 to the beginning and end
11178 of each directory in $SWIGPATH.
11179 Any command lines you define that need
11180 the SWIGPATH directory list should
11181 include $_SWIGINCFLAGS:
11182
11183 .ES
11184 env = Environment(SWIGCOM="my_swig -o $TARGET $_SWIGINCFLAGS $SORUCES")
11185 .EE
11186
11187 .IP SWIGVERSION
11188 The version number of the SWIG tool.
11189
11190 .IP TAR
11191 The tar archiver.
11192
11193 .IP TARCOM
11194 The command line used to call the tar archiver.
11195
11196 .IP TARCOMSTR
11197 The string displayed when archiving files
11198 using the tar archiver.
11199 If this is not set, then $TARCOM (the command line) is displayed.
11200
11201 .ES
11202 env = Environment(TARCOMSTR = "Archiving $TARGET")
11203 .EE
11204
11205 .IP TARFLAGS
11206 General options passed to the tar archiver.
11207
11208 .IP TARGET
11209 A reserved variable name
11210 that may not be set or used in a construction environment.
11211 (See "Variable Substitution," below.)
11212
11213 .IP TARGET_ARCH
11214 Sets the target architecture for Visual Studio compiler (i.e. the arch
11215 of the binaries generated by the compiler). If not set, default to
11216 $HOST_ARCH, or, if that is unset, to the architecture of the
11217 running machine's OS (note that the python build or architecture has no
11218 effect).
11219 This variable must be passed as an argument to the Environment()
11220 constructor; setting it later has no effect.
11221 This is currently only used on Windows, but in the future it will be
11222 used on other OSes as well.
11223
11224 Valid values for Windows are
11225 .BR x86 ,
11226 .B i386
11227 (for 32 bits);
11228 .BR amd64 ,
11229 .BR emt64 ,
11230 .B x86_64
11231 (for 64 bits);
11232 and \fBia64\fP (Itanium).
11233 For example, if you want to compile 64-bit binaries, you would set
11234 \fBTARGET_ARCH='x86_64'\fP in your SCons environment.
11235
11236 .IP TARGET_OS
11237 The name of the target operating system for the compiled objects
11238 created by this Environment.
11239 This defaults to the value of HOST_OS, and the user can override it.
11240 Currently only set for Win32.
11241
11242 .IP TARGETS
11243 A reserved variable name
11244 that may not be set or used in a construction environment.
11245 (See "Variable Substitution," below.)
11246
11247 .IP TARSUFFIX
11248 The suffix used for tar file names.
11249
11250 .IP TEMPFILEPREFIX
11251 The prefix for a temporary file used
11252 to execute lines longer than $MAXLINELENGTH.
11253 The default is '@'.
11254 This may be set for toolchains that use other values,
11255 such as '-@' for the diab compiler
11256 or '-via' for ARM toolchain.
11257
11258 .IP TEX
11259 The TeX formatter and typesetter.
11260
11261 .IP TEXCOM
11262 The command line used to call the TeX formatter and typesetter.
11263
11264 .IP TEXCOMSTR
11265 The string displayed when calling
11266 the TeX formatter and typesetter.
11267 If this is not set, then $TEXCOM (the command line) is displayed.
11268
11269 .ES
11270 env = Environment(TEXCOMSTR = "Building $TARGET from TeX input $SOURCES")
11271 .EE
11272
11273 .IP TEXFLAGS
11274 General options passed to the TeX formatter and typesetter.
11275
11276 .IP TEXINPUTS
11277 List of directories that the LaTeX program will search
11278 for include directories.
11279 The LaTeX implicit dependency scanner will search these
11280 directories for \\include and \\import files.
11281
11282 .IP TEXTFILEPREFIX
11283 The prefix used for \fBTextfile\fP() file names,
11284 the null string by default.
11285
11286 .IP TEXTFILESUFFIX
11287 The suffix used for \fBTextfile\fP() file names;
11288 \fB.txt\fP by default.
11289
11290 .IP TOOLS
11291 A list of the names of the Tool specifications
11292 that are part of this construction environment.
11293
11294 .IP UNCHANGED_SOURCES
11295 A reserved variable name
11296 that may not be set or used in a construction environment.
11297 (See "Variable Substitution," below.)
11298
11299 .IP UNCHANGED_TARGETS
11300 A reserved variable name
11301 that may not be set or used in a construction environment.
11302 (See "Variable Substitution," below.)
11303
11304 .IP VENDOR
11305 The person or organization who supply the packaged software.
11306 This is used to fill in the
11307 .B Vendor:
11308 field in the controlling information for RPM packages,
11309 and the
11310 .B Manufacturer:
11311 field in the controlling information for MSI packages.
11312
11313 .IP VERSION
11314 The version of the project, specified as a string.
11315
11316 .IP WIN32_INSERT_DEF
11317 A deprecated synonym for $WINDOWS_INSERT_DEF.
11318
11319 .IP WIN32DEFPREFIX
11320 A deprecated synonym for $WINDOWSDEFPREFIX.
11321
11322 .IP WIN32DEFSUFFIX
11323 A deprecated synonym for $WINDOWSDEFSUFFIX.
11324
11325 .IP WIN32EXPPREFIX
11326 A deprecated synonym for $WINDOWSEXPSUFFIX.
11327
11328 .IP WIN32EXPSUFFIX
11329 A deprecated synonym for $WINDOWSEXPSUFFIX.
11330
11331 .IP WINDOWS_INSERT_DEF
11332 When this is set to true,
11333 a library build of a Windows shared library
11334 .RB ( .dll file)
11335 will also build a corresponding \fB.def\fP file
11336 at the same time,
11337 if a \fB.def\fP file
11338 is not already listed as a build target.
11339 The default is 0 (do not build a \fB.def\fP file).
11340
11341 .IP WINDOWS_INSERT_MANIFEST
11342 When this is set to true,
11343 .B scons
11344 will be aware of the
11345 .B .manifest
11346 files generated by Microsoft Visua C/C++ 8.
11347
11348 .IP WINDOWSDEFPREFIX
11349 The prefix used for Windows \fB.def\fPfile names.
11350
11351 .IP WINDOWSDEFSUFFIX
11352 The suffix used for Windows \fB.def\fP file names.
11353
11354 .IP WINDOWSEXPPREFIX
11355 The prefix used for Windows \fB.exp\fP file names.
11356
11357 .IP WINDOWSEXPSUFFIX
11358 The suffix used for Windows \fB.exp\fP file names.
11359
11360 .IP WINDOWSPROGMANIFESTPREFIX
11361 The prefix used for executable program \fB.manifest\fP files
11362 generated by Microsoft Visual C/C++.
11363
11364 .IP WINDOWSPROGMANIFESTSUFFIX
11365 The suffix used for executable program \fB.manifest\fP files
11366 generated by Microsoft Visual C/C++.
11367
11368 .IP WINDOWSSHLIBMANIFESTPREFIX
11369 The prefix used for shared library \fB.manifest\fP files
11370 generated by Microsoft Visual C/C++.
11371
11372 .IP WINDOWSSHLIBMANIFESTSUFFIX
11373 The suffix used for shared library \fB.manifest\fP files
11374 generated by Microsoft Visual C/C++.
11375
11376 .IP X_IPK_DEPENDS
11377 This is used to fill in the
11378 .B Depends:
11379 field in the controlling information for Ipkg packages.
11380
11381 .IP X_IPK_DESCRIPTION
11382 This is used to fill in the
11383 .B Description:
11384 field in the controlling information for Ipkg packages.
11385 The default value is
11386 .B "$SUMMARY\\\\$SUMMARY"
11387 .IP X_IPK_MAINTAINER
11388 This is used to fill in the
11389 .B Maintainer:
11390 field in the controlling information for Ipkg packages.
11391
11392 .IP X_IPK_PRIORITY
11393 This is used to fill in the
11394 .B Priority:
11395 field in the controlling information for Ipkg packages.
11396
11397 .IP X_IPK_SECTION
11398 This is used to fill in the
11399 .B Section:
11400 field in the controlling information for Ipkg packages.
11401
11402 .IP X_MSI_LANGUAGE
11403 This is used to fill in the
11404 .B Language:
11405 attribute in the controlling information for MSI packages.
11406
11407 .IP X_MSI_LICENSE_TEXT
11408 The text of the software license in RTF format.
11409 Carriage return characters will be
11410 replaced with the RTF equivalent \\\par.
11411
11412 .IP X_MSI_UPGRADE_CODE
11413 TODO
11414
11415 .IP X_RPM_AUTOREQPROV
11416 This is used to fill in the
11417 .B AutoReqProv:
11418 field in the RPM
11419 \fB.spec\fP file.
11420
11421 .IP X_RPM_BUILD
11422 internal, but overridable
11423
11424 .IP X_RPM_BUILDREQUIRES
11425 This is used to fill in the
11426 .B BuildRequires:
11427 field in the RPM
11428 \fB.spec\fP file.
11429
11430 .IP X_RPM_BUILDROOT
11431 internal, but overridable
11432
11433 .IP X_RPM_CLEAN
11434 internal, but overridable
11435
11436 .IP X_RPM_CONFLICTS
11437 This is used to fill in the
11438 .B Conflicts:
11439 field in the RPM
11440 \fB.spec\fP file.
11441
11442 .IP X_RPM_DEFATTR
11443 This value is used as the default attributes
11444 for the files in the RPM package.
11445 The default value is
11446 .BR (-,root,root) .
11447
11448 .IP X_RPM_DISTRIBUTION
11449 This is used to fill in the
11450 .B Distribution:
11451 field in the RPM
11452 \fB.spec\fP file.
11453
11454 .IP X_RPM_EPOCH
11455 This is used to fill in the
11456 .B Epoch:
11457 field in the controlling information for RPM packages.
11458
11459 .IP X_RPM_EXCLUDEARCH
11460 This is used to fill in the
11461 .B ExcludeArch:
11462 field in the RPM
11463 \fB.spec\fP file.
11464
11465 .IP X_RPM_EXLUSIVEARCH
11466 This is used to fill in the
11467 .B ExclusiveArch:
11468 field in the RPM
11469 \fB.spec\fP file.
11470
11471 .IP X_RPM_GROUP
11472 This is used to fill in the
11473 .B Group:
11474 field in the RPM
11475 \fB.spec\fP file.
11476
11477 .IP X_RPM_GROUP_lang
11478 This is used to fill in the
11479 .B Group(lang):
11480 field in the RPM
11481 \fB.spec\fP file.
11482 Note that
11483 .I lang
11484 is not literal
11485 and should be replaced by
11486 the appropriate language code.
11487
11488 .IP X_RPM_ICON
11489 This is used to fill in the
11490 .B Icon:
11491 field in the RPM
11492 \fB.spec\fP file.
11493
11494 .IP X_RPM_INSTALL
11495 internal, but overridable
11496
11497 .IP X_RPM_PACKAGER
11498 This is used to fill in the
11499 .B Packager:
11500 field in the RPM
11501 \fB.spec\fP file.
11502
11503 .IP X_RPM_POSTINSTALL
11504 This is used to fill in the
11505 .B %post:
11506 section in the RPM
11507 \fB.spec\fP file.
11508
11509 .IP X_RPM_POSTUNINSTALL
11510 This is used to fill in the
11511 .B %postun:
11512 section in the RPM
11513 \fB.spec\fP file.
11514
11515 .IP X_RPM_PREFIX
11516 This is used to fill in the
11517 .B Prefix:
11518 field in the RPM
11519 \fB.spec\fP file.
11520
11521 .IP X_RPM_PREINSTALL
11522 This is used to fill in the
11523 .B %pre:
11524 section in the RPM
11525 \fB.spec\fP file.
11526
11527 .IP X_RPM_PREP
11528 internal, but overridable
11529
11530 .IP X_RPM_PREUNINSTALL
11531 This is used to fill in the
11532 .B %preun:
11533 section in the RPM
11534 \fB.spec\fP file.
11535
11536 .IP X_RPM_PROVIDES
11537 This is used to fill in the
11538 .B Provides:
11539 field in the RPM
11540 \fB.spec\fP file.
11541
11542 .IP X_RPM_REQUIRES
11543 This is used to fill in the
11544 .B Requires:
11545 field in the RPM
11546 \fB.spec\fP file.
11547
11548 .IP X_RPM_SERIAL
11549 This is used to fill in the
11550 .B Serial:
11551 field in the RPM
11552 \fB.spec\fP file.
11553
11554 .IP X_RPM_URL
11555 This is used to fill in the
11556 .B Url:
11557 field in the RPM
11558 \fB.spec\fP file.
11559
11560 .IP YACC
11561 The parser generator.
11562
11563 .IP YACCCOM
11564 The command line used to call the parser generator
11565 to generate a source file.
11566
11567 .IP YACCCOMSTR
11568 The string displayed when generating a source file
11569 using the parser generator.
11570 If this is not set, then $YACCCOM (the command line) is displayed.
11571
11572 .ES
11573 env = Environment(YACCCOMSTR = "Yacc'ing $TARGET from $SOURCES")
11574 .EE
11575
11576 .IP YACCFLAGS
11577 General options passed to the parser generator.
11578 If $YACCFLAGS contains a \fB\-d\fP option,
11579 SCons assumes that the call will also create a .h file
11580 (if the yacc source file ends in a .y suffix)
11581 or a .hpp file
11582 (if the yacc source file ends in a .yy suffix)
11583
11584 .IP YACCHFILESUFFIX
11585 The suffix of the C
11586 header file generated by the parser generator
11587 when the
11588 .B \-d
11589 option is used.
11590 Note that setting this variable does not cause
11591 the parser generator to generate a header
11592 file with the specified suffix,
11593 it exists to allow you to specify
11594 what suffix the parser generator will use of its own accord.
11595 The default value is
11596 .BR .h .
11597
11598 .IP YACCHXXFILESUFFIX
11599 The suffix of the C++
11600 header file generated by the parser generator
11601 when the
11602 .B \-d
11603 option is used.
11604 Note that setting this variable does not cause
11605 the parser generator to generate a header
11606 file with the specified suffix,
11607 it exists to allow you to specify
11608 what suffix the parser generator will use of its own accord.
11609 The default value is
11610 .BR .hpp ,
11611 except on Mac OS X,
11612 where the default is
11613 .BR ${TARGET.suffix}.h .
11614 because the default &bison; parser generator just
11615 appends \fB.h\fP
11616 to the name of the generated C++ file.
11617
11618 .IP YACCVCGFILESUFFIX
11619 The suffix of the file
11620 containing the VCG grammar automaton definition
11621 when the
11622 .B \-\-graph=
11623 option is used.
11624 Note that setting this variable does not cause
11625 the parser generator to generate a VCG
11626 file with the specified suffix,
11627 it exists to allow you to specify
11628 what suffix the parser generator will use of its own accord.
11629 The default value is
11630 .BR .vcg .
11631
11632 .IP ZIP
11633 The zip compression and file packaging utility.
11634
11635 .IP ZIPCOM
11636 The command line used to call the zip utility,
11637 or the internal Python function used to create a
11638 zip archive.
11639
11640 .IP ZIPCOMPRESSION
11641 The
11642 .I compression
11643 flag
11644 from the Python
11645 .B zipfile
11646 module used by the internal Python function
11647 to control whether the zip archive
11648 is compressed or not.
11649 The default value is
11650 .BR zipfile.ZIP_DEFLATED ,
11651 which creates a compressed zip archive.
11652 This value has no effect if the
11653 .B zipfile
11654 module is unavailable.
11655
11656 .IP ZIPCOMSTR
11657 The string displayed when archiving files
11658 using the zip utility.
11659 If this is not set, then $ZIPCOM
11660 (the command line or internal Python function) is displayed.
11661
11662 .ES
11663 env = Environment(ZIPCOMSTR = "Zipping $TARGET")
11664 .EE
11665
11666 .IP ZIPFLAGS
11667 General options passed to the zip utility.
11668
11669 .IP ZIPSUFFIX
11670 The suffix used for zip file names.
11671 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
11672 '\" END GENERATED CONSTRUCTION VARIABLE DESCRIPTIONS
11673 '\"
11674 '\" The descriptions above of the various SCons construction variables
11675 '\" are generated from the .xml files that live next to the various
11676 '\" Python modules in the build enginer library. If you're reading
11677 '\" this [gnt]roff file with an eye towards patching this man page,
11678 '\" you can still submit a diff against this text, but it will have to
11679 '\" be translated to a diff against the underlying .xml file before the
11680 '\" patch is actually accepted. If you do that yourself, it will make
11681 '\" it easier to integrate the patch.
11682 '\"
11683 '\" END GENERATED CONSTRUCTION VARIABLE DESCRIPTIONS
11684 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
11685
11686 .LP
11687 Construction variables can be retrieved and set using the
11688 .B Dictionary
11689 method of the construction environment:
11690
11691 .ES
11692 dict = env.Dictionary()
11693 dict["CC"] = "cc"
11694 .EE
11695
11696 or using the [] operator:
11697
11698 .ES
11699 env["CC"] = "cc"
11700 .EE
11701
11702 Construction variables can also be passed to the construction environment
11703 constructor:
11704
11705 .ES
11706 env = Environment(CC="cc")
11707 .EE
11708
11709 or when copying a construction environment using the
11710 .B Clone
11711 method:
11712
11713 .ES
11714 env2 = env.Clone(CC="cl.exe")
11715 .EE
11716
11717 .SS Configure Contexts
11718
11719 .B scons
11720 supports
11721 .I configure contexts,
11722 an integrated mechanism similar to the
11723 various AC_CHECK macros in GNU autoconf
11724 for testing for the existence of C header
11725 files, libraries, etc.
11726 In contrast to autoconf,
11727 .B scons
11728 does not maintain an explicit cache of the tested values,
11729 but uses its normal dependency tracking to keep the checked values
11730 up to date. However, users may override this behaviour with the
11731 .B --config
11732 command line option.
11733
11734 The following methods can be used to perform checks:
11735
11736 .TP
11737 .RI Configure( env ", [" custom_tests ", " conf_dir ", " log_file ", " config_h ", " clean ", " help])
11738 .TP
11739 .RI env.Configure([ custom_tests ", " conf_dir ", " log_file ", " config_h ", " clean ", " help])
11740 This creates a configure context, which can be used to perform checks.
11741 .I env
11742 specifies the environment for building the tests.
11743 This environment may be modified when performing checks.
11744 .I custom_tests
11745 is a dictionary containing custom tests.
11746 See also the section about custom tests below.
11747 By default, no custom tests are added to the configure context.
11748 .I conf_dir
11749 specifies a directory where the test cases are built.
11750 Note that this directory is not used for building
11751 normal targets.
11752 The default value is the directory
11753 #/.sconf_temp.
11754 .I log_file
11755 specifies a file which collects the output from commands
11756 that are executed to check for the existence of header files, libraries, etc.
11757 The default is the file #/config.log.
11758 If you are using the
11759 .BR VariantDir ()
11760 method,
11761 you may want to specify a subdirectory under your variant directory.
11762 .I config_h
11763 specifies a C header file where the results of tests
11764 will be written, e.g. #define HAVE_STDIO_H, #define HAVE_LIBM, etc.
11765 The default is to not write a
11766 .B config.h
11767 file.
11768 You can specify the same
11769 .B config.h
11770 file in multiple calls to Configure,
11771 in which case
11772 .B scons
11773 will concatenate all results in the specified file.
11774 Note that SCons
11775 uses its normal dependency checking
11776 to decide if it's necessary to rebuild
11777 the specified
11778 .I config_h
11779 file.
11780 This means that the file is not necessarily re-built each
11781 time scons is run,
11782 but is only rebuilt if its contents will have changed
11783 and some target that depends on the
11784 .I config_h
11785 file is being built.
11786
11787 The optional
11788 .B clean
11789 and
11790 .B help
11791 arguments can be used to suppress execution of the configuration
11792 tests when the
11793 .B -c/--clean
11794 or
11795 .B -H/-h/--help
11796 options are used, respectively.
11797 The default behavior is always to execute
11798 configure context tests,
11799 since the results of the tests may
11800 affect the list of targets to be cleaned
11801 or the help text.
11802 If the configure tests do not affect these,
11803 then you may add the
11804 .B clean=False
11805 or
11806 .B help=False
11807 arguments
11808 (or both)
11809 to avoid unnecessary test execution.
11810
11811 .EE
11812 A created
11813 .B Configure
11814 instance has the following associated methods:
11815
11816 .TP
11817 .RI SConf.Finish( context )
11818 .TP
11819 .IR sconf .Finish()
11820 This method should be called after configuration is done.
11821 It returns the environment as modified
11822 by the configuration checks performed.
11823 After this method is called, no further checks can be performed
11824 with this configuration context.
11825 However, you can create a new
11826 .RI Configure
11827 context to perform additional checks.
11828 Only one context should be active at a time.
11829
11830 The following Checks are predefined.
11831 (This list will likely grow larger as time
11832 goes by and developers contribute new useful tests.)
11833
11834 .TP
11835 .RI SConf.CheckHeader( context ", " header ", [" include_quotes ", " language ])
11836 .TP
11837 .IR sconf .CheckHeader( header ", [" include_quotes ", " language ])
11838 Checks if
11839 .I header
11840 is usable in the specified language.
11841 .I header
11842 may be a list,
11843 in which case the last item in the list
11844 is the header file to be checked,
11845 and the previous list items are
11846 header files whose
11847 .B #include
11848 lines should precede the
11849 header line being checked for.
11850 The optional argument
11851 .I include_quotes
11852 must be
11853 a two character string, where the first character denotes the opening
11854 quote and the second character denotes the closing quote.
11855 By default, both characters are " (double quote).
11856 The optional argument
11857 .I language
11858 should be either
11859 .B C
11860 or
11861 .B C++
11862 and selects the compiler to be used for the check.
11863 Returns 1 on success and 0 on failure.
11864
11865 .TP
11866 .RI SConf.CheckCHeader( context ", " header ", [" include_quotes ])
11867 .TP
11868 .IR sconf .CheckCHeader( header ", [" include_quotes ])
11869 This is a wrapper around
11870 .B SConf.CheckHeader
11871 which checks if
11872 .I header
11873 is usable in the C language.
11874 .I header
11875 may be a list,
11876 in which case the last item in the list
11877 is the header file to be checked,
11878 and the previous list items are
11879 header files whose
11880 .B #include
11881 lines should precede the
11882 header line being checked for.
11883 The optional argument
11884 .I include_quotes
11885 must be
11886 a two character string, where the first character denotes the opening
11887 quote and the second character denotes the closing quote (both default
11888 to \N'34').
11889 Returns 1 on success and 0 on failure.
11890
11891 .TP
11892 .RI SConf.CheckCXXHeader( context ", " header ", [" include_quotes ])
11893 .TP
11894 .IR sconf .CheckCXXHeader( header ", [" include_quotes ])
11895 This is a wrapper around
11896 .B SConf.CheckHeader
11897 which checks if
11898 .I header
11899 is usable in the C++ language.
11900 .I header
11901 may be a list,
11902 in which case the last item in the list
11903 is the header file to be checked,
11904 and the previous list items are
11905 header files whose
11906 .B #include
11907 lines should precede the
11908 header line being checked for.
11909 The optional argument
11910 .I include_quotes
11911 must be
11912 a two character string, where the first character denotes the opening
11913 quote and the second character denotes the closing quote (both default
11914 to \N'34').
11915 Returns 1 on success and 0 on failure.
11916
11917 .TP
11918 .RI SConf.CheckFunc( context, ", " function_name ", [" header ", " language ])
11919 .TP
11920 .IR sconf .CheckFunc( function_name ", [" header ", " language ])
11921 Checks if the specified
11922 C or C++ function is available.
11923 .I function_name
11924 is the name of the function to check for.
11925 The optional
11926 .I header
11927 argument is a string
11928 that will be
11929 placed at the top
11930 of the test file
11931 that will be compiled
11932 to check if the function exists;
11933 the default is:
11934 .ES
11935 #ifdef __cplusplus
11936 extern "C"
11937 #endif
11938 char function_name();
11939 .EE
11940 The optional
11941 .I language
11942 argument should be
11943 .B C
11944 or
11945 .B C++
11946 and selects the compiler to be used for the check;
11947 the default is "C".
11948
11949 .TP
11950 .RI SConf.CheckLib( context ", [" library ", " symbol ", " header ", " language ", " autoadd=1 ])
11951 .TP
11952 .IR sconf .CheckLib([ library ", " symbol ", " header ", " language ", " autoadd =1 ])
11953 Checks if
11954 .I library
11955 provides
11956 .IR symbol .
11957 If the value of
11958 .I autoadd
11959 is 1 and the library provides the specified
11960 .IR symbol ,
11961 appends the library to the LIBS construction environment variable.
11962 .I library
11963 may also be None (the default),
11964 in which case
11965 .I symbol
11966 is checked with the current LIBS variable,
11967 or a list of library names,
11968 in which case each library in the list
11969 will be checked for
11970 .IR symbol .
11971 If
11972 .I symbol
11973 is not set or is
11974 .BR None ,
11975 then
11976 .BR SConf.CheckLib ()
11977 just checks if
11978 you can link against the specified
11979 .IR library .
11980 The optional
11981 .I language
11982 argument should be
11983 .B C
11984 or
11985 .B C++
11986 and selects the compiler to be used for the check;
11987 the default is "C".
11988 The default value for
11989 .I autoadd
11990 is 1.
11991 This method returns 1 on success and 0 on error.
11992
11993 .TP
11994 .RI SConf.CheckLibWithHeader( context ", " library ", " header ", " language ", [" call ", " autoadd ])
11995 .TP
11996 .IR sconf .CheckLibWithHeader( library ", " header ", " language ", [" call ", " autoadd ])
11997
11998 In contrast to the
11999 .RI SConf.CheckLib
12000 call, this call provides a more sophisticated way to check against libraries.
12001 Again,
12002 .I library
12003 specifies the library or a list of libraries to check.
12004 .I header
12005 specifies a header to check for.
12006 .I header
12007 may be a list,
12008 in which case the last item in the list
12009 is the header file to be checked,
12010 and the previous list items are
12011 header files whose
12012 .B #include
12013 lines should precede the
12014 header line being checked for.
12015 .I language
12016 may be one of 'C','c','CXX','cxx','C++' and 'c++'.
12017 .I call
12018 can be any valid expression (with a trailing ';').
12019 If
12020 .I call
12021 is not set,
12022 the default simply checks that you
12023 can link against the specified
12024 .IR library .
12025 .I autoadd
12026 specifies whether to add the library to the environment (only if the check
12027 succeeds). This method returns 1 on success and 0 on error.
12028
12029 .TP
12030 .RI SConf.CheckType( context ", " type_name ", [" includes ", " language ])
12031 .TP
12032 .IR sconf .CheckType( type_name ", [" includes ", " language ])
12033 Checks for the existence of a type defined by
12034 .BR typedef .
12035 .I type_name
12036 specifies the typedef name to check for.
12037 .I includes
12038 is a string containing one or more
12039 .B #include
12040 lines that will be inserted into the program
12041 that will be run to test for the existence of the type.
12042 The optional
12043 .I language
12044 argument should be
12045 .B C
12046 or
12047 .B C++
12048 and selects the compiler to be used for the check;
12049 the default is "C".
12050 Example:
12051 .ES
12052 sconf.CheckType('foo_type', '#include "my_types.h"', 'C++')
12053 .EE
12054
12055 .TP
12056 .RI Configure.CheckCC( self )
12057 Checks whether the C compiler (as defined by the CC construction variable) works
12058 by trying to compile a small source file.
12059
12060 By default, SCons only detects if there is a program with the correct name, not
12061 if it is a functioning compiler.
12062
12063 This uses the exact same command than the one used by the object builder for C
12064 source file, so it can be used to detect if a particular compiler flag works or
12065 not.
12066
12067 .TP
12068 .RI Configure.CheckCXX( self )
12069 Checks whether the C++ compiler (as defined by the CXX construction variable)
12070 works by trying to compile a small source file. By default, SCons only detects
12071 if there is a program with the correct name, not if it is a functioning compiler .
12072
12073 This uses the exact same command than the one used by the object builder for
12074 CXX source files, so it can be used to detect if a particular compiler flag
12075 works or not.
12076
12077 .TP
12078 .RI Configure.CheckSHCC( self )
12079 Checks whether the C compiler (as defined by the SHCC construction variable) wor ks
12080 by trying to compile a small source file. By default, SCons only detects if
12081 there is a program with the correct name, not if it is a functioning compiler.
12082
12083 This uses the exact same command than the one used by the object builder for C
12084 source file, so it can be used to detect if a particular compiler flag works or
12085 not. This does not check whether the object code can be used to build a shared
12086 library, only that the compilation (not link) succeeds.
12087
12088 .TP
12089 .RI Configure.CheckSHCXX( self )
12090 Checks whether the C++ compiler (as defined by the SHCXX construction variable)
12091 works by trying to compile a small source file. By default, SCons only detects
12092 if there is a program with the correct name, not if it is a functioning compiler .
12093
12094 This uses the exact same command than the one used by the object builder for
12095 CXX source files, so it can be used to detect if a particular compiler flag
12096 works or not. This does not check whether the object code can be used to build
12097 a shared library, only that the compilation (not link) succeeds.
12098
12099 .EE
12100 Example of a typical Configure usage:
12101
12102 .ES
12103 env = Environment()
12104 conf = Configure( env )
12105 if not conf.CheckCHeader( 'math.h' ):
12106 print 'We really need math.h!'
12107 Exit(1)
12108 if conf.CheckLibWithHeader( 'qt', 'qapp.h', 'c++',
12109 'QApplication qapp(0,0);' ):
12110 # do stuff for qt - usage, e.g.
12111 conf.env.Append( CPPFLAGS = '-DWITH_QT' )
12112 env = conf.Finish()
12113 .EE
12114
12115 .TP
12116 .RI SConf.CheckTypeSize( context ", " type_name ", [" header ", " language ", " expect ])
12117 .TP
12118 .IR sconf .CheckTypeSize( type_name ", [" header ", " language ", " expect ])
12119 Checks for the size of a type defined by
12120 .BR typedef .
12121 .I type_name
12122 specifies the typedef name to check for.
12123 The optional
12124 .I header
12125 argument is a string
12126 that will be
12127 placed at the top
12128 of the test file
12129 that will be compiled
12130 to check if the function exists;
12131 the default is empty.
12132 The optional
12133 .I language
12134 argument should be
12135 .B C
12136 or
12137 .B C++
12138 and selects the compiler to be used for the check;
12139 the default is "C".
12140 The optional
12141 .I expect
12142 argument should be an integer.
12143 If this argument is used,
12144 the function will only check whether the type
12145 given in type_name has the expected size (in bytes).
12146 For example,
12147 .B "CheckTypeSize('short', expect = 2)"
12148 will return success only if short is two bytes.
12149
12150 .ES
12151 .EE
12152
12153 .TP
12154 .RI SConf.CheckDeclaration( context ", " symbol ", [" includes ", " language ])
12155 .TP
12156 .IR sconf .CheckDeclaration( symbol ", [" includes ", " language ])
12157 Checks if the specified
12158 .I symbol
12159 is declared.
12160 .I includes
12161 is a string containing one or more
12162 .B #include
12163 lines that will be inserted into the program
12164 that will be run to test for the existence of the type.
12165 The optional
12166 .I language
12167 argument should be
12168 .B C
12169 or
12170 .B C++
12171 and selects the compiler to be used for the check;
12172 the default is "C".
12173
12174 .TP
12175 .RI SConf.Define( context ", " symbol ", [" value ", " comment ])
12176 .TP
12177 .IR sconf .Define( symbol ", [" value ", " comment ])
12178 This function does not check for anything, but defines a
12179 preprocessor symbol that will be added to the configuration header file.
12180 It is the equivalent of AC_DEFINE,
12181 and defines the symbol
12182 .I name
12183 with the optional
12184 .B value
12185 and the optional comment
12186 .BR comment .
12187
12188 .IP
12189 Examples:
12190
12191 .ES
12192 env = Environment()
12193 conf = Configure( env )
12194
12195 # Puts the following line in the config header file:
12196 # #define A_SYMBOL
12197 conf.Define('A_SYMBOL')
12198
12199 # Puts the following line in the config header file:
12200 # #define A_SYMBOL 1
12201 conf.Define('A_SYMBOL', 1)
12202 .EE
12203
12204 .IP
12205 Be careful about quoting string values, though:
12206
12207 .ES
12208 env = Environment()
12209 conf = Configure( env )
12210
12211 # Puts the following line in the config header file:
12212 # #define A_SYMBOL YA
12213 conf.Define('A_SYMBOL', "YA")
12214
12215 # Puts the following line in the config header file:
12216 # #define A_SYMBOL "YA"
12217 conf.Define('A_SYMBOL', '"YA"')
12218 .EE
12219
12220 .IP
12221 For comment:
12222
12223 .ES
12224 env = Environment()
12225 conf = Configure( env )
12226
12227 # Puts the following lines in the config header file:
12228 # /* Set to 1 if you have a symbol */
12229 # #define A_SYMBOL 1
12230 conf.Define('A_SYMBOL', 1, 'Set to 1 if you have a symbol')
12231 .EE
12232
12233 .EE
12234 You can define your own custom checks.
12235 in addition to the predefined checks.
12236 These are passed in a dictionary to the Configure function.
12237 This dictionary maps the names of the checks
12238 to user defined Python callables
12239 (either Python functions or class instances implementing the
12240 .I __call__
12241 method).
12242 The first argument of the call is always a
12243 .I CheckContext
12244 instance followed by the arguments,
12245 which must be supplied by the user of the check.
12246 These CheckContext instances define the following methods:
12247
12248 .TP
12249 .RI CheckContext.Message( self ", " text )
12250
12251 Usually called before the check is started.
12252 .I text
12253 will be displayed to the user, e.g. 'Checking for library X...'
12254
12255 .TP
12256 .RI CheckContext.Result( self, ", " res )
12257
12258 Usually called after the check is done.
12259 .I res
12260 can be either an integer or a string. In the former case, 'yes' (res != 0)
12261 or 'no' (res == 0) is displayed to the user, in the latter case the
12262 given string is displayed.
12263
12264 .TP
12265 .RI CheckContext.TryCompile( self ", " text ", " extension )
12266 Checks if a file with the specified
12267 .I extension
12268 (e.g. '.c') containing
12269 .I text
12270 can be compiled using the environment's
12271 .B Object
12272 builder. Returns 1 on success and 0 on failure.
12273
12274 .TP
12275 .RI CheckContext.TryLink( self ", " text ", " extension )
12276 Checks, if a file with the specified
12277 .I extension
12278 (e.g. '.c') containing
12279 .I text
12280 can be compiled using the environment's
12281 .B Program
12282 builder. Returns 1 on success and 0 on failure.
12283
12284 .TP
12285 .RI CheckContext.TryRun( self ", " text ", " extension )
12286 Checks, if a file with the specified
12287 .I extension
12288 (e.g. '.c') containing
12289 .I text
12290 can be compiled using the environment's
12291 .B Program
12292 builder. On success, the program is run. If the program
12293 executes successfully
12294 (that is, its return status is 0),
12295 a tuple
12296 .I (1, outputStr)
12297 is returned, where
12298 .I outputStr
12299 is the standard output of the
12300 program.
12301 If the program fails execution
12302 (its return status is non-zero),
12303 then (0, '') is returned.
12304
12305 .TP
12306 .RI CheckContext.TryAction( self ", " action ", [" text ", " extension ])
12307 Checks if the specified
12308 .I action
12309 with an optional source file (contents
12310 .I text
12311 , extension
12312 .I extension
12313 = ''
12314 ) can be executed.
12315 .I action
12316 may be anything which can be converted to a
12317 .B scons
12318 .RI Action.
12319 On success,
12320 .I (1, outputStr)
12321 is returned, where
12322 .I outputStr
12323 is the content of the target file.
12324 On failure
12325 .I (0, '')
12326 is returned.
12327
12328 .TP
12329 .RI CheckContext.TryBuild( self ", " builder ", [" text ", " extension ])
12330 Low level implementation for testing specific builds;
12331 the methods above are based on this method.
12332 Given the Builder instance
12333 .I builder
12334 and the optional
12335 .I text
12336 of a source file with optional
12337 .IR extension ,
12338 this method returns 1 on success and 0 on failure. In addition,
12339 .I self.lastTarget
12340 is set to the build target node, if the build was successful.
12341
12342 .EE
12343 Example for implementing and using custom tests:
12344
12345 .ES
12346 def CheckQt(context, qtdir):
12347 context.Message( 'Checking for qt ...' )
12348 lastLIBS = context.env['LIBS']
12349 lastLIBPATH = context.env['LIBPATH']
12350 lastCPPPATH= context.env['CPPPATH']
12351 context.env.Append(LIBS = 'qt', LIBPATH = qtdir + '/lib', CPPPATH = qtdir + '/include' )
12352 ret = context.TryLink("""
12353 #include <qapp.h>
12354 int main(int argc, char **argv) {
12355 QApplication qapp(argc, argv);
12356 return 0;
12357 }
12358 """)
12359 if not ret:
12360 context.env.Replace(LIBS = lastLIBS, LIBPATH=lastLIBPATH, CPPPATH=lastCP PPATH)
12361 context.Result( ret )
12362 return ret
12363
12364 env = Environment()
12365 conf = Configure( env, custom_tests = { 'CheckQt' : CheckQt } )
12366 if not conf.CheckQt('/usr/lib/qt'):
12367 print 'We really need qt!'
12368 Exit(1)
12369 env = conf.Finish()
12370 .EE
12371
12372 .SS Command-Line Construction Variables
12373
12374 Often when building software,
12375 some variables must be specified at build time.
12376 For example, libraries needed for the build may be in non-standard
12377 locations, or site-specific compiler options may need to be passed to the
12378 compiler.
12379 .B scons
12380 provides a
12381 .B Variables
12382 object to support overriding construction variables
12383 on the command line:
12384 .ES
12385 $ scons VARIABLE=foo
12386 .EE
12387 The variable values can also be specified in a text-based SConscript file.
12388 To create a Variables object, call the Variables() function:
12389
12390 .TP
12391 .RI Variables([ files "], [" args ])
12392 This creates a Variables object that will read construction variables from
12393 the file or list of filenames specified in
12394 .IR files .
12395 If no files are specified,
12396 or the
12397 .I files
12398 argument is
12399 .BR None ,
12400 then no files will be read.
12401 The optional argument
12402 .I args
12403 is a dictionary of
12404 values that will override anything read from the specified files;
12405 it is primarily intended to be passed the
12406 .B ARGUMENTS
12407 dictionary that holds variables
12408 specified on the command line.
12409 Example:
12410
12411 .ES
12412 vars = Variables('custom.py')
12413 vars = Variables('overrides.py', ARGUMENTS)
12414 vars = Variables(None, {FOO:'expansion', BAR:7})
12415 .EE
12416
12417 Variables objects have the following methods:
12418
12419 .TP
12420 .RI Add( key ", [" help ", " default ", " validator ", " converter ])
12421 This adds a customizable construction variable to the Variables object.
12422 .I key
12423 is the name of the variable.
12424 .I help
12425 is the help text for the variable.
12426 .I default
12427 is the default value of the variable;
12428 if the default value is
12429 .B None
12430 and there is no explicit value specified,
12431 the construction variable will
12432 .I not
12433 be added to the construction environment.
12434 .I validator
12435 is called to validate the value of the variable, and should take three
12436 arguments: key, value, and environment.
12437 The recommended way to handle an invalid value is
12438 to raise an exception (see example below).
12439 .I converter
12440 is called to convert the value before putting it in the environment, and
12441 should take either a value, or the value and environment, as parameters.
12442 The
12443 .I converter
12444 must return a value,
12445 which will be converted into a string
12446 before being validated by the
12447 .I validator
12448 (if any)
12449 and then added to the environment.
12450
12451 Examples:
12452
12453 .ES
12454 vars.Add('CC', 'The C compiler')
12455
12456 def validate_color(key, val, env):
12457 if not val in ['red', 'blue', 'yellow']:
12458 raise Exception("Invalid color value '%s'" % val)
12459 vars.Add('COLOR', validator=valid_color)
12460 .EE
12461
12462 .TP
12463 .RI AddVariables( list )
12464 A wrapper script that adds
12465 multiple customizable construction variables
12466 to a Variables object.
12467 .I list
12468 is a list of tuple or list objects
12469 that contain the arguments
12470 for an individual call to the
12471 .B Add
12472 method.
12473
12474 .ES
12475 opt.AddVariables(
12476 ('debug', '', 0),
12477 ('CC', 'The C compiler'),
12478 ('VALIDATE', 'An option for testing validation',
12479 'notset', validator, None),
12480 )
12481 .EE
12482
12483 .TP
12484 .RI Update( env ", [" args ])
12485 This updates a construction environment
12486 .I env
12487 with the customized construction variables.
12488 Any specified variables that are
12489 .I not
12490 configured for the Variables object
12491 will be saved and may be
12492 retrieved with the
12493 .BR UnknownVariables ()
12494 method, below.
12495
12496 Normally this method is not called directly,
12497 but is called indirectly by passing the Variables object to
12498 the Environment() function:
12499
12500 .ES
12501 env = Environment(variables=vars)
12502 .EE
12503
12504 .IP
12505 The text file(s) that were specified
12506 when the Variables object was created
12507 are executed as Python scripts,
12508 and the values of (global) Python variables set in the file
12509 are added to the construction environment.
12510
12511 Example:
12512
12513 .ES
12514 CC = 'my_cc'
12515 .EE
12516
12517 .TP
12518 .RI UnknownVariables( )
12519 Returns a dictionary containing any
12520 variables that were specified
12521 either in the files or the dictionary
12522 with which the Variables object was initialized,
12523 but for which the Variables object was
12524 not configured.
12525
12526 .ES
12527 env = Environment(variables=vars)
12528 for key, value in vars.UnknownVariables():
12529 print "unknown variable: %s=%s" % (key, value)
12530 .EE
12531
12532 .TP
12533 .RI Save( filename ", " env )
12534 This saves the currently set variables into a script file named
12535 .I filename
12536 that can be used on the next invocation to automatically load the current
12537 settings. This method combined with the Variables method can be used to
12538 support caching of variables between runs.
12539
12540 .ES
12541 env = Environment()
12542 vars = Variables(['variables.cache', 'custom.py'])
12543 vars.Add(...)
12544 vars.Update(env)
12545 vars.Save('variables.cache', env)
12546 .EE
12547
12548 .TP
12549 .RI GenerateHelpText( env ", [" sort ])
12550 This generates help text documenting the customizable construction
12551 variables suitable to passing in to the Help() function.
12552 .I env
12553 is the construction environment that will be used to get the actual values
12554 of customizable variables. Calling with
12555 an optional
12556 .I sort
12557 function
12558 will cause the output to be sorted
12559 by the specified argument.
12560 The specific
12561 .I sort
12562 function
12563 should take two arguments
12564 and return
12565 -1, 0 or 1
12566 (like the standard Python
12567 .I cmp
12568 function).
12569
12570 .ES
12571 Help(vars.GenerateHelpText(env))
12572 Help(vars.GenerateHelpText(env, sort=cmp))
12573 .EE
12574
12575 .TP
12576 .RI FormatVariableHelpText( env ", " opt ", " help ", " default ", " actual )
12577 This method returns a formatted string
12578 containing the printable help text
12579 for one option.
12580 It is normally not called directly,
12581 but is called by the
12582 .IR GenerateHelpText ()
12583 method to create the returned help text.
12584 It may be overridden with your own
12585 function that takes the arguments specified above
12586 and returns a string of help text formatted to your liking.
12587 Note that the
12588 .IR GenerateHelpText ()
12589 will not put any blank lines or extra
12590 characters in between the entries,
12591 so you must add those characters to the returned
12592 string if you want the entries separated.
12593
12594 .ES
12595 def my_format(env, opt, help, default, actual):
12596 fmt = "\n%s: default=%s actual=%s (%s)\n"
12597 return fmt % (opt, default. actual, help)
12598 vars.FormatVariableHelpText = my_format
12599 .EE
12600
12601 To make it more convenient to work with customizable Variables,
12602 .B scons
12603 provides a number of functions
12604 that make it easy to set up
12605 various types of Variables:
12606
12607 .TP
12608 .RI BoolVariable( key ", " help ", " default )
12609 Return a tuple of arguments
12610 to set up a Boolean option.
12611 The option will use
12612 the specified name
12613 .IR key ,
12614 have a default value of
12615 .IR default ,
12616 and display the specified
12617 .I help
12618 text.
12619 The option will interpret the values
12620 .BR y ,
12621 .BR yes ,
12622 .BR t ,
12623 .BR true ,
12624 .BR 1 ,
12625 .B on
12626 and
12627 .B all
12628 as true,
12629 and the values
12630 .BR n ,
12631 .BR no ,
12632 .BR f ,
12633 .BR false ,
12634 .BR 0 ,
12635 .B off
12636 and
12637 .B none
12638 as false.
12639
12640 .TP
12641 .RI EnumVariable( key ", " help ", " default ", " allowed_values ", [" map ", " ignorecase ])
12642 Return a tuple of arguments
12643 to set up an option
12644 whose value may be one
12645 of a specified list of legal enumerated values.
12646 The option will use
12647 the specified name
12648 .IR key ,
12649 have a default value of
12650 .IR default ,
12651 and display the specified
12652 .I help
12653 text.
12654 The option will only support those
12655 values in the
12656 .I allowed_values
12657 list.
12658 The optional
12659 .I map
12660 argument is a dictionary
12661 that can be used to convert
12662 input values into specific legal values
12663 in the
12664 .I allowed_values
12665 list.
12666 If the value of
12667 .I ignore_case
12668 is
12669 .B 0
12670 (the default),
12671 then the values are case-sensitive.
12672 If the value of
12673 .I ignore_case
12674 is
12675 .BR 1 ,
12676 then values will be matched
12677 case-insensitive.
12678 If the value of
12679 .I ignore_case
12680 is
12681 .BR 1 ,
12682 then values will be matched
12683 case-insensitive,
12684 and all input values will be
12685 converted to lower case.
12686
12687 .TP
12688 .RI ListVariable( key ", " help ", " default ", " names ", [", map ])
12689 Return a tuple of arguments
12690 to set up an option
12691 whose value may be one or more
12692 of a specified list of legal enumerated values.
12693 The option will use
12694 the specified name
12695 .IR key ,
12696 have a default value of
12697 .IR default ,
12698 and display the specified
12699 .I help
12700 text.
12701 The option will only support the values
12702 .BR all ,
12703 .BR none ,
12704 or the values in the
12705 .I names
12706 list.
12707 More than one value may be specified,
12708 with all values separated by commas.
12709 The default may be a string of
12710 comma-separated default values,
12711 or a list of the default values.
12712 The optional
12713 .I map
12714 argument is a dictionary
12715 that can be used to convert
12716 input values into specific legal values
12717 in the
12718 .I names
12719 list.
12720
12721 .TP
12722 .RI PackageVariable( key ", " help ", " default )
12723 Return a tuple of arguments
12724 to set up an option
12725 whose value is a path name
12726 of a package that may be
12727 enabled, disabled or
12728 given an explicit path name.
12729 The option will use
12730 the specified name
12731 .IR key ,
12732 have a default value of
12733 .IR default ,
12734 and display the specified
12735 .I help
12736 text.
12737 The option will support the values
12738 .BR yes ,
12739 .BR true ,
12740 .BR on ,
12741 .BR enable
12742 or
12743 .BR search ,
12744 in which case the specified
12745 .I default
12746 will be used,
12747 or the option may be set to an
12748 arbitrary string
12749 (typically the path name to a package
12750 that is being enabled).
12751 The option will also support the values
12752 .BR no ,
12753 .BR false ,
12754 .BR off
12755 or
12756 .BR disable
12757 to disable use of the specified option.
12758
12759 .TP
12760 .RI PathVariable( key ", " help ", " default ", [" validator ])
12761 Return a tuple of arguments
12762 to set up an option
12763 whose value is expected to be a path name.
12764 The option will use
12765 the specified name
12766 .IR key ,
12767 have a default value of
12768 .IR default ,
12769 and display the specified
12770 .I help
12771 text.
12772 An additional
12773 .I validator
12774 may be specified
12775 that will be called to
12776 verify that the specified path
12777 is acceptable.
12778 SCons supplies the
12779 following ready-made validators:
12780 .BR PathVariable.PathExists
12781 (the default),
12782 which verifies that the specified path exists;
12783 .BR PathVariable.PathIsFile ,
12784 which verifies that the specified path is an existing file;
12785 .BR PathVariable.PathIsDir ,
12786 which verifies that the specified path is an existing directory;
12787 .BR PathVariable.PathIsDirCreate ,
12788 which verifies that the specified path is a directory
12789 and will create the specified directory if the path does not exist;
12790 and
12791 .BR PathVariable.PathAccept ,
12792 which simply accepts the specific path name argument without validation,
12793 and which is suitable if you want your users
12794 to be able to specify a directory path that will be
12795 created as part of the build process, for example.
12796 You may supply your own
12797 .I validator
12798 function,
12799 which must take three arguments
12800 .RI ( key ,
12801 the name of the variable to be set;
12802 .IR val ,
12803 the specified value being checked;
12804 and
12805 .IR env ,
12806 the construction environment)
12807 and should raise an exception
12808 if the specified value is not acceptable.
12809
12810 .RE
12811 These functions make it
12812 convenient to create a number
12813 of variables with consistent behavior
12814 in a single call to the
12815 .B AddVariables
12816 method:
12817
12818 .ES
12819 vars.AddVariables(
12820 BoolVariable('warnings', 'compilation with -Wall and similiar', 1),
12821 EnumVariable('debug', 'debug output and symbols', 'no'
12822 allowed_values=('yes', 'no', 'full'),
12823 map={}, ignorecase=0), # case sensitive
12824 ListVariable('shared',
12825 'libraries to build as shared libraries',
12826 'all',
12827 names = list_of_libs),
12828 PackageVariable('x11',
12829 'use X11 installed here (yes = search some places)',
12830 'yes'),
12831 PathVariable('qtdir', 'where the root of Qt is installed', qtdir),
12832 PathVariable('foopath', 'where the foo library is installed', foopath,
12833 PathVariable.PathIsDir),
12834
12835 )
12836 .EE
12837
12838 .SS File and Directory Nodes
12839
12840 The
12841 .IR File ()
12842 and
12843 .IR Dir ()
12844 functions return
12845 .I File
12846 and
12847 .I Dir
12848 Nodes, respectively.
12849 python objects, respectively.
12850 Those objects have several user-visible attributes
12851 and methods that are often useful:
12852
12853 .IP path
12854 The build path
12855 of the given
12856 file or directory.
12857 This path is relative to the top-level directory
12858 (where the
12859 .B SConstruct
12860 file is found).
12861 The build path is the same as the source path if
12862 .I variant_dir
12863 is not being used.
12864
12865 .IP abspath
12866 The absolute build path of the given file or directory.
12867
12868 .IP srcnode()
12869 The
12870 .IR srcnode ()
12871 method
12872 returns another
12873 .I File
12874 or
12875 .I Dir
12876 object representing the
12877 .I source
12878 path of the given
12879 .I File
12880 or
12881 .IR Dir .
12882 The
12883
12884 .ES
12885 # Get the current build dir's path, relative to top.
12886 Dir('.').path
12887 # Current dir's absolute path
12888 Dir('.').abspath
12889 # Next line is always '.', because it is the top dir's path relative to itself.
12890 Dir('#.').path
12891 File('foo.c').srcnode().path # source path of the given source file.
12892
12893 # Builders also return File objects:
12894 foo = env.Program('foo.c')
12895 print "foo will be built in %s"%foo.path
12896 .EE
12897
12898 A
12899 .I Dir
12900 Node or
12901 .I File
12902 Node can also be used to create
12903 file and subdirectory Nodes relative to the generating Node.
12904 A
12905 .I Dir
12906 Node will place the new Nodes within the directory it represents.
12907 A
12908 .I File
12909 node will place the new Nodes within its parent directory
12910 (that is, "beside" the file in question).
12911 If
12912 .I d
12913 is a
12914 .I Dir
12915 (directory) Node and
12916 .I f
12917 is a
12918 .I File
12919 (file) Node,
12920 then these methods are available:
12921
12922 .TP
12923 .IR d .Dir( name )
12924 Returns a directory Node for a subdirectory of
12925 .I d
12926 named
12927 .IR name .
12928
12929 .TP
12930 .IR d .File( name )
12931 Returns a file Node for a file within
12932 .I d
12933 named
12934 .IR name .
12935
12936 .TP
12937 .IR d .Entry( name )
12938 Returns an unresolved Node within
12939 .I d
12940 named
12941 .IR name .
12942
12943 .TP
12944 .IR f .Dir( name )
12945 Returns a directory named
12946 .I name
12947 within the parent directory of
12948 .IR f .
12949
12950 .TP
12951 .IR f .File( name )
12952 Returns a file named
12953 .I name
12954 within the parent directory of
12955 .IR f .
12956
12957 .TP
12958 .IR f .Entry( name )
12959 Returns an unresolved Node named
12960 .I name
12961 within the parent directory of
12962 .IR f .
12963
12964 .RE
12965 For example:
12966
12967 .ES
12968 # Get a Node for a file within a directory
12969 incl = Dir('include')
12970 f = incl.File('header.h')
12971
12972 # Get a Node for a subdirectory within a directory
12973 dist = Dir('project-3.2.1)
12974 src = dist.Dir('src')
12975
12976 # Get a Node for a file in the same directory
12977 cfile = File('sample.c')
12978 hfile = cfile.File('sample.h')
12979
12980 # Combined example
12981 docs = Dir('docs')
12982 html = docs.Dir('html')
12983 index = html.File('index.html')
12984 css = index.File('app.css')
12985 .EE
12986
12987 .SH EXTENDING SCONS
12988 .SS Builder Objects
12989 .B scons
12990 can be extended to build different types of targets
12991 by adding new Builder objects
12992 to a construction environment.
12993 .IR "In general" ,
12994 you should only need to add a new Builder object
12995 when you want to build a new type of file or other external target.
12996 If you just want to invoke a different compiler or other tool
12997 to build a Program, Object, Library, or any other
12998 type of output file for which
12999 .B scons
13000 already has an existing Builder,
13001 it is generally much easier to
13002 use those existing Builders
13003 in a construction environment
13004 that sets the appropriate construction variables
13005 (CC, LINK, etc.).
13006
13007 Builder objects are created
13008 using the
13009 .B Builder
13010 function.
13011 The
13012 .B Builder
13013 function accepts the following arguments:
13014
13015 .IP action
13016 The command line string used to build the target from the source.
13017 .B action
13018 can also be:
13019 a list of strings representing the command
13020 to be executed and its arguments
13021 (suitable for enclosing white space in an argument),
13022 a dictionary
13023 mapping source file name suffixes to
13024 any combination of command line strings
13025 (if the builder should accept multiple source file extensions),
13026 a Python function;
13027 an Action object
13028 (see the next section);
13029 or a list of any of the above.
13030
13031 An action function
13032 takes three arguments:
13033 .I source
13034 - a list of source nodes,
13035 .I target
13036 - a list of target nodes,
13037 .I env
13038 - the construction environment.
13039
13040 .IP prefix
13041 The prefix that will be prepended to the target file name.
13042 This may be specified as a:
13043
13044 .RS 10
13045 .HP 6
13046 *
13047 .IR string ,
13048
13049 .HP 6
13050 *
13051 .I callable object
13052 - a function or other callable that takes
13053 two arguments (a construction environment and a list of sources)
13054 and returns a prefix,
13055
13056 .HP 6
13057 *
13058 .I dictionary
13059 - specifies a mapping from a specific source suffix (of the first
13060 source specified) to a corresponding target prefix. Both the source
13061 suffix and target prefix specifications may use environment variable
13062 substitution, and the target prefix (the 'value' entries in the
13063 dictionary) may also be a callable object. The default target prefix
13064 may be indicated by a dictionary entry with a key value of None.
13065 .RE
13066 .P
13067
13068 .ES
13069 b = Builder("build_it < $SOURCE > $TARGET",
13070 prefix = "file-")
13071
13072 def gen_prefix(env, sources):
13073 return "file-" + env['PLATFORM'] + '-'
13074 b = Builder("build_it < $SOURCE > $TARGET",
13075 prefix = gen_prefix)
13076
13077 b = Builder("build_it < $SOURCE > $TARGET",
13078 suffix = { None: "file-",
13079 "$SRC_SFX_A": gen_prefix })
13080 .EE
13081
13082 .IP suffix
13083 The suffix that will be appended to the target file name.
13084 This may be specified in the same manner as the prefix above.
13085 If the suffix is a string, then
13086 .B scons
13087 will append a '.' to the beginning of the suffix if it's not already
13088 there. The string returned by callable object (or obtained from the
13089 dictionary) is untouched and must append its own '.' to the beginning
13090 if one is desired.
13091
13092 .ES
13093 b = Builder("build_it < $SOURCE > $TARGET"
13094 suffix = "-file")
13095
13096 def gen_suffix(env, sources):
13097 return "." + env['PLATFORM'] + "-file"
13098 b = Builder("build_it < $SOURCE > $TARGET",
13099 suffix = gen_suffix)
13100
13101 b = Builder("build_it < $SOURCE > $TARGET",
13102 suffix = { None: ".sfx1",
13103 "$SRC_SFX_A": gen_suffix })
13104 .EE
13105
13106 .IP ensure_suffix
13107 When set to any true value, causes
13108 .B scons
13109 to add the target suffix specified by the
13110 .I suffix
13111 keyword to any target strings
13112 that have a different suffix.
13113 (The default behavior is to leave untouched
13114 any target file name that looks like it already has any suffix.)
13115
13116 .ES
13117 b1 = Builder("build_it < $SOURCE > $TARGET"
13118 suffix = ".out")
13119 b2 = Builder("build_it < $SOURCE > $TARGET"
13120 suffix = ".out",
13121 ensure_suffix)
13122 env = Environment()
13123 env['BUILDERS']['B1'] = b1
13124 env['BUILDERS']['B2'] = b2
13125
13126 # Builds "foo.txt" because ensure_suffix is not set.
13127 env.B1('foo.txt', 'foo.in')
13128
13129 # Builds "bar.txt.out" because ensure_suffix is set.
13130 env.B2('bar.txt', 'bar.in')
13131 .EE
13132
13133 .IP src_suffix
13134 The expected source file name suffix. This may be a string or a list
13135 of strings.
13136
13137 .IP target_scanner
13138 A Scanner object that
13139 will be invoked to find
13140 implicit dependencies for this target file.
13141 This keyword argument should be used
13142 for Scanner objects that find
13143 implicit dependencies
13144 based only on the target file
13145 and the construction environment,
13146 .I not
13147 for implicit
13148 (See the section "Scanner Objects," below,
13149 for information about creating Scanner objects.)
13150
13151 .IP source_scanner
13152 A Scanner object that
13153 will be invoked to
13154 find implicit dependences in
13155 any source files
13156 used to build this target file.
13157 This is where you would
13158 specify a scanner to
13159 find things like
13160 .B #include
13161 lines in source files.
13162 The pre-built
13163 .B DirScanner
13164 Scanner object may be used to
13165 indicate that this Builder
13166 should scan directory trees
13167 for on-disk changes to files
13168 that
13169 .B scons
13170 does not know about from other Builder or function calls.
13171 (See the section "Scanner Objects," below,
13172 for information about creating your own Scanner objects.)
13173
13174 .IP target_factory
13175 A factory function that the Builder will use
13176 to turn any targets specified as strings into SCons Nodes.
13177 By default,
13178 SCons assumes that all targets are files.
13179 Other useful target_factory
13180 values include
13181 .BR Dir ,
13182 for when a Builder creates a directory target,
13183 and
13184 .BR Entry ,
13185 for when a Builder can create either a file
13186 or directory target.
13187
13188 Example:
13189
13190 .ES
13191 MakeDirectoryBuilder = Builder(action=my_mkdir, target_factory=Dir)
13192 env = Environment()
13193 env.Append(BUILDERS = {'MakeDirectory':MakeDirectoryBuilder})
13194 env.MakeDirectory('new_directory', [])
13195 .EE
13196
13197 .IP
13198 Note that the call to the MakeDirectory Builder
13199 needs to specify an empty source list
13200 to make the string represent the builder's target;
13201 without that, it would assume the argument is the source,
13202 and would try to deduce the target name from it,
13203 which in the absence of an automatically-added prefix or suffix
13204 would lead to a matching target and source name
13205 and a circular dependency.
13206
13207 .IP source_factory
13208 A factory function that the Builder will use
13209 to turn any sources specified as strings into SCons Nodes.
13210 By default,
13211 SCons assumes that all source are files.
13212 Other useful source_factory
13213 values include
13214 .BR Dir ,
13215 for when a Builder uses a directory as a source,
13216 and
13217 .BR Entry ,
13218 for when a Builder can use files
13219 or directories (or both) as sources.
13220
13221 Example:
13222
13223 .ES
13224 CollectBuilder = Builder(action=my_mkdir, source_factory=Entry)
13225 env = Environment()
13226 env.Append(BUILDERS = {'Collect':CollectBuilder})
13227 env.Collect('archive', ['directory_name', 'file_name'])
13228 .EE
13229
13230 .IP emitter
13231 A function or list of functions to manipulate the target and source
13232 lists before dependencies are established
13233 and the target(s) are actually built.
13234 .B emitter
13235 can also be a string containing a construction variable to expand
13236 to an emitter function or list of functions,
13237 or a dictionary mapping source file suffixes
13238 to emitter functions.
13239 (Only the suffix of the first source file
13240 is used to select the actual emitter function
13241 from an emitter dictionary.)
13242
13243 An emitter function
13244 takes three arguments:
13245 .I source
13246 - a list of source nodes,
13247 .I target
13248 - a list of target nodes,
13249 .I env
13250 - the construction environment.
13251 An emitter must return a tuple containing two lists,
13252 the list of targets to be built by this builder,
13253 and the list of sources for this builder.
13254
13255 Example:
13256
13257 .ES
13258 def e(target, source, env):
13259 return (target + ['foo.foo'], source + ['foo.src'])
13260
13261 # Simple association of an emitter function with a Builder.
13262 b = Builder("my_build < $TARGET > $SOURCE",
13263 emitter = e)
13264
13265 def e2(target, source, env):
13266 return (target + ['bar.foo'], source + ['bar.src'])
13267
13268 # Simple association of a list of emitter functions with a Builder.
13269 b = Builder("my_build < $TARGET > $SOURCE",
13270 emitter = [e, e2])
13271
13272 # Calling an emitter function through a construction variable.
13273 env = Environment(MY_EMITTER = e)
13274 b = Builder("my_build < $TARGET > $SOURCE",
13275 emitter = '$MY_EMITTER')
13276
13277 # Calling a list of emitter functions through a construction variable.
13278 env = Environment(EMITTER_LIST = [e, e2])
13279 b = Builder("my_build < $TARGET > $SOURCE",
13280 emitter = '$EMITTER_LIST')
13281
13282 # Associating multiple emitters with different file
13283 # suffixes using a dictionary.
13284 def e_suf1(target, source, env):
13285 return (target + ['another_target_file'], source)
13286 def e_suf2(target, source, env):
13287 return (target, source + ['another_source_file'])
13288 b = Builder("my_build < $TARGET > $SOURCE",
13289 emitter = {'.suf1' : e_suf1,
13290 '.suf2' : e_suf2})
13291 .EE
13292
13293 .IP multi
13294 Specifies whether this builder is allowed to be called multiple times for
13295 the same target file(s). The default is 0, which means the builder
13296 can not be called multiple times for the same target file(s). Calling a
13297 builder multiple times for the same target simply adds additional source
13298 files to the target; it is not allowed to change the environment associated
13299 with the target, specify addition environment overrides, or associate a differen t
13300 builder with the target.
13301
13302 .IP env
13303 A construction environment that can be used
13304 to fetch source code using this Builder.
13305 (Note that this environment is
13306 .I not
13307 used for normal builds of normal target files,
13308 which use the environment that was
13309 used to call the Builder for the target file.)
13310
13311 .IP generator
13312 A function that returns a list of actions that will be executed to build
13313 the target(s) from the source(s).
13314 The returned action(s) may be
13315 an Action object, or anything that
13316 can be converted into an Action object
13317 (see the next section).
13318
13319 The generator function
13320 takes four arguments:
13321 .I source
13322 - a list of source nodes,
13323 .I target
13324 - a list of target nodes,
13325 .I env
13326 - the construction environment,
13327 .I for_signature
13328 - a Boolean value that specifies
13329 whether the generator is being called
13330 for generating a build signature
13331 (as opposed to actually executing the command).
13332 Example:
13333
13334 .ES
13335 def g(source, target, env, for_signature):
13336 return [["gcc", "-c", "-o"] + target + source]
13337
13338 b = Builder(generator=g)
13339 .EE
13340
13341 .IP
13342 The
13343 .I generator
13344 and
13345 .I action
13346 arguments must not both be used for the same Builder.
13347
13348 .IP src_builder
13349 Specifies a builder to use when a source file name suffix does not match
13350 any of the suffixes of the builder. Using this argument produces a
13351 multi-stage builder.
13352
13353 .IP single_source
13354 Specifies that this builder expects exactly one source file per call. Giving
13355 more than one source file without target files results in implicitely calling
13356 the builder multiple times (once for each source given). Giving multiple
13357 source files together with target files results in a UserError exception.
13358
13359 .RE
13360 .IP
13361 The
13362 .I generator
13363 and
13364 .I action
13365 arguments must not both be used for the same Builder.
13366
13367 .IP source_ext_match
13368 When the specified
13369 .I action
13370 argument is a dictionary,
13371 the default behavior when a builder is passed
13372 multiple source files is to make sure that the
13373 extensions of all the source files match.
13374 If it is legal for this builder to be
13375 called with a list of source files with different extensions,
13376 this check can be suppressed by setting
13377 .B source_ext_match
13378 to
13379 .B None
13380 or some other non-true value.
13381 When
13382 .B source_ext_match
13383 is disable,
13384 .B scons
13385 will use the suffix of the first specified
13386 source file to select the appropriate action from the
13387 .I action
13388 dictionary.
13389
13390 In the following example,
13391 the setting of
13392 .B source_ext_match
13393 prevents
13394 .B scons
13395 from exiting with an error
13396 due to the mismatched suffixes of
13397 .B foo.in
13398 and
13399 .BR foo.extra .
13400
13401 .ES
13402 b = Builder(action={'.in' : 'build $SOURCES > $TARGET'},
13403 source_ext_match = None)
13404
13405 env = Environment(BUILDERS = {'MyBuild':b})
13406 env.MyBuild('foo.out', ['foo.in', 'foo.extra'])
13407 .EE
13408
13409 .IP env
13410 A construction environment that can be used
13411 to fetch source code using this Builder.
13412 (Note that this environment is
13413 .I not
13414 used for normal builds of normal target files,
13415 which use the environment that was
13416 used to call the Builder for the target file.)
13417
13418 .ES
13419 b = Builder(action="build < $SOURCE > $TARGET")
13420 env = Environment(BUILDERS = {'MyBuild' : b})
13421 env.MyBuild('foo.out', 'foo.in', my_arg = 'xyzzy')
13422 .EE
13423
13424 .IP chdir
13425 A directory from which scons
13426 will execute the
13427 action(s) specified
13428 for this Builder.
13429 If the
13430 .B chdir
13431 argument is
13432 a string or a directory Node,
13433 scons will change to the specified directory.
13434 If the
13435 .B chdir
13436 is not a string or Node
13437 and is non-zero,
13438 then scons will change to the
13439 target file's directory.
13440
13441 Note that scons will
13442 .I not
13443 automatically modify
13444 its expansion of
13445 construction variables like
13446 .B $TARGET
13447 and
13448 .B $SOURCE
13449 when using the chdir
13450 keyword argument--that is,
13451 the expanded file names
13452 will still be relative to
13453 the top-level SConstruct directory,
13454 and consequently incorrect
13455 relative to the chdir directory.
13456 Builders created using chdir keyword argument,
13457 will need to use construction variable
13458 expansions like
13459 .B ${TARGET.file}
13460 and
13461 .B ${SOURCE.file}
13462 to use just the filename portion of the
13463 targets and source.
13464
13465 .ES
13466 b = Builder(action="build < ${SOURCE.file} > ${TARGET.file}",
13467 chdir=1)
13468 env = Environment(BUILDERS = {'MyBuild' : b})
13469 env.MyBuild('sub/dir/foo.out', 'sub/dir/foo.in')
13470 .EE
13471
13472 .B WARNING:
13473 Python only keeps one current directory
13474 location for all of the threads.
13475 This means that use of the
13476 .B chdir
13477 argument
13478 will
13479 .I not
13480 work with the SCons
13481 .B -j
13482 option,
13483 because individual worker threads spawned
13484 by SCons interfere with each other
13485 when they start changing directory.
13486
13487 .RE
13488 Any additional keyword arguments supplied
13489 when a Builder object is created
13490 (that is, when the Builder() function is called)
13491 will be set in the executing construction
13492 environment when the Builder object is called.
13493 The canonical example here would be
13494 to set a construction variable to
13495 the repository of a source code system.
13496
13497 Any additional keyword arguments supplied
13498 when a Builder
13499 .I object
13500 is called
13501 will only be associated with the target
13502 created by that particular Builder call
13503 (and any other files built as a
13504 result of the call).
13505
13506 These extra keyword arguments are passed to the
13507 following functions:
13508 command generator functions,
13509 function Actions,
13510 and emitter functions.
13511
13512 .SS Action Objects
13513
13514 The
13515 .BR Builder ()
13516 function will turn its
13517 .B action
13518 keyword argument into an appropriate
13519 internal Action object.
13520 You can also explicity create Action objects
13521 using the
13522 .BR Action ()
13523 global function,
13524 which can then be passed to the
13525 .BR Builder ()
13526 function.
13527 This can be used to configure
13528 an Action object more flexibly,
13529 or it may simply be more efficient
13530 than letting each separate Builder object
13531 create a separate Action
13532 when multiple
13533 Builder objects need to do the same thing.
13534
13535 The
13536 .BR Action ()
13537 global function
13538 returns an appropriate object for the action
13539 represented by the type of the first argument:
13540
13541 .IP Action
13542 If the first argument is already an Action object,
13543 the object is simply returned.
13544
13545 .IP String
13546 If the first argument is a string,
13547 a command-line Action is returned.
13548 Note that the command-line string
13549 may be preceded by an
13550 .B @
13551 (at-sign)
13552 to suppress printing of the specified command line,
13553 or by a
13554 .B \-
13555 (hyphen)
13556 to ignore the exit status from the specified command:
13557
13558 .ES
13559 Action('$CC -c -o $TARGET $SOURCES')
13560
13561 # Doesn't print the line being executed.
13562 Action('@build $TARGET $SOURCES')
13563
13564 # Ignores return value
13565 Action('-build $TARGET $SOURCES')
13566 .EE
13567 .\" XXX From Gary Ruben, 23 April 2002:
13568 .\" What would be useful is a discussion of how you execute command
13569 .\" shell commands ie. what is the process used to spawn the shell, pass
13570 .\" environment variables to it etc., whether there is one shell per
13571 .\" environment or one per command etc. It might help to look at the Gnu
13572 .\" make documentation to see what they think is important to discuss about
13573 .\" a build system. I'm sure you can do a better job of organising the
13574 .\" documentation than they have :-)
13575
13576 .IP List
13577 If the first argument is a list,
13578 then a list of Action objects is returned.
13579 An Action object is created as necessary
13580 for each element in the list.
13581 If an element
13582 .I within
13583 the list is itself a list,
13584 the internal list is the
13585 command and arguments to be executed via
13586 the command line.
13587 This allows white space to be enclosed
13588 in an argument by defining
13589 a command in a list within a list:
13590
13591 .ES
13592 Action([['cc', '-c', '-DWHITE SPACE', '-o', '$TARGET', '$SOURCES']])
13593 .EE
13594
13595 .IP Function
13596 If the first argument is a Python function,
13597 a function Action is returned.
13598 The Python function must take three keyword arguments,
13599 .B target
13600 (a Node object representing the target file),
13601 .B source
13602 (a Node object representing the source file)
13603 and
13604 .B env
13605 (the construction environment
13606 used for building the target file).
13607 The
13608 .B target
13609 and
13610 .B source
13611 arguments may be lists of Node objects if there is
13612 more than one target file or source file.
13613 The actual target and source file name(s) may
13614 be retrieved from their Node objects
13615 via the built-in Python str() function:
13616
13617 .ES
13618 target_file_name = str(target)
13619 source_file_names = map(lambda x: str(x), source)
13620 .EE
13621 .IP
13622 The function should return
13623 .B 0
13624 or
13625 .B None
13626 to indicate a successful build of the target file(s).
13627 The function may raise an exception
13628 or return a non-zero exit status
13629 to indicate an unsuccessful build.
13630
13631 .ES
13632 def build_it(target = None, source = None, env = None):
13633 # build the target from the source
13634 return 0
13635
13636 a = Action(build_it)
13637 .EE
13638
13639 If the action argument is not one of the above,
13640 None is returned.
13641 .PP
13642
13643 The second argument is optional and is used to define the output
13644 which is printed when the Action is actually performed.
13645 In the absence of this parameter,
13646 or if it's an empty string,
13647 a default output depending on the type of the action is used.
13648 For example, a command-line action will print the executed command.
13649 The argument must be either a Python function or a string.
13650
13651 In the first case,
13652 it's a function that returns a string to be printed
13653 to describe the action being executed.
13654 The function may also be specified by the
13655 .IR strfunction =
13656 keyword argument.
13657 Like a function to build a file,
13658 this function must take three keyword arguments:
13659 .B target
13660 (a Node object representing the target file),
13661 .B source
13662 (a Node object representing the source file)
13663 and
13664 .BR env
13665 (a construction environment).
13666 The
13667 .B target
13668 and
13669 .B source
13670 arguments may be lists of Node objects if there is
13671 more than one target file or source file.
13672
13673 In the second case, you provide the string itself.
13674 The string may also be specified by the
13675 .IR cmdstr =
13676 keyword argument.
13677 The string typically contains variables, notably
13678 $TARGET(S) and $SOURCE(S), or consists of just a single
13679 variable, which is optionally defined somewhere else.
13680 SCons itself heavily uses the latter variant.
13681
13682 Examples:
13683
13684 .ES
13685 def build_it(target, source, env):
13686 # build the target from the source
13687 return 0
13688
13689 def string_it(target, source, env):
13690 return "building '%s' from '%s'" % (target[0], source[0])
13691
13692 # Use a positional argument.
13693 f = Action(build_it, string_it)
13694 s = Action(build_it, "building '$TARGET' from '$SOURCE'")
13695
13696 # Alternatively, use a keyword argument.
13697 f = Action(build_it, strfunction=string_it)
13698 s = Action(build_it, cmdstr="building '$TARGET' from '$SOURCE'")
13699
13700 # You can provide a configurable variable.
13701 l = Action(build_it, '$STRINGIT')
13702 .EE
13703
13704 The third and succeeding arguments, if present,
13705 may either be a construction variable or a list of construction variables
13706 whose values will be included in the signature of the Action
13707 when deciding whether a target should be rebuilt because the action changed.
13708 The variables may also be specified by a
13709 .IR varlist =
13710 keyword parameter;
13711 if both are present, they are combined.
13712 This is necessary whenever you want a target to be rebuilt
13713 when a specific construction variable changes.
13714 This is not often needed for a string action,
13715 as the expanded variables will normally be part of the command line,
13716 but may be needed if a Python function action uses
13717 the value of a construction variable when generating the command line.
13718
13719 .ES
13720 def build_it(target, source, env):
13721 # build the target from the 'XXX' construction variable
13722 open(target[0], 'w').write(env['XXX'])
13723 return 0
13724
13725 # Use positional arguments.
13726 a = Action(build_it, '$STRINGIT', ['XXX'])
13727
13728 # Alternatively, use a keyword argument.
13729 a = Action(build_it, varlist=['XXX'])
13730 .EE
13731
13732 The
13733 .BR Action ()
13734 global function
13735 can be passed the following
13736 optional keyword arguments
13737 to modify the Action object's behavior:
13738
13739 .IP
13740 .B chdir
13741 The
13742 .B chdir
13743 keyword argument specifies that
13744 scons will execute the action
13745 after changing to the specified directory.
13746 If the
13747 .B chdir
13748 argument is
13749 a string or a directory Node,
13750 scons will change to the specified directory.
13751 If the
13752 .B chdir
13753 argument
13754 is not a string or Node
13755 and is non-zero,
13756 then scons will change to the
13757 target file's directory.
13758
13759 Note that scons will
13760 .I not
13761 automatically modify
13762 its expansion of
13763 construction variables like
13764 .B $TARGET
13765 and
13766 .B $SOURCE
13767 when using the chdir
13768 keyword argument--that is,
13769 the expanded file names
13770 will still be relative to
13771 the top-level SConstruct directory,
13772 and consequently incorrect
13773 relative to the chdir directory.
13774 Builders created using chdir keyword argument,
13775 will need to use construction variable
13776 expansions like
13777 .B ${TARGET.file}
13778 and
13779 .B ${SOURCE.file}
13780 to use just the filename portion of the
13781 targets and source.
13782
13783 .ES
13784 a = Action("build < ${SOURCE.file} > ${TARGET.file}",
13785 chdir=1)
13786 .EE
13787
13788 .IP
13789 .B exitstatfunc
13790 The
13791 .BR Action ()
13792 global function
13793 also takes an
13794 .B exitstatfunc
13795 keyword argument
13796 which specifies a function
13797 that is passed the exit status
13798 (or return value)
13799 from the specified action
13800 and can return an arbitrary
13801 or modified value.
13802 This can be used, for example,
13803 to specify that an Action object's
13804 return value should be ignored
13805 under special conditions
13806 and SCons should, therefore,
13807 consider that the action always suceeds:
13808
13809 .ES
13810 def always_succeed(s):
13811 # Always return 0, which indicates success.
13812 return 0
13813 a = Action("build < ${SOURCE.file} > ${TARGET.file}",
13814 exitstatfunc=always_succeed)
13815 .EE
13816
13817 .IP
13818 .B batch_key
13819 The
13820 .B batch_key
13821 keyword argument can be used
13822 to specify that the Action can create multiple target files
13823 by processing multiple independent source files simultaneously.
13824 (The canonical example is "batch compilation"
13825 of multiple object files
13826 by passing multiple source files
13827 to a single invocation of a compiler
13828 such as Microsoft's Visual C / C++ compiler.)
13829 If the
13830 .B batch_key
13831 argument is any non-False, non-callable Python value,
13832 the configured Action object will cause
13833 .B scons
13834 to collect all targets built with the Action object
13835 and configured with the same construction environment
13836 into single invocations of the Action object's
13837 command line or function.
13838 Command lines will typically want to use the
13839 .BR CHANGED_SOURCES
13840 construction variable
13841 (and possibly
13842 .BR CHANGED_TARGETS
13843 as well)
13844 to only pass to the command line those sources that
13845 have actually changed since their targets were built.
13846
13847 Example:
13848
13849 .ES
13850 a = Action('build $CHANGED_SOURCES', batch_key=True)
13851 .EE
13852
13853 The
13854 .B batch_key
13855 argument may also be
13856 a callable function
13857 that returns a key that
13858 will be used to identify different
13859 "batches" of target files to be collected
13860 for batch building.
13861 A
13862 .B batch_key
13863 function must take the following arguments:
13864
13865 .IP action
13866 The action object.
13867
13868 .IP env
13869 The construction environment
13870 configured for the target.
13871
13872 .IP target
13873 The list of targets for a particular configured action.
13874
13875 .IP source
13876 The list of source for a particular configured action.
13877
13878 The returned key should typically
13879 be a tuple of values derived from the arguments,
13880 using any appropriate logic to decide
13881 how multiple invocations should be batched.
13882 For example, a
13883 .B batch_key
13884 function may decide to return
13885 the value of a specific construction
13886 variable from the
13887 .B env
13888 argument
13889 which will cause
13890 .B scons
13891 to batch-build targets
13892 with matching values of that variable,
13893 or perhaps return the
13894 .BR id ()
13895 of the entire construction environment,
13896 in which case
13897 .B scons
13898 will batch-build
13899 all targets configured with the same construction environment.
13900 Returning
13901 .B None
13902 indicates that
13903 the particular target should
13904 .I not
13905 be part of any batched build,
13906 but instead will be built
13907 by a separate invocation of action's
13908 command or function.
13909 Example:
13910
13911 .ES
13912 def batch_key(action, env, target, source):
13913 tdir = target[0].dir
13914 if tdir.name == 'special':
13915 # Don't batch-build any target
13916 # in the special/ subdirectory.
13917 return None
13918 return (id(action), id(env), tdir)
13919 a = Action('build $CHANGED_SOURCES', batch_key=batch_key)
13920 .EE
13921
13922 .SS Miscellaneous Action Functions
13923
13924 .B scons
13925 supplies a number of functions
13926 that arrange for various common
13927 file and directory manipulations
13928 to be performed.
13929 These are similar in concept to "tasks" in the
13930 Ant build tool,
13931 although the implementation is slightly different.
13932 These functions do not actually
13933 perform the specified action
13934 at the time the function is called,
13935 but instead return an Action object
13936 that can be executed at the
13937 appropriate time.
13938 (In Object-Oriented terminology,
13939 these are actually
13940 Action
13941 .I Factory
13942 functions
13943 that return Action objects.)
13944
13945 In practice,
13946 there are two natural ways
13947 that these
13948 Action Functions
13949 are intended to be used.
13950
13951 First,
13952 if you need
13953 to perform the action
13954 at the time the SConscript
13955 file is being read,
13956 you can use the
13957 .B Execute
13958 global function to do so:
13959 .ES
13960 Execute(Touch('file'))
13961 .EE
13962
13963 Second,
13964 you can use these functions
13965 to supply Actions in a list
13966 for use by the
13967 .B Command
13968 method.
13969 This can allow you to
13970 perform more complicated
13971 sequences of file manipulation
13972 without relying
13973 on platform-specific
13974 external commands:
13975 that
13976 .ES
13977 env = Environment(TMPBUILD = '/tmp/builddir')
13978 env.Command('foo.out', 'foo.in',
13979 [Mkdir('$TMPBUILD'),
13980 Copy('$TMPBUILD', '${SOURCE.dir}'),
13981 "cd $TMPBUILD && make",
13982 Delete('$TMPBUILD')])
13983 .EE
13984
13985 .TP
13986 .RI Chmod( dest ", " mode )
13987 Returns an Action object that
13988 changes the permissions on the specified
13989 .I dest
13990 file or directory to the specified
13991 .IR mode .
13992 Examples:
13993
13994 .ES
13995 Execute(Chmod('file', 0755))
13996
13997 env.Command('foo.out', 'foo.in',
13998 [Copy('$TARGET', '$SOURCE'),
13999 Chmod('$TARGET', 0755)])
14000 .EE
14001
14002 .TP
14003 .RI Copy( dest ", " src )
14004 Returns an Action object
14005 that will copy the
14006 .I src
14007 source file or directory to the
14008 .I dest
14009 destination file or directory.
14010 Examples:
14011
14012 .ES
14013 Execute(Copy('foo.output', 'foo.input'))
14014
14015 env.Command('bar.out', 'bar.in',
14016 Copy('$TARGET', '$SOURCE'))
14017 .EE
14018
14019 .TP
14020 .RI Delete( entry ", [" must_exist ])
14021 Returns an Action that
14022 deletes the specified
14023 .IR entry ,
14024 which may be a file or a directory tree.
14025 If a directory is specified,
14026 the entire directory tree
14027 will be removed.
14028 If the
14029 .I must_exist
14030 flag is set,
14031 then a Python error will be thrown
14032 if the specified entry does not exist;
14033 the default is
14034 .BR must_exist=0 ,
14035 that is, the Action will silently do nothing
14036 if the entry does not exist.
14037 Examples:
14038
14039 .ES
14040 Execute(Delete('/tmp/buildroot'))
14041
14042 env.Command('foo.out', 'foo.in',
14043 [Delete('${TARGET.dir}'),
14044 MyBuildAction])
14045
14046 Execute(Delete('file_that_must_exist', must_exist=1))
14047 .EE
14048
14049 .TP
14050 .RI Mkdir( dir )
14051 Returns an Action
14052 that creates the specified
14053 directory
14054 .I dir .
14055 Examples:
14056
14057 .ES
14058 Execute(Mkdir('/tmp/outputdir'))
14059
14060 env.Command('foo.out', 'foo.in',
14061 [Mkdir('/tmp/builddir'),
14062 Copy('/tmp/builddir/foo.in', '$SOURCE'),
14063 "cd /tmp/builddir && make",
14064 Copy('$TARGET', '/tmp/builddir/foo.out')])
14065 .EE
14066
14067 .TP
14068 .RI Move( dest ", " src )
14069 Returns an Action
14070 that moves the specified
14071 .I src
14072 file or directory to
14073 the specified
14074 .I dest
14075 file or directory.
14076 Examples:
14077
14078 .ES
14079 Execute(Move('file.destination', 'file.source'))
14080
14081 env.Command('output_file', 'input_file',
14082 [MyBuildAction,
14083 Move('$TARGET', 'file_created_by_MyBuildAction')])
14084 .EE
14085
14086 .TP
14087 .RI Touch( file )
14088 Returns an Action
14089 that updates the modification time
14090 on the specified
14091 .IR file .
14092 Examples:
14093
14094 .ES
14095 Execute(Touch('file_to_be_touched'))
14096
14097 env.Command('marker', 'input_file',
14098 [MyBuildAction,
14099 Touch('$TARGET')])
14100 .EE
14101
14102 .SS Variable Substitution
14103
14104 Before executing a command,
14105 .B scons
14106 performs construction variable interpolation on the strings that make up
14107 the command line of builders.
14108 Variables are introduced by a
14109 .B $
14110 prefix.
14111 Besides construction variables, scons provides the following
14112 variables for each command execution:
14113
14114 .IP CHANGED_SOURCES
14115 The file names of all sources of the build command
14116 that have changed since the target was last built.
14117
14118 .IP CHANGED_TARGETS
14119 The file names of all targets that would be built
14120 from sources that have changed since the target was last built.
14121
14122 .IP SOURCE
14123 The file name of the source of the build command,
14124 or the file name of the first source
14125 if multiple sources are being built.
14126
14127 .IP SOURCES
14128 The file names of the sources of the build command.
14129
14130 .IP TARGET
14131 The file name of the target being built,
14132 or the file name of the first target
14133 if multiple targets are being built.
14134
14135 .IP TARGETS
14136 The file names of all targets being built.
14137
14138 .IP UNCHANGED_SOURCES
14139 The file names of all sources of the build command
14140 that have
14141 .I not
14142 changed since the target was last built.
14143
14144 .IP UNCHANGED_TARGETS
14145 The file names of all targets that would be built
14146 from sources that have
14147 .I not
14148 changed since the target was last built.
14149
14150 (Note that the above variables are reserved
14151 and may not be set in a construction environment.)
14152
14153 .LP
14154 For example, given the construction variable CC='cc', targets=['foo'], and
14155 sources=['foo.c', 'bar.c']:
14156
14157 .ES
14158 action='$CC -c -o $TARGET $SOURCES'
14159 .EE
14160
14161 would produce the command line:
14162
14163 .ES
14164 cc -c -o foo foo.c bar.c
14165 .EE
14166
14167 Variable names may be surrounded by curly braces ({})
14168 to separate the name from the trailing characters.
14169 Within the curly braces, a variable name may have
14170 a Python slice subscript appended to select one
14171 or more items from a list.
14172 In the previous example, the string:
14173
14174 .ES
14175 ${SOURCES[1]}
14176 .EE
14177
14178 would produce:
14179
14180 .ES
14181 bar.c
14182 .EE
14183
14184 Additionally, a variable name may
14185 have the following special
14186 modifiers appended within the enclosing curly braces
14187 to modify the interpolated string:
14188
14189 .IP base
14190 The base path of the file name,
14191 including the directory path
14192 but excluding any suffix.
14193
14194 .IP dir
14195 The name of the directory in which the file exists.
14196
14197 .IP file
14198 The file name,
14199 minus any directory portion.
14200
14201 .IP filebase
14202 Just the basename of the file,
14203 minus any suffix
14204 and minus the directory.
14205
14206 .IP suffix
14207 Just the file suffix.
14208
14209 .IP abspath
14210 The absolute path name of the file.
14211
14212 .IP posix
14213 The POSIX form of the path,
14214 with directories separated by
14215 .B /
14216 (forward slashes)
14217 not backslashes.
14218 This is sometimes necessary on Windows systems
14219 when a path references a file on other (POSIX) systems.
14220
14221 .IP srcpath
14222 The directory and file name to the source file linked to this file through
14223 .BR VariantDir ().
14224 If this file isn't linked,
14225 it just returns the directory and filename unchanged.
14226
14227 .IP srcdir
14228 The directory containing the source file linked to this file through
14229 .BR VariantDir ().
14230 If this file isn't linked,
14231 it just returns the directory part of the filename.
14232
14233 .IP rsrcpath
14234 The directory and file name to the source file linked to this file through
14235 .BR VariantDir ().
14236 If the file does not exist locally but exists in a Repository,
14237 the path in the Repository is returned.
14238 If this file isn't linked, it just returns the
14239 directory and filename unchanged.
14240
14241 .IP rsrcdir
14242 The Repository directory containing the source file linked to this file through
14243 .BR VariantDir ().
14244 If this file isn't linked,
14245 it just returns the directory part of the filename.
14246
14247 .LP
14248 For example, the specified target will
14249 expand as follows for the corresponding modifiers:
14250
14251 .ES
14252 $TARGET => sub/dir/file.x
14253 ${TARGET.base} => sub/dir/file
14254 ${TARGET.dir} => sub/dir
14255 ${TARGET.file} => file.x
14256 ${TARGET.filebase} => file
14257 ${TARGET.suffix} => .x
14258 ${TARGET.abspath} => /top/dir/sub/dir/file.x
14259
14260 SConscript('src/SConscript', variant_dir='sub/dir')
14261 $SOURCE => sub/dir/file.x
14262 ${SOURCE.srcpath} => src/file.x
14263 ${SOURCE.srcdir} => src
14264
14265 Repository('/usr/repository')
14266 $SOURCE => sub/dir/file.x
14267 ${SOURCE.rsrcpath} => /usr/repository/src/file.x
14268 ${SOURCE.rsrcdir} => /usr/repository/src
14269 .EE
14270
14271 Note that curly braces braces may also be used
14272 to enclose arbitrary Python code to be evaluated.
14273 (In fact, this is how the above modifiers are substituted,
14274 they are simply attributes of the Python objects
14275 that represent TARGET, SOURCES, etc.)
14276 See the section "Python Code Substitution," below,
14277 for more thorough examples of
14278 how this can be used.
14279
14280 Lastly, a variable name
14281 may be a callable Python function
14282 associated with a
14283 construction variable in the environment.
14284 The function should
14285 take four arguments:
14286 .I target
14287 - a list of target nodes,
14288 .I source
14289 - a list of source nodes,
14290 .I env
14291 - the construction environment,
14292 .I for_signature
14293 - a Boolean value that specifies
14294 whether the function is being called
14295 for generating a build signature.
14296 SCons will insert whatever
14297 the called function returns
14298 into the expanded string:
14299
14300 .ES
14301 def foo(target, source, env, for_signature):
14302 return "bar"
14303
14304 # Will expand $BAR to "bar baz"
14305 env=Environment(FOO=foo, BAR="$FOO baz")
14306 .EE
14307
14308 You can use this feature to pass arguments to a
14309 Python function by creating a callable class
14310 that stores one or more arguments in an object,
14311 and then uses them when the
14312 .B __call__()
14313 method is called.
14314 Note that in this case,
14315 the entire variable expansion must
14316 be enclosed by curly braces
14317 so that the arguments will
14318 be associated with the
14319 instantiation of the class:
14320
14321 .ES
14322 class foo(object):
14323 def __init__(self, arg):
14324 self.arg = arg
14325
14326 def __call__(self, target, source, env, for_signature):
14327 return self.arg + " bar"
14328
14329 # Will expand $BAR to "my argument bar baz"
14330 env=Environment(FOO=foo, BAR="${FOO('my argument')} baz")
14331 .EE
14332
14333 .LP
14334 The special pseudo-variables
14335 .B "$("
14336 and
14337 .B "$)"
14338 may be used to surround parts of a command line
14339 that may change
14340 .I without
14341 causing a rebuild--that is,
14342 which are not included in the signature
14343 of target files built with this command.
14344 All text between
14345 .B "$("
14346 and
14347 .B "$)"
14348 will be removed from the command line
14349 before it is added to file signatures,
14350 and the
14351 .B "$("
14352 and
14353 .B "$)"
14354 will be removed before the command is executed.
14355 For example, the command line:
14356
14357 .ES
14358 echo Last build occurred $( $TODAY $). > $TARGET
14359 .EE
14360
14361 .LP
14362 would execute the command:
14363
14364 .ES
14365 echo Last build occurred $TODAY. > $TARGET
14366 .EE
14367
14368 .LP
14369 but the command signature added to any target files would be:
14370
14371 .ES
14372 echo Last build occurred . > $TARGET
14373 .EE
14374
14375 .SS Python Code Substitution
14376
14377 Any python code within
14378 .BR "${" - "}"
14379 pairs gets evaluated by python 'eval', with the python globals set to
14380 the current environment's set of construction variables.
14381 So in the following case:
14382 .ES
14383 env['COND'] = 0
14384 env.Command('foo.out', 'foo.in',
14385 '''echo ${COND==1 and 'FOO' or 'BAR'} > $TARGET''')
14386 .EE
14387 the command executed will be either
14388 .ES
14389 echo FOO > foo.out
14390 .EE
14391 or
14392 .ES
14393 echo BAR > foo.out
14394 .EE
14395 according to the current value of env['COND'] when the command is
14396 executed. The evaluation occurs when the target is being
14397 built, not when the SConscript is being read. So if env['COND'] is changed
14398 later in the SConscript, the final value will be used.
14399
14400 Here's a more interesting example. Note that all of COND, FOO, and
14401 BAR are environment variables, and their values are substituted into
14402 the final command. FOO is a list, so its elements are interpolated
14403 separated by spaces.
14404
14405 .ES
14406 env=Environment()
14407 env['COND'] = 0
14408 env['FOO'] = ['foo1', 'foo2']
14409 env['BAR'] = 'barbar'
14410 env.Command('foo.out', 'foo.in',
14411 'echo ${COND==1 and FOO or BAR} > $TARGET')
14412
14413 # Will execute this:
14414 # echo foo1 foo2 > foo.out
14415 .EE
14416
14417 SCons uses the following rules when converting construction variables into
14418 command lines:
14419
14420 .IP String
14421 When the value is a string it is interpreted as a space delimited list of
14422 command line arguments.
14423
14424 .IP List
14425 When the value is a list it is interpreted as a list of command line
14426 arguments. Each element of the list is converted to a string.
14427
14428 .IP Other
14429 Anything that is not a list or string is converted to a string and
14430 interpreted as a single command line argument.
14431
14432 .IP Newline
14433 Newline characters (\\n) delimit lines. The newline parsing is done after
14434 all other parsing, so it is not possible for arguments (e.g. file names) to
14435 contain embedded newline characters. This limitation will likely go away in
14436 a future version of SCons.
14437
14438 .SS Scanner Objects
14439
14440 You can use the
14441 .B Scanner
14442 function to define
14443 objects to scan
14444 new file types for implicit dependencies.
14445 The
14446 .B Scanner
14447 function accepts the following arguments:
14448
14449 .IP function
14450 This can be either:
14451 1) a Python function that will process
14452 the Node (file)
14453 and return a list of strings (file names)
14454 representing the implicit
14455 dependencies found in the contents;
14456 or:
14457 2) a dictionary that maps keys
14458 (typically the file suffix, but see below for more discussion)
14459 to other Scanners that should be called.
14460
14461 If the argument is actually a Python function,
14462 the function must take three or four arguments:
14463
14464 def scanner_function(node, env, path):
14465
14466 def scanner_function(node, env, path, arg=None):
14467
14468 The
14469 .B node
14470 argument is the internal
14471 SCons node representing the file.
14472 Use
14473 .B str(node)
14474 to fetch the name of the file, and
14475 .B node.get_contents()
14476 to fetch contents of the file.
14477 Note that the file is
14478 .I not
14479 guaranteed to exist before the scanner is called,
14480 so the scanner function should check that
14481 if there's any chance that the scanned file
14482 might not exist
14483 (for example, if it's built from other files).
14484
14485 The
14486 .B env
14487 argument is the construction environment for the scan.
14488 Fetch values from it using the
14489 .B env.Dictionary()
14490 method.
14491
14492 The
14493 .B path
14494 argument is a tuple (or list)
14495 of directories that can be searched
14496 for files.
14497 This will usually be the tuple returned by the
14498 .B path_function
14499 argument (see below).
14500
14501 The
14502 .B arg
14503 argument is the argument supplied
14504 when the scanner was created, if any.
14505
14506 .IP name
14507 The name of the Scanner.
14508 This is mainly used
14509 to identify the Scanner internally.
14510
14511 .IP argument
14512 An optional argument that, if specified,
14513 will be passed to the scanner function
14514 (described above)
14515 and the path function
14516 (specified below).
14517
14518 .IP skeys
14519 An optional list that can be used to
14520 determine which scanner should be used for
14521 a given Node.
14522 In the usual case of scanning for file names,
14523 this argument will be a list of suffixes
14524 for the different file types that this
14525 Scanner knows how to scan.
14526 If the argument is a string,
14527 then it will be expanded
14528 into a list by the current environment.
14529
14530 .IP path_function
14531 A Python function that takes four or five arguments:
14532 a construction environment,
14533 a Node for the directory containing
14534 the SConscript file in which
14535 the first target was defined,
14536 a list of target nodes,
14537 a list of source nodes,
14538 and an optional argument supplied
14539 when the scanner was created.
14540 The
14541 .B path_function
14542 returns a tuple of directories
14543 that can be searched for files to be returned
14544 by this Scanner object.
14545 (Note that the
14546 .BR FindPathDirs ()
14547 function can be used to return a ready-made
14548 .B path_function
14549 for a given construction variable name,
14550 instead of having to write your own function from scratch.)
14551
14552 .IP node_class
14553 The class of Node that should be returned
14554 by this Scanner object.
14555 Any strings or other objects returned
14556 by the scanner function
14557 that are not of this class
14558 will be run through the
14559 .B node_factory
14560 function.
14561
14562 .IP node_factory
14563 A Python function that will take a string
14564 or other object
14565 and turn it into the appropriate class of Node
14566 to be returned by this Scanner object.
14567
14568 .IP scan_check
14569 An optional Python function that takes two arguments,
14570 a Node (file) and a construction environment,
14571 and returns whether the
14572 Node should, in fact,
14573 be scanned for dependencies.
14574 This check can be used to eliminate unnecessary
14575 calls to the scanner function when,
14576 for example, the underlying file
14577 represented by a Node does not yet exist.
14578
14579 .IP recursive
14580 An optional flag that
14581 specifies whether this scanner should be re-invoked
14582 on the dependency files returned by the scanner.
14583 When this flag is not set,
14584 the Node subsystem will
14585 only invoke the scanner on the file being scanned,
14586 and not (for example) also on the files
14587 specified by the #include lines
14588 in the file being scanned.
14589 .I recursive
14590 may be a callable function,
14591 in which case it will be called with a list of
14592 Nodes found and
14593 should return a list of Nodes
14594 that should be scanned recursively;
14595 this can be used to select a specific subset of
14596 Nodes for additional scanning.
14597
14598 .RE
14599 Note that
14600 .B scons
14601 has a global
14602 .B SourceFileScanner
14603 object that is used by
14604 the
14605 .BR Object (),
14606 .BR SharedObject (),
14607 and
14608 .BR StaticObject ()
14609 builders to decide
14610 which scanner should be used
14611 for different file extensions.
14612 You can using the
14613 .BR SourceFileScanner.add_scanner ()
14614 method to add your own Scanner object
14615 to the
14616 .B scons
14617 infrastructure
14618 that builds target programs or
14619 libraries from a list of
14620 source files of different types:
14621
14622 .ES
14623 def xyz_scan(node, env, path):
14624 contents = node.get_text_contents()
14625 # Scan the contents and return the included files.
14626
14627 XYZScanner = Scanner(xyz_scan)
14628
14629 SourceFileScanner.add_scanner('.xyx', XYZScanner)
14630
14631 env.Program('my_prog', ['file1.c', 'file2.f', 'file3.xyz'])
14632 .EE
14633
14634 .SH SYSTEM-SPECIFIC BEHAVIOR
14635 SCons and its configuration files are very portable,
14636 due largely to its implementation in Python.
14637 There are, however, a few portability
14638 issues waiting to trap the unwary.
14639 .SS .C file suffix
14640 SCons handles the upper-case
14641 .B .C
14642 file suffix differently,
14643 depending on the capabilities of
14644 the underlying system.
14645 On a case-sensitive system
14646 such as Linux or UNIX,
14647 SCons treats a file with a
14648 .B .C
14649 suffix as a C++ source file.
14650 On a case-insensitive system
14651 such as Windows,
14652 SCons treats a file with a
14653 .B .C
14654 suffix as a C source file.
14655 .SS .F file suffix
14656 SCons handles the upper-case
14657 .B .F
14658 file suffix differently,
14659 depending on the capabilities of
14660 the underlying system.
14661 On a case-sensitive system
14662 such as Linux or UNIX,
14663 SCons treats a file with a
14664 .B .F
14665 suffix as a Fortran source file
14666 that is to be first run through
14667 the standard C preprocessor.
14668 On a case-insensitive system
14669 such as Windows,
14670 SCons treats a file with a
14671 .B .F
14672 suffix as a Fortran source file that should
14673 .I not
14674 be run through the C preprocessor.
14675 .SS Windows: Cygwin Tools and Cygwin Python vs. Windows Pythons
14676 Cygwin supplies a set of tools and utilities
14677 that let users work on a
14678 Windows system using a more POSIX-like environment.
14679 The Cygwin tools, including Cygwin Python,
14680 do this, in part,
14681 by sharing an ability to interpret UNIX-like path names.
14682 For example, the Cygwin tools
14683 will internally translate a Cygwin path name
14684 like /cygdrive/c/mydir
14685 to an equivalent Windows pathname
14686 of C:/mydir (equivalent to C:\\mydir).
14687
14688 Versions of Python
14689 that are built for native Windows execution,
14690 such as the python.org and ActiveState versions,
14691 do not have the Cygwin path name semantics.
14692 This means that using a native Windows version of Python
14693 to build compiled programs using Cygwin tools
14694 (such as gcc, bison, and flex)
14695 may yield unpredictable results.
14696 "Mixing and matching" in this way
14697 can be made to work,
14698 but it requires careful attention to the use of path names
14699 in your SConscript files.
14700
14701 In practice, users can sidestep
14702 the issue by adopting the following rules:
14703 When using gcc,
14704 use the Cygwin-supplied Python interpreter
14705 to run SCons;
14706 when using Microsoft Visual C/C++
14707 (or some other Windows compiler)
14708 use the python.org or ActiveState version of Python
14709 to run SCons.
14710 .SS Windows: scons.bat file
14711 On Windows systems,
14712 SCons is executed via a wrapper
14713 .B scons.bat
14714 file.
14715 This has (at least) two ramifications:
14716
14717 First, Windows command-line users
14718 that want to use variable assignment
14719 on the command line
14720 may have to put double quotes
14721 around the assignments:
14722
14723 .ES
14724 scons "FOO=BAR" "BAZ=BLEH"
14725 .EE
14726
14727 Second, the Cygwin shell does not
14728 recognize this file as being the same
14729 as an
14730 .B scons
14731 command issued at the command-line prompt.
14732 You can work around this either by
14733 executing
14734 .B scons.bat
14735 from the Cygwin command line,
14736 or by creating a wrapper shell
14737 script named
14738 .B scons .
14739
14740 .SS MinGW
14741
14742 The MinGW bin directory must be in your PATH environment variable or the
14743 PATH variable under the ENV construction variable for SCons
14744 to detect and use the MinGW tools. When running under the native Windows
14745 Python interpreter, SCons will prefer the MinGW tools over the Cygwin
14746 tools, if they are both installed, regardless of the order of the bin
14747 directories in the PATH variable. If you have both MSVC and MinGW
14748 installed and you want to use MinGW instead of MSVC,
14749 then you must explictly tell SCons to use MinGW by passing
14750
14751 .ES
14752 tools=['mingw']
14753 .EE
14754
14755 to the Environment() function, because SCons will prefer the MSVC tools
14756 over the MinGW tools.
14757
14758 .SH EXAMPLES
14759
14760 To help you get started using SCons,
14761 this section contains a brief overview of some common tasks.
14762
14763 .SS Basic Compilation From a Single Source File
14764
14765 .ES
14766 env = Environment()
14767 env.Program(target = 'foo', source = 'foo.c')
14768 .EE
14769
14770 Note: Build the file by specifying
14771 the target as an argument
14772 ("scons foo" or "scons foo.exe").
14773 or by specifying a dot ("scons .").
14774
14775 .SS Basic Compilation From Multiple Source Files
14776
14777 .ES
14778 env = Environment()
14779 env.Program(target = 'foo', source = Split('f1.c f2.c f3.c'))
14780 .EE
14781
14782 .SS Setting a Compilation Flag
14783
14784 .ES
14785 env = Environment(CCFLAGS = '-g')
14786 env.Program(target = 'foo', source = 'foo.c')
14787 .EE
14788
14789 .SS Search The Local Directory For .h Files
14790
14791 Note: You do
14792 .I not
14793 need to set CCFLAGS to specify -I options by hand.
14794 SCons will construct the right -I options from CPPPATH.
14795
14796 .ES
14797 env = Environment(CPPPATH = ['.'])
14798 env.Program(target = 'foo', source = 'foo.c')
14799 .EE
14800
14801 .SS Search Multiple Directories For .h Files
14802
14803 .ES
14804 env = Environment(CPPPATH = ['include1', 'include2'])
14805 env.Program(target = 'foo', source = 'foo.c')
14806 .EE
14807
14808 .SS Building a Static Library
14809
14810 .ES
14811 env = Environment()
14812 env.StaticLibrary(target = 'foo', source = Split('l1.c l2.c'))
14813 env.StaticLibrary(target = 'bar', source = ['l3.c', 'l4.c'])
14814 .EE
14815
14816 .SS Building a Shared Library
14817
14818 .ES
14819 env = Environment()
14820 env.SharedLibrary(target = 'foo', source = ['l5.c', 'l6.c'])
14821 env.SharedLibrary(target = 'bar', source = Split('l7.c l8.c'))
14822 .EE
14823
14824 .SS Linking a Local Library Into a Program
14825
14826 .ES
14827 env = Environment(LIBS = 'mylib', LIBPATH = ['.'])
14828 env.Library(target = 'mylib', source = Split('l1.c l2.c'))
14829 env.Program(target = 'prog', source = ['p1.c', 'p2.c'])
14830 .EE
14831
14832 .SS Defining Your Own Builder Object
14833
14834 Notice that when you invoke the Builder,
14835 you can leave off the target file suffix,
14836 and SCons will add it automatically.
14837
14838 .ES
14839 bld = Builder(action = 'pdftex < $SOURCES > $TARGET'
14840 suffix = '.pdf',
14841 src_suffix = '.tex')
14842 env = Environment(BUILDERS = {'PDFBuilder' : bld})
14843 env.PDFBuilder(target = 'foo.pdf', source = 'foo.tex')
14844
14845 # The following creates "bar.pdf" from "bar.tex"
14846 env.PDFBuilder(target = 'bar', source = 'bar')
14847 .EE
14848
14849 Note also that the above initialization
14850 overwrites the default Builder objects,
14851 so the Environment created above
14852 can not be used call Builders like env.Program(),
14853 env.Object(), env.StaticLibrary(), etc.
14854
14855 .SS Adding Your Own Builder Object to an Environment
14856
14857 .ES
14858 bld = Builder(action = 'pdftex < $SOURCES > $TARGET'
14859 suffix = '.pdf',
14860 src_suffix = '.tex')
14861 env = Environment()
14862 env.Append(BUILDERS = {'PDFBuilder' : bld})
14863 env.PDFBuilder(target = 'foo.pdf', source = 'foo.tex')
14864 env.Program(target = 'bar', source = 'bar.c')
14865 .EE
14866
14867 You also can use other Pythonic techniques to add
14868 to the BUILDERS construction variable, such as:
14869
14870 .ES
14871 env = Environment()
14872 env['BUILDERS]['PDFBuilder'] = bld
14873 .EE
14874
14875 .SS Defining Your Own Scanner Object
14876
14877 The following example shows an extremely simple scanner (the
14878 .BR kfile_scan ()
14879 function)
14880 that doesn't use a search path at all
14881 and simply returns the
14882 file names present on any
14883 .B include
14884 lines in the scanned file.
14885 This would implicitly assume that all included
14886 files live in the top-level directory:
14887
14888 .ES
14889 import re
14890
14891 '\" Note: the \\ in the following are for the benefit of nroff/troff,
14892 '\" not inappropriate doubled escape characters within the r'' raw string.
14893 include_re = re.compile(r'^include\\s+(\\S+)$', re.M)
14894
14895 def kfile_scan(node, env, path, arg):
14896 contents = node.get_text_contents()
14897 includes = include_re.findall(contents)
14898 return includes
14899
14900 kscan = Scanner(name = 'kfile',
14901 function = kfile_scan,
14902 argument = None,
14903 skeys = ['.k'])
14904 scanners = Environment().Dictionary('SCANNERS')
14905 env = Environment(SCANNERS = scanners + [kscan])
14906
14907 env.Command('foo', 'foo.k', 'kprocess < $SOURCES > $TARGET')
14908
14909 bar_in = File('bar.in')
14910 env.Command('bar', bar_in, 'kprocess $SOURCES > $TARGET')
14911 bar_in.target_scanner = kscan
14912 .EE
14913
14914 Here is a similar but more complete example that searches
14915 a path of directories
14916 (specified as the
14917 .B MYPATH
14918 construction variable)
14919 for files that actually exist:
14920
14921 .ES
14922 include_re = re.compile(r'^include\\s+(\\S+)$', re.M)
14923
14924 def my_scan(node, env, path, arg):
14925 contents = node.get_text_contents()
14926 includes = include_re.findall(contents)
14927 if includes == []:
14928 return []
14929 results = []
14930 for inc in includes:
14931 for dir in path:
14932 file = dir + os.sep + inc
14933 if os.path.exists(file):
14934 results.append(file)
14935 break
14936 return results
14937
14938 scanner = Scanner(name = 'myscanner',
14939 function = my_scan,
14940 argument = None,
14941 skeys = ['.x'],
14942 path_function = FindPathDirs('MYPATH'),
14943 )
14944 scanners = Environment().Dictionary('SCANNERS')
14945 env = Environment(SCANNERS = scanners + [scanner])
14946 .EE
14947
14948 The
14949 .BR FindPathDirs ()
14950 function used in the previous example returns a function
14951 (actually a callable Python object)
14952 that will return a list of directories
14953 specified in the
14954 .B $MYPATH
14955 construction variable.
14956 If you need to customize how the search path is derived,
14957 you would provide your own
14958 .B path_function
14959 argument when creating the Scanner object,
14960 as follows:
14961
14962 .ES
14963 # MYPATH is a list of directories to search for files in
14964 def pf(env, dir, target, source, arg):
14965 top_dir = Dir('#').abspath
14966 results = []
14967 if 'MYPATH' in env:
14968 for p in env['MYPATH']:
14969 results.append(top_dir + os.sep + p)
14970 return results
14971
14972 scanner = Scanner(name = 'myscanner',
14973 function = my_scan,
14974 argument = None,
14975 skeys = ['.x'],
14976 path_function = pf,
14977 )
14978 .EE
14979
14980 .SS Creating a Hierarchical Build
14981
14982 Notice that the file names specified in a subdirectory's
14983 SConscript
14984 file are relative to that subdirectory.
14985
14986 .ES
14987 SConstruct:
14988
14989 env = Environment()
14990 env.Program(target = 'foo', source = 'foo.c')
14991
14992 SConscript('sub/SConscript')
14993
14994 sub/SConscript:
14995
14996 env = Environment()
14997 # Builds sub/foo from sub/foo.c
14998 env.Program(target = 'foo', source = 'foo.c')
14999
15000 SConscript('dir/SConscript')
15001
15002 sub/dir/SConscript:
15003
15004 env = Environment()
15005 # Builds sub/dir/foo from sub/dir/foo.c
15006 env.Program(target = 'foo', source = 'foo.c')
15007 .EE
15008
15009 .SS Sharing Variables Between SConscript Files
15010
15011 You must explicitly Export() and Import() variables that
15012 you want to share between SConscript files.
15013
15014 .ES
15015 SConstruct:
15016
15017 env = Environment()
15018 env.Program(target = 'foo', source = 'foo.c')
15019
15020 Export("env")
15021 SConscript('subdirectory/SConscript')
15022
15023 subdirectory/SConscript:
15024
15025 Import("env")
15026 env.Program(target = 'foo', source = 'foo.c')
15027 .EE
15028
15029 .SS Building Multiple Variants From the Same Source
15030
15031 Use the variant_dir keyword argument to
15032 the SConscript function to establish
15033 one or more separate variant build directory trees
15034 for a given source directory:
15035
15036 .ES
15037 SConstruct:
15038
15039 cppdefines = ['FOO']
15040 Export("cppdefines")
15041 SConscript('src/SConscript', variant_dir='foo')
15042
15043 cppdefines = ['BAR']
15044 Export("cppdefines")
15045 SConscript('src/SConscript', variant_dir='bar')
15046
15047 src/SConscript:
15048
15049 Import("cppdefines")
15050 env = Environment(CPPDEFINES = cppdefines)
15051 env.Program(target = 'src', source = 'src.c')
15052 .EE
15053
15054 Note the use of the Export() method
15055 to set the "cppdefines" variable to a different
15056 value each time we call the SConscript function.
15057
15058 .SS Hierarchical Build of Two Libraries Linked With a Program
15059
15060 .ES
15061 SConstruct:
15062
15063 env = Environment(LIBPATH = ['#libA', '#libB'])
15064 Export('env')
15065 SConscript('libA/SConscript')
15066 SConscript('libB/SConscript')
15067 SConscript('Main/SConscript')
15068
15069 libA/SConscript:
15070
15071 Import('env')
15072 env.Library('a', Split('a1.c a2.c a3.c'))
15073
15074 libB/SConscript:
15075
15076 Import('env')
15077 env.Library('b', Split('b1.c b2.c b3.c'))
15078
15079 Main/SConscript:
15080
15081 Import('env')
15082 e = env.Copy(LIBS = ['a', 'b'])
15083 e.Program('foo', Split('m1.c m2.c m3.c'))
15084 .EE
15085
15086 The '#' in the LIBPATH directories specify that they're relative to the
15087 top-level directory, so they don't turn into "Main/libA" when they're
15088 used in Main/SConscript.
15089
15090 Specifying only 'a' and 'b' for the library names
15091 allows SCons to append the appropriate library
15092 prefix and suffix for the current platform
15093 (for example, 'liba.a' on POSIX systems,
15094 \&'a.lib' on Windows).
15095
15096 .SS Customizing construction variables from the command line.
15097
15098 The following would allow the C compiler to be specified on the command
15099 line or in the file custom.py.
15100
15101 .ES
15102 vars = Variables('custom.py')
15103 vars.Add('CC', 'The C compiler.')
15104 env = Environment(variables=vars)
15105 Help(vars.GenerateHelpText(env))
15106 .EE
15107
15108 The user could specify the C compiler on the command line:
15109
15110 .ES
15111 scons "CC=my_cc"
15112 .EE
15113
15114 or in the custom.py file:
15115
15116 .ES
15117 CC = 'my_cc'
15118 .EE
15119
15120 or get documentation on the options:
15121
15122 .ES
15123 $ scons -h
15124
15125 CC: The C compiler.
15126 default: None
15127 actual: cc
15128
15129 .EE
15130
15131 .SS Using Microsoft Visual C++ precompiled headers
15132
15133 Since windows.h includes everything and the kitchen sink, it can take quite
15134 some time to compile it over and over again for a bunch of object files, so
15135 Microsoft provides a mechanism to compile a set of headers once and then
15136 include the previously compiled headers in any object file. This
15137 technology is called precompiled headers. The general recipe is to create a
15138 file named "StdAfx.cpp" that includes a single header named "StdAfx.h", and
15139 then include every header you want to precompile in "StdAfx.h", and finally
15140 include "StdAfx.h" as the first header in all the source files you are
15141 compiling to object files. For example:
15142
15143 StdAfx.h:
15144 .ES
15145 #include <windows.h>
15146 #include <my_big_header.h>
15147 .EE
15148
15149 StdAfx.cpp:
15150 .ES
15151 #include <StdAfx.h>
15152 .EE
15153
15154 Foo.cpp:
15155 .ES
15156 #include <StdAfx.h>
15157
15158 /* do some stuff */
15159 .EE
15160
15161 Bar.cpp:
15162 .ES
15163 #include <StdAfx.h>
15164
15165 /* do some other stuff */
15166 .EE
15167
15168 SConstruct:
15169 .ES
15170 env=Environment()
15171 env['PCHSTOP'] = 'StdAfx.h'
15172 env['PCH'] = env.PCH('StdAfx.cpp')[0]
15173 env.Program('MyApp', ['Foo.cpp', 'Bar.cpp'])
15174 .EE
15175
15176 For more information see the document for the PCH builder, and the PCH and
15177 PCHSTOP construction variables. To learn about the details of precompiled
15178 headers consult the MSDN documention for /Yc, /Yu, and /Yp.
15179
15180 .SS Using Microsoft Visual C++ external debugging information
15181
15182 Since including debugging information in programs and shared libraries can
15183 cause their size to increase significantly, Microsoft provides a mechanism
15184 for including the debugging information in an external file called a PDB
15185 file. SCons supports PDB files through the PDB construction
15186 variable.
15187
15188 SConstruct:
15189 .ES
15190 env=Environment()
15191 env['PDB'] = 'MyApp.pdb'
15192 env.Program('MyApp', ['Foo.cpp', 'Bar.cpp'])
15193 .EE
15194
15195 For more information see the document for the PDB construction variable.
15196
15197 .SH ENVIRONMENT
15198
15199 .IP SCONS_LIB_DIR
15200 Specifies the directory that contains the SCons Python module directory
15201 (e.g. /home/aroach/scons-src-0.01/src/engine).
15202
15203 .IP SCONSFLAGS
15204 A string of options that will be used by scons in addition to those passed
15205 on the command line.
15206
15207 .SH "SEE ALSO"
15208 .B scons
15209 User Manual,
15210 .B scons
15211 Design Document,
15212 .B scons
15213 source code.
15214
15215 .SH AUTHORS
15216 Steven Knight <knight@baldmt.com>
15217 .br
15218 Anthony Roach <aroach@electriceyeball.com>
15219
OLDNEW
« no previous file with comments | « scons-2.0.1/os_spawnv_fix.diff ('k') | scons-2.0.1/scons-time.1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698