summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-04-09 15:31:46 (GMT)
committerSteven Knight <knight@baldmt.com>2002-04-09 15:31:46 (GMT)
commit48b6454994a21440a03cacaf14bad63295a62bbf (patch)
tree25445f516444bbd5984bcf4caf2af54224b08ab4 /doc
parent72b58192cc6bea9962cff01f2d72e8de77591bda (diff)
downloadSCons-48b6454994a21440a03cacaf14bad63295a62bbf.zip
SCons-48b6454994a21440a03cacaf14bad63295a62bbf.tar.gz
SCons-48b6454994a21440a03cacaf14bad63295a62bbf.tar.bz2
Add a better hierarchical build example from the scons-users mailing list.
Diffstat (limited to 'doc')
-rw-r--r--doc/man/scons.137
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index cedfc2e..116a5f7 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -1905,6 +1905,43 @@ Note the use of the Export() method
to set the "ccflags" variable to a different
value for each variant build.
+.SS Hierarchical Build of Two Libraries Linked With a Program
+
+.ES
+SConstruct:
+
+ env = Environment(LIBPATH = ['#libA', '#libB'])
+ Export('env')
+ SConscript('libA/SConscript')
+ SConscript('libB/SConscript')
+ SConscript('Main/SConscript')
+
+libA/SConscript:
+
+ Import('env')
+ env.Library('a', 'a1.c a2.c a3.c')
+
+libB/SConscript:
+ Import('env')
+ env.Library('b', 'b1.c b2.c b3.c')
+
+Main/SConscript:
+
+ Import('env')
+ e = env.Copy(LIBS = ['a', ','b'])
+ e.Program('foo', 'm1.c m2.c m3.c')
+.EE
+
+The '#' in the LIBPATH directories specify that they're relative to the
+top-level directory, so they don't turn into "Main/libA" when they're
+used in Main/SConscript.
+
+Specifying only 'a' and 'b' for the library names
+allows SCons to append the appropriate library
+prefix and suffix for the current platform
+(for example, 'liba.a' on POSIX systems,
+'a.lib' on Windows).
+
.SH ENVIRONMENT
.IP SCONS_LIB_DIR