Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61418 - in branches/release/tools/jam: . doc src test
From: ghost_at_[hidden]
Date: 2010-04-20 07:51:10


Author: vladimir_prus
Date: 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
New Revision: 61418
URL: http://svn.boost.org/trac/boost/changeset/61418

Log:
Complete sync with /tags/tools/jam/Boost_Jam_3_1_18
Added:
   branches/release/tools/jam/src/md5.c
      - copied unchanged from r61417, /tags/tools/jam/Boost_Jam_3_1_18/src/md5.c
   branches/release/tools/jam/src/md5.h
      - copied unchanged from r61417, /tags/tools/jam/Boost_Jam_3_1_18/src/md5.h
   branches/release/tools/jam/test/rule_param.jam (contents, props changed)
Properties modified:
   branches/release/tools/jam/ (props changed)
Text files modified:
   branches/release/tools/jam/doc/bjam.qbk | 169 ++++++++++++++++++++++---------
   branches/release/tools/jam/doc/build.jam | 2
   branches/release/tools/jam/doc/history.qbk | 44 ++++++++
   branches/release/tools/jam/src/boost-jam.spec | 2
   branches/release/tools/jam/src/build.bat | 2
   branches/release/tools/jam/src/build.jam | 22 +++
   branches/release/tools/jam/src/build.sh | 2
   branches/release/tools/jam/src/builtins.c | 217 ++++++++++++++++++++++++++++++++++++++++
   branches/release/tools/jam/src/builtins.h | 6 +
   branches/release/tools/jam/src/execunix.c | 6
   branches/release/tools/jam/src/expand.c | 21 +++
   branches/release/tools/jam/src/hash.c | 4
   branches/release/tools/jam/src/hcache.c | 2
   branches/release/tools/jam/src/jam.c | 45 +++++++-
   branches/release/tools/jam/src/jam.h | 5
   branches/release/tools/jam/src/lists.h | 2
   branches/release/tools/jam/src/make1.c | 12 +
   branches/release/tools/jam/src/output.c | 4
   branches/release/tools/jam/src/patchlevel.h | 6
   branches/release/tools/jam/src/rules.h | 2
   branches/release/tools/jam/test/test.jam | 1
   21 files changed, 499 insertions(+), 77 deletions(-)

