summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/man/scons.162
-rw-r--r--doc/user/caching.in25
-rw-r--r--doc/user/libraries.in60
-rw-r--r--doc/user/libraries.sgml50
-rw-r--r--doc/user/main.in3
5 files changed, 197 insertions, 3 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index 73e3df9..c0b91ec 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -1975,6 +1975,59 @@ until the Action object is actually used.
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.TP
+.RI AddMethod( object, function ", [" name ])
+.TP
+.RI env.AddMethod( function ", [" name ])
+When called with the
+.BR AddMethod ()
+form,
+adds the specified
+.I function
+to the specified
+.I object
+as the specified method
+.IR name .
+When called with the
+.BR env.AddMethod ()
+form,
+adds the specified
+.I function
+to the construction environment
+.I env
+as the specified method
+.IR name .
+In both cases, if
+.I name
+is omitted or
+.BR None ,
+the name of the
+specified
+.I function
+itself is used for the method name.
+
+.ES
+# Note that the first argument to the function to
+# be attached as a method must be the object through
+# which the method will be called; the Python
+# convention is to call it 'self'.
+def my_method(self, arg):
+ print "my_method() got", arg
+
+# Use the global AddMethod() function to add a method
+# to the Environment class. This
+AddMethod(Environment, my_method)
+env = Environment()
+env.my_method('arg')
+
+# Add the function as a method, using the function
+# name for the method call.
+env = Environment()
+env.AddMethod(my_method, 'other_method_name')
+env.other_method_name('another arg')
+.EE
+
+'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.TP
.RI AddPostAction( target ", " action )
.TP
.RI env.AddPostAction( target ", " action )
@@ -4048,16 +4101,19 @@ if not env.has_key('FOO'): env['FOO'] = 'foo'
This function provides a way to set a select subset of the scons command
line options from a SConscript file. The options supported are:
.B clean
-which corresponds to -c, --clean, and --remove;
+which corresponds to -c, --clean and --remove;
.B duplicate
-which
-corresponds to --duplicate;
+which corresponds to --duplicate;
+.B help
+which corresponds to -h and --help;
.B implicit_cache
which corresponds to --implicit-cache;
.B max_drift
which corresponds to --max-drift;
.B num_jobs
which corresponds to -j and --jobs.
+.B random
+which corresponds to --random.
See the documentation for the
corresponding command line object for information about each specific
option. Example:
diff --git a/doc/user/caching.in b/doc/user/caching.in
index 015407b..8dfa731 100644
--- a/doc/user/caching.in
+++ b/doc/user/caching.in
@@ -430,6 +430,31 @@
</para>
+ <para>
+
+ If you want to make sure dependencies will be built
+ in a random order without having to specify
+ the <literal>--random</literal> on very command line,
+ you can use the &SetOption; function to
+ set the <literal>random</litera> option
+ within any &SConscript; file:
+
+ </para>
+
+ <scons_example name="ex-random">
+ <file name="SConstruct" printme="1">
+ SetOption('random', 1)
+ Program('prog',
+ ['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c'])
+ </file>
+ <file name="f1.c">f1.c</file>
+ <file name="f2.c">f2.c</file>
+ <file name="f3.c">f3.c</file>
+ <file name="f4.c">f4.c</file>
+ <file name="f5.c">f5.c</file>
+ <file name="f6.c">f6.c</file>
+ </scons_example>
+
</section>
<!--
diff --git a/doc/user/libraries.in b/doc/user/libraries.in
index e5368d1..9a12062 100644
--- a/doc/user/libraries.in
+++ b/doc/user/libraries.in
@@ -94,6 +94,66 @@
</para>
<section>
+ <title>Building Libraries From Source Code or Object Files</title>
+
+ <para>
+
+ The previous example shows building a library from a
+ list of source files.
+ You can, however, also give the &b-link-Library; call
+ object files,
+ and it will correctly realize
+ In fact, you can arbitrarily mix source code files
+ and object files in the source list:
+
+ </para>
+
+ <para>
+
+ <scons_example name="objects" printme="1">
+ <file name="SConstruct" printme="1">
+ Library('foo', ['f1.c', 'f2.o', 'f3.c', 'f4.o'])
+ </file>
+ <file name="f1.c">
+ void f1() { printf("f1.c\n"); }
+ </file>
+ <file name="f2.o">
+ object file
+ </file>
+ <file name="f3.c">
+ void f3() { printf("f3.c\n"); }
+ </file>
+ <file name="f4.o">
+ object file
+ </file>
+ </scons_example>
+
+ <para>
+
+ And SCons realizes that only the source code files
+ must be compiled into object files
+ before creating the final library:
+
+ </para>
+
+ <scons_output example="objects" os="posix">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ Of course, in this example, the object files
+ must already exist for the build to succeed.
+ See <xref linkend="chap-nodes">, below,
+ for information about how you can
+ build object files explicitly
+ and include the built files in a library.
+
+ </para>
+
+ </section>
+
+ <section>
<title>Building Static Libraries Explicitly: the &b-StaticLibrary; Builder</title>
<para>
diff --git a/doc/user/libraries.sgml b/doc/user/libraries.sgml
index ca2cb97..96814a7 100644
--- a/doc/user/libraries.sgml
+++ b/doc/user/libraries.sgml
@@ -92,6 +92,56 @@
</para>
<section>
+ <title>Building Libraries From Source Code or Object Files</title>
+
+ <para>
+
+ The previous example shows building a library from a
+ list of source files.
+ You can, however, also give the &b-link-Library; call
+ object files,
+ and it will correctly realize
+ In fact, you can arbitrarily mix source code files
+ and object files in the source list:
+
+ </para>
+
+ <para>
+
+ <programlisting>
+ Library('foo', ['f1.c', 'f2.o', 'f3.c', 'f4.o'])
+ </programlisting>
+
+ <para>
+
+ And SCons realizes that only the source code files
+ must be compiled into object files
+ before creating the final library:
+
+ </para>
+
+ <screen>
+ % <userinput>scons -Q</userinput>
+ cc -o f1.o -c f1.c
+ cc -o f3.o -c f3.c
+ ar rc libfoo.a f1.o f2.o f3.o f4.o
+ ranlib libfoo.a
+ </screen>
+
+ <para>
+
+ Of course, in this example, the object files
+ must already exist for the build to succeed.
+ See <xref linkend="chap-nodes">, below,
+ for information about how you can
+ build object files explicitly
+ and include the built files in a library.
+
+ </para>
+
+ </section>
+
+ <section>
<title>Building Static Libraries Explicitly: the &b-StaticLibrary; Builder</title>
<para>
diff --git a/doc/user/main.in b/doc/user/main.in
index d864350..aaddb2a 100644
--- a/doc/user/main.in
+++ b/doc/user/main.in
@@ -117,6 +117,9 @@
XXX SetOption('duplicate')
XXX - - duplicate=
+ XXX GetOption('help')
+ XXX SetOption('help')
+
XXX GetOption('num_jobs')
XXX SetOption('num_jobs')