diff options
Diffstat (limited to 'doc/user')
-rw-r--r-- | doc/user/caching.in | 25 | ||||
-rw-r--r-- | doc/user/libraries.in | 60 | ||||
-rw-r--r-- | doc/user/libraries.sgml | 50 | ||||
-rw-r--r-- | doc/user/main.in | 3 |
4 files changed, 138 insertions, 0 deletions
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') |