diff options
author | Steven Knight <knight@baldmt.com> | 2003-02-28 08:16:45 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-02-28 08:16:45 (GMT) |
commit | c03ac136007521fda90a7963baa4956d950b9363 (patch) | |
tree | fcf2915a1e3a318b4940a937022c26908d7ecd42 /doc | |
parent | c98c5391f5afa134589db88ebe986368a1b6097f (diff) | |
download | SCons-c03ac136007521fda90a7963baa4956d950b9363.zip SCons-c03ac136007521fda90a7963baa4956d950b9363.tar.gz SCons-c03ac136007521fda90a7963baa4956d950b9363.tar.bz2 |
Better documentation of exporting variables to SConscript files.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/man/scons.1 | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1 index 0bfb13b..f9a6ea9 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -3082,18 +3082,36 @@ EnsureSConsVersion(0,9) This tells .B scons to export a list of variables from the current -SConscript file to all other SConscript files. The exported variables -are kept in a global collection, so subsequent exports +SConscript file to all other SConscript files. +The exported variables are kept in a global collection, +so subsequent calls to +.BR Export () will over-write previous exports that have the same name. Multiple variable names should be passed to .BR Export () as separate arguments. Examples: .ES +env = Environment() +# Make env available for all SConscript files to Import(). Export("env") -Export("env", "variable") + +package = 'my_name' +# Make env and package available for all SConscript files to Import(). +Export("env", "package") .EE +.IP +Note that the +.BR SConscript () +function supports an +.I exports +argument that makes it easier to to export a variable or +set of variables to a single SConscript file. +See the description of the +.BR SConscript () +function, below. + .TP .RI File( name ", [" directory ]) This returns an object that represents a given file @@ -3286,12 +3304,24 @@ This tells .B scons to execute .I script -as a SConscript (configuration) file. The optional +as a SConscript (configuration) file. + +The optional .I exports argument provides a list of variable names to export to .IR script ". " +These variables are locally exported only to the specified +.IR script , +and do not affect the +global pool of variables used by +the +.BR Export () +function. +'\"If multiple dirs are provided, +'\"each script gets a fresh export. +The subsidiary .I script -must use the +file must use the .BR Import () function to import the variables. @@ -3332,7 +3362,7 @@ than the default of .IR duplicate =1, but it may cause build problems in certain end-cases, such as compiling from source files that -are generated by the build. +are generated by the build.) Any variables returned by .I script @@ -3344,9 +3374,11 @@ will be returned by the call to Examples: .ES -SConscript('dir/SConscript') -foo = SConscript('subdir/SConscript', "env") +SConscript('subdir/SConscript') +foo = SConscript('sub/SConscript', exports='env') +SConscript('dir/SConscript', exports=['env', 'variable']) SConscript('src/SConscript', build_dir='build', duplicate=0) +SConscript('bld/SConscript', src_dir='src', exports='env') .EE .TP |