summaryrefslogtreecommitdiff
path: root/doc/user/hierarchy.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/user/hierarchy.xml')
-rw-r--r--doc/user/hierarchy.xml324
1 files changed, 198 insertions, 126 deletions
diff --git a/doc/user/hierarchy.xml b/doc/user/hierarchy.xml
index 17067d7..c0664ee 100644
--- a/doc/user/hierarchy.xml
+++ b/doc/user/hierarchy.xml
@@ -1,6 +1,28 @@
+<?xml version='1.0'?>
+<!DOCTYPE sconsdoc [
+ <!ENTITY % scons SYSTEM "../scons.mod">
+ %scons;
+
+ <!ENTITY % builders-mod SYSTEM "../generated/builders.mod">
+ %builders-mod;
+ <!ENTITY % functions-mod SYSTEM "../generated/functions.mod">
+ %functions-mod;
+ <!ENTITY % tools-mod SYSTEM "../generated/tools.mod">
+ %tools-mod;
+ <!ENTITY % variables-mod SYSTEM "../generated/variables.mod">
+ %variables-mod;
+
+]>
+
+<chapter id="chap-hierarchical"
+ xmlns="http://www.scons.org/dbxsd/v1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0/scons.xsd scons.xsd">
+<title>Hierarchical Builds</title>
+
<!--
- Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
+ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -196,12 +218,12 @@ make no difference to the build.
</para>
- <programlisting>
- SConscript(['drivers/display/SConscript',
- 'drivers/mouse/SConscript',
- 'parser/SConscript',
- 'utilities/SConscript'])
- </programlisting>
+ <sconstruct>
+SConscript(['drivers/display/SConscript',
+ 'drivers/mouse/SConscript',
+ 'parser/SConscript',
+ 'utilities/SConscript'])
+ </sconstruct>
<para>
@@ -218,11 +240,11 @@ make no difference to the build.
</para>
- <programlisting>
- SConscript(['drivers/SConscript',
- 'parser/SConscript',
- 'utilities/SConscript'])
- </programlisting>
+ <sconstruct>
+SConscript(['drivers/SConscript',
+ 'parser/SConscript',
+ 'utilities/SConscript'])
+ </sconstruct>
<para>
@@ -232,10 +254,10 @@ make no difference to the build.
</para>
- <programlisting>
- SConscript(['display/SConscript',
- 'mouse/SConscript'])
- </programlisting>
+ <sconstruct>
+SConscript(['display/SConscript',
+ 'mouse/SConscript'])
+ </sconstruct>
<para>
@@ -279,10 +301,40 @@ make no difference to the build.
</para>
- <programlisting>
- SConscript(['prog1/SConscript',
- 'prog2/SConscript'])
- </programlisting>
+ <scons_example name="hierarchy_ex1">
+ <file name="SConstruct" printme="1">
+SConscript(['prog1/SConscript',
+ 'prog2/SConscript'])
+ </file>
+ <file name="prog1/SConscript">
+env = Environment()
+env.Program('prog1', ['main.c', 'foo1.c', 'foo2.c'])
+ </file>
+ <file name="prog2/SConscript">
+env = Environment()
+env.Program('prog2', ['main.c', 'bar1.c', 'bar2.c'])
+ </file>
+ <directory name="prog1"></directory>
+ <file name="prog1/main.c">
+x
+ </file>
+ <file name="prog1/foo1.c">
+x
+ </file>
+ <file name="prog1/foo2.c">
+x
+ </file>
+ <directory name="prog2"></directory>
+ <file name="prog2/main.c">
+x
+ </file>
+ <file name="prog2/bar1.c">
+x
+ </file>
+ <file name="prog2/bar2.c">
+x
+ </file>
+ </scons_example>
<para>
@@ -290,11 +342,8 @@ make no difference to the build.
</para>
-
- <programlisting>
- env = Environment()
- env.Program('prog1', ['main.c', 'foo1.c', 'foo2.c'])
- </programlisting>
+ <scons_example_file example="hierarchy_ex1" name="prog1/SConscript">
+ </scons_example_file>
<para>
@@ -302,11 +351,8 @@ make no difference to the build.
</para>
-
- <programlisting>
- env = Environment()
- env.Program('prog2', ['main.c', 'bar1.c', 'bar2.c'])
- </programlisting>
+ <scons_example_file example="hierarchy_ex1" name="prog2/SConscript">
+ </scons_example_file>
<para>
@@ -315,17 +361,9 @@ make no difference to the build.
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o prog1/foo1.o -c prog1/foo1.c
- cc -o prog1/foo2.o -c prog1/foo2.c
- cc -o prog1/main.o -c prog1/main.c
- cc -o prog1/prog1 prog1/main.o prog1/foo1.o prog1/foo2.o
- cc -o prog2/bar1.o -c prog2/bar1.c
- cc -o prog2/bar2.o -c prog2/bar2.c
- cc -o prog2/main.o -c prog2/main.c
- cc -o prog2/prog2 prog2/main.o prog2/bar1.o prog2/bar2.o
- </screen>
+ <scons_output example="hierarchy_ex1" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -364,10 +402,24 @@ make no difference to the build.
</para>
- <programlisting>
- env = Environment()
- env.Program('prog', ['main.c', '#lib/foo1.c', 'foo2.c'])
- </programlisting>
+ <scons_example name="hierarchy_ex2">
+ <file name="SConstruct">
+SConscript('src/prog/SConscript')
+ </file>
+ <file name="src/prog/SConscript" printme="1">
+env = Environment()
+env.Program('prog', ['main.c', '#lib/foo1.c', 'foo2.c'])
+ </file>
+ <file name="src/prog/main.c">
+x
+ </file>
+ <file name="lib/foo1.c">
+x
+ </file>
+ <file name="src/prog/foo2.c">
+x
+ </file>
+ </scons_example>
<para>
@@ -380,13 +432,9 @@ make no difference to the build.
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o lib/foo1.o -c lib/foo1.c
- cc -o src/prog/foo2.o -c src/prog/foo2.c
- cc -o src/prog/main.o -c src/prog/main.c
- cc -o src/prog/prog src/prog/main.o lib/foo1.o src/prog/foo2.o
- </screen>
+ <scons_output example="hierarchy_ex2" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -410,10 +458,24 @@ make no difference to the build.
</para>
- <programlisting>
- env = Environment()
- env.Program('prog', ['main.c', '/usr/joe/lib/foo1.c', 'foo2.c'])
- </programlisting>
+ <scons_example name="hierarchy_ex3">
+ <file name="SConstruct">
+SConscript('src/prog/SConscript')
+ </file>
+ <file name="src/prog/SConscript" printme="1">
+env = Environment()
+env.Program('prog', ['main.c', '__ROOT__/usr/joe/lib/foo1.c', 'foo2.c'])
+ </file>
+ <file name="src/prog/main.c">
+x
+ </file>
+ <file name="__ROOT__/usr/joe/lib/foo1.c">
+x
+ </file>
+ <file name="src/prog/foo2.c">
+x
+ </file>
+ </scons_example>
<para>
@@ -421,13 +483,9 @@ make no difference to the build.
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o src/prog/foo2.o -c src/prog/foo2.c
- cc -o src/prog/main.o -c src/prog/main.c
- cc -o /usr/joe/lib/foo1.o -c /usr/joe/lib/foo1.c
- cc -o src/prog/prog src/prog/main.o /usr/joe/lib/foo1.o src/prog/foo2.o
- </screen>
+ <scons_output example="hierarchy_ex3" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -490,10 +548,10 @@ make no difference to the build.
</para>
- <programlisting>
- env = Environment()
- Export('env')
- </programlisting>
+ <sconstruct>
+env = Environment()
+Export('env')
+ </sconstruct>
<para>
@@ -501,11 +559,11 @@ make no difference to the build.
</para>
- <programlisting>
- env = Environment()
- debug = ARGUMENTS['debug']
- Export('env', 'debug')
- </programlisting>
+ <sconstruct>
+env = Environment()
+debug = ARGUMENTS['debug']
+Export('env', 'debug')
+ </sconstruct>
<para>
@@ -515,9 +573,9 @@ make no difference to the build.
</para>
- <programlisting>
- Export('env debug')
- </programlisting>
+ <sconstruct>
+Export('env debug')
+ </sconstruct>
<para>
@@ -527,9 +585,9 @@ make no difference to the build.
</para>
- <programlisting>
- SConscript('src/SConscript', 'env')
- </programlisting>
+ <sconstruct>
+SConscript('src/SConscript', 'env')
+ </sconstruct>
<para>
@@ -537,9 +595,9 @@ make no difference to the build.
</para>
- <programlisting>
- SConscript('src/SConscript', exports='env')
- </programlisting>
+ <sconstruct>
+SConscript('src/SConscript', exports='env')
+ </sconstruct>
<para>
@@ -550,10 +608,10 @@ make no difference to the build.
</para>
- <programlisting>
- SConscript(['src1/SConscript',
- 'src2/SConscript'], exports='env')
- </programlisting>
+ <sconstruct>
+SConscript(['src1/SConscript',
+ 'src2/SConscript'], exports='env')
+ </sconstruct>
<para>
@@ -578,10 +636,10 @@ make no difference to the build.
</para>
- <programlisting>
- Import('env')
- env.Program('prog', ['prog.c'])
- </programlisting>
+ <sconstruct>
+Import('env')
+env.Program('prog', ['prog.c'])
+ </sconstruct>
<para>
@@ -600,11 +658,11 @@ make no difference to the build.
</para>
- <programlisting>
- Import('env', 'debug')
- env = env.Clone(DEBUG = debug)
- env.Program('prog', ['prog.c'])
- </programlisting>
+ <sconstruct>
+Import('env', 'debug')
+env = env.Clone(DEBUG = debug)
+env.Program('prog', ['prog.c'])
+ </sconstruct>
<para>
@@ -614,11 +672,11 @@ make no difference to the build.
</para>
- <programlisting>
- Import('env debug')
- env = env.Clone(DEBUG = debug)
- env.Program('prog', ['prog.c'])
- </programlisting>
+ <sconstruct>
+Import('env debug')
+env = env.Clone(DEBUG = debug)
+env.Program('prog', ['prog.c'])
+ </sconstruct>
<para>
@@ -629,11 +687,11 @@ make no difference to the build.
</para>
- <programlisting>
- Import('*')
- env = env.Clone(DEBUG = debug)
- env.Program('prog', ['prog.c'])
- </programlisting>
+ <sconstruct>
+Import('*')
+env = env.Clone(DEBUG = debug)
+env.Program('prog', ['prog.c'])
+ </sconstruct>
<para>
@@ -678,15 +736,35 @@ make no difference to the build.
</para>
- <programlisting>
- env = Environment()
- Export('env')
- objs = []
- for subdir in ['foo', 'bar']:
- o = SConscript('%s/SConscript' % subdir)
- objs.append(o)
- env.Library('prog', objs)
- </programlisting>
+ <scons_example name="hierarchy_Return">
+ <file name="SConstruct" printme="1">
+env = Environment()
+Export('env')
+objs = []
+for subdir in ['foo', 'bar']:
+ o = SConscript('%s/SConscript' % subdir)
+ objs.append(o)
+env.Library('prog', objs)
+ </file>
+ <directory name="foo"></directory>
+ <directory name="bar"></directory>
+ <file name="foo/SConscript">
+Import('env')
+obj = env.Object('foo.c')
+Return('obj')
+ </file>
+ <file name="bar/SConscript">
+Import('env')
+obj = env.Object('bar.c')
+Return('obj')
+ </file>
+ <file name="foo/foo.c">
+void foo(void) { printf("foo/foo.c\n"); }
+ </file>
+ <file name="bar/bar.c">
+void bar(void) { printf("bar/bar.c\n"); }
+ </file>
+ </scons_example>
<para>
@@ -696,12 +774,8 @@ make no difference to the build.
</para>
-
- <programlisting>
- Import('env')
- obj = env.Object('foo.c')
- Return('obj')
- </programlisting>
+ <scons_example_file example="hierarchy_Return" name="foo/SConscript">
+ </scons_example_file>
<para>
@@ -714,13 +788,9 @@ make no difference to the build.
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o bar/bar.o -c bar/bar.c
- cc -o foo/foo.o -c foo/foo.c
- ar rc libprog.a foo/foo.o bar/bar.o
- ranlib libprog.a
- </screen>
+ <scons_output example="hierarchy_Return" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<!--
XXX Return(stop=False)
@@ -744,3 +814,5 @@ make no difference to the build.
</section>
-->
+
+</chapter>