diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/user/less-simple.in | 24 | ||||
-rw-r--r-- | doc/user/less-simple.xml | 24 | ||||
-rw-r--r-- | doc/user/separate.in | 57 | ||||
-rw-r--r-- | doc/user/separate.xml | 46 | ||||
-rw-r--r-- | doc/user/troubleshoot.xml | 50 |
5 files changed, 181 insertions, 20 deletions
diff --git a/doc/user/less-simple.in b/doc/user/less-simple.in index 76afa30..7b45271 100644 --- a/doc/user/less-simple.in +++ b/doc/user/less-simple.in @@ -209,6 +209,30 @@ </section> <section> + <title>Making a list of files with Glob()</title> + + <para> + + You can also use the Glob() function to find all files matching a + certain template, using standard the shell pattern matching + characters *, ?, and [abc] to match any of a, b, or c. [!abc] is + also supported, to match any character <emphasis>except</emphasis> + a, b, or c. This makes many multi-source-file builds quite easy: + + </para> + + <sconstruct> + Program('program', Glob('*.c')) + </sconstruct> + + <para> + + The SCons man page has more details on using Glob() with Variant + dirs and Repositories and returning strings rather than Nodes. + + </section> + + <section> <title>Specifying Single Files Vs. Lists of Files</title> <para> diff --git a/doc/user/less-simple.xml b/doc/user/less-simple.xml index eea3425..c6ded70 100644 --- a/doc/user/less-simple.xml +++ b/doc/user/less-simple.xml @@ -198,6 +198,30 @@ </section> <section> + <title>Making a list of files with Glob()</title> + + <para> + + You can also use the Glob() function to find all files matching a + certain template, using standard the shell pattern matching + characters *, ?, and [abc] to match any of a, b, or c. [!abc] is + also supported, to match any character <emphasis>except</emphasis> + a, b, or c. This makes many multi-source-file builds quite easy: + + </para> + + <programlisting> + Program('program', Glob('*.c')) + </programlisting> + + <para> + + The SCons man page has more details on using Glob() with Variant + dirs and Repositories and returning strings rather than Nodes. + + </section> + + <section> <title>Specifying Single Files Vs. Lists of Files</title> <para> diff --git a/doc/user/separate.in b/doc/user/separate.in index be7e6c5..dc77af3 100644 --- a/doc/user/separate.in +++ b/doc/user/separate.in @@ -466,6 +466,63 @@ program using the F<build/foo.c> path name. </section> + <section> + <title>Using Glob() with &VariantDir;</title> + + <para> + + The Glob() file name pattern matching function + works just as usual when using &VariantDir;. + For example, if the + <filename>src/SConscript</filename> + looks like this: + + </para> + + <scons_example name="example_glob_builddir_sconscript"> + <file name="SConstruct"> + VariantDir('build', 'src') + SConscript('build/SConscript') + </file> + <file name="src/SConscript" printme="1"> + env = Environment() + env.Program('hello', Glob('*.c')) + </file> + <file name="src/f1.c"> + #include "f2.h" + int main() { printf(f2()); } + </file> + <file name="src/f2.c"> + const char * f2() { return("Hello, world!\n"); } + </file> + <file name="src/f2.h"> + const char * f2(); + </file> + </scons_example> + + <para> + + Then with the same &SConstruct; file as in the previous section, + and source files f1.c and f2.c in src, we would see the following + output: + + </para> + + <scons_output example="example_glob_builddir_sconscript"> + <scons_output_command>ls src</scons_output_command> + <scons_output_command>scons -Q</scons_output_command> + <scons_output_command>ls build</scons_output_command> + </scons_output> + + <para> + + The Glob function returns Nodes in the build/ tree, as + you'd expect. + + </para> + + </section> + <!-- <section> diff --git a/doc/user/separate.xml b/doc/user/separate.xml index 57ade04..c5e90e0 100644 --- a/doc/user/separate.xml +++ b/doc/user/separate.xml @@ -457,6 +457,52 @@ program using the F<build/foo.c> path name. </section> + <section> + <title>Using Glob() with &VariantDir;</title> + + <para> + + The Glob() file name pattern matching function + works just as usual when using &VariantDir;. + For example, if the + <filename>src/SConscript</filename> + looks like this: + + </para> + + <programlisting> + env = Environment() + env.Program('hello', Glob('*.c')) + </programlisting> + + <para> + + Then with the same &SConstruct; file as in the previous section, + and source files f1.c and f2.c in src, we would see the following + output: + + </para> + + <screen> + % <userinput>ls src</userinput> + SConscript f1.c f2.c f2.h + % <userinput>scons -Q</userinput> + cc -o build/f1.o -c build/f1.c + cc -o build/f2.o -c build/f2.c + cc -o build/hello build/f1.o build/f2.o + % <userinput>ls build</userinput> + SConscript f1.c f1.o f2.c f2.h f2.o hello + </screen> + + <para> + + The Glob function returns Nodes in the build/ tree, as + you'd expect. + + </para> + + </section> + <!-- <section> diff --git a/doc/user/troubleshoot.xml b/doc/user/troubleshoot.xml index dc90622..0a34559 100644 --- a/doc/user/troubleshoot.xml +++ b/doc/user/troubleshoot.xml @@ -1115,11 +1115,10 @@ % <userinput>scons -Q --debug=stacktrace</userinput> scons: *** Source `prog.c' not found, needed by target `prog.o'. Stop. scons: internal stack trace: - File "bootstrap/src/engine/SCons/Job.py", line 131, in start + File "bootstrap/src/engine/SCons/Job.py", line 187, in start File "bootstrap/src/engine/SCons/Script/Main.py", line 169, in prepare - File "bootstrap/src/engine/SCons/Taskmaster.py", line 169, in prepare - File "bootstrap/src/engine/SCons/Node/FS.py", line 2551, in prepare - File "bootstrap/src/engine/SCons/Node/__init__.py", line 349, in prepare + File "bootstrap/src/engine/SCons/Taskmaster.py", line 184, in prepare + File "bootstrap/src/engine/SCons/Executor.py", line 171, in prepare </screen> <para> @@ -1174,24 +1173,35 @@ <screen> % <userinput>scons -Q --taskmastertrace=- prog</userinput> - Taskmaster: 'prog': children: - ['prog.o'] - waiting on unfinished children: - ['prog.o'] - Taskmaster: 'prog.o': children: - ['inc.h', 'prog.c'] - waiting on unfinished children: - ['inc.h', 'prog.c'] - Taskmaster: 'prog.c': evaluating prog.c - Taskmaster: 'inc.h': evaluating inc.h - Taskmaster: 'prog.o': children: - ['inc.h', 'prog.c'] - evaluating prog.o + + Taskmaster: Looking for a node to evaluate + Taskmaster: Considering node <no_state 'prog'> and its children: + Taskmaster: <no_state 'prog.o'> + Taskmaster: Considering node <no_state 'prog.o'> and its children: + Taskmaster: <no_state 'prog.c'> + Taskmaster: <no_state 'inc.h'> + Taskmaster: Considering node <no_state 'prog.c'> and its children: + Taskmaster: Evaluating <pending 'prog.c'> + + Taskmaster: Looking for a node to evaluate + Taskmaster: Considering node <no_state 'inc.h'> and its children: + Taskmaster: Evaluating <pending 'inc.h'> + + Taskmaster: Looking for a node to evaluate + Taskmaster: Considering node <pending 'prog.o'> and its children: + Taskmaster: <up_to_date 'prog.c'> + Taskmaster: <up_to_date 'inc.h'> + Taskmaster: Evaluating <pending 'prog.o'> cc -o prog.o -c -I. prog.c - Taskmaster: 'prog': children: - ['prog.o'] - evaluating prog + + Taskmaster: Looking for a node to evaluate + Taskmaster: Considering node <pending 'prog'> and its children: + Taskmaster: <executed 'prog.o'> + Taskmaster: Evaluating <pending 'prog'> cc -o prog prog.o + + Taskmaster: Looking for a node to evaluate + Taskmaster: No candidate anymore. </screen> <para> |