Modified: branches/release/tools/jam/doc/bjam.qbk
==============================================================================
--- branches/release/tools/jam/doc/bjam.qbk (original)
+++ branches/release/tools/jam/doc/bjam.qbk 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -1,6 +1,6 @@
 [article Boost.Jam
     [quickbook 1.3]
- [version: 3.1.17]
+ [version: 3.1.18]
     [authors [Rivera, Rene], [Abrahams, David], [Prus, Vladimir]]
     [copyright 2003 2004 2005 2006 2007 Rene Rivera, David Abrahams, Vladimir Prus]
     [category tool-build]
@@ -21,7 +21,7 @@
 
 [/ Shortcuts ]
 
-[def :version: 3.1.17]
+[def :version: 3.1.18]
 
 [/ Images ]
 
@@ -37,7 +37,7 @@
 
 [/ Templates ]
 
-[template literal[text]'''<literallayout>'''[text]'''</literallayout>''']
+[template literal[text]'''<literallayout><literal>'''[text]'''</literal></literallayout>''']
 [template list[items]'''<itemizedlist>'''[items]'''</itemizedlist>''']
 [template orderedlist[items]'''<orderedlist>'''[items]'''</orderedlist>''']
 [template li[text]'''<listitem>'''[text]'''</listitem>''']
@@ -46,7 +46,15 @@
 
 [section:intro Introduction]
 
-Boost.Jam (BJam) is a build tool based on FTJam, which in turn is based on :Perforce_Jam:. It contains significant improvements made to facilitate its use in the Boost Build System, but should be backward compatible with :Perforce_Jam:.
+[warning Most probably, you are looking for [@http://boost.org/boost-build2/doc/html/index.html Boost.Build
+manual]. This document is not meant to be read standalone and will only
+confuse you. Boost.Build manual refers to specific sections when necessary.]
+
+Boost.Jam (BJam) is the low-level build engine tool for
+[@http://boost.org/boost-build2 Boost.Build]. Historically, Boost.Jam is based
+on on FTJam and on :Perforce_Jam: but has grown a number of significant
+features and is now developed independently, with no merge back expected to
+happen, and little use outside Boost.Build.
 
 This is version :version: of BJam and is based on version 2.4 of Jam/MR:
 
@@ -61,24 +69,6 @@
 ALL WARRANTIES ARE HEREBY DISCLAIMED.
 ]
 
-[section:features Features]
-
-Jam is a make(1) replacement that makes building simple things simple and building complicated things manageable.
-
-Jam's language is expressive, making Jamfiles (c.f. Makefiles) compact.
-
-Jam handles header file dependencies automatically and on-the-fly.
-
-Jam is very portable: it runs on UNIX, VMS, Mac, and NT. Most Jamfiles themselves are portable.
-
-Jam is unintrusive: it is small, it has negligible CPU overhead, and it doesn't create any of its own funny files (c.f. Odin, nmake, SunOS make).
-
-Jam can build large projects spread across many directories in one pass, without recursing, tracking the relationships among all files. Jam can do this with multiple, concurrent processes.
-
-Jam isn't under the blinkin GNU copyright, so you can incorporate it into commercial products.
-
-[endsect]
-
 [endsect]
 
 [section:building Building BJam]
@@ -388,29 +378,29 @@
 The arguments starting with the "=--option=" forms are passed to the =build.jam= script and are used to further customize what gets built. Options and targets supported by the =build.jam= script:
 
 [variablelist
- [[[^---]]
+ [[[literal ---]]
         [Empty option when one wants to only specify a target.]]
- [[[^--release]]
+ [[[literal --release]]
         [The default, builds the optimized executable.]]
- [[[^--debug]]
+ [[[literal --debug]]
         [Builds debugging versions of the executable. When built they are placed in their own directory "=bin./platform/.debug=".]]
- [[[^--grammar]]
+ [[[literal --grammar]]
         [Normally the Jam language grammar parsing files are not regenerated. This forces building of the grammar, although it may not force the regeneration of the grammar parser. If the parser is out of date it will be regenerated and subsequently built.]]
- [[[^--with-python=/path/]]
+ [[[literal --with-python=/path/]]
         [Enables Python integration, given a path to the Python libraries.]]
- [[[^--gc]]
+ [[[literal --gc]]
         [Enables use of the Boehm Garbage Collector. The build will look for the Boehm-GC source in a "boehm_gc" subdirectory from the =bjam= sources.]]
- [[[^--duma]]
+ [[[literal --duma]]
         [Enables use of the DUMA (Detect Uintended Memory Access) debugging memory allocator. The build expects to find the DUMA source files in a "duma" subdirectory from the =bjam= sources.]]
- [[[^--toolset-root=/path/]]
+ [[[literal --toolset-root=/path/]]
         [Indicates where the toolset used to build is located. This option is passed in by the bootstrap (=build.bat= or =build.sh=) script.]]
- [[[^--show-locate-target]]
+ [[[literal --show-locate-target]]
         [For information, prints out where it will put the built executable.]]
- [[[^--noassert]]
+ [[[literal --noassert]]
         [Disable debug assertions, even if building the debug version of the executable.]]
- [[[^dist]]
+ [[[literal dist]]
         [Generate packages (compressed archives) as appropriate for distribution in the platform, if possible.]]
- [[[^clean]]
+ [[[literal clean]]
         [Remove all the built executables and objects.]]
 ]
 
@@ -418,6 +408,13 @@
 
 [section:usage Using BJam]
 
+[warning Most probably, you are looking for
+[@http://boost.org/boost-build2/doc/html/index.html Boost.Build
+manual] or [@http://www.boost.org/boost-build2/doc/html/bbv2/overview/invocation.html Boost.Build
+command-line syntax]. This section documents only low-level options used by
+the Boost.Jam build engine, and does not mention any high-level syntax of Boost.Build]
+
+
 If /target/ is provided on the command line, =bjam= builds /target/; otherwise =bjam= builds the target =all=.
 
 [pre
@@ -430,10 +427,10 @@
 
 [variablelist
   
- [ [[^-a]]
+ [ [[literal -a]]
     [Build all targets anyway, even if they are up-to-date.] ]
   
- [ [[^-d'''&nbsp;'''/n/]]
+ [ [[literal -d /n/]]
     [
     Enable cummulative debugging levels from 1 to n. Values are:
     
@@ -454,43 +451,43 @@
         ]
     ] ]
   
- [ [[^-d'''&nbsp;'''+/n/]]
+ [ [[literal -d +/n/]]
     [Enable debugging level /n/.] ]
   
- [ [[^-d'''&nbsp;'''0]]
+ [ [[literal -d 0]]
     [Turn off all debugging levels. Only errors are reported.] ]
   
- [ [[^-f'''&nbsp;'''/Jambase/]] [Read /Jambase/ instead of using the built-in
+ [ [[literal -f /Jambase/]] [Read /Jambase/ instead of using the built-in
     Jambase. Only one -f flag is permitted, but the /Jambase/ may explicitly
     include other files. A /Jambase/ name of "-" is allowed, in which case
     console input is read until it is closed, at which point the input is
     treated as the Jambase.] ]
   
- [ [[^-j'''&nbsp;'''/n/]]
+ [ [[literal -j /n/]]
     [Run up to /n/ shell commands concurrently (UNIX and NT only). The default is 1.] ]
   
- [ [[^-l'''&nbsp;'''/n/]]
+ [ [[literal -l /n/]]
     [Limit actions to running for /n/ number of seconds, after which they are stopped. Note: Windows only.] ]
   
- [ [[^-n]]
+ [ [[literal -n]]
     [Don't actually execute the updating actions, but do everything else. This changes the debug level default to =-d 2=.] ]
   
- [ [[^-o'''&nbsp;'''/file/]]
+ [ [[literal -o /file/]]
     [Write the updating actions to the specified file instead of running them.] ]
   
- [ [[^-q]]
+ [ [[literal -q]]
     [Quit quickly (as if an interrupt was received) as soon as *any* target fails.] ]
   
- [ [[^-s'''&nbsp;'''/var/=/value/]]
+ [ [[literal -s /var/=/value/]]
     [Set the variable /var/ to /value/, overriding both internal variables and variables imported from the environment.] ]
   
- [ [[^-t'''&nbsp;'''/target/]]
+ [ [[literal -t /target/]]
     [Rebuild /target/ and everything that depends on it, even if it is up-to-date.] ]
   
- [ [[^--'''&nbsp;'''/value/]]
+ [ [[literal -- /value/]]
     [The option and /value/ is ignored, but is available from the =$(ARGV)= variable. ]]
   
- [ [[^-v]]
+ [ [[literal -v]]
     [Print the version of =bjam= and exit.] ]
 ]
 
@@ -1043,6 +1040,77 @@
 
 [endsect]
 
+[section =MD5= ]
+
+[pre
+rule MD5 ( /string/ )
+]
+
+=MD5= computes the MD5 hash of the string passed as paramater and returns it.
+
+[endsect]
+
+[section =SPLIT_BY_CHARACTERS= ]
+
+[pre
+rule SPLIT_BY_CHARACTERS ( /string/ : /delimiters/ )
+]
+
+=SPLIT_BY_CHARACTERS= splits the specified /string/ on any delimiter character
+present in /delimiters/ and returns the resulting list.
+
+[endsect]
+
+[section =PRECIOUS= ]
+
+[pre
+rule PRECIOUS ( /targets/ * )
+]
+
+The =PRECIOUS= rule specifies that each of the targets passed as the arguments
+should not be removed even if the command updating that target fails.
+
+[endsect]
+
+[section =PAD= ]
+
+[pre
+rule PAD ( /string/ : /width/ )
+]
+
+If /string/ is shorter than /width/ characters, pads it with whitespace
+characters on the right, and returns the result. Otherwise, returns
+/string/ unmodified.
+
+[endsect]
+
+[section =FILE_OPEN= ]
+
+[pre
+rule FILE_OPEN ( /filename/ : /mode/ )
+]
+
+The =FILE_OPEN= rule opens the specified file and returns a file
+descriptor. The /mode/ parameter can be either "w" or "r". Note
+that at present, only the =UPDATE_NOW= rule can use the resulting
+file descriptor number.
+
+[endsect]
+
+[section =UPDATE_NOW= ]
+
+[pre
+rule UPDATE_NOW ( /targets/ * : /log/ ? : /ignore-minus-n/ ? )
+]
+
+The =UPDATE_NOW= caused the specified targets to be updated immediately.
+If update was successfull, non-empty string is returned. The /log/ parameter,
+if present, specifies a descriptor of a file where all output from building
+is redirected. If the /ignore-minus-n/ parameter is specified, the targets
+are updated even if the =-n= parameter is specified on the command line.
+
+[endsect]
+
 [endsect]
 
 [endsect]
@@ -1343,7 +1411,10 @@
 
 [section:builtins Built-in Variables]
 
-This section discusses variables that have special meaning to =bjam=.
+This section discusses variables that have special meaning to =bjam=. All of
+these must be defined or used in the global module -- using those variables
+inside a named module will not have the desired effect.
+See [link jam.language.modules Modules].
 
 [section:search SEARCH and LOCATE]
 

Modified: branches/release/tools/jam/doc/build.jam
==============================================================================
--- branches/release/tools/jam/doc/build.jam (original)
+++ branches/release/tools/jam/doc/build.jam 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -30,7 +30,9 @@
         <dependency>html
         <dependency>html/images
         <xsl:param>boost.root=.
+ -<xsl:param>boost.defaults=Boost
         <xsl:param>nav.layout=none
+ <xsl:param>boost.image=Boost
         <format>html:<xsl:param>admon.graphics.path=images/
         <format>html:<xsl:param>navig.graphics.path=images/
     ;

Modified: branches/release/tools/jam/doc/history.qbk
==============================================================================
--- branches/release/tools/jam/doc/history.qbk (original)
+++ branches/release/tools/jam/doc/history.qbk 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -1,5 +1,49 @@
 [variablelist
 
+[[3.1.18] [
+
+After years of bjam developments.. This is going to be the last unbundled release of the
+3.1.x series. From this point forward bjam will only be bundled as part of the larger
+Boost Build system. And hence will likely change name at some point. As a side effect
+of this move people will get more frequent release of bjam (or whatever it ends up being
+called).
+
+[list
+ [li New built-ins, MD5, SPLIT_BY_CHARACTERS, PRECIOUS, PAD, FILE_OPEN, and UPDATE_NOW.
+ -- ['Vladimir P.]
+ ]
+ [li Ensure all file descriptors are closed when executing actions complete on *nix.
+ -- ['Noel B.]
+ ]
+ [li Fix warnings, patch from Mateusz Loskot.
+ -- ['Vladimir P.]
+ ]
+ [li Add KEEP_GOING var to programatically override the '-q' option.
+ -- ['Vladimir P.]
+ ]
+ [li Add more parameters, up to 19 from 9, to rule invocations. Patch from
+ Jonathan Biggar.
+ -- ['Vladimir P.]
+ ]
+ [li Print failed command output even if the normally quite '-d0' option.
+ -- ['Vladimir P.]
+ ]
+ [li Build of bjam with vc10, aka Visual Studio 2010.
+ -- ['Vladimir P.]
+ ]
+ [li More macros for detection of OSPLAT, patch from John W. Bito.
+ -- ['Vladimir P.]
+ ]
+ [li Add PARALLELISM var to programatically override the '-j' option.
+ -- ['Vladimir P.]
+ ]
+ [li Tweak doc building to allow for PDF generation of docs.
+ -- ['John M.]
+ ]
+]
+
+]]
+
 [[3.1.17] [
 
 A year in the making this release has many stability improvements and various performance

Modified: branches/release/tools/jam/src/boost-jam.spec
==============================================================================
--- branches/release/tools/jam/src/boost-jam.spec (original)
+++ branches/release/tools/jam/src/boost-jam.spec 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -1,5 +1,5 @@
 Name: boost-jam
-Version: 3.1.17
+Version: 3.1.18
 Summary: Build tool
 Release: 1
 Source: %{name}-%{version}.tgz

Modified: branches/release/tools/jam/src/build.bat
==============================================================================
--- branches/release/tools/jam/src/build.bat (original)
+++ branches/release/tools/jam/src/build.bat 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -442,7 +442,7 @@
 set BJAM_SOURCES=%BJAM_SOURCES% hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c
 set BJAM_SOURCES=%BJAM_SOURCES% newstr.c option.c output.c parse.c pathunix.c regexp.c
 set BJAM_SOURCES=%BJAM_SOURCES% rules.c scan.c search.c subst.c timestamp.c variable.c modules.c
-set BJAM_SOURCES=%BJAM_SOURCES% strings.c filesys.c builtins.c pwd.c class.c w32_getreg.c native.c
+set BJAM_SOURCES=%BJAM_SOURCES% strings.c filesys.c builtins.c md5.c pwd.c class.c w32_getreg.c native.c
 set BJAM_SOURCES=%BJAM_SOURCES% modules/set.c modules/path.c modules/regex.c
 set BJAM_SOURCES=%BJAM_SOURCES% modules/property-set.c modules/sequence.c modules/order.c
 

Modified: branches/release/tools/jam/src/build.jam
==============================================================================
--- branches/release/tools/jam/src/build.jam (original)
+++ branches/release/tools/jam/src/build.jam 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -2,6 +2,20 @@
 #~ Distributed under the Boost Software License, Version 1.0.
 #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
+# Clean env vars of any "extra" empty values.
+for local v in ARGV CC CFLAGS LIBS
+{
+ local values ;
+ for local x in $($(v))
+ {
+ if $(x) != ""
+ {
+ values += $(x) ;
+ }
+ }
+ $(v) = $(values) ;
+}
+
 # Platform related specifics.
 if $(NT) { rule .path { return "$(<:J=\\)" ; } ./ = "/" ; }
 else if $(OS2) { rule .path { return "$(<:J=\\)" ; } ./ = "/" ; }
@@ -13,7 +27,7 @@
 ./ ?= "" ;
 
 # Info about what we are building.
-_VERSION_ = 3 1 17 ;
+_VERSION_ = 3 1 18 ;
 NAME = boost-jam ;
 VERSION = $(_VERSION_:J=$(.)) ;
 RELEASE = 1 ;
@@ -57,7 +71,7 @@
     {
         --python-include = [ .path $(python-location) include ] ;
         --python-lib = ;
- for local v in 25 24 23 22
+ for local v in 26 25 24 23 22
         {
             --python-lib ?=
                 [ GLOB [ .path $(python-location) libs ] : "python$(v).lib" ]
@@ -80,7 +94,7 @@
     {
         --python-include = ;
         --python-lib = ;
- for local v in 2.5 2.4 2.3 2.2
+ for local v in 2.6 2.5 2.4 2.3 2.2
         {
             local inc = [ GLOB [ .path $(python-location) include ] : python$(v) ] ;
             local lib = [ GLOB [ .path $(python-location) lib ] : libpython$(v)* ] ;
@@ -472,7 +486,7 @@
     option.c output.c parse.c regexp.c rules.c
     scan.c search.c subst.c w32_getreg.c
     timestamp.c variable.c modules.c strings.c filesys.c
- builtins.c pwd.c class.c native.c modules/set.c
+ builtins.c pwd.c class.c native.c md5.c modules/set.c
     modules/path.c modules/regex.c modules/property-set.c
     modules/sequence.c modules/order.c
     ;

Modified: branches/release/tools/jam/src/build.sh
==============================================================================
--- branches/release/tools/jam/src/build.sh (original)
+++ branches/release/tools/jam/src/build.sh 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -240,7 +240,7 @@
  hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c\
  newstr.c option.c output.c parse.c pathunix.c pathvms.c regexp.c\
  rules.c scan.c search.c subst.c timestamp.c variable.c modules.c\
- strings.c filesys.c builtins.c pwd.c class.c native.c w32_getreg.c\
+ strings.c filesys.c builtins.c pwd.c class.c native.c md5.c w32_getreg.c\
  modules/set.c modules/path.c modules/regex.c modules/property-set.c\
  modules/sequence.c modules/order.c"
 case $BOOST_JAM_TOOLSET in

Modified: branches/release/tools/jam/src/builtins.c
==============================================================================
--- branches/release/tools/jam/src/builtins.c (original)
+++ branches/release/tools/jam/src/builtins.c 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -24,6 +24,7 @@
 #include "native.h"
 #include "variable.h"
 #include "timestamp.h"
+#include "md5.h"
 #include <ctype.h>
 
 
@@ -140,6 +141,12 @@
       bind_builtin( "MATCH",
                     builtin_match, 0, 0 ) );
 
+ {
+ char * args[] = { "string", ":", "delimiters" };
+ bind_builtin( "SPLIT_BY_CHARACTERS",
+ builtin_split_by_characters, 0, 0 );
+ }
+
     duplicate_rule( "NoCare",
       bind_builtin( "NOCARE",
                     builtin_flags, T_FLAG_NOCARE, 0 ) );
@@ -181,6 +188,14 @@
       }
 
       {
+ char * args[] = { "targets", "*",
+ ":", "log", "?",
+ ":", "ignore-minus-n", "?", 0 };
+ bind_builtin( "UPDATE_NOW",
+ builtin_update_now, 0, args );
+ }
+
+ {
           char * args[] = { "string", "pattern", "replacements", "+", 0 };
           duplicate_rule( "subst",
             bind_builtin( "SUBST",
@@ -342,6 +357,30 @@
                           builtin_shell, 0, args ) );
       }
 
+ {
+ char * args[] = { "string", 0 };
+ bind_builtin( "MD5",
+ builtin_md5, 0, args ) ;
+ }
+
+ {
+ char * args[] = { "name", ":", "mode", 0 };
+ bind_builtin( "FILE_OPEN",
+ builtin_file_open, 0, args );
+ }
+
+ {
+ char * args[] = { "string", ":", "width", 0 };
+ bind_builtin( "PAD",
+ builtin_pad, 0, args );
+ }
+
+ {
+ char * args[] = { "targets", "*", 0 };
+ bind_builtin( "PRECIOUS",
+ builtin_precious, 0, args );
+ }
+
       /* Initialize builtin modules. */
       init_set();
       init_path();
@@ -838,6 +877,28 @@
     return result;
 }
 
+LIST * builtin_split_by_characters( PARSE * parse, FRAME * frame )
+{
+ LIST * l1 = lol_get( frame->args, 0 );
+ LIST * l2 = lol_get( frame->args, 1 );
+
+ LIST * result = 0;
+
+ char* s = strdup (l1->string);
+ char* delimiters = l2->string;
+ char* t;
+
+ t = strtok (s, delimiters);
+ while (t)
+ {
+ result = list_new(result, newstr(t));
+ t = strtok (NULL, delimiters);
+ }
+
+ free (s);
+
+ return result;
+}
 
 LIST * builtin_hdrmacro( PARSE * parse, FRAME * frame )
 {
@@ -1231,6 +1292,75 @@
     return result;
 }
 
+extern int anyhow;
+
+/* Takes a list of target names as first argument, and immediately
+ updates them.
+ Second parameter, if specified, if the descriptor (converted to a string)
+ of a log file where all build output is redirected.
+ Third parameter, if non-empty, specifies that the -n option should have
+ no effect -- that is, all out-of-date targets should be rebuild.
+*/
+LIST * builtin_update_now( PARSE * parse, FRAME * frame )
+{
+ LIST * targets = lol_get( frame->args, 0 );
+ LIST * log = lol_get( frame->args, 1 );
+ LIST * force = lol_get (frame->args, 2);
+ int status = 0;
+ int original_stdout;
+ int original_stderr;
+ int n;
+ int targets_count;
+ const char** targets2;
+ int i;
+ int original_noexec;
+
+
+ if (log)
+ {
+ int fd = atoi(log->string);
+ /* Redirect stdout and stderr, temporary, to the log file. */
+ original_stdout = dup (0);
+ original_stderr = dup (1);
+ dup2 (fd, 0);
+ dup2 (fd, 1);
+ }
+
+ if (force)
+ {
+ original_noexec = globs.noexec;
+ globs.noexec = 0;
+ }
+
+ targets_count = list_length( targets );
+ targets2 = (const char * *)BJAM_MALLOC( targets_count * sizeof( char * ) );
+ for (i = 0 ; targets; targets = list_next( targets ) )
+ targets2[ i++ ] = targets->string;
+ status |= make( targets_count, targets2, anyhow);
+ free( targets );
+
+ if (force)
+ {
+ globs.noexec = original_noexec;
+ }
+
+ if (log)
+ {
+ /* Flush whatever stdio might have buffered, while descriptions
+ 0 and 1 still refer to the log file. */
+ fflush (stdout);
+ fflush (stderr);
+ dup2 (original_stdout, 0);
+ dup2 (original_stderr, 1);
+ close (original_stdout);
+ close (original_stderr);
+ }
+
+ if (status == 0)
+ return list_new (L0, newstr ("ok"));
+ else
+ return L0;
+}
 
 LIST * builtin_search_for_target( PARSE * parse, FRAME * frame )
 {
@@ -1488,6 +1618,93 @@
 }
 
 
+LIST * builtin_md5( PARSE * parse, FRAME * frame )
+{
+ LIST * l = lol_get( frame->args, 0 );
+ char* s = l->string;
+
+ md5_state_t state;
+ md5_byte_t digest[16];
+ char hex_output[16*2 + 1];
+
+ int di;
+
+ md5_init(&state);
+ md5_append(&state, (const md5_byte_t *)s, strlen(s));
+ md5_finish(&state, digest);
+
+ for (di = 0; di < 16; ++di)
+ sprintf(hex_output + di * 2, "%02x", digest[di]);
+
+ return list_new (0, newstr(hex_output));
+}
+
+LIST *builtin_file_open( PARSE *parse, FRAME *frame )
+{
+ char* name = lol_get(frame->args, 0)->string;
+ char* mode = lol_get(frame->args, 1)->string;
+ int fd;
+ char buffer[sizeof("4294967295")];
+
+ if (strcmp(mode, "w") == 0)
+ {
+ fd = open(name, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+ }
+ else
+ {
+ fd = open(name, O_RDONLY);
+ }
+
+ if (fd != -1)
+ {
+ sprintf(buffer, "%d", fd);
+ return list_new(L0, newstr(buffer));
+ }
+ else
+ {
+ return L0;
+ }
+}
+
+LIST *builtin_pad( PARSE *parse, FRAME *frame )
+{
+ char *string = lol_get(frame->args, 0)->string;
+ char *width_s = lol_get(frame->args, 1)->string;
+
+ int current = strlen (string);
+ int desired = atoi(width_s);
+ if (current >= desired)
+ return list_new (L0, string);
+ else
+ {
+ char *buffer = malloc (desired + 1);
+ int i;
+ LIST *result;
+
+ strcpy (buffer, string);
+ for (i = current; i < desired; ++i)
+ buffer[i] = ' ';
+ buffer[desired] = '\0';
+ result = list_new (L0, newstr (buffer));
+ free (buffer);
+ return result;
+ }
+}
+
+LIST *builtin_precious( PARSE *parse, FRAME *frame )
+{
+ LIST* targets = lol_get(frame->args, 0);
+
+ for ( ; targets; targets = list_next( targets ) )
+ {
+ TARGET* t = bindtarget (targets->string);
+ t->flags |= T_FLAG_PRECIOUS;
+ }
+
+ return L0;
+}
+
+
 #ifdef HAVE_PYTHON
 
 LIST * builtin_python_import_rule( PARSE * parse, FRAME * frame )

Modified: branches/release/tools/jam/src/builtins.h
==============================================================================
--- branches/release/tools/jam/src/builtins.h (original)
+++ branches/release/tools/jam/src/builtins.h 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -31,6 +31,7 @@
 LIST *builtin_glob_recursive( PARSE *parse, FRAME *frame );
 LIST *builtin_subst( PARSE *parse, FRAME *args );
 LIST *builtin_match( PARSE *parse, FRAME *args );
+LIST *builtin_split_by_characters( PARSE *parse, FRAME *args );
 LIST *builtin_hdrmacro( PARSE *parse, FRAME *args );
 LIST *builtin_rulenames( PARSE *parse, FRAME *args );
 LIST *builtin_varnames( PARSE *parse, FRAME *args );
@@ -41,6 +42,7 @@
 LIST *builtin_backtrace( PARSE *parse, FRAME *args );
 LIST *builtin_pwd( PARSE *parse, FRAME *args );
 LIST *builtin_update( PARSE *parse, FRAME *args );
+LIST *builtin_update_now( PARSE *parse, FRAME *args );
 LIST *builtin_search_for_target( PARSE *parse, FRAME *args );
 LIST *builtin_import_module( PARSE *parse, FRAME *args );
 LIST *builtin_imported_modules( PARSE *parse, FRAME *frame );
@@ -54,6 +56,10 @@
 LIST *builtin_check_if_file( PARSE *parse, FRAME *frame );
 LIST *builtin_python_import_rule( PARSE *parse, FRAME *frame );
 LIST *builtin_shell( PARSE *parse, FRAME *frame );
+LIST *builtin_md5( PARSE *parse, FRAME *frame );
+LIST *builtin_file_open( PARSE *parse, FRAME *frame );
+LIST *builtin_pad( PARSE *parse, FRAME *frame );
+LIST *builtin_precious( PARSE *parse, FRAME *frame );
 
 void backtrace( FRAME *frame );
 

Modified: branches/release/tools/jam/src/execunix.c
==============================================================================
--- branches/release/tools/jam/src/execunix.c (original)
+++ branches/release/tools/jam/src/execunix.c 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -226,13 +226,13 @@
         dup2( out[1], STDOUT_FILENO );
 
         if ( globs.pipe_action == 0 )
- {
             dup2( out[1], STDERR_FILENO );
- close( err[1] );
- }
         else
             dup2( err[1], STDERR_FILENO );
 
+ close( out[1] );
+ close( err[1] );
+
         /* Make this process a process group leader so that when we kill it, all
          * child processes of this process are terminated as well. We use
          * killpg(pid, SIGKILL) to kill the process group leader and all its

Modified: branches/release/tools/jam/src/expand.c
==============================================================================
--- branches/release/tools/jam/src/expand.c (original)
+++ branches/release/tools/jam/src/expand.c 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -110,6 +110,24 @@
                 return list_copy( l, lol_get( lol, in[ 2 ] - '1' ) );
         }
     }
+ else if ( in[0] == '$' && in[1] == '(' && in[2] == '1' && in[4] == ')' &&
+ in[5] == '\0') {
+
+ switch( in[3] )
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ return list_copy( l, lol_get( lol, in[3]-'0'+10-1 ) );
+ }
+ }
 
     /* Expand @() files, to single item plus accompanying file. */
     if ( ( in[ 0 ] == '@' ) && ( in[ 1 ] == '(' ) && ( *( end - 1 ) == ')' ) )
@@ -354,6 +372,9 @@
                     value = lol_get( lol, 1 );
                 else if ( ( varname[0] >= '1' ) && ( varname[0] <= '9' ) )
                     value = lol_get( lol, varname[0] - '1' );
+ else if( varname[0] == '1' && varname[1] >= '0' &&
+ varname[1] <= '9' && !varname[2] )
+ value = lol_get( lol, varname[1] - '0' + 10 - 1 );
             }
 
             if ( !value )

Modified: branches/release/tools/jam/src/hash.c
==============================================================================
--- branches/release/tools/jam/src/hash.c (original)
+++ branches/release/tools/jam/src/hash.c 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -448,12 +448,12 @@
         run = here;
     }
 
- printf( "%s table: %d+%d+%d (%dK+%ldK) items+table+hash, %f density\n",
+ printf( "%s table: %d+%d+%d (%dK+%luK) items+table+hash, %f density\n",
         hp->name,
         count,
         hp->items.nel,
         hp->tab.nel,
         hp->items.nel * hp->items.size / 1024,
- hp->tab.nel * sizeof( ITEM ** ) / 1024,
+ (long unsigned)hp->tab.nel * sizeof( ITEM ** ) / 1024,
         (float)count / (float)sets );
 }

Modified: branches/release/tools/jam/src/hcache.c
==============================================================================
--- branches/release/tools/jam/src/hcache.c (original)
+++ branches/release/tools/jam/src/hcache.c 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -166,7 +166,7 @@
 {
     if ( !s )
         s = "";
- fprintf( f, "%lu\t%s\n", strlen( s ), s );
+ fprintf( f, "%lu\t%s\n", (long unsigned)strlen( s ), s );
 }
 
 

Modified: branches/release/tools/jam/src/jam.c
==============================================================================
--- branches/release/tools/jam/src/jam.c (original)
+++ branches/release/tools/jam/src/jam.c 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -200,6 +200,8 @@
 }
 #endif
 
+int anyhow = 0;
+
 #ifdef HAVE_PYTHON
     extern PyObject * bjam_call ( PyObject * self, PyObject * args );
     extern PyObject * bjam_import_rule ( PyObject * self, PyObject * args );
@@ -214,7 +216,6 @@
     char * s;
     struct option optv[N_OPTS];
     char const * all = "all";
- int anyhow = 0;
     int status;
     int arg_c = argc;
     char * * arg_v = argv;
@@ -448,6 +449,9 @@
             }
         }
 
+ if (!targets_to_update())
+ mark_target_for_updating("all");
+
         /* Parse ruleset. */
         {
             FRAME frame[ 1 ];
@@ -476,16 +480,45 @@
             ++globs.noexec;
         }
 
+ /* The build system may set the PARALLELISM variable to override -j
+ options. */
+ {
+ LIST *p = L0;
+ p = var_get ("PARALLELISM");
+ if (p)
+ {
+ int j = atoi (p->string);
+ if (j == -1)
+ {
+ printf( "Invalid value of PARALLELISM: %s\n", p->string);
+ }
+ else
+ {
+ globs.jobs = j;
+ }
+ }
+ }
+
+ /* KEEP_GOING overrides -q option. */
+ {
+ LIST *p = L0;
+ p = var_get ("KEEP_GOING");
+ if (p)
+ {
+ int v = atoi (p->string);
+ if (v == 0)
+ globs.quitquick = 1;
+ else
+ globs.quitquick = 0;
+ }
+ }
+
         /* Now make target. */
         {
             PROFILE_ENTER( MAIN_MAKE );
 
             LIST * targets = targets_to_update();
- if ( !targets )
- {
- status |= make( 1, &all, anyhow );
- }
- else
+ if (targets)
             {
                 int targets_count = list_length( targets );
                 const char * * targets2 = (const char * *)

Modified: branches/release/tools/jam/src/jam.h
==============================================================================
--- branches/release/tools/jam/src/jam.h (original)
+++ branches/release/tools/jam/src/jam.h 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -410,6 +410,7 @@
 #include <signal.h>
 #include <string.h>
 #include <time.h>
+#include <unistd.h>
 
 #ifndef OS_QNX
     #include <memory.h>
@@ -452,6 +453,7 @@
 
 #if defined( _i386_ ) || \
     defined( __i386__ ) || \
+ defined( __i386 ) || \
     defined( _M_IX86 )
     #define OSPLAT "OSPLAT=X86"
 #endif
@@ -469,7 +471,8 @@
 #endif
 
 
-#ifdef __sparc__
+#if defined( __sparc__ ) || \
+ defined( __sparc )
     #define OSPLAT "OSPLAT=SPARC"
 #endif
 

Modified: branches/release/tools/jam/src/lists.h
==============================================================================
--- branches/release/tools/jam/src/lists.h (original)
+++ branches/release/tools/jam/src/lists.h 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -63,7 +63,7 @@
 
 typedef struct _lol LOL;
 
-# define LOL_MAX 9
+# define LOL_MAX 19
 
 struct _lol {
     int count;

Modified: branches/release/tools/jam/src/make1.c
==============================================================================
--- branches/release/tools/jam/src/make1.c (original)
+++ branches/release/tools/jam/src/make1.c 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -839,12 +839,20 @@
     /* If the command was interrupted or failed and the target is not
      * "precious", remove the targets.
      */
- if ( ( status != EXEC_CMD_OK ) && !( cmd->rule->actions->flags & RULE_TOGETHER ) )
+ if (status != EXEC_CMD_OK)
     {
         LIST * targets = lol_get( &cmd->args, 0 );
         for ( ; targets; targets = list_next( targets ) )
- if ( !unlink( targets->string ) )
+ {
+ int need_unlink = 1;
+ TARGET* t = bindtarget ( targets->string );
+ if (t->flags & T_FLAG_PRECIOUS)
+ {
+ need_unlink = 0;
+ }
+ if (need_unlink && !unlink( targets->string ) )
                 printf( "...removing %s\n", targets->string );
+ }
     }
 
     /* Free this command and call make1c() to move onto the next one scheduled

Modified: branches/release/tools/jam/src/output.c
==============================================================================
--- branches/release/tools/jam/src/output.c (original)
+++ branches/release/tools/jam/src/output.c 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -78,8 +78,8 @@
           break;
     }
 
- /* Print out the command output, if requested. */
- if ( action )
+ /* Print out the command output, if requested, or if the program failed. */
+ if ( action || exit_reason != EXIT_OK)
     {
         /* But only output for non-quietly actions. */
         if ( ( 0 != out_data ) &&

Modified: branches/release/tools/jam/src/patchlevel.h
==============================================================================
--- branches/release/tools/jam/src/patchlevel.h (original)
+++ branches/release/tools/jam/src/patchlevel.h 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -9,9 +9,9 @@
 
 #define VERSION_MAJOR 3
 #define VERSION_MINOR 1
-#define VERSION_PATCH 17
+#define VERSION_PATCH 18
 #define VERSION_MAJOR_SYM "03"
 #define VERSION_MINOR_SYM "1"
-#define VERSION_PATCH_SYM "17"
-#define VERSION "3.1.17"
+#define VERSION_PATCH_SYM "18"
+#define VERSION "3.1.18"
 #define JAMVERSYM "JAMVERSION=3.1"

Modified: branches/release/tools/jam/src/rules.h
==============================================================================
--- branches/release/tools/jam/src/rules.h (original)
+++ branches/release/tools/jam/src/rules.h 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -166,6 +166,8 @@
  */
 #define T_FLAG_ISFILE 0x0400
 
+#define T_FLAG_PRECIOUS 0x0800
+
     char binding; /* how target relates to a real file or
                                        * folder
                                        */

Added: branches/release/tools/jam/test/rule_param.jam
==============================================================================
--- (empty file)
+++ branches/release/tools/jam/test/rule_param.jam 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -0,0 +1,60 @@
+#~ Copyright 2008 Jonathan Biggar
+#~ Distributed under the Boost Software License, Version 1.0.
+#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+ECHO -- Testing parameter passing... ;
+
+rule test_numeric_params
+{
+ assert $(1) : (==) : 1 ;
+ assert $(2) : (==) : 2 ;
+ assert $(3) : (==) : 3 ;
+ assert $(4) : (==) : 4 ;
+ assert $(5) : (==) : 5 ;
+ assert $(6) : (==) : 6 ;
+ assert $(7) : (==) : 7 ;
+ assert $(8) : (==) : 8 ;
+ assert $(9) : (==) : 9 ;
+ assert $(10) : (==) : 10 ;
+ assert $(11) : (==) : 11 ;
+ assert $(12) : (==) : 12 ;
+ assert $(13) : (==) : 13 ;
+ assert $(14) : (==) : 14 ;
+ assert $(15) : (==) : 15 ;
+ assert $(16) : (==) : 16 ;
+ assert $(17) : (==) : 17 ;
+ assert $(18) : (==) : 18 ;
+ assert $(19) : (==) : 19 ;
+}
+
+rule test_named_params ( p1 : p2 : p3 : p4 : p5 : p6 : p7 : p8 : p9 :
+ p10 : p11 : p12 : p13 : p14 : p15 : p16 : p17 : p18 : p19 )
+
+
+{
+ assert $(p1) : (==) : 1 ;
+ assert $(p2) : (==) : 2 ;
+ assert $(p3) : (==) : 3 ;
+ assert $(p4) : (==) : 4 ;
+ assert $(p5) : (==) : 5 ;
+ assert $(p6) : (==) : 6 ;
+ assert $(p7) : (==) : 7 ;
+ assert $(p8) : (==) : 8 ;
+ assert $(p9) : (==) : 9 ;
+ assert $(p10) : (==) : 10 ;
+ assert $(p11) : (==) : 11 ;
+ assert $(p12) : (==) : 12 ;
+ assert $(p13) : (==) : 13 ;
+ assert $(p14) : (==) : 14 ;
+ assert $(p15) : (==) : 15 ;
+ assert $(p16) : (==) : 16 ;
+ assert $(p17) : (==) : 17 ;
+ assert $(p18) : (==) : 18 ;
+ assert $(p19) : (==) : 19 ;
+}
+
+test_numeric_params 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 :
+ 10 : 11 : 12 : 13 : 14 : 15 : 16 : 17 : 18 : 19 ;
+
+test_named_params 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 :
+ 10 : 11 : 12 : 13 : 14 : 15 : 16 : 17 : 18 : 19 ;

Modified: branches/release/tools/jam/test/test.jam
==============================================================================
--- branches/release/tools/jam/test/test.jam (original)
+++ branches/release/tools/jam/test/test.jam 2010-04-20 07:51:08 EDT (Tue, 20 Apr 2010)
@@ -14,6 +14,7 @@
     parallel_actions
     parallel_multifile_actions_1
     parallel_multifile_actions_2
+ rule_param
     stress_var_expand
     target_var
     var_expand


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk