Sync CVS log from master Aegis repository.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 3 Nov 2003 23:29:02 +0000 (23:29 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 3 Nov 2003 23:29:02 +0000 (23:29 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@836 fdb21ef1-2011-0410-befe-b5e4ea1792b1

34 files changed:
HOWTO/change.txt
HOWTO/release.txt
bin/linecount
doc/SConscript
doc/user/alias.in
doc/user/alias.sgml
doc/user/builders-built-in.in
doc/user/builders-built-in.sgml
doc/user/builders-commands.in
doc/user/builders-commands.sgml
doc/user/caching.in
doc/user/caching.sgml
doc/user/default.in
doc/user/default.sgml
doc/user/environments.in
doc/user/environments.sgml
doc/user/help.in
doc/user/help.sgml
doc/user/install.in
doc/user/install.sgml
doc/user/libraries.in
doc/user/libraries.sgml
doc/user/precious.in
doc/user/precious.sgml
doc/user/run.in
doc/user/run.sgml
doc/user/simple.in
doc/user/simple.sgml
src/engine/SCons/Node/FS.py
src/engine/SCons/Sig/SigTests.py
src/engine/SCons/Sig/__init__.py
src/script/sconsign.py
test/SConsignFile.py
test/sconsign-script.py

index ff949883c509739a43c83478dea44739755f0a03..e0d020fc04e6497d50c5586574333b40c4594aea 100644 (file)
@@ -30,28 +30,28 @@ Handling a change set:
 
     -- Distribute the change to scons-aedist:
 
-               aedist -s -p scons.0.92 {cnum} > scons.0.92.C{cnum}.ae
-               pine -attach scons.0.92.C{cnum}.ae scons-aedist@lists.sourceforge.net
-                       Subject: scons.0.92 - {SUMMARY}
-                       Body:  aegis -l -p scons.0.92 -c {cnum} cd
+               aedist -s -p scons.0.93 {cnum} > scons.0.93.C{cnum}.ae
+               pine -attach scons.0.93.C{cnum}.ae scons-aedist@lists.sourceforge.net
+                       Subject: scons.0.93 - {SUMMARY}
+                       Body:  aegis -l -p scons.0.93 -c {cnum} cd
 
-               rm scons.0.92.C{cnum}.ae
+               rm scons.0.93.C{cnum}.ae
 
        [This will eventually be automated.]
 
     -- Update the aedist baseline on the web site:
 
-               aedist -s -bl -p scons.0.92 > scons.0.92.ae
-               scp scons.0.92.ae stevenknight@scons.sourceforge.net:/home/groups/s/sc/scons/htdocs/scons.0.92.ae
-               rm scons.0.92.ae
+               aedist -s -bl -p scons.0.93 > scons.0.93.ae
+               scp scons.0.93.ae stevenknight@scons.sourceforge.net:/home/groups/s/sc/scons/htdocs/scons.0.93.ae
+               rm scons.0.93.ae
 
        [This will eventually be automated.]
 
     -- Distribute the change to CVS:
 
                export CVS_RSH=ssh
-               ae2cvs -n -aegis -p scons.0.92 -c {cnum} -u ~/SCons/scons
-               ae2cvs -X -aegis -p scons.0.92 -c {cnum} -u ~/SCons/scons
+               ae2cvs -n -aegis -p scons.0.93 -c {cnum} -u ~/SCons/scons
+               ae2cvs -X -aegis -p scons.0.93 -c {cnum} -u ~/SCons/scons
 
         If you need the "ae2cvs" Perl script, you can find a copy
         checked in to the bin/subdirectory.
index f93c5a8a9bca34a69c306496e0af2eb420fa1622..e89c7099597afe77adb52132b3242d43a72626c7 100644 (file)
@@ -41,11 +41,11 @@ Things to do to release a new version of SCons:
 
                ae_p scons.0
 
-               aede {92}
+               aede {93}
 
-               aerpass {92}
+               aerpass {93}
 
-               aeib {92}
+               aeib {93}
 
                aeb
 
@@ -59,16 +59,16 @@ Things to do to release a new version of SCons:
 
        START THE NEW BRANCH FOR RELEASE
 
-               aenbr -p scons.0 {93}
+               aenbr -p scons.0 {94}
 
-               aenc -p scons.0.{93}
+               aenc -p scons.0.{94}
 
                         Call it something like,
                         "Initialize the new branch for release."
                         Cause = internal_enhancement.
                         Exempt it from all tests (*_exempt = true).
 
-               ae_p scons.0.{93}
+               ae_p scons.0.{94}
 
                aedb 100
 
@@ -146,16 +146,16 @@ Things to do to release a new version of SCons:
                <your email>
                cd incoming
                bin
-               put scons-0.{93}-1.noarch.rpm
-               put scons-0.{93}-1.src.rpm
-               put scons-0.{93}.tar.gz
-               put scons-0.{93}.win32.exe
-               put scons-0.{93}.zip
-               put scons-local-0.{93}.tar.gz
-               put scons-local-0.{93}.zip
-               put scons-src-0.{93}.tar.gz
-               put scons-src-0.{93}.zip
-               put scons_0.{93}-1_all.deb
+               put scons-0.{94}-1.noarch.rpm
+               put scons-0.{94}-1.src.rpm
+               put scons-0.{94}.tar.gz
+               put scons-0.{94}.win32.exe
+               put scons-0.{94}.zip
+               put scons-local-0.{94}.tar.gz
+               put scons-local-0.{94}.zip
+               put scons-src-0.{94}.tar.gz
+               put scons-src-0.{94}.zip
+               put scons_0.{94}-1_all.deb
 
        Create the new release at the SourceForge project page:
 
@@ -167,7 +167,7 @@ Things to do to release a new version of SCons:
 
                => Add Release
 
-               New release name:  0.{93}
+               New release name:  0.{94}
 
                Cut-and-paste or upload the RELEASE.txt file.
 
@@ -184,12 +184,12 @@ Things to do to release a new version of SCons:
 
                Edit the file info:
 
-                       scons-0.{93}-1.noarch.rpm       Any     .rpm
-                       scons-0.{93}-1.src.rpm          Any     Source .rpm
-                       scons-0.{93}.tar.gz             Any     .gz
-                       scons-0.{93}.win32.exe          i386    .exe (32-bit Windows)
-                       scons-0.{93}.zip                Any     .zip
-                       scons_0.{93}-1_all.deb          Any     .deb
+                       scons-0.{94}-1.noarch.rpm       Any     .rpm
+                       scons-0.{94}-1.src.rpm          Any     Source .rpm
+                       scons-0.{94}.tar.gz             Any     .gz
+                       scons-0.{94}.win32.exe          i386    .exe (32-bit Windows)
+                       scons-0.{94}.zip                Any     .zip
+                       scons_0.{94}-1_all.deb          Any     .deb
 
                 Click "Update/Refresh" for each file; this must be done
                 one at a time.
@@ -206,7 +206,7 @@ Things to do to release a new version of SCons:
 
                => Add Release
 
-               New release name:  0.{93}
+               New release name:  0.{94}
 
                Cut-and-paste or upload the RELEASE.txt file.
 
@@ -223,8 +223,8 @@ Things to do to release a new version of SCons:
 
                Edit the file info:
 
-                       scons-local-0.{93}.tar.gz       Any     .gz
-                       scons-local-0.{93}.zip          Any     .zip
+                       scons-local-0.{94}.tar.gz       Any     .gz
+                       scons-local-0.{94}.zip          Any     .zip
 
                 Click "Update/Refresh" for each file; this must be done
                 one at a time.
@@ -241,7 +241,7 @@ Things to do to release a new version of SCons:
 
                => Add Release
 
-               New release name:  0.{93}
+               New release name:  0.{94}
 
                Cut-and-paste or upload the RELEASE.txt file.
 
@@ -258,8 +258,8 @@ Things to do to release a new version of SCons:
 
                Edit the file info:
 
-                       scons-src-0.{93}.tar.gz         Any     .gz
-                       scons-src-0.{93}.zip            Any     .zip
+                       scons-src-0.{94}.tar.gz         Any     .gz
+                       scons-src-0.{94}.zip            Any     .zip
 
                 Click "Update/Refresh" for each file; this must be done
                 one at a time.
@@ -268,7 +268,7 @@ Things to do to release a new version of SCons:
                Release Notice section.
 
 
-       Hide release {0.90} at the SourceForge download page:
+       Hide release 0.{92} at the SourceForge download page:
 
                Go to the Admin page
 
@@ -278,7 +278,7 @@ Things to do to release a new version of SCons:
 
                => Edit Releases
 
-               Release Name: {0.90}
+               Release Name: 0.{92}
 
                => Edit This Release
 
@@ -295,7 +295,7 @@ Things to do to release a new version of SCons:
 
                => Edit Releases
 
-               Release Name: {0.90}
+               Release Name: 0.{92}
 
                => Edit This Release
 
@@ -312,7 +312,7 @@ Things to do to release a new version of SCons:
 
                => Edit Releases
 
-               Release Name: {0.90}
+               Release Name: 0.{92}
 
                => Edit This Release
 
@@ -322,7 +322,7 @@ Things to do to release a new version of SCons:
 
 
 
-       In the Bugs Tracker, add a Group for the new release {0.92}
+       In the Bugs Tracker, add a Group for the new release 0.{92}
 
 
 
index 6034208c89a90bda9931bcae7c47e58298b172df..e344e2a2a8661c801255ee92022d284690122853 100644 (file)
@@ -55,8 +55,17 @@ nbsl = filter(lambda x: x != '', slines)
 nctl = filter(lambda x: x[0] != '#', nbtl)
 ncsl = filter(lambda x: x[0] != '#', nbsl)
 
+def ratio(over, under):
+    return "%.2f" % (float(len(over)) / float(len(under)))
+
+rfiles = ratio(tests, sources)
+rlines = ratio(tlines, slines)
+rnonblank = ratio(nbtl, nbsl)
+rnoncomment = ratio(nctl, ncsl)
+
 fmt = "%-8s  %12s  %12s  %12s  %12s"
 
 print fmt % ('', 'files', 'lines', 'non-blank', 'non-comment')
 print fmt % ('tests:', len(tests), len(tlines), len(nbtl), len(nctl))
 print fmt % ('sources:', len(sources), len(slines), len(nbsl), len(ncsl))
+print fmt % ('ratio:', rfiles, rlines, rnonblank, rnoncomment)
index b973fd45875f4de162dd334d3339b221e776b343..976e0a611de7ca14a20bc6c430e8440299ac7ae3 100644 (file)
@@ -174,6 +174,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE.  DO NOT EDIT.
             orig_env.Install(build, s)
         else:
             orig_env.SCons_revision(os.path.join(build, s), s)
+        Local(os.path.join(build, s))
 
     #
     # For each document, build the document itself in HTML, Postscript,
@@ -190,6 +191,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE.  DO NOT EDIT.
             else:
                 orig_env.SCons_revision(os.path.join(build, doc, s),
                                         os.path.join(doc, s))
+            Local(os.path.join(build, doc, s))
 
         main = os.path.join(build, doc, 'main.sgml')
         out = 'main.out'
index 22fc1280b253d922161ea97039f2623f2c109305..6cc68b00c967bf29c73613ddebb387e38271488a 100644 (file)
@@ -50,7 +50,7 @@
   </para>
 
   <scons_output example="ex1" os="posix">
-     <command>scons install</command>
+     <command>scons -Q install</command>
   </scons_output>
 
   <para>
@@ -95,8 +95,8 @@
   </para>
 
   <scons_output example="ex2" os="posix">
-     <command>scons install-bin</command>
-     <command>scons install-lib</command>
-     <command>scons -c __ROOT__/</command>
-     <command>scons install</command>
+     <command>scons -Q install-bin</command>
+     <command>scons -Q install-lib</command>
+     <command>scons -Q -c __ROOT__/</command>
+     <command>scons -Q install</command>
   </scons_output>
index 3f48ee095f7e80035d06bf7559e40b82a2fd7e42..a4b65dad69d0e836112deb83eb56b49a1a5d1975 100644 (file)
@@ -45,7 +45,9 @@
   </para>
 
   <literallayout>
-     % <userinput>scons install</userinput>
+     % <userinput>scons -Q install</userinput>
+     cc -c -o hello.o hello.c
+     cc -o hello hello.o
      Install file: "hello" as "/usr/bin/hello"
   </literallayout>
 
@@ -64,8 +66,8 @@
 
   <programlisting>
      env = Environment()
-     p = env.Program('hello.c')
-     l = env.Library('hello.c')
+     p = env.Program('foo.c')
+     l = env.Library('bar.c')
      env.Install('/usr/bin', p)
      env.Install('/usr/lib', l)
      ib = env.Alias('install-bin', '/usr/bin')
   </para>
 
   <literallayout>
-     % <userinput>scons install-bin</userinput>
-     Install file: "hello" as "/usr/bin/hello"
-     % <userinput>scons install-lib</userinput>
-     Install file: "libhello.a" as "/usr/lib/libhello.a"
-     % <userinput>scons -c /</userinput>
-     % <userinput>scons install</userinput>
-     Install file: "hello" as "/usr/bin/hello"
-     Install file: "libhello.a" as "/usr/lib/libhello.a"
+     % <userinput>scons -Q install-bin</userinput>
+     cc -c -o foo.o foo.c
+     cc -o foo foo.o
+     Install file: "foo" as "/usr/bin/foo"
+     % <userinput>scons -Q install-lib</userinput>
+     cc -c -o bar.o bar.c
+     ar r libbar.a bar.o
+     ranlib libbar.a
+     Install file: "libbar.a" as "/usr/lib/libbar.a"
+     % <userinput>scons -Q -c /</userinput>
+     Removed foo.o
+     Removed foo
+     Removed /usr/bin/foo
+     Removed bar.o
+     Removed libbar.a
+     Removed /usr/lib/libbar.a
+     % <userinput>scons -Q install</userinput>
+     cc -c -o foo.o foo.c
+     cc -o foo foo.o
+     Install file: "foo" as "/usr/bin/foo"
+     cc -c -o bar.o bar.c
+     ar r libbar.a bar.o
+     ranlib libbar.a
+     Install file: "libbar.a" as "/usr/lib/libbar.a"
   </literallayout>
index 89f0af346e7ddb7465d465ee25ce9d99c813cfe5..1d00a109e1ef2450924e08fac2f852d02ba3b865 100644 (file)
@@ -33,6 +33,9 @@
   This section will describe all of the different
   types of files that you can build with &SCons;,
   and the built-in &Builder; objects used to build them.
+  By default, all of the  &Builder; objects in this section
+  can be built either with or without an explicit
+  construction environment.
 
   </para>
 
@@ -52,8 +55,7 @@
     </para>
 
     <programlisting>
-      env = Environment()
-      env.Program('prog', 'file1.o')
+      Program('prog', 'file1.o')
     </programlisting>
 
     <para>
     If you omit the &target;,
     the base of the first input
     file name specified
-    because the base of the target
+    becomes the base of the target
     program created.
     For example:
 
     </para>
 
     <programlisting>
-      env = Environment()
-      env.Program(['hello.c', 'goodbye.c'])
+      Program(['hello.c', 'goodbye.c'])
     </programlisting>
 
     <para>
 
     </para>
 
+    <para>
+
+    Two construction variables control what libraries
+    will be linked with the resulting program.
+    The &LIBS; variable is a list of the names of
+    libraries that will be linked into any programs,
+    and the &LIBPATH; variables is a list of
+    directories that will be searched for
+    the specified libraries.
+    &SCons; will construct the right command-line
+    options for the running system.
+    For example:
+
+    </para>
+
+    <scons_example name="libs">
+      <file name="SConstruct" printme="1">
+      env = Environment(LIBS = ['foo1', 'foo2'],
+                        LIBPATH = ['/usr/dir1', 'dir2'])
+      env.Program(['hello.c', 'goodbye.c'])
+      </file>
+      <file name="hello.c">
+      int hello() { printf("Hello, world!\n"); }
+      </file>
+      <file name="goodbye.c">
+      int goodbye() { printf("Goodbye, world!\n"); }
+      </file>
+    </scons_example>
+
+    <para>
+
+    Will execute as follows on a POSIX system:
+
+    </para>
+
+    <scons_output example="libs" os="posix">
+      <command>scons -Q</command>
+    </scons_output>
+
+    <para>
+
+    And execute as follows on a Windows system:
+
+    </para>
+
+    <scons_output example="libs" os="win32">
+      <command>scons -Q</command>
+    </scons_output>
+
+    <para>
+
+    The &LIBS; construction variable
+    is turned into command line options
+    by appending the &LIBLINKPREFIX; and &LIBLINKSUFFIX;
+    construction variables to the beginning and end,
+    respectively, of each specified library.
+
+    </para>
+
+    <para>
+
+    The &LIBPATH; construction variable
+    is turned into command line options
+    by appending the &LIBDIRPREFIX; and &LIBDIRSUFFIX;
+    construction variables to the beginning and end,
+    respectively, of each specified library.
+
+    </para>
+
+    <para>
+
+    Other relevant construction variables
+    include those used by the &Object;
+    builders to affect how the
+    source files specified as input to the &Program;
+    builders are turned into object files;
+    see the next section.
+
+    </para>
+
+    <para>
+
+    The command line used to control how a program is linked
+    is specified by the &LINKCOM; construction variable.
+    By default, it uses the
+    &LINK; construction variable
+    and the &LINKFLAGS; construction variable.
+
+    </para>
+
   </section>
 
   <section>
     <para>
 
     &SCons; provides separate Builder objects
-    to create both static and shared object files.
+    to create static and shared object files.
+    The distinction becomes especially important when 
+    archiving object files into different types of libraries.
 
     </para>
 
 
       <para>
 
-      XXX
+      The &StaticObject; Builder
+      is used to build an object file
+      suitable for static linking into a program,
+      or for inclusion in a static library.
+      The &source; argument is a single source-code file,
+      and the &target; argument is the
+      name of the static object file to be created.
+      For example:
 
       </para>
 
       <programlisting>
-        XXX
+        StaticObject('file', 'file.c')
       </programlisting>
 
+      <para>
+
+      Will create the &file_o;
+      object file on a POSIX system,
+      the &file_obj; executable on a Windows system.
+
+      </para>
+
+      <para>
+
+      The target file's prefix and suffix may be omitted,
+      and the values from the
+      $OBJPREFIX
+      and
+      $OBJSUFFIX
+      construction variables
+      will be appended appropriately.
+      For example:
+
+      </para>
+
+      <programlisting>
+        env = Environment(OBJPREFIX='my', OBJSUFFIX='.xxx')
+        env.StaticObject('file', 'file.c')
+      </programlisting>
+
+      <para>
+
+      Will create an object file named
+      <filename>myfile.xxx</filename>
+      regardless of the system on which it is run.
+
+      </para>
+
+      <para>
+
+      If you omit the &target;,
+      the base of the first input
+      file name specified
+      beomces the base of the name
+      of the static object file to be created.
+      For example:
+
+      </para>
+
       <literallayout>
-        XXX
+        StaticObject('file.c')
       </literallayout>
 
+      <para>
+
+      Will create the &file_o;
+      executable on a POSIX system,
+      the &file_obj; executable on a Windows system.
+
+      </para>
+
     </section>
 
     <section>
 
       <para>
 
-      XXX
+      The &SharedObject; Builder
+      is used to build an object file
+      suitable for shared linking into a program,
+      or for inclusion in a shared library.
+      The &source; argument is a single source-code file,
+      and the &target; argument is the
+      name of the shared object file to be created.
+      For example:
 
       </para>
 
       <programlisting>
-        XXX
+        SharedObject('file', 'file.c')
       </programlisting>
 
-      <literallayout>
-        XXX
-      </literallayout>
+      <para>
 
-    </section>
+      Will create the &file_o;
+      object file on a POSIX system,
+      the &file_obj; executable on a Windows system.
 
-    <section>
-    <title>The &Object; Builder</title>
+      </para>
 
       <para>
 
-      XXX
+      The target file's prefix and suffix may be omitted,
+      and the values from the
+      $SHOBJPREFIX
+      and
+      $SHOBJSUFFIX
+      construction variables
+      will be appended appropriately.
+      For example:
 
       </para>
 
       <programlisting>
-        XXX
+        env = Environment(SHOBJPREFIX='my', SHOBJSUFFIX='.xxx')
+        env.SharedObject('file', 'file.c')
       </programlisting>
 
       <para>
 
-      Creates a static object file.
+      Will create an object file named
+      <filename>myfile.xxx</filename>
+      regardless of the system on which it is run.
+
+      </para>
+
+      <para>
+
+      If you omit the &target;,
+      the base of the first input
+      file name specified
+      becomes the base of the name
+      of the shared object file to be created.
+      For example:
+
+      </para>
+
+      <literallayout>
+        SharedObject('file.c')
+      </literallayout>
+
+      <para>
+
+      Will create the &file_o;
+      executable on a POSIX system,
+      the &file_obj; executable on a Windows system.
+
+      </para>
+
+    </section>
+
+    <section>
+    <title>The &Object; Builder</title>
+
+      <para>
+
+      The &Object; Builder is a synonym for &StaticObject;
+      and is completely equivalent.
 
       </para>
 
     <para>
 
     &SCons; provides separate Builder objects
-    to create both static and shared libraries.
+    to create static and shared libraries.
 
     </para>
 
 
       <para>
 
-      XXX
+      The &StaticLibrary; Builder
+      is used to create a library
+      suitable for static linking into a program.
+      The &source; argument is one or more
+      source-code files or object files,
+      and the &target; argument is the
+      name of the static library to be created.
+      For example:
 
       </para>
 
       <programlisting>
-        XXX
+        StaticLibrary('foo', ['file1.c', 'file2.c'])
       </programlisting>
 
+      <para>
+
+      The target file's prefix and suffix may be omitted,
+      and the values from the
+      $LIBPREFIX
+      and
+      $LIBSUFFIX
+      construction variables
+      will be appended appropriately.
+      For example:
+
+      </para>
+
+      <programlisting>
+        env = Environment(LIBPREFIX='my', LIBSUFFIX='.xxx')
+        env.StaticLibrary('lib', ['file1.o', 'file2.o'])
+      </programlisting>
+
+      <para>
+
+      Will create an object file named
+      <filename>mylib.xxx</filename>
+      regardless of the system on which it is run.
+
+      </para>
+
+      <programlisting>
+        StaticLibrary('foo', ['file1.c', 'file2.c'])
+      </programlisting>
+
+      <para>
+
+      If you omit the &target;,
+      the base of the first input
+      file name specified
+      becomes the base of the name of the static object file to be created.
+      For example:
+
+      </para>
+
       <literallayout>
-        XXX
+        StaticLibrary(['file.c', 'another.c'])
       </literallayout>
 
+      <para>
+
+      Will create the &libfile_a;
+      library on a POSIX system,
+      the &file_lib; library on a Windows system.
+
+      </para>
+
     </section>
 
     <section>
 
       <para>
 
-      XXX
+      The &SharedLibrary; Builder
+      is used to create a shared library
+      suitable for linking with a program.
+      The &source; argument is one or more
+      source-code files or object files,
+      and the &target; argument is the
+      name of the shared library to be created.
+      For example:
 
       </para>
 
-    </section>
+      <programlisting>
+        SharedLibrary('foo', ['file1.c', 'file2.c'])
+      </programlisting>
 
-    <section>
-    <title>The &Library; Builder</title>
+      <para>
+
+      The target file's prefix and suffix may be omitted,
+      and the values from the
+      $SHLIBPREFIX
+      and
+      $SHLIBSUFFIX
+      construction variables
+      will be appended appropriately.
+      For example:
+
+      </para>
+
+      <programlisting>
+        env = Environment(SHLIBPREFIX='my', SHLIBSUFFIX='.xxx')
+        env.SharedLibrary('shared', ['file1.o', 'file2.o'])
+      </programlisting>
 
       <para>
 
-      XXX
+      Will create an object file named
+      <filename>myshared.xxx</filename>
+      regardless of the system on which it is run.
 
       </para>
 
       <programlisting>
-        XXX
+        SharedLibrary('foo', ['file1.c', 'file2.c'])
       </programlisting>
 
+      <para>
+
+      If you omit the &target;,
+      the base of the first input
+      file name specified
+      becomes the base of the name of the shared library to be created.
+      For example:
+
+      </para>
+
       <literallayout>
-        XXX
+        SharedLibrary(['file.c', 'another.c'])
       </literallayout>
 
       <para>
 
-      Creates a static library file.
+      Will create the &libfile_so;
+      library on a POSIX system,
+      the &file_dll; library on a Windows system.
+
+      </para>
+
+    </section>
+
+    <section>
+    <title>The &Library; Builder</title>
+
+      <para>
+
+      The &Library; Builder is a synonym for &StaticLibrary;
+      and is completely equivalent.
 
       </para>
 
     &SCons; supports two Builder objects
     that know how to build source files
     from other input files.
+    These are typically invoked "internally"
+    to turn files that need preprocessing into other source files.
 
     </para>
 
       </scons_example>
 
       <scons_output example="ex1" os="posix">
-        <command>scons .</command>
+        <command>scons -Q .</command>
       </scons_output>
 
       <para>
       </scons_example>
 
       <scons_output example="ex2" os="posix">
-        <command>scons .</command>
+        <command>scons -Q .</command>
       </scons_output>
 
       <para>
       </scons_example>
 
       <scons_output example="ex3" os="posix">
-        <command>scons .</command>
+        <command>scons -Q .</command>
       </scons_output>
 
     </section>
       </para>
 
       <scons_output example="ex4" os="posix">
-        <command>scons .</command>
+        <command>scons -Q .</command>
       </scons_output>
 
       <para>
       </para>
 
       <literallayout>
-        % <userinput>scons .</userinput>
+        % <userinput>scons -Q .</userinput>
         zip /home/my/project/zip.out file1 file2
       </literallayout>
 
index bb29cc414bb3251aa94b659f41b6691d1aa8249d..3afbf195900f76f976b5024041d04bb863981bd6 100644 (file)
@@ -33,6 +33,9 @@
   This section will describe all of the different
   types of files that you can build with &SCons;,
   and the built-in &Builder; objects used to build them.
+  By default, all of the  &Builder; objects in this section
+  can be built either with or without an explicit
+  construction environment.
 
   </para>
 
@@ -52,8 +55,7 @@
     </para>
 
     <programlisting>
-      env = Environment()
-      env.Program('prog', 'file1.o')
+      Program('prog', 'file1.o')
     </programlisting>
 
     <para>
     If you omit the &target;,
     the base of the first input
     file name specified
-    because the base of the target
+    becomes the base of the target
     program created.
     For example:
 
     </para>
 
     <programlisting>
-      env = Environment()
-      env.Program(['hello.c', 'goodbye.c'])
+      Program(['hello.c', 'goodbye.c'])
     </programlisting>
 
     <para>
 
     </para>
 
+    <para>
+
+    Two construction variables control what libraries
+    will be linked with the resulting program.
+    The &LIBS; variable is a list of the names of
+    libraries that will be linked into any programs,
+    and the &LIBPATH; variables is a list of
+    directories that will be searched for
+    the specified libraries.
+    &SCons; will construct the right command-line
+    options for the running system.
+    For example:
+
+    </para>
+
+    <programlisting>
+      env = Environment(LIBS = ['foo1', 'foo2'],
+                        LIBPATH = ['/usr/dir1', 'dir2'])
+      env.Program(['hello.c', 'goodbye.c'])
+    </programlisting>
+
+    <para>
+
+    Will execute as follows on a POSIX system:
+
+    </para>
+
+    <literallayout>
+      % <userinput>scons -Q</userinput>
+      cc -c -o goodbye.o goodbye.c
+      cc -c -o hello.o hello.c
+      cc -o hello hello.o goodbye.o -L/usr/dir1 -Ldir2 -lfoo1 -lfoo2
+    </literallayout>
+
+    <para>
+
+    And execute as follows on a Windows system:
+
+    </para>
+
+    <literallayout>
+      C:\><userinput>scons -Q</userinput>
+      cl /nologo /c goodbye.c /Fogoodbye.obj
+      cl /nologo /c hello.c /Fohello.obj
+      link /nologo /OUT:hello.exe /LIBPATH:\usr\dir1 /LIBPATH:dir2 foo1.lib foo2.lib hello.obj goodbye.obj
+    </literallayout>
+
+    <para>
+
+    The &LIBS; construction variable
+    is turned into command line options
+    by appending the &LIBLINKPREFIX; and &LIBLINKSUFFIX;
+    construction variables to the beginning and end,
+    respectively, of each specified library.
+
+    </para>
+
+    <para>
+
+    The &LIBPATH; construction variable
+    is turned into command line options
+    by appending the &LIBDIRPREFIX; and &LIBDIRSUFFIX;
+    construction variables to the beginning and end,
+    respectively, of each specified library.
+
+    </para>
+
+    <para>
+
+    Other relevant construction variables
+    include those used by the &Object;
+    builders to affect how the
+    source files specified as input to the &Program;
+    builders are turned into object files;
+    see the next section.
+
+    </para>
+
+    <para>
+
+    The command line used to control how a program is linked
+    is specified by the &LINKCOM; construction variable.
+    By default, it uses the
+    &LINK; construction variable
+    and the &LINKFLAGS; construction variable.
+
+    </para>
+
   </section>
 
   <section>
     <para>
 
     &SCons; provides separate Builder objects
-    to create both static and shared object files.
+    to create static and shared object files.
+    The distinction becomes especially important when 
+    archiving object files into different types of libraries.
 
     </para>
 
 
       <para>
 
-      XXX
+      The &StaticObject; Builder
+      is used to build an object file
+      suitable for static linking into a program,
+      or for inclusion in a static library.
+      The &source; argument is a single source-code file,
+      and the &target; argument is the
+      name of the static object file to be created.
+      For example:
 
       </para>
 
       <programlisting>
-        XXX
+        StaticObject('file', 'file.c')
       </programlisting>
 
+      <para>
+
+      Will create the &file_o;
+      object file on a POSIX system,
+      the &file_obj; executable on a Windows system.
+
+      </para>
+
+      <para>
+
+      The target file's prefix and suffix may be omitted,
+      and the values from the
+      $OBJPREFIX
+      and
+      $OBJSUFFIX
+      construction variables
+      will be appended appropriately.
+      For example:
+
+      </para>
+
+      <programlisting>
+        env = Environment(OBJPREFIX='my', OBJSUFFIX='.xxx')
+        env.StaticObject('file', 'file.c')
+      </programlisting>
+
+      <para>
+
+      Will create an object file named
+      <filename>myfile.xxx</filename>
+      regardless of the system on which it is run.
+
+      </para>
+
+      <para>
+
+      If you omit the &target;,
+      the base of the first input
+      file name specified
+      beomces the base of the name
+      of the static object file to be created.
+      For example:
+
+      </para>
+
       <literallayout>
-        XXX
+        StaticObject('file.c')
       </literallayout>
 
+      <para>
+
+      Will create the &file_o;
+      executable on a POSIX system,
+      the &file_obj; executable on a Windows system.
+
+      </para>
+
     </section>
 
     <section>
 
       <para>
 
-      XXX
+      The &SharedObject; Builder
+      is used to build an object file
+      suitable for shared linking into a program,
+      or for inclusion in a shared library.
+      The &source; argument is a single source-code file,
+      and the &target; argument is the
+      name of the shared object file to be created.
+      For example:
 
       </para>
 
       <programlisting>
-        XXX
+        SharedObject('file', 'file.c')
       </programlisting>
 
-      <literallayout>
-        XXX
-      </literallayout>
+      <para>
 
-    </section>
+      Will create the &file_o;
+      object file on a POSIX system,
+      the &file_obj; executable on a Windows system.
 
-    <section>
-    <title>The &Object; Builder</title>
+      </para>
 
       <para>
 
-      XXX
+      The target file's prefix and suffix may be omitted,
+      and the values from the
+      $SHOBJPREFIX
+      and
+      $SHOBJSUFFIX
+      construction variables
+      will be appended appropriately.
+      For example:
 
       </para>
 
       <programlisting>
-        XXX
+        env = Environment(SHOBJPREFIX='my', SHOBJSUFFIX='.xxx')
+        env.SharedObject('file', 'file.c')
       </programlisting>
 
       <para>
 
-      Creates a static object file.
+      Will create an object file named
+      <filename>myfile.xxx</filename>
+      regardless of the system on which it is run.
+
+      </para>
+
+      <para>
+
+      If you omit the &target;,
+      the base of the first input
+      file name specified
+      becomes the base of the name
+      of the shared object file to be created.
+      For example:
+
+      </para>
+
+      <literallayout>
+        SharedObject('file.c')
+      </literallayout>
+
+      <para>
+
+      Will create the &file_o;
+      executable on a POSIX system,
+      the &file_obj; executable on a Windows system.
+
+      </para>
+
+    </section>
+
+    <section>
+    <title>The &Object; Builder</title>
+
+      <para>
+
+      The &Object; Builder is a synonym for &StaticObject;
+      and is completely equivalent.
 
       </para>
 
     <para>
 
     &SCons; provides separate Builder objects
-    to create both static and shared libraries.
+    to create static and shared libraries.
 
     </para>
 
 
       <para>
 
-      XXX
+      The &StaticLibrary; Builder
+      is used to create a library
+      suitable for static linking into a program.
+      The &source; argument is one or more
+      source-code files or object files,
+      and the &target; argument is the
+      name of the static library to be created.
+      For example:
 
       </para>
 
       <programlisting>
-        XXX
+        StaticLibrary('foo', ['file1.c', 'file2.c'])
+      </programlisting>
+
+      <para>
+
+      The target file's prefix and suffix may be omitted,
+      and the values from the
+      $LIBPREFIX
+      and
+      $LIBSUFFIX
+      construction variables
+      will be appended appropriately.
+      For example:
+
+      </para>
+
+      <programlisting>
+        env = Environment(LIBPREFIX='my', LIBSUFFIX='.xxx')
+        env.StaticLibrary('lib', ['file1.o', 'file2.o'])
+      </programlisting>
+
+      <para>
+
+      Will create an object file named
+      <filename>mylib.xxx</filename>
+      regardless of the system on which it is run.
+
+      </para>
+
+      <programlisting>
+        StaticLibrary('foo', ['file1.c', 'file2.c'])
       </programlisting>
 
+      <para>
+
+      If you omit the &target;,
+      the base of the first input
+      file name specified
+      becomes the base of the name of the static object file to be created.
+      For example:
+
+      </para>
+
       <literallayout>
-        XXX
+        StaticLibrary(['file.c', 'another.c'])
       </literallayout>
 
+      <para>
+
+      Will create the &libfile_a;
+      library on a POSIX system,
+      the &file_lib; library on a Windows system.
+
+      </para>
+
     </section>
 
     <section>
 
       <para>
 
-      XXX
+      The &SharedLibrary; Builder
+      is used to create a shared library
+      suitable for linking with a program.
+      The &source; argument is one or more
+      source-code files or object files,
+      and the &target; argument is the
+      name of the shared library to be created.
+      For example:
 
       </para>
 
-    </section>
+      <programlisting>
+        SharedLibrary('foo', ['file1.c', 'file2.c'])
+      </programlisting>
 
-    <section>
-    <title>The &Library; Builder</title>
+      <para>
+
+      The target file's prefix and suffix may be omitted,
+      and the values from the
+      $SHLIBPREFIX
+      and
+      $SHLIBSUFFIX
+      construction variables
+      will be appended appropriately.
+      For example:
+
+      </para>
+
+      <programlisting>
+        env = Environment(SHLIBPREFIX='my', SHLIBSUFFIX='.xxx')
+        env.SharedLibrary('shared', ['file1.o', 'file2.o'])
+      </programlisting>
 
       <para>
 
-      XXX
+      Will create an object file named
+      <filename>myshared.xxx</filename>
+      regardless of the system on which it is run.
 
       </para>
 
       <programlisting>
-        XXX
+        SharedLibrary('foo', ['file1.c', 'file2.c'])
       </programlisting>
 
+      <para>
+
+      If you omit the &target;,
+      the base of the first input
+      file name specified
+      becomes the base of the name of the shared library to be created.
+      For example:
+
+      </para>
+
       <literallayout>
-        XXX
+        SharedLibrary(['file.c', 'another.c'])
       </literallayout>
 
       <para>
 
-      Creates a static library file.
+      Will create the &libfile_so;
+      library on a POSIX system,
+      the &file_dll; library on a Windows system.
+
+      </para>
+
+    </section>
+
+    <section>
+    <title>The &Library; Builder</title>
+
+      <para>
+
+      The &Library; Builder is a synonym for &StaticLibrary;
+      and is completely equivalent.
 
       </para>
 
     &SCons; supports two Builder objects
     that know how to build source files
     from other input files.
+    These are typically invoked "internally"
+    to turn files that need preprocessing into other source files.
 
     </para>
 
       </programlisting>
 
       <literallayout>
-        % <userinput>scons .</userinput>
+        % <userinput>scons -Q .</userinput>
         tar -c -f out1.tar file1 file2
         tar -c -f out2.tar directory
       </literallayout>
       </programlisting>
 
       <literallayout>
-        % <userinput>scons .</userinput>
+        % <userinput>scons -Q .</userinput>
         tar -c -z -f out.tar.gz directory
       </literallayout>
 
       </programlisting>
 
       <literallayout>
-        % <userinput>scons .</userinput>
+        % <userinput>scons -Q .</userinput>
         tar -c -z -f out.tgz directory
       </literallayout>
 
       </para>
 
       <literallayout>
-        % <userinput>scons .</userinput>
+        % <userinput>scons -Q .</userinput>
         zip("out.zip", ["file1", "file2"])
       </literallayout>
 
       </para>
 
       <literallayout>
-        % <userinput>scons .</userinput>
+        % <userinput>scons -Q .</userinput>
         zip /home/my/project/zip.out file1 file2
       </literallayout>
 
index 5fc2c7380fa0cf430fe04544b63095c4b572d78e..2c72bbdee22c6a6088b031abcfdcf32b1559893d 100644 (file)
@@ -80,7 +80,7 @@
   </scons_example>
 
   <scons_output example="ex1">
-    <command>scons .</command>
+    <command>scons -Q</command>
   </scons_output>
 
   <para>
   </scons_example>
 
   <scons_output example="ex2">
-    <command>scons .</command>
+    <command>scons -Q</command>
   </scons_output>
index e21f6d0179056753064661061ce0a9015bfe29f5..64c81e52a26c989ee7b9b0c5440bd75ebebda509 100644 (file)
 
   <programlisting>
      env = Environment()
-     env.Command('foo.out', 'foo.in', "sed 's/x/y/' < $TARGET > $SOURCE")
+     env.Command('foo.out', 'foo.in', "sed 's/x/y/' < $SOURCE > $TARGET")
   </programlisting>
 
   <literallayout>
-    % <userinput>scons .</userinput>
-    sed 's/x/y' < foo.in > foo.out
+    % <userinput>scons -Q</userinput>
+    sed 's/x/y/' < foo.in > foo.out
   </literallayout>
 
   <para>
 
   <programlisting>
      env = Environment()
-     def build(target, source, env)
-         XXX
+     def build(target, source, env):
+         # Whatever it takes to build
          return None
      env.Command('foo.out', 'foo.in', build)
   </programlisting>
 
   <literallayout>
-    % <userinput>scons .</userinput>
+    % <userinput>scons -Q</userinput>
     build("foo.out", "foo.in")
   </literallayout>
index 23017843519a463a9a92f32565f628628f98e5ee..3c87761dda9754760efd14dd99ec48f5a44873b2 100644 (file)
@@ -93,9 +93,9 @@
     </para>
 
     <scons_output example="ex1">
-      <command>scons</command>
-      <command>scons -c</command>
-      <command>scons</command>
+      <command>scons -Q</command>
+      <command>scons -Q -c</command>
+      <command>scons -Q</command>
     </scons_output>
 
   </section>
     </para>
 
     <scons_output example="ex1">
-      <command>scons</command>
-      <command>scons -c</command>
-      <command>scons --cache-show</command>
+      <command>scons -Q</command>
+      <command>scons -Q -c</command>
+      <command>scons -Q --cache-show</command>
     </scons_output>
 
     <para>
     </para>
 
     <scons_output example="ex1">
-      <command>scons</command>
-      <command>scons -c</command>
-      <command>scons</command>
-      <command>scons -c</command>
-      <command>scons --cache-disable</command>
+      <command>scons -Q</command>
+      <command>scons -Q -c</command>
+      <command>scons -Q</command>
+      <command>scons -Q -c</command>
+      <command>scons -Q --cache-disable</command>
     </scons_output>
 
   </section>
     </para>
 
     <scons_output example="ex1">
-      <command>scons --cache-disable</command>
-      <command>scons -c</command>
-      <command>scons --cache-disable</command>
-      <command>scons --cache-force</command>
-      <command>scons -c</command>
-      <command>scons</command>
+      <command>scons -Q --cache-disable</command>
+      <command>scons -Q -c</command>
+      <command>scons -Q --cache-disable</command>
+      <command>scons -Q --cache-force</command>
+      <command>scons -Q -c</command>
+      <command>scons -Q</command>
     </scons_output>
 
     <para>
index 3d9158efcf529278b085b62cee228ef5beae6363..223592e1d4d18ad3703ba369ebb01f2b5dd776f9 100644 (file)
     </para>
 
     <literallayout>
-      % <userinput>scons</userinput>
-      cc -c hello.c -o hello.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o hello.o hello.c
       cc -o hello hello.o
-      % <userinput>scons -c</userinput>
+      % <userinput>scons -Q -c</userinput>
       Removed hello.o
       Removed hello
-      % <userinput>scons</userinput>
+      % <userinput>scons -Q</userinput>
       Retrieved `hello.o' from cache
       Retrieved `hello' from cache
-      %
     </literallayout>
 
   </section>
     </para>
 
     <literallayout>
-      % <userinput>scons</userinput>
-      cc -c hello.c -o hello.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o hello.o hello.c
       cc -o hello hello.o
-      % <userinput>scons -c</userinput>
+      % <userinput>scons -Q -c</userinput>
       Removed hello.o
       Removed hello
-      % <userinput>scons --cache-show</userinput>
-      cc -c hello.c -o hello.o
+      % <userinput>scons -Q --cache-show</userinput>
+      cc -c -o hello.o hello.c
       cc -o hello hello.o
-      %
     </literallayout>
 
     <para>
     </para>
 
     <literallayout>
-      % <userinput>scons</userinput>
-      cc -c hello.c -o hello.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o hello.o hello.c
       cc -o hello hello.o
-      % <userinput>scons -c</userinput>
+      % <userinput>scons -Q -c</userinput>
       Removed hello.o
       Removed hello
-      % <userinput>scons</userinput>
+      % <userinput>scons -Q</userinput>
       Retrieved `hello.o' from cache
       Retrieved `hello' from cache
-      % <userinput>scons -c</userinput>
+      % <userinput>scons -Q -c</userinput>
       Removed hello.o
       Removed hello
-      % <userinput>scons --cache-disable</userinput>
-      cc -c hello.c -o hello.o
+      % <userinput>scons -Q --cache-disable</userinput>
+      cc -c -o hello.o hello.c
       cc -o hello hello.o
-      %
     </literallayout>
 
   </section>
     </para>
 
     <literallayout>
-      % <userinput>scons --cache-disable</userinput>
-      cc -c hello.c -o hello.o
+      % <userinput>scons -Q --cache-disable</userinput>
+      cc -c -o hello.o hello.c
       cc -o hello hello.o
-      % <userinput>scons -c</userinput>
+      % <userinput>scons -Q -c</userinput>
       Removed hello.o
       Removed hello
-      % <userinput>scons --cache-disable</userinput>
-      cc -c hello.c -o hello.o
+      % <userinput>scons -Q --cache-disable</userinput>
+      cc -c -o hello.o hello.c
       cc -o hello hello.o
-      % <userinput>scons --cache-force</userinput>
-      % <userinput>scons -c</userinput>
+      % <userinput>scons -Q --cache-force</userinput>
+      scons: `.' is up to date.
+      % <userinput>scons -Q -c</userinput>
       Removed hello.o
       Removed hello
-      % <userinput>scons</userinput>
+      % <userinput>scons -Q</userinput>
       Retrieved `hello.o' from cache
       Retrieved `hello' from cache
-      %
     </literallayout>
 
     <para>
index dbe6ecdb336ed87b08b528d55fd34da9786425e8..2410da6828f711c4522888f2abae9dba30a4bfe3 100644 (file)
@@ -100,9 +100,9 @@ default list.
    </para>
 
    <scons_output example="ex1">
-      <command>scons</command>
-      <command>scons</command>
-      <command>scons goodbye</command>
+      <command>scons -Q</command>
+      <command>scons -Q</command>
+      <command>scons -Q goodbye</command>
    </scons_output>
 
    <para>
@@ -117,7 +117,7 @@ default list.
    </para>
 
    <scons_output example="ex1">
-      <command>scons .</command>
+      <command>scons -Q .</command>
    </scons_output>
 
    <para>
@@ -176,8 +176,8 @@ default list.
    </para>
 
    <scons_output example="ex2">
-      <command>scons</command>
-      <command>scons .</command>
+      <command>scons -Q</command>
+      <command>scons -Q .</command>
    </scons_output>
 
    <para>
@@ -211,6 +211,6 @@ default list.
    </para>
 
    <scons_output example="ex3">
-      <command>scons</command>
-      <command>scons .</command>
+      <command>scons -Q</command>
+      <command>scons -Q .</command>
    </scons_output>
index f44719f9fc57bb0f5e9cb3fb15b686d5e4fcd321..fa21bae77336d34241a679a83b19ecbfbfc865fd 100644 (file)
@@ -92,14 +92,14 @@ default list.
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      cc -c hello.c -o hello.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o hello.o hello.c
       cc -o hello hello.o
-      % <userinput>scons</userinput>
-      % <userinput>scons goodbye</userinput>
-      cc -c goodbye.c -o goodbye.o
+      % <userinput>scons -Q</userinput>
+      scons: `hello' is up to date.
+      % <userinput>scons -Q goodbye</userinput>
+      cc -c -o goodbye.o goodbye.c
       cc -o goodbye goodbye.o
-      %
    </literallayout>
 
    <para>
@@ -114,12 +114,11 @@ default list.
    </para>
 
    <literallayout>
-      % <userinput>scons .</userinput>
-      cc -c goodbye.c -o goodbye.o
+      % <userinput>scons -Q .</userinput>
+      cc -c -o goodbye.o goodbye.c
       cc -o goodbye goodbye.o
-      cc -c hello.c -o hello.o
+      cc -c -o hello.o hello.c
       cc -o hello hello.o
-      %
    </literallayout>
 
    <para>
@@ -167,15 +166,14 @@ default list.
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      cc -c prog1.c -o prog1.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o prog1.o prog1.c
       cc -o prog1 prog1.o
-      cc -c prog3.c -o prog3.o
+      cc -c -o prog3.o prog3.c
       cc -o prog3 prog3.o
-      % <userinput>scons .</userinput>
-      cc -c prog2.c -o prog2.o
+      % <userinput>scons -Q .</userinput>
+      cc -c -o prog2.o prog2.c
       cc -o prog2 prog2.o
-      %
    </literallayout>
 
    <para>
@@ -201,12 +199,11 @@ default list.
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
+      % <userinput>scons -Q</userinput>
       scons: *** No targets specified and no Default() targets found.  Stop.
-      % <userinput>scons .</userinput>
-      cc -c prog1.c -o prog1.o
+      % <userinput>scons -Q .</userinput>
+      cc -c -o prog1.o prog1.c
       cc -o prog1 prog1.o
-      cc -c prog2.c -o prog2.o
+      cc -c -o prog2.o prog2.c
       cc -o prog2 prog2.o
-      %
    </literallayout>
index 7f022c19507b8bd7abda86e47cd586ed40cad21b..2083d4fcb799f2e0cb4a0c30bd6d62d43ad09477 100644 (file)
@@ -410,10 +410,8 @@ environment undisturbed.
 
  <para>
 
-   A &consenv; is created by the &Environment;
-   method which you have already seen.
-   What you haven't seen, though,
-   is that when you initialize a &consenv;,
+   A &consenv; is created by the &Environment; method.
+   When you initialize a &consenv;,
    you can set the values of the
    environment's &consvars;
    to control how a program is built.
@@ -422,7 +420,7 @@ environment undisturbed.
  </para>
 
   <scons_example name="ex1">
-    <file name="SConstruct">
+    <file name="SConstruct" printme="1">
     env = Environment(CC = 'gcc',
                       CCFLAGS = '-O2')
 
@@ -446,7 +444,7 @@ environment undisturbed.
  </para>
 
  <scons_output example="ex1">
-    <command>scons</command>
+    <command>scons -Q</command>
  </scons_output>
 
  <section>
@@ -454,36 +452,21 @@ environment undisturbed.
 
    <para>
 
-   So far,
-   all of our examples have
-   created a single &consenv; named
-   <literal>env</literal>.
-   <literal>env</literal>, however,
-   is simply a Python variable name,
-   and you can use any other variable name that you like.
-   For example:
-
-   </para>
-
-   <sconstruct>
-      my_env = Environment(CC = 'gcc',
-                           CCFLAGS = '-O2')
-
-      my_env.Program('foo.c')
-   </sconstruct>
-
-   <para>
-
-   This opens up the possibility of
-   using multiple &consenvs;,
-   each with a separate variable name.
-   We can then use these separate &consenvs;
-   to build different programs in different ways:
+   The real advantage of construction environments
+   become apparent when you realize
+   that you can create as many different construction
+   environments as you need,
+   each tailored to a different way to build
+   some piece of software or other file.
+   If, for example, we need to build
+   one program with the <literal>-O2</literal> flag
+   and another with the <literal>-g</literal> (debug) flag,
+   we would do this like so:
 
    </para>
 
    <scons_example name="ex2">
-     <file name="SConstruct">
+     <file name="SConstruct" printme="1">
       opt = Environment(CCFLAGS = '-O2')
       dbg = Environment(CCFLAGS = '-g')
 
@@ -500,7 +483,7 @@ environment undisturbed.
    </scons_example>
 
    <scons_output example="ex2">
-      <command>scons</command>
+      <command>scons -Q</command>
    </scons_output>
 
    <para>
@@ -514,7 +497,7 @@ environment undisturbed.
    </para>
 
    <scons_example name="ex3">
-     <file name="SConstruct">
+     <file name="SConstruct" printme="1">
       opt = Environment(CCFLAGS = '-O2')
       dbg = Environment(CCFLAGS = '-g')
 
@@ -534,7 +517,7 @@ environment undisturbed.
    </para>
 
    <scons_output example="ex3">
-      <command>scons</command>
+      <command>scons -Q</command>
    </scons_output>
 
    <para>
@@ -546,6 +529,9 @@ environment undisturbed.
    <literal>-O2</literal>
    and one with a &CCFLAGS; value of
    <literal>-g</literal>.
+   &SCons; can't just decide that one of them
+   should take precedence over the other,
+   so it generates the error.
    To avoid this problem,
    we must explicitly specify
    that each environment compile
@@ -559,7 +545,7 @@ environment undisturbed.
    </programlisting>
 
    <scons_example name="ex4">
-     <file name="SConstruct">
+     <file name="SConstruct" printme="1">
       opt = Environment(CCFLAGS = '-O2')
       dbg = Environment(CCFLAGS = '-g')
 
@@ -579,7 +565,7 @@ environment undisturbed.
    Notice that each call to the &Object; builder
    returns a value,
    an internal &SCons; object that
-   represents the file that will be built.
+   represents the object file that will be built.
    We then use that object
    as input to the &Program; builder.
    This avoids having to specify explicitly
@@ -591,7 +577,7 @@ environment undisturbed.
    </para>
 
    <scons_output example="ex4">
-      <command>scons</command>
+      <command>scons -Q</command>
    </scons_output>
 
  </section>
@@ -622,7 +608,7 @@ environment undisturbed.
    that sets &CC; to &gcc;,
    and then creating two copies,
    one which sets &CCFLAGS; for optimization
-   and the other with sets &CCFLAGS; for debugging:
+   and the other which sets &CCFLAGS; for debugging:
 
    </para>
 
@@ -632,7 +618,7 @@ environment undisturbed.
       opt = env.Copy(CCFLAGS = '-O2')
       dbg = env.Copy(CCFLAGS = '-g')
 
-      e = opt.Object('foo', 'foo.c')
+      env.Program('foo', 'foo.c')
 
       o = opt.Object('foo-opt', 'foo.c')
       opt.Program(o)
@@ -652,7 +638,7 @@ environment undisturbed.
    </para>
 
    <scons_output example="ex5">
-      <command>scons</command>
+      <command>scons -Q</command>
    </scons_output>
 
  </section>
@@ -684,8 +670,7 @@ environment undisturbed.
    </para>
 
    <scons_output example="ex6">
-      <command>scons</command>
-      CC is: cc
+      <command>scons -Q</command>
    </scons_output>
 
    <para>
@@ -703,22 +688,31 @@ environment undisturbed.
       <file name="SConstruct" printme="1">
       env = Environment(FOO = 'foo', BAR = 'bar')
       dict = env.Dictionary()
-      for key, value in dict.items():
-          print "key = %s, value = %s % (key, value)
+      for key in ['OBJSUFFIX', 'LIBSUFFIX', 'PROGSUFFIX']:
+          print "key = %s, value = %s" % (key, dict[key])
       </file>
    </scons_Example>
 
    <para>
 
    This &SConstruct; file
-   will print the dictionary items for us as follows:
+   will print the specified dictionary items for us on POSIX
+   systems as follows:
+
+   </para>
+
+   <scons_output example="ex6b" os="posix">
+      <command>scons -Q</command>
+   </scons_output>
+
+   <para>
+
+   And on Win32:
 
    </para>
 
-   <scons_output example="ex6b">
-      % <userinput>scons</userinput>
-      key = FOO, value = foo
-      key = BAR, value = bar
+   <scons_output example="ex6b" os="win32">
+      <command>scons -Q</command>
    </scons_output>
 
  </section>
@@ -765,7 +759,7 @@ environment undisturbed.
      </para>
 
      <scons_output example="ex7">
-        <command>scons</command>
+        <command>scons -Q</command>
      </scons_output>
 
    </section>
@@ -793,7 +787,7 @@ environment undisturbed.
      </scons_example>
 
      <scons_output example="ex8">
-        <command>scons</command>
+        <command>scons -Q</command>
      </scons_output>
 
    </section>
@@ -821,7 +815,7 @@ environment undisturbed.
      </scons_example>
 
      <scons_output example="ex9">
-        <command>scons</command>
+        <command>scons -Q</command>
      </scons_output>
 
    </section>
index 2cba46e4bf72faa4dfe4b7f30779379f4620c7f3..2be8614e52e7e46aab2e22f130ec4126c2bd9de0 100644 (file)
@@ -410,10 +410,8 @@ environment undisturbed.
 
  <para>
 
-   A &consenv; is created by the &Environment;
-   method which you have already seen.
-   What you haven't seen, though,
-   is that when you initialize a &consenv;,
+   A &consenv; is created by the &Environment; method.
+   When you initialize a &consenv;,
    you can set the values of the
    environment's &consvars;
    to control how a program is built.
@@ -421,12 +419,12 @@ environment undisturbed.
 
  </para>
 
- <programlisting>
 <programlisting>
     env = Environment(CC = 'gcc',
                       CCFLAGS = '-O2')
 
     env.Program('foo.c')
- </programlisting>
 </programlisting>
 
  <para>
    
@@ -441,8 +439,8 @@ environment undisturbed.
  </para>
 
  <literallayout>
-    % <userinput>scons</userinput>
-    gcc -c -O2 foo.c -o foo.o
+    % <userinput>scons -Q</userinput>
+    gcc -O2 -c -o foo.o foo.c
     gcc -o foo foo.o
  </literallayout>
 
@@ -451,31 +449,16 @@ environment undisturbed.
 
    <para>
 
-   So far,
-   all of our examples have
-   created a single &consenv; named
-   <literal>env</literal>.
-   <literal>env</literal>, however,
-   is simply a Python variable name,
-   and you can use any other variable name that you like.
-   For example:
-
-   </para>
-
-   <programlisting>
-      my_env = Environment(CC = 'gcc',
-                           CCFLAGS = '-O2')
-
-      my_env.Program('foo.c')
-   </programlisting>
-
-   <para>
-
-   This opens up the possibility of
-   using multiple &consenvs;,
-   each with a separate variable name.
-   We can then use these separate &consenvs;
-   to build different programs in different ways:
+   The real advantage of construction environments
+   become apparent when you realize
+   that you can create as many different construction
+   environments as you need,
+   each tailored to a different way to build
+   some piece of software or other file.
+   If, for example, we need to build
+   one program with the <literal>-O2</literal> flag
+   and another with the <literal>-g</literal> (debug) flag,
+   we would do this like so:
 
    </para>
 
@@ -489,10 +472,10 @@ environment undisturbed.
    </programlisting>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      cc -c -O2 bar.c -o bar.o
+      % <userinput>scons -Q</userinput>
+      cc -g -c -o bar.o bar.c
       cc -o bar bar.o
-      cc -c -g foo.c -o foo.o
+      cc -O2 -c -o foo.o foo.c
       cc -o foo foo.o
    </literallayout>
 
@@ -522,8 +505,9 @@ environment undisturbed.
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      scons: *** Two different environments were specified for the same target:  foo.o
+      % <userinput>scons -Q</userinput>
+      
+      scons: *** Two different environments were specified for the same target: foo.o
       File "SConstruct", line 6, in ?
    </literallayout>
 
@@ -536,6 +520,9 @@ environment undisturbed.
    <literal>-O2</literal>
    and one with a &CCFLAGS; value of
    <literal>-g</literal>.
+   &SCons; can't just decide that one of them
+   should take precedence over the other,
+   so it generates the error.
    To avoid this problem,
    we must explicitly specify
    that each environment compile
@@ -545,6 +532,9 @@ environment undisturbed.
 
    </para>
 
+   <programlisting>
+   </programlisting>
+
    <programlisting>
       opt = Environment(CCFLAGS = '-O2')
       dbg = Environment(CCFLAGS = '-g')
@@ -561,7 +551,7 @@ environment undisturbed.
    Notice that each call to the &Object; builder
    returns a value,
    an internal &SCons; object that
-   represents the file that will be built.
+   represents the object file that will be built.
    We then use that object
    as input to the &Program; builder.
    This avoids having to specify explicitly
@@ -573,10 +563,10 @@ environment undisturbed.
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      cc -c -g foo.c -o foo-dbg.o
+      % <userinput>scons -Q</userinput>
+      cc -g -c -o foo-dbg.o foo.c
       cc -o foo-dbg foo-dbg.o
-      cc -c -O2 foo.c -o foo-opt.o
+      cc -O2 -c -o foo-opt.o foo.c
       cc -o foo-opt foo-opt.o
    </literallayout>
 
@@ -608,7 +598,7 @@ environment undisturbed.
    that sets &CC; to &gcc;,
    and then creating two copies,
    one which sets &CCFLAGS; for optimization
-   and the other with sets &CCFLAGS; for debugging:
+   and the other which sets &CCFLAGS; for debugging:
 
    </para>
 
@@ -617,7 +607,7 @@ environment undisturbed.
       opt = env.Copy(CCFLAGS = '-O2')
       dbg = env.Copy(CCFLAGS = '-g')
 
-      e = opt.Object('foo', 'foo.c')
+      env.Program('foo', 'foo.c')
 
       o = opt.Object('foo-opt', 'foo.c')
       opt.Program(o)
@@ -633,12 +623,12 @@ environment undisturbed.
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      gcc -c foo.c -o foo.o
+      % <userinput>scons -Q</userinput>
+      gcc -c -o foo.o foo.c
       gcc -o foo foo.o
-      gcc -c -g foo.c -o foo-dbg.o
+      gcc -g -c -o foo-dbg.o foo.c
       gcc -o foo-dbg foo-dbg.o
-      gcc -c -O2 foo.c -o foo-opt.o
+      gcc -O2 -c -o foo-opt.o foo.c
       gcc -o foo-opt foo-opt.o
    </literallayout>
 
@@ -669,8 +659,9 @@ environment undisturbed.
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
+      % <userinput>scons -Q</userinput>
       CC is: cc
+      scons: `.' is up to date.
    </literallayout>
 
    <para>
@@ -687,21 +678,38 @@ environment undisturbed.
    <programlisting>
       env = Environment(FOO = 'foo', BAR = 'bar')
       dict = env.Dictionary()
-      for key, value in dict.items():
-          print "key = %s, value = %s % (key, value)
+      for key in ['OBJSUFFIX', 'LIBSUFFIX', 'PROGSUFFIX']:
+          print "key = %s, value = %s" % (key, dict[key])
    </programlisting>
 
    <para>
 
    This &SConstruct; file
-   will print the dictionary items for us as follows:
+   will print the specified dictionary items for us on POSIX
+   systems as follows:
+
+   </para>
+
+   <literallayout>
+      % <userinput>scons -Q</userinput>
+      key = OBJSUFFIX, value = .o
+      key = LIBSUFFIX, value = .a
+      key = PROGSUFFIX, value = 
+      scons: `.' is up to date.
+   </literallayout>
+
+   <para>
+
+   And on Win32:
 
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      key = FOO, value = foo
-      key = BAR, value = bar
+      C:\><userinput>scons -Q</userinput>
+      key = OBJSUFFIX, value = .obj
+      key = LIBSUFFIX, value = .lib
+      key = PROGSUFFIX, value = .exe
+      scons: `.' is up to date.
    </literallayout>
 
  </section>
@@ -727,7 +735,7 @@ environment undisturbed.
      </para>
 
      <programlisting>
-        env = Environment(CCFLAGS = '-DDEFINE1)
+        env = Environment(CCFLAGS = '-DDEFINE1')
         env.Program('foo.c')
         env.Replace(CCFLAGS = '-DDEFINE2')
         env.Program('bar.c')
@@ -740,11 +748,11 @@ environment undisturbed.
      </para>
 
      <literallayout>
-        % <userinput>scons</userinput>
-        gcc -DDEFINE2 -c bar.c -o bar.o
-        gcc -o bar bar.o
-        gcc -DDEFINE2 -c foo.c -o foo.o
-        gcc -o foo foo.o
+        % <userinput>scons -Q</userinput>
+        cc -DDEFINE2 -c -o bar.o bar.c
+        cc -o bar bar.o
+        cc -DDEFINE1 -c -o foo.o foo.c
+        cc -o foo foo.o
      </literallayout>
 
    </section>
@@ -767,9 +775,9 @@ environment undisturbed.
      </programlisting>
 
      <literallayout>
-        % <userinput>scons</userinput>
-        gcc -DMY_VALUE -DLAST -c foo.c -o foo.o
-        gcc -o foo foo.o
+        % <userinput>scons -Q</userinput>
+        cc -DMY_VALUE -DLAST -c -o foo.o foo.c
+        cc -o foo foo.o
      </literallayout>
 
    </section>
@@ -792,9 +800,9 @@ environment undisturbed.
      </programlisting>
 
      <literallayout>
-        % <userinput>scons</userinput>
-        gcc -DFIRST -DMY_VALUE -c foo.c -o foo.o
-        gcc -o foo foo.o
+        % <userinput>scons -Q</userinput>
+        cc -DFIRST -DMY_VALUE -c -o foo.o foo.c
+        cc -o foo foo.o
      </literallayout>
 
    </section>
index 96e775b58e18eed82a86852215e025c8d9f66776..087f3bfd215dd4c4628954684dc6f0882e465571 100644 (file)
    It's often very useful to be able to give
    users some help that describes the
    specific targets, build options, etc.,
-   that can be used for the build.
+   that can be used for your build.
    &SCons; provides the &Help; function
    to allow you to specify this help text:
 
    </para>
 
    <scons_example name="ex1">
-      <file name="SConstruct">
+      <file name="SConstruct" printme="1">
       Help("""
       Type: 'scons program' to build the production program,
             'scons debug' to build the debug version.
index 233809e7a988762df1bf8762b99d444906d583bb..72e09aa4783e013c42bf4509c3eb5e2a99cbe10b 100644 (file)
@@ -28,7 +28,7 @@
    It's often very useful to be able to give
    users some help that describes the
    specific targets, build options, etc.,
-   that can be used for the build.
+   that can be used for your build.
    &SCons; provides the &Help; function
    to allow you to specify this help text:
 
 
    <literallayout>
       % <userinput>scons -h</userinput>
+      scons: Reading SConscript files ...
+      scons: done reading SConscript files.
+      
       Type: 'scons program' to build the production program,
             'scons debug' to build the debug version.
+      
+      Use scons -H for help about command-line options.
    </literallayout>
 
    <para>
index a263f658b3b3be168d9cae7080b2ed4962e222c1..370ca9f50d920640f25a93a494d0584868b8866d 100644 (file)
@@ -62,8 +62,8 @@
   </para>
 
   <scons_output example="ex1">
-     <command>scons</command>
-     <command>scons __ROOT__/usr/bin</command>
+     <command>scons -Q</command>
+     <command>scons -Q __ROOT__/usr/bin</command>
   </scons_output>
 
   <para>
 
   </para>
 
-  <scons_output example="ex1">
-     <command>scons</command>
-     <command>scons install</command>
+  <scons_output example="ex2">
+     <command>scons -Q</command>
+     <command>scons -Q install</command>
   </scons_output>
 
   <section>
       <file name="hello.c">
       int main() { printf("Hello, world!\n"); }
       </file>
+      <file name="goodbye.c">
+      int main() { printf("Goodbye, world!\n"); }
+      </file>
     </scons_example>
 
     <para>
     </para>
 
     <scons_output example="ex3">
-       <command>scons install</command>
+       <command>scons -Q install</command>
     </scons_output>
 
   </section>
     </para>
 
     <scons_output example="ex4">
-       <command>scons install</command>
+       <command>scons -Q install</command>
     </scons_output>
 
   </section>
        env.InstallAs(['__ROOT__/usr/bin/hello-new',
                       '__ROOT__/usr/bin/goodbye-new'],
                      [hello, goodbye])
+       env.Alias('install', '__ROOT__/usr/bin')
       </file>
       <file name="hello.c">
       int main() { printf("Hello, world!\n"); }
       </file>
+      <file name="goodbye.c">
+      int main() { printf("Goodbye, world!\n"); }
+      </file>
     </scons_example>
 
     <para>
     </para>
 
     <scons_output example="ex5">
-       <command>scons install</command>
+       <command>scons -Q install</command>
     </scons_output>
 
   </section>
index 7f522e568a07219111a1d99937ee24b573da913b..b7555b7b6dccf7ca0d00ec638185920c7c543af9 100644 (file)
   </para>
 
   <literallayout>
-     % <userinput>scons</userinput>
-     cc -c hello.c -o hello.o
+     % <userinput>scons -Q</userinput>
+     cc -c -o hello.o hello.c
      cc -o hello hello.o
-     % <userinput>scons /usr/bin</userinput>
+     % <userinput>scons -Q /usr/bin</userinput>
      Install file: "hello" as "/usr/bin/hello"
   </literallayout>
 
   </para>
 
   <literallayout>
-     % <userinput>scons install</userinput>
+     % <userinput>scons -Q</userinput>
+     cc -c -o hello.o hello.c
+     cc -o hello hello.o
+     % <userinput>scons -Q install</userinput>
      Install file: "hello" as "/usr/bin/hello"
   </literallayout>
 
        hello = env.Program('hello.c')
        goodbye = env.Program('goodbye.c')
        env.Install('/usr/bin', hello)
-       env.Install('/usr/bin', goodbye])
+       env.Install('/usr/bin', goodbye)
        env.Alias('install', '/usr/bin')
     </programlisting>
 
     </para>
 
     <literallayout>
-       % <userinput>scons install</userinput>
-       cc -c goodbye.c -o goodbye.o
+       % <userinput>scons -Q install</userinput>
+       cc -c -o goodbye.o goodbye.c
        cc -o goodbye goodbye.o
-       cc -c hello.c -o hello.o
-       cc -o hello hello.o
        Install file: "goodbye" as "/usr/bin/goodbye"
+       cc -c -o hello.o hello.c
+       cc -o hello hello.o
        Install file: "hello" as "/usr/bin/hello"
     </literallayout>
 
     </para>
 
     <literallayout>
-       % <userinput>scons install</userinput>
-       cc -c hello.c -o hello.o
+       % <userinput>scons -Q install</userinput>
+       cc -c -o hello.o hello.c
        cc -o hello hello.o
        Install file: "hello" as "/usr/bin/hello-new"
     </literallayout>
        hello = env.Program('hello.c')
        goodbye = env.Program('goodbye.c')
        env.InstallAs(['/usr/bin/hello-new',
-                      '/usr/bin/goodbye-new',
+                      '/usr/bin/goodbye-new'],
                      [hello, goodbye])
+       env.Alias('install', '/usr/bin')
     </programlisting>
 
     <para>
     </para>
 
     <literallayout>
-       % <userinput>scons install</userinput>
-       cc -c goodbye.c -o goodbye.o
+       % <userinput>scons -Q install</userinput>
+       cc -c -o goodbye.o goodbye.c
        cc -o goodbye goodbye.o
-       cc -c hello.c -o hello.o
-       cc -o hello hello.o
        Install file: "goodbye" as "/usr/bin/goodbye-new"
+       cc -c -o hello.o hello.c
+       cc -o hello hello.o
        Install file: "hello" as "/usr/bin/hello-new"
     </literallayout>
 
index 337b0daa50467a684c30db5cecf3e446d0441c6b..a69bbeeb7f96c9efa33bd031c55336fd3dbff2e8 100644 (file)
@@ -43,8 +43,7 @@
 
     <scons_example name="ex1" printme="1">
       <file name="SConstruct" printme="1">
-      env = Environment()
-      env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
+      Library('foo', ['f1.c', 'f2.c', 'f3.c'])
       </file>
       <file name="hello.c">
       int main() { printf("Hello, world!\n"); }
@@ -69,8 +68,8 @@
 
     </para>
 
-    <scons_output example="ex1">
-      <command>scons</command>
+    <scons_output example="ex1" os="posix">
+      <command>scons -Q</command>
     </scons_output>
 
     <para>
@@ -80,8 +79,8 @@
 
     </para>
 
-    <scons_output example="ex1">
-      <command>scons</command>
+    <scons_output example="ex1" os="win32">
+      <command>scons -Q</command>
     </scons_output>
 
     <para>
     and by specifying the directory in which
     the library will be found in the 
     &LIBPATH; construction variable:
+      env = Environment(LIBS = 'foo', LIBPATH = '.')
 
     </para>
 
     <scons_example name="ex2">
-      <file name="SConstruct">
-      env = Environment(LIBS = 'foo', LIBPATH = '.')
-      env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
-      env.Program('prog.c')
+      <file name="SConstruct" printme="1">
+      Library('foo', ['f1.c', 'f2.c', 'f3.c'])
+      Program('prog.c', LIBS='foo', LIBPATH='.')
       </file>
       <file name="f1.c">
       int main() { printf("Hello, world!\n"); }
 
     </para>
 
-    <scons_output example="ex2">
-      <command>scons</command>
+    <scons_output example="ex2" os="posix">
+      <command>scons -Q</command>
     </scons_output>
 
     <para>
     </para>
 
     <scons_output example="ex2" os="win32">
-      <command>scons</command>
+      <command>scons -Q</command>
     </scons_output>
 
     <para>
 
     <scons_example name="ex3">
       <file name="SConstruct" printme="1">
-      env = Environment(LIBS = 'm',
+      Program('prog.c', LIBS = 'm',
                         LIBPATH = ['/usr/lib', '/usr/local/lib'])
-      env.Program('prog.c')
       </file>
       <file name="prog.c">
       int main() { printf("prog.c\n"); }
 
     </para>
 
-    <scons_output example="ex3">
-      <command>scons</command>
+    <scons_output example="ex3" os="posix">
+      <command>scons -Q</command>
     </scons_output>
 
     <para>
     </para>
 
     <scons_output example="ex3" os="win32">
-      <command>scons</command>
+      <command>scons -Q</command>
     </scons_output>
 
     <para>
index 6fc6c5d6637a015a4eeeb0cc64af3edf0e505895..118a5608568b8f0e9cea10893aa5023fb652b76c 100644 (file)
@@ -42,8 +42,7 @@
     </para>
 
     <programlisting>
-      env = Environment()
-      env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
+      Library('foo', ['f1.c', 'f2.c', 'f3.c'])
     </programlisting>
 
     <para>
     &SCons; uses the appropriate library prefix and suffix for your system.
     So on POSIX or Linux systems,
     the above example would build as follows
-    (although &ranlib may not be called on all systems):
+    (although &ranlib; may not be called on all systems):
 
     </para>
 
     <literallayout>
-      % <userinput>scons</userinput>
-      cc -c f1.c -o f1.o
-      cc -c f2.c -o f2.o
-      cc -c f3.c -o f3.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o f1.o f1.c
+      cc -c -o f2.o f2.c
+      cc -c -o f3.o f3.c
       ar r libfoo.a f1.o f2.o f3.o
       ranlib libfoo.a
     </literallayout>
     </para>
 
     <literallayout>
-      C:\><userinput>scons</userinput>
-      cl /Fof1.obj f1.c
-      cl /Fof2.obj f2.c
-      cl /Fof3.obj f3.c
+      C:\><userinput>scons -Q</userinput>
+      cl /nologo /c f1.c /Fof1.obj
+      cl /nologo /c f2.c /Fof2.obj
+      cl /nologo /c f3.c /Fof3.obj
       lib /nologo /OUT:foo.lib f1.obj f2.obj f3.obj
     </literallayout>
 
     and by specifying the directory in which
     the library will be found in the 
     &LIBPATH; construction variable:
+      env = Environment(LIBS = 'foo', LIBPATH = '.')
 
     </para>
 
     <programlisting>
-      env = Environment(LIBS = 'foo', LIBPATH = '.')
-      env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
-      env.Program('prog.c')
+      Library('foo', ['f1.c', 'f2.c', 'f3.c'])
+      Program('prog.c', LIBS='foo', LIBPATH='.')
     </programlisting>
 
     <para>
     </para>
 
     <literallayout>
-      % <userinput>scons</userinput>
-      cc -c f1.c -o f1.o
-      cc -c f2.c -o f2.o
-      cc -c f3.c -o f3.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o f1.o f1.c
+      cc -c -o f2.o f2.c
+      cc -c -o f3.o f3.c
       ar r libfoo.a f1.o f2.o f3.o
       ranlib libfoo.a
-      cc -c prog.c -o prog.o
-      cc -o prog -L. -lfoo prog.o
+      cc -c -o prog.o prog.c
+      cc -o prog prog.o -L. -lfoo
     </literallayout>
 
     <para>
     </para>
 
     <literallayout>
-      C:\><userinput>scons</userinput>
-      cl /Fof1.obj f1.c
-      cl /Fof2.obj f2.c
-      cl /Fof3.obj f3.c
+      C:\><userinput>scons -Q</userinput>
+      cl /nologo /c f1.c /Fof1.obj
+      cl /nologo /c f2.c /Fof2.obj
+      cl /nologo /c f3.c /Fof3.obj
       lib /nologo /OUT:foo.lib f1.obj f2.obj f3.obj
-      cl /Foprog.obj prog.c
-      link /OUT:prog.exe /LIBPATH:. foo.lib prog.obj
+      cl /nologo /c prog.c /Foprog.obj
+      link /nologo /OUT:prog.exe /LIBPATH:. foo.lib prog.obj
     </literallayout>
 
     <para>
     </para>
 
     <programlisting>
-      env = Environment(LIBS = 'm',
+      Program('prog.c', LIBS = 'm',
                         LIBPATH = ['/usr/lib', '/usr/local/lib'])
-      env.Program('prog.c')
     </programlisting>
 
     <para>
     </para>
 
     <literallayout>
-      % <userinput>scons</userinput>
-      cc -c prog.c -o prog.o
-      cc -o prog -L/usr/lib -L/usr/local/lib -lm prog.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o prog.o prog.c
+      cc -o prog prog.o -L/usr/lib -L/usr/local/lib -lm
     </literallayout>
 
     <para>
     </para>
 
     <literallayout>
-      C:\><userinput>scons</userinput>
-      cl /Foprog.obj prog.c
-      link /nologo /OUT:program.exe /LIBPATH:\usr\lib;\usr\local\lib m.lib prog.obj
+      C:\><userinput>scons -Q</userinput>
+      cl /nologo /c prog.c /Foprog.obj
+      link /nologo /OUT:prog.exe /LIBPATH:\usr\lib /LIBPATH:\usr\local\lib m.lib prog.obj
     </literallayout>
 
     <para>
index 2be22eca1e8dd6cf1a42b9f0aeebc153a7ee7180..95a2c56aa7f53784f63469710beb4e035e3b1ed8 100644 (file)
@@ -55,8 +55,7 @@ which the C<AfterBuild> method is called.
 
  <scons_example name="ex1">
    <file name="SConstruct" printme="1">
-    env = Environment(XXX NEED LIBRARY FLAGS
-                      LIBFLAGS = '-r')
+    env = Environment()
     lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
     env.Precious(lib)
    </file>
@@ -73,17 +72,19 @@ which the C<AfterBuild> method is called.
 
  <para>
 
- XXX:
+ Although the output doesn't look any different,
+ &SCons; does not, in fact,
+ delete the target library before rebuilding it:
 
  </para>
 
  <scons_output example="ex1">
-    <command>scons</command>
+    <command>scons -Q</command>
  </scons_output>
 
  <para>
 
- &SCons; will still delete files marked as &Precious;
+ &SCons; will, however, still delete files marked as &Precious;
  when the <literal>-c</literal> option is used.
 
  </para>
index 26ad34510c664d1b4827f95cb994417c9b7de04a..4453d4b701d6210416f2255edb3b450f39babb7a 100644 (file)
@@ -54,26 +54,31 @@ which the C<AfterBuild> method is called.
  </para>
 
  <programlisting>
-    env = Environment(XXX NEED LIBRARY FLAGS
-                      LIBFLAGS = '-r')
+    env = Environment()
     lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c'])
     env.Precious(lib)
  </programlisting>
 
  <para>
 
- XXX:
+ Although the output doesn't look any different,
+ &SCons; does not, in fact,
+ delete the target library before rebuilding it:
 
  </para>
 
  <literallayout>
-    % <userinput>scons</userinput>
-    XXX ANY INPUT HERE?
+    % <userinput>scons -Q</userinput>
+    cc -c -o f1.o f1.c
+    cc -c -o f2.o f2.c
+    cc -c -o f3.o f3.c
+    ar r libfoo.a f1.o f2.o f3.o
+    ranlib libfoo.a
  </literallayout>
 
  <para>
 
- &SCons; will still delete files marked as &Precious;
+ &SCons; will, however, still delete files marked as &Precious;
  when the <literal>-c</literal> option is used.
 
  </para>
index 83ca3d2d27bff9b626c7a69b3c6ad50f674e8116..d8e19f87c762dd38076123ca6d5f3ca17373b961 100644 (file)
@@ -315,6 +315,28 @@ do an unconstrained build before committing the integration).
 
   </para>
 
+  <section>
+  <title>Command-Line Options</title>
+
+    <para>
+
+    XXX
+
+    </para>
+
+  </section>
+
+  <section>
+  <title>Getting at Command-Line Arguments</title>
+
+    <para>
+
+    XXX
+
+    </para>
+
+  </section>
+
   <section>
   <title>Selective Builds</title>
 
@@ -357,7 +379,37 @@ do an unconstrained build before committing the integration).
 
     <para>
 
-    XXX
+    Users may find themselves supplying
+    the same command-line options every time
+    they run &SCons;.
+    For example, a user might find that it saves time
+    to always specify a value of <literal>-j 2</literal>
+    to run the builds in parallel.
+
+    </para>
+
+    <scons_example name="SCONSFLAGS">
+      <file name="SConstruct">
+      def b(target, source, env):
+          pass
+      def s(target, source, env):
+          return "    ..."
+      a = Action(b, strfunction = s)
+      env = Environment(BUILDERS = {'A' : a})
+      env.A('foo.out', 'foo.in')
+      </file>
+      <file name="foo.in">
+      foo.in
+      </file>
+    </scons_example>
+
+    <scons_output example="SCONSFLAGS">
+      <command>scons</command>
+      <command>export SCONSFLAGS="-Q"</command>
+      <command>scons</command>
+    </scons_output>
+
+    <para>
 
     </para>
 
index 83ca3d2d27bff9b626c7a69b3c6ad50f674e8116..9cdb07cb66b81ba4d519be43ceec6919a298369f 100644 (file)
@@ -315,6 +315,28 @@ do an unconstrained build before committing the integration).
 
   </para>
 
+  <section>
+  <title>Command-Line Options</title>
+
+    <para>
+
+    XXX
+
+    </para>
+
+  </section>
+
+  <section>
+  <title>Getting at Command-Line Arguments</title>
+
+    <para>
+
+    XXX
+
+    </para>
+
+  </section>
+
   <section>
   <title>Selective Builds</title>
 
@@ -357,7 +379,36 @@ do an unconstrained build before committing the integration).
 
     <para>
 
-    XXX
+    Users may find themselves supplying
+    the same command-line options every time
+    they run &SCons;.
+    For example, a user might find that it saves time
+    to always specify a value of <literal>-j 2</literal>
+    to run the builds in parallel.
+
+    </para>
+
+    
+
+    <literallayout>
+      % <userinput>scons</userinput>
+      scons: Reading SConscript files ...
+          ...
+      scons: done reading SConscript files.
+      scons: Building targets ...
+      scons: `.' is up to date.
+      scons: done building targets.
+      % <userinput>export SCONSFLAGS="-Q"</userinput>
+      % <userinput>scons</userinput>
+      scons: Reading SConscript files ...
+          ...
+      scons: done reading SConscript files.
+      scons: Building targets ...
+      scons: `.' is up to date.
+      scons: done building targets.
+    </literallayout>
+
+    <para>
 
     </para>
 
index df82ea2e9c4f62ea7d090b10c184217c4b486a54..3940bc336d5f3fb77be36d4e349a0c62ac920daf 100644 (file)
@@ -46,8 +46,7 @@
 
  <scons_example name="ex1">
     <file name="SConstruct" printme="1">
-    env = Environment()
-    env.Program('hello.c')
+    Program('hello.c')
     </file>
     <file name="hello.c">
     int main() { printf("Hello, world!\n"); }
    </para>
 
    <programlisting>
-      env = Environment()    # Create an environment.
       # Arrange to build the "hello" program.
-      env.Program('hello.c')
+      Program('hello.c')    # "hello.c" is the source file.
    </programlisting>
 
    <para>
 
  </section>
 
+ <section>
+ <title>Making the Output Less Verbose</title>
+
+   <para>
+
+   You've already seen how &SCons; prints
+   some messages about what it's doing,
+   surrounding the actual commands used to build the software:
+
+   </para>
+
+   <scons_output example="ex1" os="win32">
+      <command>scons</command>
+   </scons_output>
+
+   <para>
+
+   These messages emphasize the
+   order in which &SCons; does its work:
+   the configuration files
+   (generically referred to as &SConscript; files)
+   are read and executed first,
+   and only then are the target files built.
+   Among other benefits, these messages help to distinguish between
+   errors that occur while the configuration files are read,
+   and errors that occur while targets are being built.
+
+   </para>
+
+   <para>
+
+   The drawback, of course, is that these messages clutter the output.
+   Fortunately, they're easily disabled by using
+   the &Q; option when invoking &SCons;:
+
+   </para>
+
+   <scons_output example="ex1" os="win32">
+      <command>scons -Q</command>
+   </scons_output>
+
+   <para>
+
+   Because we want this User's Guide to focus
+   on what &SCons; is actually doing,
+   we're going use the &Q; option
+   to remove these messages from the
+   output of all the remaining examples in this Guide.
+
+   </para>
+
+ </section>
+
  <section>
  <title>Compiling Multiple Source Files</title>
 
 
    <scons_example name="ex2">
       <file name="SConstruct" printme="1">
-      env = Environment()
-      env.Program(['prog.c', 'file1.c', 'file2.c'])
+      Program(['prog.c', 'file1.c', 'file2.c'])
       </file>
       <file name="prog.c">
       int main() { printf("prog.c\n"); }
    </para>
 
    <scons_output example="ex2">
-      <command>scons</command>
+      <command>scons -Q</command>
    </scons_output>
 
    <para>
 
    <scons_example name="ex3">
       <file name="SConstruct" printme="1">
-      env = Environment()
-      env.Program('program', ['main.c', 'file1.c', 'file2.c'])
+      Program('program', ['main.c', 'file1.c', 'file2.c'])
       </file>
       <file name="main.c">
       int main() { printf("prog.c\n"); }
    </para>
 
    <scons_output example="ex3" os="posix">
-      <command>scons</command>
+      <command>scons -Q</command>
    </scons_output>
 
    <para>
    </para>
 
    <scons_output example="ex3" os="win32">
-      <command>scons</command>
+      <command>scons -Q</command>
    </scons_output>
 
  </section>
    </para>
 
    <programlisting>
-      env = Environment()
-      env.Program('program', Split('main.c file1.c file2.'))
+      Program('program', Split('main.c file1.c file2.'))
    </programlisting>
 
    <para>
 
+   (If you're already familiar with Python,
+   you'll have realized that this is similar to the
+   <function>split()</function> method
+   in the Python standard <function>string</function> module.
+   Unlike the <function>string.split()</function> method,
+   however, the &Split; function
+   does not require a string as input
+   and will wrap up a single non-string object in a list,
+   or return its argument untouched if it's already a list.
+   This comes in handy as a way to make sure
+   arbitrary values can be passed to &SCons; functions
+   without having to check the type of the variable by hand.)
+
+   </para>
+
+   <para>
+
    Putting the call to the &Split; function
-   inside the <function>env.Program</function> call
+   inside the <function>Program</function> call
    can also be a little unwieldy.
    A more readable alternative is to
    assign the output from the &Split; call
    to a variable name,
    and then use the variable when calling the
-   <function>env.Program</function> function:
+   <function>Program</function> function:
 
    </para>
 
    <programlisting>
-      env = Environment()
       list = Split('main.c file1.c file2.')
-      env.Program('program', list)
+      Program('program', list)
    </programlisting>
 
    <para>
    </para>
 
    <programlisting>
-      env = Environment()
       list = Split('main.c
                     file1.c
                     file2.c')
-      env.Program('program', list)
+      Program('program', list)
    </programlisting>
 
  </section>
    </para>
 
    <programlisting>
-      env = Environment()
       list = Split('main.c file1.c file2.')
-      env.Program(target = 'program', source = list)
+      Program(target = 'program', source = list)
+   </programlisting>
+
+   <para>
+
+   Because the keywords explicitly identify
+   what each argument is,
+   you can actually reverse the order if you prefer:
+
+   </para>
+
+   <programlisting>
+      list = Split('main.c file1.c file2.')
+      Program(source = list, target = 'program')
    </programlisting>
 
    <para>
 
    Whether or not you choose to use keyword arguments
-   to identify the target and source files
-   is purely a personal choice;
-   &SCons; functions the same either way.
+   to identify the target and source files,
+   and the order in which you specify them
+   when using keywords,
+   are purely personal choices;
+   &SCons; functions the same regardless.
 
    </para>
 
 
    In order to compile multiple programs
    within the same &SConstruct; file,
-   simply call the <function>env.Program</function> method
+   simply call the <function>Program</function> method
    multiple times,
    once for each program you need to build:
 
 
    <scons_example name="ex4">
       <file name="SConstruct" printme="1">
-      env = Environment()
-      env.Program('foo.c')
-      env.Program('bar', ['bar1.c', 'bar2.c'])
+      Program('foo.c')
+      Program('bar', ['bar1.c', 'bar2.c'])
       </file>
       <file name="foo.c">
       int main() { printf("foo.c\n"); }
    </para>
 
    <scons_output example="ex4">
-      <command>scons</command>
+      <command>scons -Q</command>
    </scons_output>
 
    <para>
 
    <scons_example name="ex5">
       <file name="SConstruct" printme="1">
-      env = Environment()
-      env.Program(Split('foo.c common1.c common2.c'))
-      env.Program('bar', Split('bar1.c bar2.c common1.c common2.c'))
+      Program(Split('foo.c common1.c common2.c'))
+      Program('bar', Split('bar1.c bar2.c common1.c common2.c'))
       </file>
       <file name="foo.c">
       int main() { printf("foo.c\n"); }
    &SCons; recognizes that the object files for
    the &common1_c; and &common2_c; source files
    each only need to be built once,
-   even though the files are listed multiple times:
+   even though the resulting object files are
+   each linked in to both of the resulting executable programs:
 
    </para>
 
    <scons_output example="ex5">
-      <command>scons</command>
+      <command>scons -Q</command>
    </scons_output>
 
    <para>
       common = ['common1.c', 'common2.c']
       foo_files = ['foo.c'] + common
       bar_files = ['bar1.c', 'bar2.c'] + common
-      env = Environment()
-      env.Program('foo', foo_files)
-      env.Program('bar', bar_files)
+      Program('foo', foo_files)
+      Program('bar', bar_files)
    </programlisting>
 
    <para>
index d97badc085f376684375551b65b742ae91cfd37b..02a57ef6e24f2c752464a80fd4ac09a119c28e79 100644 (file)
@@ -45,8 +45,7 @@
  </para>
 
  <programlisting>
-    env = Environment()
-    env.Program('hello.c')
+    Program('hello.c')
  </programlisting>
 
  <para>
 
  <literallayout>
     % <userinput>scons</userinput>
-    cc -c hello.c -o hello.o
+    scons: Reading SConscript files ...
+    scons: done reading SConscript files.
+    scons: Building targets ...
+    cc -c -o hello.o hello.c
     cc -o hello hello.o
+    scons: done building targets.
  </literallayout>
 
  <para>
 
  <literallayout>
     C:\><userinput>scons</userinput>
-    cl /Fohello.obj hello.c
-    link /Fohello.exe hello.obj
+    scons: Reading SConscript files ...
+    scons: done reading SConscript files.
+    scons: Building targets ...
+    cl /nologo /c hello.c /Fohello.obj
+    link /nologo /OUT:hello.exe hello.obj
+    scons: done building targets.
  </literallayout>
 
  <para>
    </para>
 
    <programlisting>
-      env = Environment()    # Create an environment.
       # Arrange to build the "hello" program.
-      env.Program('hello.c')
+      Program('hello.c')    # "hello.c" is the source file.
    </programlisting>
 
    <para>
 
  </section>
 
+ <section>
+ <title>Making the Output Less Verbose</title>
+
+   <para>
+
+   You've already seen how &SCons; prints
+   some messages about what it's doing,
+   surrounding the actual commands used to build the software:
+
+   </para>
+
+   <literallayout>
+      C:\><userinput>scons</userinput>
+      scons: Reading SConscript files ...
+      scons: done reading SConscript files.
+      scons: Building targets ...
+      cl /nologo /c hello.c /Fohello.obj
+      link /nologo /OUT:hello.exe hello.obj
+      scons: done building targets.
+   </literallayout>
+
+   <para>
+
+   These messages emphasize the
+   order in which &SCons; does its work:
+   the configuration files
+   (generically referred to as &SConscript; files)
+   are read and executed first,
+   and only then are the target files built.
+   Among other benefits, these messages help to distinguish between
+   errors that occur while the configuration files are read,
+   and errors that occur while targets are being built.
+
+   </para>
+
+   <para>
+
+   The drawback, of course, is that these messages clutter the output.
+   Fortunately, they're easily disabled by using
+   the &Q; option when invoking &SCons;:
+
+   </para>
+
+   <literallayout>
+      C:\><userinput>scons -Q</userinput>
+      cl /nologo /c hello.c /Fohello.obj
+      link /nologo /OUT:hello.exe hello.obj
+   </literallayout>
+
+   <para>
+
+   Because we want this User's Guide to focus
+   on what &SCons; is actually doing,
+   we're going use the &Q; option
+   to remove these messages from the
+   output of all the remaining examples in this Guide.
+
+   </para>
+
+ </section>
+
  <section>
  <title>Compiling Multiple Source Files</title>
 
    </para>
 
    <programlisting>
-      env = Environment()
-      env.Program(['prog.c', 'file1.c', 'file2.'])
+      Program(['prog.c', 'file1.c', 'file2.c'])
    </programlisting>
 
    <para>
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      cc -c file1.c -o file1.o
-      cc -c file2.c -o file2.o
-      cc -c prog.c -o prog.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o file1.o file1.c
+      cc -c -o file2.o file2.c
+      cc -c -o prog.o prog.c
       cc -o prog prog.o file1.o file2.o
    </literallayout>
 
    </para>
 
    <programlisting>
-      env = Environment()
-      env.Program('program', ['main.c', 'file1.c', 'file2.'])
+      Program('program', ['main.c', 'file1.c', 'file2.c'])
    </programlisting>
 
    <para>
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      cc -c file1.c -o file1.o
-      cc -c file2.c -o file2.o
-      cc -c main.c -o main.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o file1.o file1.c
+      cc -c -o file2.o file2.c
+      cc -c -o main.o main.c
       cc -o program main.o file1.o file2.o
    </literallayout>
 
    </para>
 
    <literallayout>
-      C:\><userinput>scons</userinput>
-      cl /Fofile1.obj file1.c
-      cl /Fofile2.obj file2.c
-      cl /Fomain.obj main.c
-      link /Foprogram.exe main.obj file1.obj file2.obj
+      C:\><userinput>scons -Q</userinput>
+      cl /nologo /c file1.c /Fofile1.obj
+      cl /nologo /c file2.c /Fofile2.obj
+      cl /nologo /c main.c /Fomain.obj
+      link /nologo /OUT:program.exe main.obj file1.obj file2.obj
    </literallayout>
 
  </section>
    </para>
 
    <programlisting>
-      env = Environment()
-      env.Program('program', Split('main.c file1.c file2.'))
+      Program('program', Split('main.c file1.c file2.'))
    </programlisting>
 
    <para>
 
+   (If you're already familiar with Python,
+   you'll have realized that this is similar to the
+   <function>split()</function> method
+   in the Python standard <function>string</function> module.
+   Unlike the <function>string.split()</function> method,
+   however, the &Split; function
+   does not require a string as input
+   and will wrap up a single non-string object in a list,
+   or return its argument untouched if it's already a list.
+   This comes in handy as a way to make sure
+   arbitrary values can be passed to &SCons; functions
+   without having to check the type of the variable by hand.)
+
+   </para>
+
+   <para>
+
    Putting the call to the &Split; function
-   inside the <function>env.Program</function> call
+   inside the <function>Program</function> call
    can also be a little unwieldy.
    A more readable alternative is to
    assign the output from the &Split; call
    to a variable name,
    and then use the variable when calling the
-   <function>env.Program</function> function:
+   <function>Program</function> function:
 
    </para>
 
    <programlisting>
-      env = Environment()
       list = Split('main.c file1.c file2.')
-      env.Program('program', list)
+      Program('program', list)
    </programlisting>
 
    <para>
    </para>
 
    <programlisting>
-      env = Environment()
       list = Split('main.c
                     file1.c
                     file2.c')
-      env.Program('program', list)
+      Program('program', list)
    </programlisting>
 
  </section>
    </para>
 
    <programlisting>
-      env = Environment()
       list = Split('main.c file1.c file2.')
-      env.Program(target = 'program', source = list)
+      Program(target = 'program', source = list)
+   </programlisting>
+
+   <para>
+
+   Because the keywords explicitly identify
+   what each argument is,
+   you can actually reverse the order if you prefer:
+
+   </para>
+
+   <programlisting>
+      list = Split('main.c file1.c file2.')
+      Program(source = list, target = 'program')
    </programlisting>
 
    <para>
 
    Whether or not you choose to use keyword arguments
-   to identify the target and source files
-   is purely a personal choice;
-   &SCons; functions the same either way.
+   to identify the target and source files,
+   and the order in which you specify them
+   when using keywords,
+   are purely personal choices;
+   &SCons; functions the same regardless.
 
    </para>
 
 
    In order to compile multiple programs
    within the same &SConstruct; file,
-   simply call the <function>env.Program</function> method
+   simply call the <function>Program</function> method
    multiple times,
    once for each program you need to build:
 
    </para>
 
    <programlisting>
-      env = Environment()
-      env.Program('foo.c')
-      env.Program('bar', ['bar1.c', 'bar2.c'])
+      Program('foo.c')
+      Program('bar', ['bar1.c', 'bar2.c'])
    </programlisting>
 
    <para>
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      cc -c bar1.c -o bar1.o
-      cc -c bar2.c -o bar2.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o bar1.o bar1.c
+      cc -c -o bar2.o bar2.c
       cc -o bar bar1.o bar2.o
-      cc -c foo.c -o foo.o
+      cc -c -o foo.o foo.c
       cc -o foo foo.o
    </literallayout>
 
    </para>
 
    <programlisting>
-      env = Environment()
-      env.Program(Split('foo.c common1.c common2.c'))
-      env.Program('bar', Split('bar1.c bar2.c common1.c common2.c'))
+      Program(Split('foo.c common1.c common2.c'))
+      Program('bar', Split('bar1.c bar2.c common1.c common2.c'))
    </programlisting>
 
    <para>
    &SCons; recognizes that the object files for
    the &common1_c; and &common2_c; source files
    each only need to be built once,
-   even though the files are listed multiple times:
+   even though the resulting object files are
+   each linked in to both of the resulting executable programs:
 
    </para>
 
    <literallayout>
-      % <userinput>scons</userinput>
-      cc -c bar1.c -o bar1.o
-      cc -c bar2.c -o bar2.o
-      cc -c common1.c -o common1.o
-      cc -c common2.c -o common2.o
+      % <userinput>scons -Q</userinput>
+      cc -c -o bar1.o bar1.c
+      cc -c -o bar2.o bar2.c
+      cc -c -o common1.o common1.c
+      cc -c -o common2.o common2.c
       cc -o bar bar1.o bar2.o common1.o common2.o
-      cc -c foo.c -o foo.o
+      cc -c -o foo.o foo.c
       cc -o foo foo.o common1.o common2.o
    </literallayout>
 
       common = ['common1.c', 'common2.c']
       foo_files = ['foo.c'] + common
       bar_files = ['bar1.c', 'bar2.c'] + common
-      env = Environment()
-      env.Program('foo', foo_files)
-      env.Program('bar', bar_files)
+      Program('foo', foo_files)
+      Program('bar', bar_files)
    </programlisting>
 
    <para>
index a78a2c905e7be82f671566c99849f9c9f97c8e3c..cffa2b5dbf8f0ed4cf8e3a97a13491860ffd4987 100644 (file)
@@ -41,6 +41,7 @@ import os.path
 import shutil
 import stat
 import string
+import cStringIO
 
 import SCons.Action
 import SCons.Errors
@@ -720,7 +721,7 @@ class FS:
                 self._cwd = dir
                 if change_os_dir:
                     os.chdir(dir.abspath)
-        except:
+        except OSError:
             self._cwd = curr
             raise
 
@@ -902,6 +903,17 @@ class FS:
             message = "building associated BuildDir targets: %s" % string.join(map(str, targets))
         return targets, message
 
+class DummyExecutor:
+    """Dummy executor class returned by Dir nodes to bamboozle SCons
+    into thinking we are an actual derived node, where our sources are
+    our directory entries."""
+    def get_raw_contents(self):
+        return ''
+    def get_contents(self):
+        return ''
+    def get_timestamp(self):
+        return 0
+
 class Dir(Base):
     """A class for directories in a file system.
     """
@@ -924,12 +936,14 @@ class Dir(Base):
         self.abspath_ = self.abspath + os.sep
         self.repositories = []
         self.srcdir = None
+        self.source_scanner = None
         
         self.entries = {}
         self.entries['.'] = self
         self.entries['..'] = self.dir
         self.cwd = self
         self.builder = 1
+        self.searched = 0
         self._sconsign = None
         self.build_dirs = []
 
@@ -1023,6 +1037,19 @@ class Dir(Base):
                              self.all_children(scan))
 
     def all_children(self, scan=1):
+        # Before we traverse our children, make sure we have created Nodes
+        # for any files that this directory contains.  We need to do this
+        # so any change in a file in this directory will cause it to
+        # be out of date.
+        if not self.searched:
+            try:
+                for filename in os.listdir(self.abspath):
+                    if filename != '.sconsign':
+                        self.Entry(filename)
+            except OSError:
+                # Directory does not exist.  No big deal
+                pass
+            self.searched = 1
         keys = filter(lambda k: k != '.' and k != '..', self.entries.keys())
         kids = map(lambda x, s=self: s.entries[x], keys)
         def c(one, two):
@@ -1051,10 +1078,6 @@ class Dir(Base):
         """A directory does not get scanned."""
         return None
 
-    def calc_signature(self, calc):
-        """A directory has no signature."""
-        return None
-
     def set_bsig(self, bsig):
         """A directory has no signature."""
         bsig = None
@@ -1064,9 +1087,12 @@ class Dir(Base):
         csig = None
 
     def get_contents(self):
-        """Return a fixed "contents" value of a directory."""
-        return ''
-
+        """Return aggregate contents of all our children."""
+        contents = cStringIO.StringIO()
+        for kid in self.children(None):
+            contents.write(kid.get_contents())
+        return contents.getvalue()
+    
     def prepare(self):
         pass
 
@@ -1110,6 +1136,24 @@ class Dir(Base):
             return self.srcdir
         return Base.srcnode(self)
 
+    def get_executor(self, create=1):
+        """Fetch the action executor for this node.  Create one if
+        there isn't already one, and requested to do so."""
+        try:
+            executor = self.executor
+        except AttributeError:
+            executor = DummyExecutor()
+            self.executor = executor
+        return executor
+
+    def get_timestamp(self):
+        """Return the latest timestamp from among our children"""
+        stamp = 0
+        for kid in self.children(None):
+            if kid.get_timestamp() > stamp:
+                stamp = kid.get_timestamp()
+        return stamp
+
 class File(Base):
     """A class for files in a file system.
     """
@@ -1432,7 +1476,7 @@ class File(Base):
     def rfile(self):
         try:
             return self._rfile
-        except:
+        except AttributeError:
             self._rfile = self
             if not self.exists():
                 n = self.fs.Rsearch(self.path, clazz=File,
index c82d2c5fe59dad087c8871c8701fb6c4eee06e44..f297464d876d55a74deb44e71b2f252ebeb62054 100644 (file)
@@ -490,6 +490,41 @@ class SConsignDirFileTestCase(unittest.TestCase):
         assert f.get('foo') == (3, 1, 2)
         assert f.get_implicit('foo') == ['bar']
 
+class SConsignFileTestCase(unittest.TestCase):
+
+    def runTest(self):
+        test = TestCmd.TestCmd(workdir = '')
+        file = test.workpath('sconsign_file')
+
+        assert SCons.Sig.SConsign_db is None, SCons.Sig.SConsign_db
+
+        SCons.Sig.SConsignFile(file)
+
+        assert not SCons.Sig.SConsign_db is None, SCons.Sig.SConsign_db
+
+        class Fake_DBM:
+            def open(self, name, mode):
+                self.name = name
+                self.mode = mode
+                return self
+
+        fake_dbm = Fake_DBM()
+
+        SCons.Sig.SConsignFile(file, fake_dbm)
+
+        assert not SCons.Sig.SConsign_db is None, SCons.Sig.SConsign_db
+        assert not hasattr(fake_dbm, 'name'), fake_dbm
+        assert not hasattr(fake_dbm, 'mode'), fake_dbm
+
+        SCons.Sig.SConsign_db = None
+
+        SCons.Sig.SConsignFile(file, fake_dbm)
+
+        assert not SCons.Sig.SConsign_db is None, SCons.Sig.SConsign_db
+        assert fake_dbm.name == file, fake_dbm.name
+        assert fake_dbm.mode == "c", fake_dbm.mode
+
+
 
 def suite():
     suite = unittest.TestSuite()
@@ -500,6 +535,7 @@ def suite():
     suite.addTest(_SConsignTestCase())
     suite.addTest(SConsignDBTestCase())
     suite.addTest(SConsignDirFileTestCase())
+    suite.addTest(SConsignFileTestCase())
     return suite
 
 if __name__ == "__main__":
index 298db66cac88e11fa91f8d6471f2aa026f62f478..a2ebd5cc32b4cff27f5d1fcb4ee3c915f32d9d0b 100644 (file)
@@ -51,10 +51,6 @@ sig_files = []
 
 SConsign_db = None
 
-# 1 means use build signature for derived source files
-# 0 means use content signature for derived source files
-build_signature = 1
-
 def write():
     global sig_files
     for sig_file in sig_files:
@@ -121,7 +117,7 @@ class _SConsign:
         """
         try:
             return self.entries[filename]
-        except:
+        except (KeyError, AttributeError):
             return SConsignEntry()
 
     def set_entry(self, filename, entry):
@@ -202,6 +198,8 @@ class SConsignDB(_SConsign):
                 if type(self.entries) is not type({}):
                     self.entries = {}
                     raise TypeError
+            except KeyboardInterrupt:
+                raise
             except:
                 SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning,
                                     "Ignoring corrupt sconsign entry : %s"%self.dir.path)
@@ -213,7 +211,11 @@ class SConsignDB(_SConsign):
         if self.dirty:
             global SConsign_db
             SConsign_db[self.dir.path] = cPickle.dumps(self.entries, 1)
-            SConsign_db.sync()
+            try:
+                SConsign_db.sync()
+            except AttributeError:
+                # Not all anydbm modules have sync() methods.
+                pass
 
 class SConsignDir(_SConsign):
     def __init__(self, fp=None, module=None):
@@ -244,11 +246,13 @@ class SConsignDirFile(SConsignDir):
 
         try:
             fp = open(self.sconsign, 'rb')
-        except:
+        except IOError:
             fp = None
 
         try:
             SConsignDir.__init__(self, fp, module)
+        except KeyboardInterrupt:
+            raise
         except:
             SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning,
                                 "Ignoring corrupt .sconsign file: %s"%self.sconsign)
@@ -274,11 +278,11 @@ class SConsignDirFile(SConsignDir):
             try:
                 file = open(temp, 'wb')
                 fname = temp
-            except:
+            except IOError:
                 try:
                     file = open(self.sconsign, 'wb')
                     fname = self.sconsign
-                except:
+                except IOError:
                     return
             cPickle.dump(self.entries, file, 1)
             file.close()
@@ -287,29 +291,31 @@ class SConsignDirFile(SConsignDir):
                     mode = os.stat(self.sconsign)[0]
                     os.chmod(self.sconsign, 0666)
                     os.unlink(self.sconsign)
-                except:
+                except OSError:
                     pass
                 try:
                     os.rename(fname, self.sconsign)
-                except:
+                except OSError:
                     open(self.sconsign, 'wb').write(open(fname, 'rb').read())
                     os.chmod(self.sconsign, mode)
             try:
                 os.unlink(temp)
-            except:
+            except OSError:
                 pass
 
 SConsignForDirectory = SConsignDirFile
 
-def SConsignFile(name):
+def SConsignFile(name, dbm_module=None):
     """
     Arrange for all signatures to be stored in a global .sconsign.dbm
     file.
     """
     global SConsign_db
     if SConsign_db is None:
-        import anydbm
-        SConsign_db = anydbm.open(name, "c")
+        if dbm_module is None:
+            import anydbm
+            dbm_module = anydbm
+        SConsign_db = dbm_module.open(name, "c")
 
     global SConsignForDirectory
     SConsignForDirectory = SConsignDB
index 015f1dbe4b2081bb457b2d440d01b1448e2e5bcd..cc9e58dac13db286ce106a35890ddc4f7f8f6119 100644 (file)
@@ -80,6 +80,7 @@ if sys.platform == 'win32':
     # sys.prefix is (likely) C:\Python*;
     # check only C:\Python*.
     prefs.append(sys.prefix)
+    prefs.append(os.path.join(sys.prefix, 'Lib', 'site-packages'))
 else:
     # On other (POSIX) platforms, things are more complicated due to
     # the variety of path names and library locations.  Try to be smart
@@ -121,7 +122,13 @@ else:
         # check only /foo/lib/scons*.
         prefs.append(sys.prefix)
 
-    prefs = map(lambda x: os.path.join(x, 'lib'), prefs)
+    temp = map(lambda x: os.path.join(x, 'lib'), prefs)
+    temp.extend(map(lambda x: os.path.join(x,
+                                           'lib',
+                                           'python' + sys.version[:3],
+                                           'site-packages'),
+                           prefs))
+    prefs = temp
 
 # Look first for 'scons-__version__' in all of our preference libs,
 # then for 'scons'.
index 29f2af28ce2b7474083a997d338618025c4e980a..606f20bd7f7735094f49ff64fa147e1daca1302d 100644 (file)
@@ -77,7 +77,8 @@ test.fail_test(os.path.exists(test.workpath('work1', 'subdir', '.sconsign')))
 
 #
 test.write(['work2', 'SConstruct'], """
-SConsignFile('my_sconsign')
+e = Environment(XXX = 'scons')
+e.SConsignFile('my_${XXX}ign')
 B = Builder(action = "%s ../build.py $TARGETS $SOURCES")
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'f5.out', source = 'f5.in')
index a5c0aa788ecb6f583851ac8aa27a9de1030ecc2d..24e23a03d4135b4778bd1de8607ac413f1a79994 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (c) 2001, 2002, 2003 Steven Knight
+# __COPYRIGHT__
 #
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the
@@ -22,7 +22,7 @@
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #
 
-__revision__ = "/home/scons/scons/branch.0/baseline/test/sconsign.py 0.90.D001 2003/06/25 15:32:24 knight"
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
 import os.path
 import string