$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: jurko.gospodnetic_at_[hidden]
Date: 2008-01-05 13:13:11
Author: jurko
Date: 2008-01-05 13:13:10 EST (Sat, 05 Jan 2008)
New Revision: 42489
URL: http://svn.boost.org/trac/boost/changeset/42489
Log:
Removed or simplified some import calls. Comment updates. Minor stylistic changes.
Text files modified: 
   trunk/tools/build/v2/build/generators.jam     |   526 +++++++++++-----------                  
   trunk/tools/build/v2/build/modifiers.jam      |     8                                         
   trunk/tools/build/v2/build/targets.jam        |   887 ++++++++++++++++++++------------------- 
   trunk/tools/build/v2/build/type.jam           |   260 ++++++-----                             
   trunk/tools/build/v2/build/virtual-target.jam |   470 +++++++++++----------                   
   trunk/tools/build/v2/tools/package.jam        |     2                                         
   trunk/tools/build/v2/tools/stage.jam          |   335 +++++++-------                          
   7 files changed, 1266 insertions(+), 1222 deletions(-)
Modified: trunk/tools/build/v2/build/generators.jam
==============================================================================
--- trunk/tools/build/v2/build/generators.jam	(original)
+++ trunk/tools/build/v2/build/generators.jam	2008-01-05 13:13:10 EST (Sat, 05 Jan 2008)
@@ -5,22 +5,23 @@
 #    (See accompanying file LICENSE_1_0.txt or copy at
 #          http://www.boost.org/LICENSE_1_0.txt)
 
-#  Manages 'generators' --- objects which can do transformation between different
-#  target types and contain algorithm for finding transformation from sources
-#  to targets.
+#  Manages 'generators' --- objects which can do transformation between
+#  different target types and contain algorithm for finding transformation from
+#  sources to targets.
 #
 #  The main entry point to this module is generators.construct rule. It is given
 #  a list of source targets, desired target type and a set of properties.
-#  It starts by selecting 'viable generators', which have any chances of producing
-#  the desired target type with the required properties. Generators are ranked and
-#  a set of most specific ones is selected.
-# 
-#  The most specific generators have their 'run' methods called, with the properties
-#  and list of sources. Each one selects target which can be directly consumed, and
-#  tries to convert the remaining ones to the types it can consume. This is done
-#  by recursively calling 'construct' with all consumable types.
+#  It starts by selecting 'viable generators', which have any chances of
+#  producing the desired target type with the required properties. Generators
+#  are ranked and a set of most specific ones is selected.
 #
-#  If the generator has collected all the targets it needs, it creates targets 
+#  The most specific generators have their 'run' methods called, with the
+#  properties and list of sources. Each one selects target which can be directly
+#  consumed, and tries to convert the remaining ones to the types it can
+#  consume. This is done by recursively calling 'construct' with all consumable
+#  types.
+#
+#  If the generator has collected all the targets it needs, it creates targets
 #  corresponding to result, and returns it. When all generators have been run,
 #  results of one of them are selected and returned as result.
 #
@@ -31,7 +32,7 @@
 #  Likewise, when generator tries to convert sources to consumable types, it can get
 #  more targets that it was asked for. The question is what to do with extra targets.
 #  Boost.Build attempts to convert them to requested types, and attempts as early as
-#  possible. Specifically, this is done after invoking each generator. (Later I'll 
+#  possible. Specifically, this is done after invoking each generator. (Later I'll
 #  document the rationale for trying extra target conversion at that point).
 #
 #  That early conversion is not always desirable. Suppose a generator got a source of
@@ -42,7 +43,7 @@
 #  'construct' rule has a parameter, telling if multiple targets can be returned. If
 #  the parameter is false, conversion of extra targets is not performed.
 
-import "class" : is-a new ;
+import "class" : new ;
 import container ;
 import utility : str equal ;
 import set sequence ;
@@ -50,8 +51,8 @@
 import virtual-target ;
 import property-set ;
 
-if "--debug-generators" in [ modules.peek : ARGV ] 
-{    
+if "--debug-generators" in [ modules.peek : ARGV ]
+{
     .debug = true ;
 }
 
@@ -61,9 +62,9 @@
 local rule generators.dout ( message * )
 {
     if $(.debug)
-    {                
+    {
         ECHO [ sequence.transform utility.str : $(message) ] ;
-    }    
+    }
 }
 
 
@@ -92,7 +93,7 @@
 }
 
 # Creates a generator
-class generator 
+class generator
 {
     import generators ;
     import assert ;
@@ -107,41 +108,41 @@
     import virtual-target ;
     import "class" : new ;
     import property ;
-   
+
     EXPORT class_at_generator : indent increase-indent decrease-indent generators.dout ;
-    
-    rule __init__ (  
+
+    rule __init__ (
       id # identifies the generator - should be name of the rule which
          # sets up build actions
       composing ? # whether generator processes each source target in
                   # turn, converting it to required types.
                   # Ordinary generators pass all sources together to
                   # recusrive generators.construct-types call.
-    
+
     : source-types *  # types that this generator can handle.  If
                       # empty, the generator can consume anything.
-    
-    : target-types-and-names +   
+
+    : target-types-and-names +
       # types the generator will create and, optionally, names for
       # created targets. Each element should have the form
       #    type["(" name-pattern ")"]
       # for example, obj(%_x). Name of generated target will be found
       # by replacing % with the name of source, provided explicit name
       # was not specified.
-    
+
     : requirements *
                 )
-    {                    
+    {
         self.id = $(id) ;
         self.composing = $(composing) ;
         self.source-types = $(source-types) ;
         self.target-types-and-names = $(target-types-and-names) ;
         self.requirements = $(requirements) ;
-        
+
         for local e in $(target-types-and-names)
-        {        
+        {
             # Create three parallel lists: one with the list of target types,
-            # and two other with prefixes and postfixes to be added to target 
+            # and two other with prefixes and postfixes to be added to target
             # name. We use parallel lists for prefix and postfix (as opposed
             # to mapping), because given target type might occur several times,
             # for example "H H(%_symbols)".
@@ -150,14 +151,14 @@
             self.name-prefix += $(m[3]:E="") ;
             self.name-postfix += $(m[4]:E="") ;
         }
-                                    
+
         # Note that 'transform' here, is the same as 'for_each'.
         sequence.transform type.validate : $(self.source-types) ;
         sequence.transform type.validate : $(self.target-types) ;
     }
-                            
+
     ############## End of constructor #################
-    
+
     rule id ( )
     {
         return $(self.id) ;
@@ -171,14 +172,14 @@
 
     # Returns the list of target types that this generator produces.
     # It is assumed to be always the same -- i.e. it cannot change depending
-    # list of sources.    
+    # list of sources.
     rule target-types ( )
     {
         return $(self.target-types) ;
     }
-    
+
     # Returns the required properties for this generator. Properties
-    # in returned set must be present in build properties if this 
+    # in returned set must be present in build properties if this
     # generator is to be used. If result has grist-only element,
     # that build properties must include some value of that feature.
     # XXX: remove this method?
@@ -186,8 +187,8 @@
     {
         return $(self.requirements) ;
     }
-    
-    # Returns a true value if the generator can be run with the specified 
+
+    # Returns a true value if the generator can be run with the specified
     # properties.
     rule match-rank ( property-set-to-match )
     {
@@ -196,7 +197,7 @@
         # (i.e. grist-only element), as matching any value of the
         # feature.
         local all-requirements = [ requirements ] ;
-        
+
         local property-requirements feature-requirements ;
         for local r in $(all-requirements)
         {
@@ -207,11 +208,11 @@
             else
             {
                 feature-requirements += $(r) ;
-            }                      
+            }
         }
 
         local properties-to-match = [ $(property-set-to-match).raw ] ;
-        if $(property-requirements) in $(properties-to-match) 
+        if $(property-requirements) in $(properties-to-match)
            && $(feature-requirements) in $(properties-to-match:G)
         {
             return true ;
@@ -221,7 +222,7 @@
             return ;
         }
     }
-    
+
     # Returns another generator which differers from $(self) in
     # - id
     # - value to <toolset> feature in properties
@@ -229,14 +230,14 @@
     {
         return [ new $(__class__) $(new-id) $(self.composing)
                  : $(self.source-types)
-                 : $(self.target-types-and-names) 
+                 : $(self.target-types-and-names)
                  # Note: this does not remove any subfeatures of <toolset>
                  # which might cause problems
                  : [ property.change $(self.requirements) : <toolset> ]
                    $(new-toolset-properties)
                ] ;
     }
-    
+
     # Creates another generator that is the same as $(self), except that
     # if 'base' is in target types of $(self), 'type' will in target types
     # of the new generator.
@@ -253,37 +254,37 @@
             else
             {
                 target-types += $(t) ;
-            }                                        
+            }
         }
-                
+
         return [ new $(__class__) $(self.id) $(self.composing)
                  : $(self.source-types)
-                 : $(target-types) 
+                 : $(target-types)
                  : $(self.requirements)
                ] ;
     }
 
-    
+
     # Tries to invoke this generator on the given sources. Returns a
     # list of generated targets (instances of 'virtual-target').
     # Returning nothing from run indicates that the generator was
     # unable to create the target.
     rule run ( project  # Project for which the targets are generated
-               name ?   # Determines the name of 'name' attribute for 
+               name ?   # Determines the name of 'name' attribute for
                         # all generated targets. See 'generated-targets' method.
                : property-set # Desired properties for generated targets.
                : sources +  # Source targets.
             )
-    {       
+    {
         generators.dout [ indent ] "  ** generator" $(self.id) ;
         generators.dout [ indent ] "  multiple:" $(mutliple) ;
-        generators.dout [ indent ] "  composing:" $(self.composing) ;        
-        
+        generators.dout [ indent ] "  composing:" $(self.composing) ;
+
         if ! $(self.composing) && $(sources[2]) && $(self.source-types[2])
         {
             errors.error "Unsupported source/source-type combination" ;
         }
-               
+
         # We don't run composing generators if no name is specified. The reason
         # is that composing generator combines several targets, which can have
         # different names, and it cannot decide which name to give for produced
@@ -292,43 +293,43 @@
         # This in effect, means that composing generators are runnable only
         # at top-level of transofrmation graph, or if name is passed explicitly.
         # Thus, we dissallow composing generators in the middle. For example, the
-        # transofrmation CPP -> OBJ -> STATIC_LIB -> RSP -> EXE won't be allowed 
+        # transofrmation CPP -> OBJ -> STATIC_LIB -> RSP -> EXE won't be allowed
         # (the OBJ -> STATIC_LIB generator is composing)
         if ! $(self.composing) || $(name)
-        {            
+        {
             run-really $(project) $(name) : $(property-set) : $(sources) ;
-        }        
+        }
     }
-    
-    
+
+
     rule run-really ( project name ? : property-set : sources + )
     {
         # Targets that this generator will consume directly.
         local consumed = ;
         # Targets that can't be consumed and will be returned as-is.
         local bypassed = ;
-        
+
         if $(self.composing)
         {
             convert-multiple-sources-to-consumable-types $(project)
-              : $(property-set) : $(sources) : consumed bypassed ;            
+              : $(property-set) : $(sources) : consumed bypassed ;
         }
         else
-        {               
-            convert-to-consumable-types $(project) $(name) : 
-              $(property-set) : $(sources) 
+        {
+            convert-to-consumable-types $(project) $(name) :
+              $(property-set) : $(sources)
                 :
                 : consumed bypassed ;
         }
-                
+
         local result ;
-        if $(consumed)  
-        {            
-            result = [ construct-result $(consumed) : $(project) $(name) 
+        if $(consumed)
+        {
+            result = [ construct-result $(consumed) : $(project) $(name)
                      : $(property-set) ] ;
         }
-                            
-                
+
+
         if $(result)
         {
            generators.dout [ indent ] "  SUCCESS: " $(result) ;
@@ -338,18 +339,18 @@
             generators.dout [ indent ] "  FAILURE" ;
         }
         generators.dout ;
-        return $(result) ;        
+        return $(result) ;
     }
 
-    # Constructs the dependency graph that will be returned by this 
+    # Constructs the dependency graph that will be returned by this
     # generator
-    rule construct-result ( 
+    rule construct-result (
         consumed + # Already prepared list of consumable targets
-                   # If generator requires several source files will contain 
+                   # If generator requires several source files will contain
                    # exactly len $(self.source-types) targets with matching types
-                   # Otherwise, might contain several targets with the type of 
-                   # $(self.source-types[1])                               
-        : project name ? 
+                   # Otherwise, might contain several targets with the type of
+                   # $(self.source-types[1])
+        : project name ?
         : property-set  # Properties to be used for all actions create here
     )
     {
@@ -358,21 +359,21 @@
         if ! $(self.source-types[2]) && ! $(self.composing)
         {
             for local r in $(consumed)
-            {                
+            {
                 result += [ generated-targets $(r) : $(property-set) : $(project) $(name) ] ; #(targets) ;
             }
         }
         else
         {
-            if $(consumed) 
+            if $(consumed)
             {
-                result += [ generated-targets $(consumed) : $(property-set) 
+                result += [ generated-targets $(consumed) : $(property-set)
                             : $(project) $(name) ] ;
-            }                        
+            }
         }
         return $(result) ;
     }
-    
+
     # Determine the name of the produced target from the
     # names of the sources.
     rule determine-output-name ( sources + )
@@ -387,7 +388,7 @@
         # dot. In the second case -- no sure, but for now take
         # the part till the last dot too.
         name = [ utility.basename [ $(sources[1]).name ] ] ;
-                        
+
         for local s in $(sources[2])
         {
             local n2 = [ utility.basename [ $(s).name ] ] ;
@@ -396,23 +397,23 @@
                 error "$(self.id): source targets have different names: cannot determine target name" ;
             }
         }
-        
+
         # Names of sources might include directory. We should strip it.
         name = $(name:D=) ;
-        
+
         return $(name) ;
     }
-    
+
     # Constructs targets that are created after consuming 'sources'.
     # The result will be the list of virtual-target, which the same length
     # as 'target-types' attribute and with corresponding types.
-    # 
-    # When 'name' is empty, all source targets must have the same value of 
+    #
+    # When 'name' is empty, all source targets must have the same value of
     # the 'name' attribute, which will be used instead of the 'name' argument.
     #
     # The value of 'name' attribute for each generated target will be equal to
     # the 'name' parameter if there's no name pattern for this type. Otherwise,
-    # the '%' symbol in the name pattern will be replaced with the 'name' parameter 
+    # the '%' symbol in the name pattern will be replaced with the 'name' parameter
     # to obtain the 'name' attribute.
     #
     # For example, if targets types are T1 and T2(with name pattern "%_x"), suffixes
@@ -421,7 +422,7 @@
     # basename of a file.
     #
     # Note that this pattern mechanism has nothing to do with implicit patterns
-    # in make. It's a way to produce target which name is different for name of 
+    # in make. It's a way to produce target which name is different for name of
     # source.
     rule generated-targets ( sources + : property-set : project name ? )
     {
@@ -429,83 +430,83 @@
         {
             name = [ determine-output-name $(sources) ] ;
         }
-        
+
         # Assign an action for each target
         local action = [ action-class ] ;
-        local a = [ class.new $(action) $(sources) : $(self.id) : 
+        local a = [ class.new $(action) $(sources) : $(self.id) :
                     $(property-set) ] ;
-                
+
         # Create generated target for each target type.
         local targets ;
         local pre = $(self.name-prefix) ;
         local post = $(self.name-postfix) ;
-        for local t in $(self.target-types)                 
-        {      
+        for local t in $(self.target-types)
+        {
             local generated-name = $(pre[1])$(name)$(post[1]) ;
             pre = $(pre[2-]) ;
             post = $(post[2-]) ;
-            
-            targets += [ class.new file-target $(generated-name) 
+
+            targets += [ class.new file-target $(generated-name)
               : $(t) : $(project) : $(a) ] ;
-        }                 
-        
+        }
+
         return [ sequence.transform virtual-target.register : $(targets) ] ;
-    }    
-    
+    }
+
     # Attempts to convert 'source' to the types that this generator can
     # handle. The intention is to produce the set of targets can should be
     # used when generator is run.
-    rule convert-to-consumable-types ( project name ? : 
-        property-set : sources +  
+    rule convert-to-consumable-types ( project name ? :
+        property-set : sources +
         : only-one ? # convert 'source' to only one of source types
                      # if there's more that one possibility, report an
-                     # error 
-        : consumed-var # name of variable which recieves all targets which 
-                       # can be consumed. 
-          bypassed-var # name variable which recieves all targets which 
-                       # cannot be consumed  
+                     # error
+        : consumed-var # name of variable which recieves all targets which
+                       # can be consumed.
+          bypassed-var # name variable which recieves all targets which
+                       # cannot be consumed
     )
-    {        
+    {
         # We're likely to be passed 'consumed' and 'bypassed'
         # var names. Use "_" to avoid name conflicts.
         local _consumed ;
         local _bypassed ;
-        local missing-types ; 
+        local missing-types ;
 
         if $(sources[2])
         {
-            # Don't know how to handle several sources yet. Just try 
+            # Don't know how to handle several sources yet. Just try
             # to pass the request to other generator
             missing-types = $(self.source-types) ;
         }
         else
-        {            
+        {
             consume-directly $(sources) : _consumed : missing-types ;
         }
-        
+
         # No need to search for transformation if
         # some source type has consumed source and
         # no more source types are needed.
-        if $(only-one) && $(_consumed) 
+        if $(only-one) && $(_consumed)
         {
             missing-types = ;
         }
-            
+
         #TODO: we should check that only one source type
         #if create of 'only-one' is true.
         # TODO: consider if consuned/bypassed separation should
         # be done by 'construct-types'.
-                    
+
         if $(missing-types)
-        {            
+        {
             local transformed = [ generators.construct-types $(project) $(name)
               : $(missing-types) : $(property-set) : $(sources) ] ;
-                                
+
             # Add targets of right type to 'consumed'. Add others to
             # 'bypassed'. The 'generators.construct' rule has done
             # its best to convert everything to the required type.
             # There's no need to rerun it on targets of different types.
-                
+
             # NOTE: ignoring usage requirements
             for local t in $(transformed[2-])
             {
@@ -517,34 +518,34 @@
                 {
                     _bypassed += $(t) ;
                 }
-            }               
-        }   
-        
-        _consumed = [ sequence.unique $(_consumed) ] ;        
+            }
+        }
+
+        _consumed = [ sequence.unique $(_consumed) ] ;
         _bypassed = [ sequence.unique $(_bypassed) ] ;
-        
+
         # remove elements of '_bypassed' that are in '_consumed'
-        
-        # Suppose the target type of current generator, X is produced from 
+
+        # Suppose the target type of current generator, X is produced from
         # X_1 and X_2, which are produced from Y by one generator.
         # When creating X_1 from Y, X_2 will be added to 'bypassed'
         # Likewise, when creating X_2 from Y, X_1 will be added to 'bypassed'
         # But they are also in 'consumed'. We have to remove them from
         # bypassed, so that generators up the call stack don't try to convert
-        # them. 
-            
+        # them.
+
         # In this particular case, X_1 instance in 'consumed' and X_1 instance
         # in 'bypassed' will be the same: because they have the same source and
         # action name, and 'virtual-target.register' won't allow two different
         # instances. Therefore, it's OK to use 'set.difference'.
-        
+
         _bypassed = [ set.difference $(_bypassed) : $(_consumed) ] ;
-        
-                
+
+
         $(consumed-var) += $(_consumed) ;
         $(bypassed-var) += $(_bypassed) ;
     }
-    
+
     # Converts several files to consumable types.
     rule convert-multiple-sources-to-consumable-types
       ( project : property-set : sources * : consumed-var bypassed-var )
@@ -562,23 +563,23 @@
             {
                 generators.dout [ indent ] " failed to convert " $(source) ;
             }
-            $(consumed-var) += $(_c) ;            
+            $(consumed-var) += $(_c) ;
             $(bypassed-var) += $(_b) ;
-        }           
+        }
     }
-        
+
     rule consume-directly ( source : consumed-var : missing-types-var )
     {
         local real-source-type = [ $(source).type ] ;
-        
+
         # If there are no source types, we can consume anything
         local source-types = $(self.source-types) ;
         source-types ?= $(real-source-type) ;
-        
+
         for local st in $(source-types)
         {
             # The 'source' if of right type already)
-            if $(real-source-type) = $(st) || 
+            if $(real-source-type) = $(st) ||
               [ type.is-derived $(real-source-type) $(st) ]
             {
                 $(consumed-var) += $(source) ;
@@ -587,16 +588,16 @@
             {
                $(missing-types-var) += $(st) ;
             }
-        }        
+        }
     }
-    
-    
-    # Returns the class to be used to actions. Default implementation 
+
+
+    # Returns the class to be used to actions. Default implementation
     # returns "action".
     rule action-class ( )
     {
         return "action" ;
-    }        
+    }
 }
 
 import errors : error ;
@@ -607,24 +608,24 @@
 rule register ( g )
 {
     .generators += $(g) ;
-                   
+
     # A generator can produce several targets of the
     # same type. We want unique occurence of that generator
     # in .generators.$(t) in that case, otherwise, it will
     # be tried twice and we'll get false ambiguity.
     for local t in [ sequence.unique [ $(g).target-types ] ]
-    {            
+    {
         .generators.$(t) += $(g) ;
-    }    
-    
+    }
+
     # Update the set of generators for toolset
-    
+
     # TODO: should we check that generator with this id
     # is not already registered. For example, the fop.jam
     # module intentionally declared two generators with the
     # same id, so such check will break it.
     local id = [ $(g).id ] ;
-        
+
     # Some generators have multiple periods in their name, so the
     # normal $(id:S=) won't generate the right toolset name.
     # e.g. if id = gcc.compile.c++, then
@@ -640,7 +641,7 @@
     }
     .generators-for-toolset.$(base) += $(g) ;
 }
-    
+
 # Creates new instance of the 'generator' class and registers it.
 # Retursn the creates instance.
 # Rationale: the instance is returned so that it's possible to first register
@@ -650,7 +651,7 @@
 {
     local g = [ new generator $(id) : $(source-types) : $(target-types)
       : $(requirements) ] ;
-    register $(g) ;   
+    register $(g) ;
     return $(g) ;
 }
 
@@ -658,7 +659,7 @@
 # registers it.
 rule register-composing ( id : source-types * : target-types + : requirements * )
 {
-    local g = [ new generator $(id) true : $(source-types) 
+    local g = [ new generator $(id) true : $(source-types)
                 : $(target-types) : $(requirements) ] ;
     register $(g) ;
     return $(g) ;
@@ -682,12 +683,12 @@
 # running any of them.
 rule override ( overrider-id : overridee-id )
 {
-    .override.$(overrider-id) += $(overridee-id) ;    
+    .override.$(overrider-id) += $(overridee-id) ;
 }
 
 
 
-    
+
 # Set if results of the current generators search are going to be cached
 # This means no futher attempts to cache generators search should be
 # made.
@@ -704,23 +705,23 @@
     local generators ;
 
     local t = [ type.all-bases $(target-type) ] ;
-    
+
     local result ;
-    # 't' is the list of types which are not yet processed    
+    # 't' is the list of types which are not yet processed
     while $(t)
     {
-        # Find all generators for current type. 
+        # Find all generators for current type.
         # Unlike 'find-viable-generators' we don't care about property-set.
         local generators = $(.generators.$(t[1])) ;
         t = $(t[2-]) ;
-        
 
-        
+
+
         while $(generators)
         {
             local g = $(generators[1]) ;
             generators = $(generators[2-]) ;
-            
+
             if ! [ $(g).source-types ]
             {
                 # Empty source types -- everything can be accepted
@@ -730,10 +731,10 @@
                 # This will terminate outer loop.
                 t = ;
             }
-              
-            for local source-type in [ $(g).source-types ] 
+
+            for local source-type in [ $(g).source-types ]
             {
-                if ! $(source-type) in $(result) 
+                if ! $(source-type) in $(result)
                 {
                     # If generator accepts 'source-type' it
                     # will happily accept any type derived from it
@@ -741,19 +742,19 @@
                     for local n in $(all)
                     {
                         if ! $(n) in $(result)
-                        {   
+                        {
                             t += $(n) ;
                             result += $(n) ;
-                        }    
-                    }                    
-                }                
-            }            
-        }        
-    }          
-        
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     result = [ sequence.unique $(result) ] ;
-    
-    return $(result) ;                
+
+    return $(result) ;
 }
 
 # Helper rule, caches the result of 'viable-source-types-real'.
@@ -769,18 +770,18 @@
         }
         $(key) = $(v) ;
     }
-    
+
     if $($(key)) != none
     {
         return $($(key)) ;
-    }        
+    }
 }
 
 # Returns the list of source types, which, when passed to 'run'
 # method of 'generator', has some change of being eventually used
 # (probably after conversion by other generators)
-rule viable-source-types-for-generator-real ( generator ) 
-{        
+rule viable-source-types-for-generator-real ( generator )
+{
     local source-types = [ $(generator).source-types ] ;
     if ! $(source-types)
     {
@@ -792,21 +793,21 @@
         return * ;
     }
     else
-    {            
+    {
         local result ;
         for local s in $(source-types)
         {
-            result += [ type.all-derived $(s) ] 
+            result += [ type.all-derived $(s) ]
               [ generators.viable-source-types $(s) ] ;
         }
-        result = [ sequence.unique $(result) ] ;        
+        result = [ sequence.unique $(result) ] ;
         if * in $(result)
         {
             result = * ;
-        }        
+        }
         return $(result) ;
-    }        
-}    
+    }
+}
 
 # Helper rule, caches the result of 'viable-source-types-for-genrator'.
 local rule viable-source-types-for-generator ( generator )
@@ -819,19 +820,19 @@
         {
             v = none ;
         }
-        $(key) = $(v) ;        
+        $(key) = $(v) ;
     }
-    
+
     if $($(key)) != none
     {
         return $($(key)) ;
-    }        
+    }
 }
 
 
 
 # Returns usage requirements + list of created targets
-local rule try-one-generator-really ( project name ? : generator : 
+local rule try-one-generator-really ( project name ? : generator :
     target-type : property-set : sources * )
 {
     local targets =
@@ -839,16 +840,16 @@
                        : $(property-set)
                        : $(sources)
       ] ;
-            
+
     local usage-requirements ;
     local success ;
-    
+
     generators.dout [ indent ] returned $(targets) ;
-    
+
     if $(targets)
     {
         success = true ;
-    
+
         if  [ class.is-a $(targets[1]) : property-set ]
         {
             usage-requirements = $(targets[1]) ;
@@ -859,15 +860,14 @@
             usage-requirements = [ property-set.empty ] ;
         }
     }
-    
+
     generators.dout [ indent ] "  generator" [ $(generator).id ] " spawned " ;
-    generators.dout [ indent ] " " $(targets) ; 
+    generators.dout [ indent ] " " $(targets) ;
     if $(usage-requirements)
     {
         generators.dout [ indent ] "  with usage requirements:" $(x) ;
     }
-    
-    
+
     if $(success)
     {
         return $(usage-requirements) $(targets) ;
@@ -877,37 +877,37 @@
 # Checks if generator invocation can be pruned, because it's guaranteed
 # to fail. If so, quickly returns empty list. Otherwise, calls
 # try-one-generator-really.
-local rule try-one-generator ( project name ? : generator : 
+local rule try-one-generator ( project name ? : generator :
     target-type : property-set : sources * )
-{    
+{
     local source-types ;
     for local s in $(sources)
     {
         source-types += [ $(s).type ] ;
     }
-    local viable-source-types = 
+    local viable-source-types =
       [ viable-source-types-for-generator $(generator) ] ;
-    
-    if  $(source-types) && $(viable-source-types) != * && 
-      ! [ set.intersection $(source-types) : $(viable-source-types) ] 
+
+    if  $(source-types) && $(viable-source-types) != * &&
+      ! [ set.intersection $(source-types) : $(viable-source-types) ]
     {
         local id = [ $(generator).id ] ;
         generators.dout [ indent ] "  ** generator '$(id)' pruned" ;
         #generators.dout [ indent ] "source-types" '$(source-types)' ;
         #generators.dout [ indent ] "viable-source-types" '$(viable-source-types)' ;
-    }          
+    }
     else {
         return [ try-one-generator-really $(project) $(name)
           : $(generator)
             : $(target-type) : $(property-set) : $(sources) ] ;
-    }       
+    }
 }
 
 rule construct-types ( project name ? : target-types + :
     property-set : sources + )
 {
     local result ;
-    local matched-types ; 
+    local matched-types ;
     local usage-requirements = [ property-set.empty ] ;
     for local t in $(target-types)
     {
@@ -922,7 +922,7 @@
     }
     # TODO: have to introduce parameter controlling if
     # several types can be matches and add appropriate
-    # checks 
+    # checks
 
     # TODO: need to review the documentation for
     # 'construct' to see if it should return $(source) even
@@ -938,7 +938,7 @@
     }
 }
 
-# Ensures all 'targets' have types. If this is not so, exists with 
+# Ensures all 'targets' have types. If this is not so, exists with
 # error.
 local rule ensure-type ( targets * )
 {
@@ -947,10 +947,10 @@
         if ! [ $(t).type ]
         {
             errors.error "target" [ $(t).str ] "has no type" ;
-        }        
-    }    
+        }
+    }
 }
-    
+
 # Returns generators which can be used to construct target of specified type
 # with specified properties. Uses the following algorithm:
 # - iterates over requested target-type and all it's bases (in the order returned bt
@@ -969,22 +969,22 @@
 
     import type ;
     local t = [ type.all-bases $(target-type) ] ;
-    
-    generators.dout  [ indent ] find-viable-generators target-type= $(target-type) 
+
+    generators.dout  [ indent ] find-viable-generators target-type= $(target-type)
       property-set= [ $(property-set).as-path ]
           ;
-    
+
     # Get the lit of generators for the requested type.
     # If no generator is registered, try base type, and so on.
     local generators ;
     while $(t[1])
     {
-        generators.dout  [ indent ] "trying type" $(t[1]) ;    
+        generators.dout  [ indent ] "trying type" $(t[1]) ;
         if $(.generators.$(t[1]))
         {
             generators.dout [ indent ] "there are generators for this type" ;
             generators = $(.generators.$(t[1])) ;
-            
+
             if $(t[1]) != $(target-type)
             {
                 # We're here, when no generators for target-type are found,
@@ -999,22 +999,22 @@
                     # for toolsets, which is a bit strange, but should work.
                     # That list is only used when inheriting toolset, which
                     # should have being done before generators are run.
-                    generators2 += [ 
+                    generators2 += [
                       $(g).clone-and-change-target-type $(t[1]) : $(target-type) ] ;
                     generators.register $(generators2[-1]) ;
-                }                
+                }
                 generators = $(generators2) ;
-            }                        
+            }
             t = ;
-        }        
-        t = $(t[2-]) ;            
+        }
+        t = $(t[2-]) ;
     }
-    
-    
+
+
     for local g in $(generators)
     {
         generators.dout [ indent ] "trying generator" [ $(g).id ] "(" [ $(g).source-types ] -> [ $(g).target-types ] ")" ;
-        
+
         local m = [ $(g).match-rank $(property-set) ] ;
         if $(m)
         {
@@ -1022,7 +1022,7 @@
             viable-generators += $(g) ;
         }
     }
-                            
+
     return $(viable-generators) ;
 }
 
@@ -1036,29 +1036,29 @@
         if ! $(l)
         {
             l = none ;
-        }        
+        }
         .fv.$(key) = $(l) ;
     }
-    
+
     if $(l) = none
     {
         l = ;
     }
-                    
+
     local viable-generators ;
     for local g in $(l)
     {
-        # Avoid trying the same generator twice on different levels.        
-        if ! $(g) in $(.active-generators) 
+        # Avoid trying the same generator twice on different levels.
+        if ! $(g) in $(.active-generators)
         {
             viable-generators += $(g) ;
-        }        
+        }
     }
-    
+
     # Generators which override 'all'.
     local all-overrides ;
     # Generators which are overriden
-    local overriden-ids ;    
+    local overriden-ids ;
     for local g in $(viable-generators)
     {
         local id = [ $(g).id ] ;
@@ -1067,8 +1067,8 @@
         if all in $(this-overrides)
         {
             all-overrides += $(g) ;
-        }        
-    }         
+        }
+    }
     if $(all-overrides)
     {
         viable-generators = $(all-overrides) ;
@@ -1079,12 +1079,12 @@
         if ! [ $(g).id ] in $(overriden-ids)
         {
             result += $(g) ;
-        }        
+        }
     }
-        
+
     return $(result) ;
-}    
-        
+}
+
 .construct-stack = ;
 
 # Attempts to construct target by finding viable generators, running them
@@ -1093,20 +1093,20 @@
    project name ? : target-type : property-set : sources * )
 {
     viable-generators = [ find-viable-generators $(target-type) : $(property-set) ] ;
-                        
-    generators.dout [ indent ] "*** " [ sequence.length $(viable-generators) ] 
+
+    generators.dout [ indent ] "*** " [ sequence.length $(viable-generators) ]
       " viable generators" ;
-    
+
     local result ;
     local generators-that-succeeded ;
     for local g in $(viable-generators)
     {
         # This variable will be restored on exit from this scope.
         local .active-generators = $(g) $(.active-generators) ;
-        
+
         local r = [ try-one-generator $(project) $(name) : $(g) : $(target-type) :
           $(property-set) : $(sources) ] ;
-        
+
         if $(r)
         {
             generators-that-succeeded += $(g) ;
@@ -1138,59 +1138,59 @@
             else
             {
                 result = $(r) ;
-            }            
+            }
         }
     }
-    
+
     return $(result) ;
-}       
-    
-        
+}
+
+
 # Attempts to create target of 'target-type' with 'properties'
 # from 'sources'. The 'sources' are treated as a collection of
 # *possible* ingridients -- i.e. it is not required to consume
 # them all. If 'multiple' is true, the rule is allowed to return
-# several targets of 'target-type'.          
+# several targets of 'target-type'.
 #
 #
 # Returns a list of target. When this invocation is first instance of
 # 'construct' in stack, returns only targets of requested 'target-type',
 # otherwise, returns also unused sources and additionally generated
-# targets.    
+# targets.
 rule construct ( project name ? : target-type : property-set * : sources * )
 {
     if (.construct-stack)
     {
         ensure-type $(sources) ;
     }
-        
+
     .construct-stack += 1 ;
 
     increase-indent ;
 
     if $(.debug)
-    {        
+    {
         generators.dout [ indent ] "*** construct" $(target-type) ;
-    
+
         for local s in $(sources)
         {
             generators.dout [ indent ] "    from" $(s) ;
         }
-        generators.dout [ indent ] "    properties:" [ $(property-set).raw ] ;        
+        generators.dout [ indent ] "    properties:" [ $(property-set).raw ] ;
     }
-    
-               
-    local result = [ construct-really $(project) $(name)  
+
+
+    local result = [ construct-really $(project) $(name)
       : $(target-type) : $(property-set) : $(sources) ] ;
-                    
+
     decrease-indent ;
-        
+
     .construct-stack = $(.construct-stack[2-]) ;
-                    
-    return $(result) ;        
+
+    return $(result) ;
 }
 
-# Given 'result', obtained from some generator or 
+# Given 'result', obtained from some generator or
 # generators.construct, adds 'raw-properties' as usage requirements
 # to it. If result already contains usage requirements -- that is
 # the first element of result of an instance of the property-set class,
@@ -1199,13 +1199,13 @@
 {
     if $(result)
     {
-        if [ class.is-a $(result[1]) : property-set ] 
+        if [ class.is-a $(result[1]) : property-set ]
         {
             return [ $(result[1]).add-raw $(raw-properties) ] $(result[2-]) ;
         }
         else
         {
             return [ property-set.create $(raw-properties) ] $(result) ;
-        }        
-    }    
+        }
+    }
 }
Modified: trunk/tools/build/v2/build/modifiers.jam
==============================================================================
--- trunk/tools/build/v2/build/modifiers.jam	(original)
+++ trunk/tools/build/v2/build/modifiers.jam	2008-01-05 13:13:10 EST (Sat, 05 Jan 2008)
@@ -153,10 +153,10 @@
     }
 }
 
-# A modifier that changes the name of a target, after it's generated, given
-# a regular expression to slpit the name, and a set of token to insert
-# between the split tokens of the name. This also exposes the target for other
-# uses with a symlink to the original name (optionally).
+# A modifier that changes the name of a target, after it's generated, given a
+# regular expression to split the name, and a set of token to insert between the
+# split tokens of the name. This also exposes the target for other uses with a
+# symlink to the original name (optionally).
 #
 class name-modifier : modifier
 {
Modified: trunk/tools/build/v2/build/targets.jam
==============================================================================
--- trunk/tools/build/v2/build/targets.jam	(original)
+++ trunk/tools/build/v2/build/targets.jam	2008-01-05 13:13:10 EST (Sat, 05 Jan 2008)
@@ -8,10 +8,10 @@
 
 #   Supports 'abstract' targets, which are targets explicitly defined in Jamfile.
 #
-#   Abstract targets are represented by classes derived from 'abstract-target' class. 
-#   The first abstract target is 'project-target', which is created for each
-#   Jamfile, and can be obtained by the 'target' rule in the Jamfile's module.
-#   (see project.jam). 
+#   Abstract targets are represented by classes derived from 'abstract-target'
+#   class. The first abstract target is 'project-target', which is created for
+#   each Jamfile, and can be obtained by the 'target' rule in the Jamfile's
+#   module (see project.jam).
 #
 #   Project targets keep a list of 'main-target' instances.
 #   A main target is what the user explicitly defines in a Jamfile. It is
@@ -26,131 +26,128 @@
 #
 #   Rules supplied by the build system will use only targets derived
 #   from 'basic-target' class, which will provide some default behaviour.
-#   There will be two classes derived from it, 'make-target', created by the
-#   'make' rule, and 'typed-target', created by rules such as 'exe' and 'dll'.
+#   There will be different classes derived from it such as 'make-target',
+#   created by the 'make' rule, and 'typed-target', created by rules such as
+#   'exe' and 'lib'.
 
 #
 #                         +------------------------+
 #                         |abstract-target         |
 #                         +========================+
 #                         |name                    |
-#                         |project                 |                                   
-#                         |                        |                                   
-#                         |generate(properties) = 0|                                   
-#                         +-----------+------------+                                   
-#                                     |                                                
-#                                     ^                                                
-#                                    / \                                               
-#                                   +-+-+                                              
-#                                     |                                                
-#                                     |                                                
-#            +------------------------+------+------------------------------+          
-#            |                               |                              |          
-#            |                               |                              |          
-# +----------+-----------+            +------+------+                +------+-------+  
-# | project-target       |            | main-target |                | basic-target |  
-# +======================+ 1        * +=============+  alternatives  +==============+  
-# | generate(properties) |o-----------+ generate    |<>------------->| generate     |  
+#                         |project                 |
+#                         |                        |
+#                         |generate(properties) = 0|
+#                         +-----------+------------+
+#                                     |
+#                                     ^
+#                                    / \
+#                                   +-+-+
+#                                     |
+#                                     |
+#            +------------------------+------+------------------------------+
+#            |                               |                              |
+#            |                               |                              |
+# +----------+-----------+            +------+------+                +------+-------+
+# | project-target       |            | main-target |                | basic-target |
+# +======================+ 1        * +=============+  alternatives  +==============+
+# | generate(properties) |o-----------+ generate    |<>------------->| generate     |
 # | main-target          |            +-------------+                | construct = 0|
-# +----------------------+                                           +--------------+  
-#                                                                           |          
-#                                                                           ^          
-#                                                                          / \         
-#                                                                         +-+-+        
-#                                                                           |          
-#                                                                           |          
-#                 ...--+----------------+------------------+----------------+---+      
-#                      |                |                  |                    |      
-#                      |                |                  |                    |      
+# +----------------------+                                           +--------------+
+#                                                                           |
+#                                                                           ^
+#                                                                          / \
+#                                                                         +-+-+
+#                                                                           |
+#                                                                           |
+#                 ...--+----------------+------------------+----------------+---+
+#                      |                |                  |                    |
+#                      |                |                  |                    |
 #               ... ---+-----+   +------+-------+   +------+------+    +--------+-----+
 #                            |   | typed-target |   | make-target |    | stage-target |
 #                            .   +==============+   +=============+    +==============+
 #                            .   | construct    |   | construct   |    | construct    |
 #                                +--------------+   +-------------+    +--------------+
 
+import assert ;
 import "class" : new ;
-import sequence ;
-import regex ;
-import property ;
 import errors ;
-import common ;
-import property-set ;
-import project ;
 import feature ;
-import virtual-target ;
+import indirect ;
 import path ;
+import property ;
+import property-set ;
+import sequence ;
 import set ;
-import assert ;
-import indirect ;
 import toolset ;
 
 # Base class for all abstract targets.
-class abstract-target 
+class abstract-target
 {
-    import project assert "class" errors ;    
-        
+    import project ;
+    import assert ;
+    import "class" ;
+    import errors ;
+
     rule __init__ ( name      # name of the target in Jamfile
         : project-target      # the project target to which this one belongs
     )
-    {        
+    {
         # Note: it might seem that we don't need either name or project at all.
-        # However, there are places where we really need it. One example is error
-        # messages which should name problematic targets. Another is setting correct
-        # paths for sources and generated files.
-        
+        # However, there are places where we really need it. One example is
+        # error messages which should name problematic targets. Another is
+        # setting correct paths for sources and generated files.
+
         self.name = $(name) ;
         self.project = $(project-target) ;
         self.location = [ errors.nearest-user-location ] ;
-    }    
-    
+    }
+
     # Returns the name of this target.
     rule name ( )
     {
         return $(self.name) ;
     }
-    
+
     # Returns the project for this target.
     rule project ( )
     {
         return $(self.project) ;
     }
-    
+
     # Return the location where the target was declared
     rule location ( )
     {
         return $(self.location) ;
     }
-            
+
     # Returns a user-readable name for this target.
     rule full-name ( )
     {
         local location = [ $(self.project).get location ] ;
         return $(location)/$(self.name) ;
     }
-        
-    # Takes a property set.  Generates virtual targets for this abstract
-    # target, using the specified properties, unless a different value of some
-    # feature is required by the target. 
-    # On
-    # success, returns: 
-    # - a property-set with the usage requirements to be
-    #   applied to dependents 
-    # - a list of produced virtual targets, which may be
-    #    empty.  
-    # If 'property-set' are empty, performs default build of this
-    # target, in a way specific to derived class.
+
+    # Takes a property set.  Generates virtual targets for this abstract target,
+    # using the specified properties, unless a different value of some feature
+    # is required by the target.
+    # On success, returns:
+    # - a property-set with the usage requirements to be applied to dependents
+    # - a list of produced virtual targets, which may be empty.
+    # If 'property-set' are empty, performs default build of this target, in a
+    # way specific to derived class.
     rule generate ( property-set )
     {
         errors.error "method should be defined in derived classes" ;
     }
-    
+
     rule rename ( new-name )
     {
         self.name = $(new-name) ;
-    }        
+    }
 }
 
-if --debug-building in [ modules.peek : ARGV ]            
+if --debug-building in [ modules.peek : ARGV ]
 {
     modules.poke : .debug-building : true ;
 }
@@ -161,21 +158,23 @@
     return $(.indent:J="") ;
 }
 
+
 rule increase-indent ( )
 {
     .indent += "    " ;
 }
 
+
 rule decrease-indent ( )
 {
     .indent = $(.indent[2-]) ;
 }
 
+
 #  Project target class (derived from 'abstract-target')
 #
 #  This class these responsibilities:
-#  - maintaining a list of main target in this project and
-#    building it
+#  - maintaining a list of main targets in this project and building them
 #
 #  Main targets are constructed in two stages:
 #  - When Jamfile is read, a number of calls to 'add-alternative' is made.
@@ -183,31 +182,32 @@
 #    targets.
 #  - The first time 'main-target' or 'has-main-target' rule is called,
 #    all alternatives are enumerated an main targets are created.
-class project-target : abstract-target 
+class project-target : abstract-target
 {
-    import project targets ;
+    import project ;
+    import targets ;
     import path ;
     import print ;
     import property-set ;
-    import set : difference : set.difference ;
+    import set ;
     import sequence ;
     import "class" : new ;
     import errors ;
-        
+
     rule __init__ ( name : project-module parent-project ?
         : requirements * : default-build * )
-    {    
+    {
         abstract-target.__init__ $(name) : $(__name__) ;
-        
+
         self.project-module = $(project-module) ;
         self.location = [ project.attribute $(project-module) location ] ;
         self.requirements = $(requirements) ;
         self.default-build = $(default-build) ;
-                        
+
         if $(parent-project)
-        {            
+        {
             inherit $(parent-project) ;
-        }        
+        }
     }
 
     # This is needed only by the 'make' rule. Need to find the
@@ -216,8 +216,8 @@
     {
         return $(self.project-module) ;
     }
-        
-    rule get ( attribute )    
+
+    rule get ( attribute )
     {
         return [ project.attribute $(self.project-module) $(attribute) ] ;
     }
@@ -225,57 +225,57 @@
     rule build-dir ( )
     {
         if ! $(self.build-dir)
-        {            
+        {
             self.build-dir = [ get build-dir ] ;
             if ! $(self.build-dir)
             {
-                self.build-dir = [ path.join 
+                self.build-dir = [ path.join
                     [ $(self.project).get location ]
                       bin
                 ] ;
             }
         }
         return $(self.build-dir) ;
-    }        
-    
+    }
+
     # Generates all possible targets contained in this project.
     rule generate ( property-set * )
     {
-        if [ modules.peek : .debug-building ] 
+        if [ modules.peek : .debug-building ]
         {
             ECHO [ targets.indent ] "building project" [ name ] " ('$(__name__)') with" [ $(property-set).raw ] ;
             targets.increase-indent ;
         }
-                
+
         local usage-requirements = [ property-set.empty ] ;
         local targets ;
-                
-        for local t in [ targets-to-build ] 
+
+        for local t in [ targets-to-build ]
         {
             local g = [ $(t).generate $(property-set) ] ;
             usage-requirements = [ $(usage-requirements).add $(g[1]) ] ;
             targets += $(g[2-]) ;
         }
         targets.decrease-indent ;
-        return $(usage-requirements) [ sequence.unique $(targets) ] ;        
+        return $(usage-requirements) [ sequence.unique $(targets) ] ;
     }
-        
+
     # Computes and returns a list of abstract-target instances which
     # must be built when this project is built.
     rule targets-to-build ( )
     {
         local result ;
-        
+
         if ! $(self.built-main-targets)
         {
             build-main-targets ;
         }
-        
+
         # Collect all main targets here, except for "explicit" ones.
         for local t in $(self.main-targets)
         {
             if ! [ $(t).name ] in $(self.explicit-targets)
-            {                    
+            {
                 result += $(t) ;
             }
         }
@@ -286,10 +286,10 @@
         {
             result += [ find $(pn) ] ;
         }
-                        
+
         return $(result) ;
     }
-    
+
     # Add 'target' to the list of targets in this project that should be build
     # only by explicit request
     rule mark-target-as-explicit ( target-name )
@@ -298,19 +298,18 @@
         # rule is called before main target instaces are created.
         self.explicit-targets += $(target-name) ;
     }
-    
+
     # Add new target alternative
     rule add-alternative ( target-instance )
     {
         if $(self.built-main-targets)
         {
-            errors.error "add-alternative called when main targets are already created." 
+            errors.error "add-alternative called when main targets are already created."
               : "in project" [ full-name ] ;
-        }        
+        }
         self.alternatives += $(target-instance) ;
     }
-    
-            
+
     # Returns a 'main-target' class instance corresponding to the 'name'.
     rule main-target ( name )
     {
@@ -318,7 +317,7 @@
         {
             build-main-targets ;
         }
-                        
+
         return $(self.main-target.$(name)) ;
     }
 
@@ -329,22 +328,22 @@
         {
             build-main-targets ;
         }
-        
-        if $(self.main-target.$(name)) 
+
+        if $(self.main-target.$(name))
         {
             return true ;
-        } 
+        }
     }
 
     # Find and return the target with the specified id, treated
     # relative to self.
     rule find-really ( id )
     {
-        local result ;    
+        local result ;
         local project = $(self.project) ;
         local current-location = [ get location ] ;
-        
-        local split = [ MATCH (.*)//(.*) : $(id) ] ;        
+
+        local split = [ MATCH (.*)//(.*) : $(id) ] ;
         local project-part = $(split[1]) ;
         local target-part = $(split[2]) ;
 
@@ -356,16 +355,16 @@
             local pm = [ project.find $(project-part) : $(current-location) ] ;
             if $(pm)
             {
-                project-target = [ project.target $(pm) ] ;                
+                project-target = [ project.target $(pm) ] ;
                 result = [ $(project-target).find $(target-part) : no-error ] ;
-            }                      
+            }
             else
             {
                 extra-error-message = "error: could not find project '$(project-part)'" ;
-            }            
+            }
         }
         else
-        {   
+        {
             # Interpret target-name as name of main target
             # Need to do this before checking for file. Consider this:
             #
@@ -373,35 +372,35 @@
             #  install s : test : <location>. ;
             #
             # After first build we'll have target 'test' in Jamfile and file
-            # 'test' on the disk. We need target to override the file.            
-            result = [ main-target $(id) ] ;            
-            
+            # 'test' on the disk. We need target to override the file.
+            result = [ main-target $(id) ] ;
+
             if ! $(result)
             {
                 result = [ new file-reference [ path.make $(id) ] : $(project) ] ;
- 
+
                 if ! [ $(result).exists ]
                 {
                     # File actually does not exist.
                     # Reset 'target' so that an error is issued.
                     result = ;
-                }            
+                }
             }
-                                         
+
             # Interpret id as project-id
             if ! $(result)
-            {                
+            {
                 local project-module = [ project.find $(id) : $(current-location) ] ;
                 if $(project-module)
                 {
                     result = [ project.target $(project-module) ] ;
-                }                                
-            }            
+                }
+            }
         }
-                
+
         return $(result) ;
     }
-    
+
     rule find ( id : no-error ? )
     {
         local v = $(.id.$(id)) ;
@@ -414,11 +413,11 @@
             }
             .id.$(id) = $(v) ;
         }
-        
+
         if $(v) != none
         {
             return $(v) ;
-        }        
+        }
         else
         {
             if ! $(no-error)
@@ -430,12 +429,10 @@
                 ECHO "error:     '$(current-location)'" ;
                 ECHO $(extra-error-message) ;
                 EXIT ;
-            }            
-        }        
+            }
+        }
     }
-    
 
-    
     rule build-main-targets ( )
     {
         self.built-main-targets = true ;
@@ -450,11 +447,11 @@
                 self.main-targets += $(t) ;
                 target = $(self.main-target.$(name)) ;
             }
-            
-            $(target).add-alternative $(a) ;            
-        }    
-    }                            
-    
+
+            $(target).add-alternative $(a) ;
+        }
+    }
+
     # Accessor, add a constant.
     rule add-constant (
         name # Variable name of the constant.
@@ -467,14 +464,14 @@
             case path :
               local r ;
               for local v in $(value)
-              {                  
+              {
                 v = [ path.root [ path.make $(v) ] $(self.location) ] ;
                 # Now make the value absolute path
                 v = [ path.root $(v) [ path.pwd ] ] ;
                 # Constants should be in platform-native form
                 v = [ path.native $(v) ] ;
                 r += $(v) ;
-              }                  
+              }
               value = $(r) ;
         }
         if ! $(name) in $(self.constants)
@@ -485,28 +482,28 @@
         # Inject the constant in the scope of project-root module
         modules.poke $(self.project-module) : $(name) : $(value) ;
     }
-    
+
     rule inherit ( parent )
     {
-        for local c in [ modules.peek $(parent) : self.constants ] 
+        for local c in [ modules.peek $(parent) : self.constants ]
         {
             # No need to pass the type. Path constants were converted to
             # absolute paths already by parent.
-            add-constant $(c) 
+            add-constant $(c)
               : [ modules.peek $(parent) : self.constant.$(c) ] ;
-        }       
+        }
 
-        # Import rules from parent 
+        # Import rules from parent
         local this-module = [ project-module ] ;
         local parent-module = [ $(parent).project-module ] ;
         # Don't import rules which comes from 'project-rules', they
         # must be imported localized.
-        local user-rules = [ set.difference 
+        local user-rules = [ set.difference
             [ RULENAMES $(parent-module) ] :
             [ RULENAMES project-rules ] ] ;
         IMPORT $(parent-module) : $(user-rules) : $(this-module) : $(user-rules) ;
         EXPORT $(this-module) : $(user-rules) ;
-    }        
+    }
 }
 
 
@@ -520,14 +517,15 @@
         {
             names += [ $(t).full-name ] ;
         }
-        
-        errors.error "Recursion in main target references" 
+
+        errors.error "Recursion in main target references"
           : "the following target are being built currently:"
           : $(names) ;
     }
-    .targets-being-built += $(main-target-instance) ;    
+    .targets-being-built += $(main-target-instance) ;
 }
 
+
 local rule end-building ( main-target-instance )
 {
     .targets-being-built = $(.targets-being-built[1--2]) ;
@@ -537,20 +535,20 @@
 # A named top-level target in Jamfile
 class main-target : abstract-target
 {
-    import errors : error ;
+    import errors ;
     import assert ;
-    import sequence ;    
+    import sequence ;
     import print ;
-    import build-request feature property-set ;
+    import build-request ;
+    import feature ;
+    import property-set ;
     import targets : start-building end-building ;
-    import "class" : is-a ;
-        
+
     rule __init__ ( name : project )
     {
         abstract-target.__init__ $(name) : $(project) ;
     }
-    
-        
+
     # Add a new alternative for this target
     rule add-alternative ( target )
     {
@@ -565,7 +563,7 @@
         else
         {
             self.default-build = $(d) ;
-        }        
+        }
         self.alternatives += $(target) ;
     }
 
@@ -577,39 +575,39 @@
         # for example:
         #    lib l : l.cpp : <variant>debug ;
         #    lib l : l_opt.cpp : <variant>release ;
-        # won't work unless we add default value <variant>debug.        
-        property-set = [ $(p).add-defaults ] ;        
-        
+        # won't work unless we add default value <variant>debug.
+        property-set = [ $(p).add-defaults ] ;
+
         # The algorithm: we keep the current best viable alternative.
         # When we've got new best viable alternative, we compare it
-        # with the current one. 
-        
+        # with the current one.
+
         local best ;
         local best-properties ;
-                        
+
         if $(self.alternatives[2-])
         {
             local bad ;
-            local worklist = $(self.alternatives) ;    
+            local worklist = $(self.alternatives) ;
             while $(worklist) && ! $(bad)
             {
-                local v = $(worklist[1]) ; 
-                local properties = [ $(v).match $(property-set) $(debug) ] ;              
-                           
+                local v = $(worklist[1]) ;
+                local properties = [ $(v).match $(property-set) $(debug) ] ;
+
                 if $(properties) != no-match
-                {                                    
+                {
                     if ! $(best)
                     {
                         best = $(v) ;
                         best-properties = $(properties) ;
                     }
                     else
-                    {                                                   
+                    {
                         if $(properties) = $(best-properties)
                         {
                             bad = true ;
                         }
-                        else if $(properties) in $(best-properties) 
+                        else if $(properties) in $(best-properties)
                         {
                             # Do nothing, this alternative is worse
                         }
@@ -618,43 +616,43 @@
                             best = $(v) ;
                             best-properties = $(properties) ;
                         }
-                        else 
+                        else
                         {
                             bad = true ;
-                        }                                                
+                        }
                     }
                 }
-                worklist = $(worklist[2-]) ;                
+                worklist = $(worklist[2-]) ;
             }
             if ! $(bad)
             {
                 return $(best) ;
-            }                                    
+            }
         }
         else
         {
             return $(self.alternatives) ;
-        }        
+        }
     }
-    
-    
+
+
     rule apply-default-build ( property-set )
-    {           
+    {
         # 1. First, see what properties from default-build
-        # are already present in property-set. 
-        
+        # are already present in property-set.
+
         local raw = [ $(property-set).raw ] ;
         local specified-features = $(raw:G) ;
-        
+
         local defaults-to-apply ;
-        for local d in [ $(self.default-build).raw ] 
+        for local d in [ $(self.default-build).raw ]
         {
             if ! $(d:G) in $(specified-features)
             {
-                defaults-to-apply += $(d) ; 
-            }            
+                defaults-to-apply += $(d) ;
+            }
         }
-        
+
         # 2. If there's any defaults to be applied, form the new
         # build request. Pass it throw 'expand-no-defaults', since
         # default-build might contain "release debug", which will
@@ -662,9 +660,9 @@
         local result ;
         if $(defaults-to-apply)
         {
-            properties = [ 
-              build-request.expand-no-defaults 
-                
+            properties = [
+              build-request.expand-no-defaults
+
                 # We have to compress subproperties here to prevent
                 # property lists like:
                 #
@@ -679,23 +677,23 @@
                 # be an indication that
                 # build-request.expand-no-defaults is the wrong rule
                 # to use here.
-                [ feature.compress-subproperties $(raw) ] 
+                [ feature.compress-subproperties $(raw) ]
                   $(defaults-to-apply)
             ] ;
-              
+
             if $(properties)
-            {                
+            {
                 for local p in $(properties)
                 {
-                    result += [ property-set.create 
+                    result += [ property-set.create
                         [ feature.expand [ feature.split $(p) ] ] ] ;
                 }
             }
             else
             {
                 result = [ property-set.empty ] ;
-            }            
-            
+            }
+
         }
         else
         {
@@ -703,7 +701,7 @@
         }
         return $(result) ;
     }
-        
+
     # Select an alternative for this main target, by finding all alternatives
     # which requirements are satisfied by 'properties' and picking the one with
     # longest requirements set.
@@ -715,7 +713,7 @@
         # We want composite properties in build request act as if
         # all the properties it expands too are explicitly specified.
         property-set = [ $(property-set).expand ] ;
-        
+
         local all-property-sets = [ apply-default-build $(property-set) ] ;
         local usage-requirements = [ property-set.empty ] ;
         local result ;
@@ -729,16 +727,16 @@
             }
         }
         end-building $(__name__) ;
-        return $(usage-requirements) [ sequence.unique $(result) ] ;                
+        return $(usage-requirements) [ sequence.unique $(result) ] ;
     }
-        
+
     # Generates the main target with the given property set
     # and returns a list which first element is property-set object
     # containing usage-requirements of generated target and with
     # generated virtual target in other elements. It's possible
     # that no targets are generated.
     local rule generate-really ( property-set )
-    {            
+    {
         local best-alternatives = [ select-alternatives $(property-set) ] ;
         if ! $(best-alternatives)
         {
@@ -749,12 +747,12 @@
         else
         {
             local result = [ $(best-alternatives).generate $(property-set) ] ;
-                        
+
             # Now return virtual targets for the only alternative
             return $(result) ;
-        }        
+        }
     }
-    
+
     rule rename ( new-name )
     {
         abstract-target.rename $(new-name) ;
@@ -762,33 +760,32 @@
         {
             $(a).rename $(new-name) ;
         }
-        
+
     }
-    
 }
 
 # Abstract target which refers to a source file.
-# This is artificial creature; it's usefull so that sources to 
+# This is artificial creature; it's usefull so that sources to
 # a target can be represented as list of abstract target instances.
-class file-reference : abstract-target 
+class file-reference : abstract-target
 {
     import virtual-target ;
     import property-set ;
     import path ;
-    
+
     rule __init__ ( file : project )
     {
         abstract-target.__init__ $(file) : $(project) ;
     }
-    
+
     rule generate ( properties )
     {
         location ;
-        return [ property-set.empty ] 
+        return [ property-set.empty ]
                [ virtual-target.from-file $(self.name)
                                          : $(self.file-location)
-                                         : $(self.project) ] ;        
-    }    
+                                         : $(self.project) ] ;
+    }
 
     # Returns true if the referred file really exists;
     rule exists ( )
@@ -796,7 +793,7 @@
         location ;
         return $(self.file-path) ;
     }
-           
+
     # Returns the location of target. Needed by 'testing.jam'
     rule location ( )
     {
@@ -838,7 +835,7 @@
 
     # Find the target
     local target = [ $(project).find $(id) ] ;
-    
+
     return $(target) [ property-set.create $(sproperties) ] ;
 }
 
@@ -849,17 +846,17 @@
 # Returns a list consisting of
 # - usage requirements
 # - generated virtual targets, if any
-rule generate-from-reference 
+rule generate-from-reference
    ( target-reference            # Target reference
     : project                    # Project where the reference is made
-    : property-set               # Properties of the main target that 
+    : property-set               # Properties of the main target that
                                  # makes the reference
    )
 {
     local r = [ resolve-reference $(target-reference) : $(project) ] ;
     local target = $(r[1]) ;
     local sproperties = $(r[2]) ;
-    
+
     # Take properties which should be propagated and refine them
     # with source-specific requirements.
     local propagated = [ $(property-set).propagated ] ;
@@ -874,29 +871,28 @@
     return [ $(target).generate $(rproperties) ] ;
 }
 
-# Given build request and requirements, return properties
-# common to dependency build request and target build
-# properties
+# Given build request and requirements, return properties common to dependency
+# build request and target build properties.
 rule common-properties ( build-request requirements )
 {
     # For optimization, we add free requirements directly,
     # without using complex algorithsm.
     # This gives the complex algorithm better chance of caching results.
-    local free = [ $(requirements).free ] ;        
-    local non-free = [ property-set.create 
+    local free = [ $(requirements).free ] ;
+    local non-free = [ property-set.create
         [ $(requirements).base ]  [ $(requirements).incidental ] ] ;
-    
+
     local key = .rp.$(build-request)-$(non-free) ;
     if ! $($(key))
-    {           
-        $(key) = [ common-properties2 $(build-request) $(non-free) ] ;        
-    }        
+    {
+        $(key) = [ common-properties2 $(build-request) $(non-free) ] ;
+    }
     result = [ $($(key)).add-raw $(free) ] ;
 }
 
 # Given 'context' -- a set of already present properties, and 'requirements',
-# decide which extra properties should be applied to 'context'. 
-# For conditional requirements, this means evaluating condition. For 
+# decide which extra properties should be applied to 'context'.
+# For conditional requirements, this means evaluating condition. For
 # indirect conditional requirements, this means calling a rule. Ordinary
 # requirements are always applied.
 #
@@ -905,31 +901,31 @@
 #
 #     <toolset>gcc:<variant>release <variant>release:<define>RELEASE
 #
-# If 'what' is 'refined' returns context refined with new requirements. 
+# If 'what' is 'refined' returns context refined with new requirements.
 # If 'what' is 'added' returns just the requirements that must be applied.
 rule evaluate-requirements ( requirements : context : what )
 {
-    # Apply non-conditional requirements. 
-    # It's possible that that further conditional requirement change 
-    # a value set by non-conditional requirements. For example:
+    # Apply non-conditional requirements.
+    # It's possible that further conditional requirement change a value set by
+    # non-conditional requirements. For example:
     #
     #    exe a : a.cpp : <threading>single <toolset>foo:<threading>multi ;
-    # 
+    #
     # I'm not sure if this should be an error, or not, especially given that
     #
-    #    <threading>single 
+    #    <threading>single
     #
     # might come from project's requirements.
-    
+
     local unconditional = [ feature.expand [ $(requirements).non-conditional ] ] ;
-    
+
     local raw = [ $(context).raw ] ;
     raw = [ property.refine $(raw) : $(unconditional) ] ;
-      
+
     # We've collected properties that surely must be present in common
     # properties. We now try to figure out what other properties
-    # should be added in order to satisfy rules (4)-(6) from the docs.        
-    
+    # should be added in order to satisfy rules (4)-(6) from the docs.
+
     local conditionals = [ $(requirements).conditional ] ;
     # The 'count' variable has one element for each conditional feature
     # and for each occurence of '<indirect-conditional>' feature.
@@ -938,41 +934,41 @@
     # stabilize before we've done. It's supposed to #conditionals iterations
     # should be enough for properties to propagate along conditions in any
     # direction.
-    local count = $(conditionals) 
-                  [ $(requirements).get <conditional> ]                    
+    local count = $(conditionals)
+                  [ $(requirements).get <conditional> ]
                   and-once-more ;
-    
+
     local added-requirements ;
-    
+
     local current = $(raw) ;
-    
+
     # It's assumed that ordinary conditional requirements can't add
     # <indirect-conditional> properties, and that rules referred
-    # by <indirect-conditional> properties can't add new 
+    # by <indirect-conditional> properties can't add new
     # <indirect-conditional> properties. So the list of indirect conditionals
     # does not change.
     local indirect = [ $(requirements).get <conditional> ] ;
-    indirect = [ MATCH @(.*) : $(indirect) ] ;  
-    
+    indirect = [ MATCH @(.*) : $(indirect) ] ;
+
     local ok ;
-    while $(count) 
+    while $(count)
     {
         # Evaluate conditionals in context of current properties
-        local e = [ property.evaluate-conditionals-in-context $(conditionals) 
+        local e = [ property.evaluate-conditionals-in-context $(conditionals)
           : $(current) ] ;
-        
+
         # Evaluate indirect conditionals.
         for local i in $(indirect)
         {
             e += [ indirect.call $(i) $(current) ] ;
         }
-                             
+
         if $(e) = $(added-requirements)
-        {                
+        {
             # If we got the same result, we've found final properties.
-            count = ;      
+            count = ;
             ok = true ;
-        }         
+        }
         else
         {
             # Oops, results of evaluation of conditionals has changed.
@@ -981,91 +977,94 @@
             # requirements.
             added-requirements = $(e) ;
             current = [ property.refine $(raw) : [ feature.expand $(e) ] ] ;
-        }            
+        }
         count = $(count[2-]) ;
     }
     if ! $(ok)
     {
         errors.error "Can't evaluate conditional properties " $(conditionals) ;
     }
-    
+
 
     if $(what) = added
     {
         return [ property-set.create $(unconditional) $(added-requirements) ] ;
     }
     else if $(what) = refined
-    {        
-        return [ property-set.create $(current) ] ;    
+    {
+        return [ property-set.create $(current) ] ;
     }
     else
     {
         errors.error "Invalid value of the 'what' parameter" ;
-    }    
+    }
 }
 
-    
+
 rule common-properties2 ( build-request requirements )
-{           
+{
     # This guarantees that default properties are present
     # in result, unless they are overrided by some requirement.
     # FIXME: There is possibility that we've added <foo>bar, which is composite
     # and expands to <foo2>bar2, but default value of <foo2> is not bar2,
     # in which case it's not clear what to do.
-    # 
+    #
     build-request = [ $(build-request).add-defaults ] ;
     # Featured added by 'add-default' can be composite and expand
     # to features without default values -- so they are not added yet.
     # It could be clearer/faster to expand only newly added properties
     # but that's not critical.
     build-request = [ $(build-request).expand ] ;
-    
-    return [ evaluate-requirements $(requirements) 
+
+    return [ evaluate-requirements $(requirements)
       : $(build-request) : refined ] ;
 }
 
-# Implements the most standard way of constructing main target
-# alternative from sources. Allows sources to be either file or
-# other main target and handles generation of those dependency
-# targets.
+# Implements the most standard way of constructing main target alternative from
+# sources. Allows sources to be either file or other main target and handles
+# generation of those dependency targets.
 class basic-target : abstract-target
 {
     import build-request ;
-    import virtual-target targets ;
+    import virtual-target ;
+    import targets ;
     import property-set ;
-    import set sequence errors ;
+    import set ;
+    import sequence ;
+    import errors ;
     import "class" : new ;
-    import property feature ;
+    import property ;
+    import feature ;
     import build-system ;
-        
+
     rule __init__ ( name : project
-        : sources * : requirements * : 
+        : sources * : requirements * :
         default-build * : usage-requirements * )
-    {        
+    {
         abstract-target.__init__ $(name) : $(project) ;
-    
+
         self.sources = $(sources) ;
         if ! $(requirements) {
             requirements = [ property-set.empty ] ;
-        }    
+        }
         self.requirements = $(requirements) ;
-        if ! $(default-build) 
+        if ! $(default-build)
         {
             default-build = [ property-set.empty ] ;
-        }    
+        }
         self.default-build = $(default-build) ;
         if ! $(usage-requirements)
         {
             usage-requirements = [ property-set.empty ] ;
-        }    
+        }
         self.usage-requirements = $(usage-requirements) ;
-        
+
         if $(sources:G)
         {
             errors.user-error "properties found in the 'sources' parameter for" [ full-name ] ;
         }
     }
-    
+
     # Returns the list of abstract-targets which are used as sources.
     # The extra properties specified for sources are not represented.
     # The only user of this rule at the moment is the "--dump-tests"
@@ -1075,33 +1074,33 @@
         if ! $(self.source-targets) {
             for local s in $(self.sources)
             {
-                self.source-targets += 
+                self.source-targets +=
                   [ targets.resolve-reference $(s) : $(self.project) ] ;
-            }            
-        }    
+            }
+        }
         return $(self.source-targets) ;
     }
-    
+
     rule requirements ( )
     {
         return $(self.requirements) ;
     }
-                        
+
     rule default-build ( )
     {
         return $(self.default-build) ;
     }
-    
+
     # Returns the alternative condition for this alternative, if
     # the condition is satisfied by 'property-set'.
     rule match ( property-set debug ? )
-    {    
+    {
         # The condition is composed of all base non-conditional properties.
         # It's not clear if we should expand 'self.requirements' or not.
         # For one thing, it would be nice to be able to put
-        #    <toolset>msvc-6.0 
+        #    <toolset>msvc-6.0
         # in requirements.
-        # On the other hand, if we have <variant>release in condition it 
+        # On the other hand, if we have <variant>release in condition it
         # does not make sense to require <optimization>full to be in
         # build request just to select this variant.
         local bcondition = [ $(self.requirements).base ] ;
@@ -1110,134 +1109,134 @@
         if $(debug)
         {
             ECHO "    next alternative: required properties:" $(condition:E=(empty)) ;
-        }                
-        
-        if $(condition) in [ $(property-set).raw ] 
+        }
+
+        if $(condition) in [ $(property-set).raw ]
         {
             if $(debug)
             {
                 ECHO "        matched" ;
-            }            
-            return $(condition) ;                        
+            }
+            return $(condition) ;
         }
         else
         {
             if $(debug)
             {
                 ECHO "        not matched" ;
-            }            
+            }
             return no-match ;
-        }        
+        }
     }
-    
+
     # Takes a target reference, which might be either target id
     # or a dependency property, and generates that target using
     # 'property-set' as build request.
     #
     # The results are added to to variable called 'result-var'.
     # Usage requirements are added variable called 'usage-requirements-var'.
-    rule generate-dependencies ( dependencies * : property-set 
+    rule generate-dependencies ( dependencies * : property-set
         : result-var usage-requirements-var )
     {
         for local dependency in $(dependencies)
-        {            
+        {
             local grist = $(dependency:G) ;
             local id = $(dependency:G=) ;
-        
-            local result = 
-              [ targets.generate-from-reference $(id) : $(self.project) 
+
+            local result =
+              [ targets.generate-from-reference $(id) : $(self.project)
                 : $(property-set) ] ;
-        
+
             $(result-var) += $(result[2-]:G=$(grist)) ;
             $(usage-requirements-var) += [ $(result[1]).raw ] ;
-        }        
+        }
     }
-    
-    
+
+
     # Determines final build properties, generates sources,
     # and calls 'construct'. This method should not be
     # overridden.
     rule generate ( property-set )
     {
-        if [ modules.peek : .debug-building ] 
+        if [ modules.peek : .debug-building ]
         {
             ECHO ;
             local fn = [ full-name ] ;
             ECHO [ targets.indent ] "Building target '$(fn)'" ;
             targets.increase-indent ;
-            ECHO [ targets.indent ] "Build request: " [ $(property-set).raw ] ;            
+            ECHO [ targets.indent ] "Build request: " [ $(property-set).raw ] ;
             local cf = [ build-system.command-line-free-features ] ;
-            ECHO [ targets.indent ] "Command line free features: "               
+            ECHO [ targets.indent ] "Command line free features: "
               [ $(cf).raw ] ;
-            ECHO [ targets.indent ] "Target requirements: " [ $(self.requirements).raw ] ;            
+            ECHO [ targets.indent ] "Target requirements: " [ $(self.requirements).raw ] ;
         }
-                
-        if ! $(self.generated.$(property-set)) 
+
+        if ! $(self.generated.$(property-set))
         {
             # Apply free features form the command line.  If user
-            # said 
+            # said
             #   define=FOO
             # he most likely want this define to be set for all compiles.
-            property-set = [ $(property-set).refine 
+            property-set = [ $(property-set).refine
               [ build-system.command-line-free-features ] ] ;
-            local rproperties = [ targets.common-properties $(property-set) 
-              $(self.requirements) ] ;           
-            
-            if [ modules.peek : .debug-building ] 
+            local rproperties = [ targets.common-properties $(property-set)
+              $(self.requirements) ] ;
+
+            if [ modules.peek : .debug-building ]
             {
                 ECHO ;
                 ECHO [ targets.indent ] "Common properties:" [ $(rproperties).raw ] ;
             }
-                        
+
             if $(rproperties[1]) != "@error" && [ $(rproperties).get <build> ] != no
             {
                 local source-targets ;
                 local properties = [ $(rproperties).non-dependency ] ;
                 local usage-requirements ;
-                
+
                 generate-dependencies [ $(rproperties).dependency ]
-                  : $(rproperties) 
+                  : $(rproperties)
                   : properties usage-requirements ;
-                
+
                 generate-dependencies $(self.sources) : $(rproperties)
                   : source-targets usage-requirements ;
-                
-                if [ modules.peek : .debug-building ] 
+
+                if [ modules.peek : .debug-building ]
                 {
                     ECHO ;
-                    ECHO [ targets.indent ] 
+                    ECHO [ targets.indent ]
                       "Usage requirements for $(self.name) are " $(usage-requirements) ;
                 }
 
-                rproperties = [ property-set.create $(properties) 
+                rproperties = [ property-set.create $(properties)
                   $(usage-requirements) ] ;
                 usage-requirements = [ property-set.create $(usage-requirements) ] ;
-                
-                if [ modules.peek : .debug-building ] 
+
+                if [ modules.peek : .debug-building ]
                 {
-                    ECHO [ targets.indent ] 
+                    ECHO [ targets.indent ]
                       "Build properties: " [ $(rproperties).raw ] ;
                 }
-                
-                local extra = [ $(rproperties).get <source> ] ;                
+
+                local extra = [ $(rproperties).get <source> ] ;
                 source-targets += $(extra:G=) ;
                 # We might get duplicate sources, for example if
                 # we link to two library which have the same <library> in
                 # usage requirements.
                 source-targets = [ sequence.unique $(source-targets) ] ;
-                                                               
-                local result = 
-                  [ construct $(self.name) : 
+
+                local result =
+                  [ construct $(self.name) :
                     $(source-targets) : $(rproperties) ] ;
-                
+
                 if $(result)
                 {
                     local gur = $(result[1]) ;
                     result = $(result[2-]) ;
 
-                    local s = [ create-subvariant 
+                    local s = [ create-subvariant
                         $(result) :
-                        [ virtual-target.recent-targets ] 
+                        [ virtual-target.recent-targets ]
                           : $(property-set) : $(source-targets)
                       : $(rproperties) : $(usage-requirements) ] ;
                     virtual-target.clear-recent-targets ;
@@ -1245,72 +1244,72 @@
                     local ur = [ compute-usage-requirements $(s) ] ;
                     ur = [ $(ur).add $(gur) ] ;
                     $(s).set-usage-requirements $(ur) ;
-                    if [ modules.peek : .debug-building ] 
+                    if [ modules.peek : .debug-building ]
                     {
                         ECHO [ targets.indent ]
                           "Usage requirements from $(self.name) are "
                             [ $(ur).raw ] ;
                     }
-                    
+
                     self.generated.$(property-set) = $(ur) $(result) ;
                 }
-            } 
+            }
             else
             {
-                if $(rproperties[1]) = "@error" 
+                if $(rproperties[1]) = "@error"
                 {
-                    ECHO [ targets.indent ] 
+                    ECHO [ targets.indent ]
                       "Skipping build of: " [ full-name ] " cannot compute common properties" ;
                 }
                 else if [ $(rproperties).get <build> ] = no
                 {
-                    ECHO [ targets.indent ] 
+                    ECHO [ targets.indent ]
                       "Skipping build of: " [ full-name ] " <build>no in common properties" ;
                 }
                 else
                 {
                     ECHO [ targets.indent ] "Skipping build of: " [ full-name ] " unknown reason" ;
                 }
-                               
-                # We're here either because there's error computing
-                # properties, or there's <build>no in properties.
-                # In the latter case we don't want any diagnostic.
-                # In the former case, we need diagnostics. FIXME.
+
+                # We're here either because there's been an error computing
+                # properties, or there's <build>no in properties. In the latter
+                # case we don't want any diagnostic. In the former case, we need
+                # diagnostics. FIXME
                 self.generated.$(property-set) = $(rproperties) ;
-            }       
-        }                
+            }
+        }
         else
         {
-            if [ modules.peek : .debug-building ] 
+            if [ modules.peek : .debug-building ]
             {
                 ECHO [ targets.indent ] "Already built" ;
-            }            
+            }
         }
 
         targets.decrease-indent ;
         return $(self.generated.$(property-set)) ;
     }
 
-    # Given the set of generated targets, and refined build 
+    # Given the set of generated targets, and refined build
     # properties, determines and sets appripriate usage requirements
     # on those targets.
     rule compute-usage-requirements ( subvariant )
     {
         local rproperties = [ $(subvariant).build-properties ] ;
-        xusage-requirements = [ targets.evaluate-requirements 
-            $(self.usage-requirements) 
-              : $(rproperties) 
-                : added ] ;                
-        
+        xusage-requirements = [ targets.evaluate-requirements
+            $(self.usage-requirements)
+              : $(rproperties)
+                : added ] ;
+
         # We generate all dependency properties and add them,
         # as well as their usage requirements, to result.
         local extra ;
         generate-dependencies [ $(xusage-requirements).dependency ] :
             $(rproperties) : extra extra ;
-                
+
         local result = [ property-set.create
             [ $(xusage-requirements).non-dependency ] $(extra) ] ;
-        
+
         # Propagate usage requirements we've got from sources, except
         # for the <pch-header> and <pch-file> features.
         #
@@ -1319,7 +1318,7 @@
         #
         #   pch pch1 : ...
         #   lib lib1 : ..... pch1 ;
-        #   pch pch2 : 
+        #   pch pch2 :
         #   lib lib2 : pch2 lib1 ;
         #
         # Here, lib2 should not get <pch-header> property from pch1.
@@ -1330,42 +1329,42 @@
         # features are special.
         local raw = [ $(subvariant).sources-usage-requirements ] ;
         raw = [ $(raw).raw ] ;
-        raw = [ property.change $(raw) : <pch-header> ] ;      
-        raw = [ property.change $(raw) : <pch-file> ] ;             
-        result = [ $(result).add [ property-set.create $(raw) ] ] ;        
-        
+        raw = [ property.change $(raw) : <pch-header> ] ;
+        raw = [ property.change $(raw) : <pch-file> ] ;
+        result = [ $(result).add [ property-set.create $(raw) ] ] ;
+
         return $(result) ;
     }
-    
+
     # Creates a new subvariant-dg instances for 'targets'
     # - 'root-targets' the virtual targets will be returned to dependents
-    # - 'all-targets' all virtual 
+    # - 'all-targets' all virtual
     #      targets created while building this main target
     # - 'build-request' is property-set instance with requested build properties
-    local rule create-subvariant ( root-targets * 
+    local rule create-subvariant ( root-targets *
         : all-targets * : build-request : sources * :
-        rproperties 
+        rproperties
         : usage-requirements )
     {
-        for local e in $(root-targets)                    
+        for local e in $(root-targets)
         {
             $(e).root true ;
-        }                    
-        
+        }
+
         # Process all vtargets that will be created if this main target
         # is created.
         local s = [ new subvariant $(__name__) : $(build-request) : $(sources)
           : $(rproperties) : $(usage-requirements) : $(all-targets) ] ;
-        for local v in $(all-targets)          
+        for local v in $(all-targets)
         {
             if ! [ $(v).creating-subvariant ]
-            {                
-                $(v).creating-subvariant $(s) ;            
-            }            
-        }                        
+            {
+                $(v).creating-subvariant $(s) ;
+            }
+        }
         return $(s) ;
     }
-        
+
     # Constructs the virtual targets for this abstract targets and
     # the dependecy graph. Returns the list of virtual targets.
     # Should be overrided in derived classes.
@@ -1375,59 +1374,59 @@
     }
 }
 
+
 class typed-target : basic-target
 {
-    import generators ;    
-    
-    rule __init__ ( name : project : type 
-    : sources * : requirements * : default-build * : usage-requirements * )
+    import generators ;
+
+    rule __init__ ( name : project : type
+        : sources * : requirements * : default-build * : usage-requirements * )
     {
-        basic-target.__init__ $(name) : $(project) 
+        basic-target.__init__ $(name) : $(project)
           : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ;
-        
+
         self.type = $(type) ;
     }
-    
+
     rule type ( )
     {
         return $(self.type) ;
     }
-            
+
     rule construct ( name : source-targets * : property-set )
     {
-        local r = [ generators.construct $(self.project) $(name:S=) : $(self.type) 
-          : [ property-set.create [ $(property-set).raw ] # [ feature.expand
-              <main-target-type>$(self.type) ]
-          # ]
+        local r = [ generators.construct $(self.project) $(name:S=) : $(self.type)
+            : [ property-set.create [ $(property-set).raw ]
+                <main-target-type>$(self.type) ]
             : $(source-targets) ] ;
         if ! $(r)
-        {                        
+        {
             ECHO "warn: Unable to construct" [ full-name ] ;
-            
+
             # Are there any top-level generators for this type/property set.
-            if ! [ generators.find-viable-generators 
+            if ! [ generators.find-viable-generators
                 $(self.type) : $(property-set) ]
             {
                 ECHO "error: no generators were found for type '$(self.type)'" ;
                 ECHO "error: and the requested properties" ;
                 ECHO "error: make sure you've configured the needed tools" ;
                 ECHO "See http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html" ;
-                
                 ECHO "To debug this problem, try the --debug-generators option." ;
                 EXIT ;
             }
         }
-        
+
         return $(r) ;
-    }            
+    }
 }
 
-# Return the list of sources to use, if main target rule is invoked
-# with 'sources'. If there are any objects in 'sources', they are treated
-# as main target instances, and the name of such targets are adjusted to
-# be '<name_of_this_target>__<name_of_source_target>'. Such renaming
-# is disabled is non-empty value is passed for 'no-renaming' parameter.
-# 
+
+# Return the list of sources to use, if main target rule is invoked with
+# 'sources'. If there are any objects in 'sources', they are treated as main
+# target instances, and the name of such targets are adjusted to be
+# '<name_of_this_target>__<name_of_source_target>'. Such renaming is disabled if
+# a non-empty value is passed for 'no-renaming' parameter.
+#
 rule main-target-sources ( sources * : main-target-name : no-renaming ? )
 {
     local result ;
@@ -1435,74 +1434,76 @@
     {
         if [ class.is-instance $(t) ]
         {
-            local name = [ $(t).name ] ;            
+            local name = [ $(t).name ] ;
             if ! $(no-renaming)
-            {                
+            {
                 name = $(main-target-name)__$(name) ;
                 $(t).rename $(name) ;
-            }            
+            }
             # Inline targets are not built by default.
             local p = [ $(t).project ] ;
-            $(p).mark-target-as-explicit $(name) ;            
+            $(p).mark-target-as-explicit $(name) ;
             result += $(name) ;
         }
         else
         {
             result += $(t) ;
-        }                
-    }    
+        }
+    }
     return $(result) ;
 }
 
 
-# Returns the requirement to use when declaring a main target,
-# which are obtained by
+# Returns the requirement to use when declaring a main target, which are
+# obtained by
 # - translating all specified property paths, and
 # - refining project requirements with the one specified for the target
-rule main-target-requirements ( 
-  specification * # Properties explicitly specified for a main target
-  : project       # Project where the main target is to be declared
-      )
+rule main-target-requirements (
+  specification *  # Properties explicitly specified for a main target
+  : project        # Project where the main target is to be declared
+)
 {
     specification += [ toolset.requirements ] ;
-    
-    local requirements = [ property-set.refine-from-user-input 
+
+    local requirements = [ property-set.refine-from-user-input
         [ $(project).get requirements ] : $(specification) :
         [ $(project).project-module ] : [ $(project).get location ] ] ;
-    
-    if $(requirements[1]) = "@error" 
+
+    if $(requirements[1]) = "@error"
     {
         errors.error "Conflicting requirements for target:" $(requirements) ;
     }
     return $(requirements) ;
 }
 
-# Returns the use requirement to use when declaraing a main target,
-# which are obtained by
+
+# Returns the use requirement to use when declaring a main target, which are
+# obtained by
 # - translating all specified property paths, and
 # - adding project's usage requirements
 rule main-target-usage-requirements (
-  specification * # Use-properties explicitly specified for a main target
-  : project       # Project where the main target is to be declared
-     )
+  specification *  # Use-properties explicitly specified for a main target
+  : project        # Project where the main target is to be declared
+)
 {
-    local loc = [ $(project).get location ] ;         
+    local loc = [ $(project).get location ] ;
     local project-usage-requirements = [ $(project).get usage-requirements ] ;
-    
+
     # We don't use 'refine-from-user-input' because I'm not sure if:
     # - removing of parent's usage requirements makes sense
     # - refining of usage requirements is not needed, since usage requirements
     #   are always free.
-    local usage-requirements = [ property-set.create-from-user-input 
-        $(specification) 
+    local usage-requirements = [ property-set.create-from-user-input
+        $(specification)
           : [ $(project).project-module ] [ $(project).get location ] ] ;
-            
+
     return [ $(project-usage-requirements).add $(usage-requirements) ] ;
 }
 
-# Return the default build value to use when declaring a main target,
-# which is obtained by using specified value if not empty and parent's
-# default build attribute otherwise.
+
+# Return the default build value to use when declaring a main target, which is
+# obtained by using the specified value if not empty and parent's default build
+# attribute otherwise.
 rule main-target-default-build (
   specification * # Default build explicitly specified for a main target
   : project       # Project where the main target is to be declared
@@ -1516,33 +1517,33 @@
     else
     {
         result = [ $(project).get default-build ] ;
-    }    
+    }
     return [ property-set.create-with-validation $(result) ] ;
-}         
+}
+
 
 # Registers the specified target as a main target alternatives.
 # Returns 'target'.
-rule main-target-alternative ( target ) 
-{               
+rule main-target-alternative ( target )
+{
     local ptarget = [ $(target).project ] ;
-    
     $(ptarget).add-alternative $(target) ;
     return $(target) ;
 }
 
-# Creates a typed-target with the specified properties.
-# The 'name', 'sources', 'requirements', 'default-build' and
-# 'usage-requirements' are assumed to be in the form specified
-# by the user in Jamfile corresponding to 'project'.
-rule create-typed-target ( type : project : 
-    name : sources * : requirements * : default-build * 
+
+# Creates a typed-target with the specified properties. The 'name', 'sources',
+# 'requirements', 'default-build' and 'usage-requirements' are assumed to be in
+# the form specified by the user in Jamfile corresponding to 'project'.
+rule create-typed-target ( type : project :
+    name : sources * : requirements * : default-build *
     : usage-requirements * )
 {
     return [
       targets.main-target-alternative
       [ new typed-target $(name) : $(project) : $(type)
-        : [ targets.main-target-sources $(sources) : $(name) ] 
-        : [ targets.main-target-requirements $(requirements) : $(project) ] 
+        : [ targets.main-target-sources $(sources) : $(name) ]
+        : [ targets.main-target-requirements $(requirements) : $(project) ]
         : [ targets.main-target-default-build $(default-build) : $(project) ]
         : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
       ] ] ;
Modified: trunk/tools/build/v2/build/type.jam
==============================================================================
--- trunk/tools/build/v2/build/type.jam	(original)
+++ trunk/tools/build/v2/build/type.jam	2008-01-05 13:13:10 EST (Sat, 05 Jan 2008)
@@ -1,7 +1,7 @@
-# Copyright 2002, 2003 Dave Abrahams 
-# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus 
-# 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) 
+# Copyright 2002, 2003 Dave Abrahams
+# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
+# 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)
 
 #  Deals with target type declaration and defines target class which supports
 #  typed targets.
@@ -16,32 +16,29 @@
 
 # This creates a circular dependency
 # project-test1 -> project -> project-root -> builtin -> type -> targets -> project
-# import targets ; 
+# import targets ;
 
-# The feature is optional so that it never implicitly added.
-# It's used only for internal purposes, and in all cases we
-# want to explicitly use it.
+# The feature is optional so it would never get added implicitly. It's used only
+# for internal purposes and in all cases we want to use it explicitly.
 feature.feature target-type : : composite optional ;
 
-# feature.feature base-target-type : : composite optional ;
 feature.feature main-target-type : : optional incidental ;
 feature.feature base-target-type : : composite optional free ;
-# feature.feature main-target-type : : composite optional incidental ;
 
-# Registers a target type, possible derived from a 'base-type'. 
-# If 'suffixes' are provided, they given all the suffixes that mean a file is of 'type'.
-# Also, the first element gives the suffix to be used when constructing and object of
-# 'type'.
+# Registers a target type, possible derived from a 'base-type'. Providing a list
+# of 'suffixes' here is a shortcut for separately calling the register-suffixes
+# rule with the given suffixes and the set-generated-target-suffix rule with the
+# first given suffix.
 rule register ( type : suffixes * : base-type ? )
 {
-    # Type names cannot contain hyphens, because when used as
-    # feature-values they will be interpreted as composite features
-    # which need to be decomposed.
+    # Type names cannot contain hyphens, because when used as feature-values
+    # they would be interpreted as composite features which need to be
+    # decomposed.
     switch $(type)
     {
         case *-* : errors.error "type name \"$(type)\" contains a hyphen" ;
     }
-    
+
     if $(type) in $(.types)
     {
         errors.error "Type $(type) is already registered." ;
@@ -50,73 +47,72 @@
     {
         .types += $(type) ;
         .bases.$(type) = $(base-type) ;
-        .derived.$(base-type) += $(type) ;        
+        .derived.$(base-type) += $(type) ;
 
-        if $(suffixes)-not-empty
-        {            
-            # Generated targets of 'type' will use the first of 'suffixes'
-            # (this may be overriden)            
-            $(.suffixes).insert <target-type>$(type) : $(suffixes[1]) ;
+        if $(suffixes)-is-not-empty
+        {
             # Specify mapping from suffixes to type
             register-suffixes $(suffixes) : $(type) ;
+            # Generated targets of 'type' will use the first of 'suffixes'. This
+            # may be overriden.
+            set-generated-target-suffix $(type) : : $(suffixes[1]) ;
         }
-        
-        feature.extend target-type : $(type) ;
+
+        feature.extend target-type      : $(type) ;
         feature.extend main-target-type : $(type) ;
-        
-        feature.compose <target-type>$(type) : $(base-type:G=<base-target-type>) ; 
         feature.extend base-target-type : $(type) ;
-#        feature.compose <target-type>$(type) : <base-target-type>$(type) ;
+
+        feature.compose <target-type>$(type) : $(base-type:G=<base-target-type>) ;
         feature.compose <base-target-type>$(type) : <base-target-type>$(base-type) ;
 
-        # We used to declare main target rule only when 'main' parameter
-        # is specified. However, it's hard to decide that a type *never*
-        # will need a main target rule and so from time to time we needed
-        # to make yet another type 'main'. So, now main target rule is defined
-        # for each type.
-        main-rule-name = [ type-to-rule-name $(type) ] ;            
-        .main-target-type.$(main-rule-name) = $(type) ;    
-            
+        # We used to declare the main target rule only when a 'main' parameter
+        # was specified. However, it's hard to decide that a type will *never*
+        # need a main target rule and so from time to time we needed to make yet
+        # another type 'main'. So now a main target rule is defined for each
+        # type.
+        main-rule-name = [ type-to-rule-name $(type) ] ;
+        .main-target-type.$(main-rule-name) = $(type) ;
+
         IMPORT $(__name__) : main-target-rule : : $(main-rule-name) ;
     }
 }
 
-# Given type, returns name of main target rule which creates
-# targets of that type.
+
+# Given a type, returns the name of the main target rule which creates targets
+# of that type.
 rule type-to-rule-name ( type )
 {
     # Lowercase everything. Convert underscores to dashes.ame.
     import regex ;
     local n = [ regex.split $(type:L) "_" ] ;
-    n = $(n:J=-) ;
-    return $(n) ;
+    return $(n:J=-) ;
 }
 
-# Returns a type, given the name of a main rule.
-rule type-from-rule-name ( main-target-name )
+
+# Given a main target rule name, returns the type for which it creates targets.
+rule type-from-rule-name ( rule-name )
 {
-    return $(.main-target-type.$(main-target-name)) ;
+    return $(.main-target-type.$(rule-name)) ;
 }
 
 
-
-# Specifies that targets with suffix from 'suffixes' has the type 'type'. 
-# If different type is already specified for any of syffixes,
-# issues an error.
+# Specifies that files with suffix from 'suffixes' be recognized as targets of
+# type 'type'. Issues an error if a different type is already specified for any
+# of the suffixes.
 rule register-suffixes ( suffixes + : type )
 {
     for local s in $(suffixes)
-    {        
-        if ! $(.type.$(s)) 
+    {
+        if ! $(.type.$(s))
         {
-            .type.$(s) = $(type) ; 
+            .type.$(s) = $(type) ;
         }
-        else if $(.type.$(s)) != type 
+        else if $(.type.$(s)) != type
         {
-            errors.error Attempting to specify type for suffix \"$(s)\" 
+            errors.error Attempting to specify multiple types for suffix \"$(s)\"
               : "Old type $(.type.$(s)), New type $(type)" ;
         }
-    }            
+    }
 }
 
 
@@ -129,13 +125,14 @@
     }
 }
 
+
 # Issues an error if 'type' is unknown.
 rule validate ( type )
 {
     if ! $(type) in $(.types)
     {
         errors.error "Unknown target type $(type)" ;
-    }    
+    }
 }
 
 
@@ -145,18 +142,20 @@
     if ! $(type) in $(.types)
     {
         error "Type" $(type) "is not declared" ;
-    }    
+    }
     .scanner.$(type) = $(scanner) ;
 }
 
+
 # Returns a scanner instance appropriate to 'type' and 'properties'.
 rule get-scanner ( type : property-set )
 {
     if $(.scanner.$(type)) {
         return [ scanner.get $(.scanner.$(type)) : $(property-set) ] ;
-    }    
+    }
 }
 
+
 # returns  type and all of its bases in order of their distance from type.
 rule all-bases ( type )
 {
@@ -169,6 +168,7 @@
     return $(result) ;
 }
 
+
 rule all-derived ( type )
 {
     local result = $(type) ;
@@ -176,12 +176,11 @@
     {
         result += [ all-derived $(d) ] ;
     }
-    return $(result) ;      
+    return $(result) ;
 }
 
 
-# Returns true if 'type' has 'base' as its direct or
-# indirect base.
+# Returns true if 'type' has 'base' as its direct or indirect base.
 rule is-derived ( type base )
 {
     if $(base) in [ all-bases $(type) ]
@@ -190,8 +189,8 @@
     }
 }
 
-# Returns true if 'type' is either derived from 'base',
-# or 'type' is equal to 'base'.
+
+# Returns true if 'type' is either derived from or is equal to 'base'.
 rule is-subtype ( type base )
 {
     if $(type) = $(base)
@@ -201,7 +200,7 @@
     else
     {
         return [ is-derived $(type) $(base) ] ;
-    }    
+    }
 }
 
 
@@ -212,99 +211,108 @@
 .prefixes = [ new property-map ] ;
 
 
-# Sets a target suffix that should be used when generating target 
-# of 'type' with the specified properties. Can be called with
-# empty properties if no suffix for 'type' was specified yet.
-# This does not automatically specify that files 'suffix' have
-# 'type' --- two different types can use the same suffix for
-# generating, but only one type should be auto-detected for
-# a file with that suffix. User should explicitly specify which
-# one.
+# Sets a file suffix to be used when generating a target of 'type' with the
+# specified properties. Can be called with no properties if no suffix has
+# already been specified for the 'type'. The 'suffix' parameter can be an empty
+# string ("") to indicate that no suffix should be used.
+#
+# Note that this does not cause files with 'suffix' to be automatically
+# recognized as being of 'type'. Two different types can use the same suffix for
+# their generated files but only one type can be auto-detected for a file with
+# that suffix. User should explicitly specify which one using the
+# register-suffixes rule.
 #
-# The 'suffix' parameter can be empty string ("") to indicate that
-# no suffix should be used.
 rule set-generated-target-suffix ( type : properties * : suffix )
 {
-    set-generated-target-ps  suffix : $(type) : $(properties) : $(suffix) ;
-}    
+    set-generated-target-ps suffix : $(type) : $(properties) : $(suffix) ;
+}
 
-# Change the suffix previously registered for this type/properties 
-# combination. If suffix is not yet specified, sets it.
+
+# Change the suffix previously registered for this type/properties combination.
+# If suffix is not yet specified, sets it.
 rule change-generated-target-suffix ( type : properties * : suffix )
-{        
-    change-generated-target-ps  suffix : $(type) : $(properties) : $(suffix) ;
+{
+    change-generated-target-ps suffix : $(type) : $(properties) : $(suffix) ;
 }
 
+
+# Returns the suffix used when generating a file of 'type' with the given
+# properties.
 rule generated-target-suffix ( type : property-set )
 {
-    return [ generated-target-ps  suffix : $(type) : $(property-set) ] ;
+    return [ generated-target-ps suffix : $(type) : $(property-set) ] ;
 }
 
-# Sets a target prefix that should be used when generating target 
-# of 'type' with the specified properties. Can be called with
-# empty properties if no prefix for 'type' was specified yet.
+
+# Sets a target prefix that should be used when generating targets of 'type'
+# with the specified properties. Can be called with empty properties if no
+# prefix for 'type' has been specified yet.
 #
-# The 'prefix' parameter can be empty string ("") to indicate that
-# no prefix should be used.
+# The 'prefix' parameter can be empty string ("") to indicate that no prefix
+# should be used.
 #
-# Example usage is for library names that have to have a "lib"
-# prefix as in unix.
+# Usage example: library names use the "lib" prefix on unix.
 rule set-generated-target-prefix ( type : properties * : prefix )
 {
-    set-generated-target-ps  prefix : $(type) : $(properties) : $(prefix) ;
-}    
+    set-generated-target-ps prefix : $(type) : $(properties) : $(prefix) ;
+}
+
 
-# Change the prefix previously registered for this type/properties 
-# combination. If prefix is not yet specified, sets it.
+# Change the prefix previously registered for this type/properties combination.
+# If prefix is not yet specified, sets it.
 rule change-generated-target-prefix ( type : properties * : prefix )
-{        
-    change-generated-target-ps  prefix : $(type) : $(properties) : $(prefix) ;
+{
+    change-generated-target-ps prefix : $(type) : $(properties) : $(prefix) ;
 }
 
+
 rule generated-target-prefix ( type : property-set )
 {
-    return [ generated-target-ps  prefix : $(type) : $(property-set) ] ;
+    return [ generated-target-ps prefix : $(type) : $(property-set) ] ;
 }
 
+
 # Common rules for prefix/suffix provisioning follow
 
-rule set-generated-target-ps ( ps : type : properties * : psval )
+local rule set-generated-target-ps ( ps : type : properties * : psval )
 {
     properties = <target-type>$(type) $(properties) ;
     $(.$(ps)es).insert $(properties) : $(psval) ;
-}    
+}
+
 
-rule change-generated-target-ps ( ps : type : properties * : psval )
-{        
-    properties = <target-type>$(type) $(properties) ;    
+local rule change-generated-target-ps ( ps : type : properties * : psval )
+{
+    properties = <target-type>$(type) $(properties) ;
     local prev = [ $(.$(ps)es).find-replace $(properties) : $(psval) ] ;
     if ! $(prev)
     {
         set-generated-target-ps $(ps) : $(type) : $(properties) : $(psval) ;
-    }    
+    }
 }
 
-# Returns either prefix or suffix (as indicated by 'ps') that
-# should be used when generating target of 'type' with the specified properties.  
-# Parameter 'ps' can be either "prefix" or "suffix".  If no prefix/suffix is 
-# specified for 'type', returns prefix/suffix for base type, if any.
-rule generated-target-ps-real ( ps : type : properties * )
+
+# Returns either prefix or suffix (as indicated by 'ps') that should be used
+# when generating a target of 'type' with the specified properties. Parameter
+# 'ps' can be either "prefix" or "suffix".  If no prefix/suffix is specified for
+# 'type', returns prefix/suffix for base type, if any.
+local rule generated-target-ps-real ( ps : type : properties * )
 {
     local result ;
     local found ;
     while $(type) && ! $(found)
     {
         result = [ $(.$(ps)es).find <target-type>$(type) $(properties) ] ;
-        # If the prefix/suffix is explicitly set to empty string, 
-        # we consider prefix/suffix to be found. If we did not compare with "", 
-        # there would be no way for user to set empty prefix/suffix.
+        # If the prefix/suffix is explicitly set to an empty string, we consider
+        # prefix/suffix to be found. If we were not to compare with "", there
+        # would be no way to specify an empty prefix/suffix.
         if $(result)-is-not-empty
         {
             found = true ;
         }
         type = $(.bases.$(type)) ;
     }
-    if $(result) = "" 
+    if $(result) = ""
     {
         result = ;
     }
@@ -312,7 +320,7 @@
 }
 
 
-rule generated-target-ps ( ps : type : property-set )
+local rule generated-target-ps ( ps : type : property-set )
 {
     local key = .$(ps).$(type).$(property-set) ;
     local v = $($(key)) ;
@@ -326,21 +334,21 @@
         }
         $(key) = $(v) ;
     }
-    
+
     if $(v) != none
     {
         return $(v) ;
-    }        
+    }
 }
 
 
 # Returns file type given it's name. If there are several dots in filename,
-# tries each suffix. E.g. for name of "file.so.1.2" suffixes "2", "1", and 
-# "so"  will be tried.
-rule type ( filename ) 
+# tries each suffix. E.g. for name of "file.so.1.2" suffixes "2", "1", and "so"
+# will be tried.
+rule type ( filename )
 {
     local type ;
-    while ! $(type) && $(filename:S) 
+    while ! $(type) && $(filename:S)
     {
         local suffix = $(filename:S) ;
         type = $(.type$(suffix)) ;
@@ -350,21 +358,23 @@
 }
 
 
-
-rule main-target-rule ( name : sources * : requirements * : default-build * 
+# Rule used to construct all main targets. Note that this rule gets imported
+# into the global namespace under different names and exactly what type of
+# target it is supposed to construct is read from the name of the rule actually
+# used to invoke it.
+rule main-target-rule ( name : sources * : requirements * : default-build *
                         : usage-requirements * )
 {
-    # First find required target type, which is equal to the name used
+    # First find the required target type, which is equal to the rule name used
     # to invoke us.
     local bt = [ BACKTRACE 1 ] ;
     local rulename = $(bt[4]) ;
-    
+
     local project = [ project.current ] ;
-        
+
     # This is a circular module dependency, so it must be imported here
     import targets ;
-    return [ targets.create-typed-target $(.main-target-type.$(rulename)) : $(project)
-      : $(name) : $(sources) : $(requirements) 
-      : $(default-build) : $(usage-requirements) ] ;        
+    return [ targets.create-typed-target $(.main-target-type.$(rulename))
+      : $(project) : $(name) : $(sources) : $(requirements)
+      : $(default-build) : $(usage-requirements) ] ;
 }
-
Modified: trunk/tools/build/v2/build/virtual-target.jam
==============================================================================
--- trunk/tools/build/v2/build/virtual-target.jam	(original)
+++ trunk/tools/build/v2/build/virtual-target.jam	2008-01-05 13:13:10 EST (Sat, 05 Jan 2008)
@@ -1,8 +1,8 @@
-# Copyright 2003 Dave Abrahams 
-# Copyright 2005, 2006 Rene Rivera 
-# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus 
-# 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) 
+# Copyright 2003 Dave Abrahams
+# Copyright 2005, 2006 Rene Rivera
+# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
+# 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)
 
 #  Implements virtual targets, which correspond to actual files created during
 #  build, but are not yet targets in Jam sense. They are needed, for example,
@@ -10,7 +10,14 @@
 #  if particular target should be created at all.
 
 import "class" : new ;
-import path property-set utility sequence errors set type os ;
+import path ;
+import property-set ;
+import utility ;
+import sequence ;
+import errors ;
+import set ;
+import type ;
+import os ;
 
 #                       +--------------------------+
 #                       | virtual-target           |
@@ -64,19 +71,22 @@
 # building, if needed. However, it can be also dropped, which allows
 # to search for different transformation and select only one.
 #
-class virtual-target 
+class virtual-target
 {
-    import virtual-target utility scanner ;    
-    
+    import scanner ;
+    import sequence ;
+    import utility ;
+    import virtual-target ;
+
     rule __init__ ( name  # Name of this target -- specifies the name of
         : project # Project to which this target belongs
     )
-    {    
+    {
         self.name = $(name) ;
         self.project = $(project) ;
         self.dependencies = ;
     }
-    
+
     # Name of this target.
     rule name ( ) { return $(self.name) ; }
 
@@ -149,14 +159,14 @@
     {
         errors.error "method should be defined in derived classes" ;
     }
-    
+
     # If the target is generated one, returns the path where it will be
     # generated. Otherwise, returns empty list.
     rule path ( )
     {
-        errors.error "method should be defined in derived classes" ;        
+        errors.error "method should be defined in derived classes" ;
     }
-    
+
     # Return that actual target name that should be used
     # (for the case where no scanner is involved)
     rule actual-name ( )
@@ -167,11 +177,11 @@
 # implementation
     rule actualize-no-scanner ( )
     {
-        # In fact, we just need to merge virtual-target with 
+        # In fact, we just need to merge virtual-target with
         # abstract-virtual-target and the latter is the only class
         # derived from the former. But that's for later.
-        errors.error "method should be defined in derived classes" ;        
-    }    
+        errors.error "method should be defined in derived classes" ;
+    }
 }
 
 
@@ -187,11 +197,15 @@
 # value identifying the main target.
 class abstract-file-target : virtual-target
 {
-    import project regex sequence path type ;
+    import project ;
+    import regex ;
+    import sequence ;
+    import path ;
+    import type ;
     import property-set ;
     import indirect ;
-    
-    rule __init__ ( 
+
+    rule __init__ (
          name     # Name for this target
         exact ?   # If non-empty, the name is exactly the name
                   # created file should have. Otherwise, the '__init__'
@@ -203,20 +217,20 @@
     )
     {
         virtual-target.__init__ $(name) : $(project) ;
-            
+
         self.type = $(type) ;
         self.action = $(action) ;
         if $(action)
-        {         
+        {
             $(action).add-targets $(__name__) ;
 
-            if $(self.type) && ! $(exact)              
-            {                
+            if $(self.type) && ! $(exact)
+            {
                 _adjust-name $(name) ;
-            }            
-        }        
+            }
+        }
     }
-    
+
     rule type ( ) { return $(self.type) ; }
 
     # Sets the path. When generating target name, it will override any path
@@ -243,11 +257,11 @@
         }
         return $(self.root) ;
     }
-    
+
     # Gets or sets the subvariant which created this target. Subvariant
     # is set when target is brought into existance, and is never changed
-    # after that. In particual, if target is shared by subvariant, only 
-    # the first is stored.    
+    # after that. In particual, if target is shared by subvariant, only
+    # the first is stored.
     rule creating-subvariant ( s ? # If specified, specified the value to set,
                                    # which should be instance of 'subvariant'
                                    # class.
@@ -260,9 +274,9 @@
                 errors.error "Attempt to change 'dg'" ;
             }
             else
-            {                
+            {
                 self.creating-subvariant = $(s) ;
-            }            
+            }
         }
         return $(self.creating-subvariant) ;
     }
@@ -274,7 +288,7 @@
             $(self.action).actualize ;
         }
     }
-          
+
     # Return a human-readable representation of this target
     #
     # If this target has an action, that's:
@@ -288,21 +302,21 @@
     rule str ( )
     {
         local action = [ action ] ;
-        
+
         local name-dot-type = [ sequence.join $(self.name) "."  $(self.type) ] ;
-        
+
         if $(action)
         {
             local sources = [ $(action).sources ] ;
-            
-            local action-name =  [ $(action).action-name ] ;            
 
-            local ss ;            
+            local action-name =  [ $(action).action-name ] ;
+
+            local ss ;
             for local s in $(sources)
             {
                 ss += [ $(s).str ] ;
             }
-            
+
             return "{" $(action-name)-$(name-dot-type) $(ss) "}" ;
         }
         else
@@ -331,30 +345,30 @@
     rule actual-name ( )
     {
         if ! $(self.actual-name)
-        {            
+        {
             local grist = [ grist ] ;
 
             local basename = [ path.native $(self.name) ] ;
             self.actual-name = <$(grist)>$(basename) ;
-            
+
         }
         return $(self.actual-name) ;
     }
-        
+
     # Helper to 'actual-name', above. Compute unique prefix used to distinguish
     # this target from other targets with the same name which create different
     # file.
     rule grist ( )
     {
         # Depending on target, there may be different approaches to generating
-        # unique prefixes. We'll generate prefixes in the form 
+        # unique prefixes. We'll generate prefixes in the form
         # <one letter approach code> <the actual prefix>
         local path = [ path ] ;
         if $(path)
         {
             # The target will be generated to a known path. Just use the path
             # for identification, since path is as unique as it can get.
-            return p$(path) ;            
+            return p$(path) ;
         }
         else
         {
@@ -363,38 +377,38 @@
             local project-location = [ $(self.project).get location ] ;
             local location-grist =
               [ sequence.join [ regex.split $(project-location) "/" ] : "!" ] ;
-            
+
             if $(self.action)
             {
-                local ps = [ $(self.action).properties ] ;     
+                local ps = [ $(self.action).properties ] ;
                 local property-grist = [ $(ps).as-path ] ;
                 # 'property-grist' can be empty when 'ps' is an empty
                 # property set.
                 if $(property-grist)
-                {                    
+                {
                     location-grist = $(location-grist)/$(property-grist) ;
-                }                
-            }            
-                        
+                }
+            }
+
             return l$(location-grist) ;
-        }                
-    }            
+        }
+    }
 
     # Given the target name specified in constructor, returns the
     # name which should be really used, by looking at the <tag> properties.
     # The tag properties come in two flavour:
-    #   - <tag>value, 
+    #   - <tag>value,
     #   - <tag>@rule-name
     # In the first case, value is just added to name
     # In the second case, the specified rule is called with specified name,
     # target type and properties and should return the new name.
     # If not <tag> property is specified, or the rule specified by
-    # <tag> returns nothing, returns the result of calling 
+    # <tag> returns nothing, returns the result of calling
     # virtual-target.add-suffix
     rule _adjust-name ( specified-name )
-    {        
+    {
         local ps ;
-        if $(self.action) 
+        if $(self.action)
         {
             ps = [ $(self.action).properties ] ;
         }
@@ -402,7 +416,7 @@
         {
             ps = [ property-set.empty ] ;
         }
-        
+
         #~ We add ourselves to the properties so that any tag rule can get
         #~ more direct information about the target than just that available
         #~ through the properties. This is useful in implementing
@@ -410,7 +424,7 @@
         #~ make unique names of object files based on the source file.
         #~ --grafik
         ps = [ property-set.create [ $(ps).raw ] <target>$(__name__) ] ;
-        
+
         local tag = [ $(ps).get <tag> ] ;
 
         if $(tag)
@@ -422,23 +436,23 @@
                 {
                     errors.error "<tag>@rulename is present but is not the only <tag> feature" ;
                 }
-                
+
                 self.name = [ indirect.call $(rule-name) $(specified-name) :
                   $(self.type) :  $(ps) ] ;
             }
             else
             {
-                errors.error 
+                errors.error
                   "The value of the <tag> feature must be '@rule-nane'" ;
             }
         }
-        
+
         # If there's no tag or the tag rule returned nothing.
         if ! $(tag) || ! $(self.name)
-        {                            
+        {
             self.name = [ virtual-target.add-prefix-and-suffix
                 $(specified-name) : $(self.type) : $(ps) ] ;
-        }    
+        }
     }
 
     rule actualize-no-scanner ( )
@@ -448,9 +462,9 @@
         # Do anything only on the first invocation
         if ! $(self.made.$(name)) {
             self.made.$(name) = true ;
-            
+
             if $(self.action)
-            {                
+            {
                 # For non-derived target, we don't care if there
                 # are several virtual targets that refer to the same name.
                 # One case when this is unavoidable is when file name is
@@ -458,7 +472,7 @@
                 # and MOCCABLE_CPP (for convertion to H via Qt tools).
                 virtual-target.register-actual-name $(name) : $(__name__) ;
             }
-                        
+
             for local i in $(self.dependencies) {
                 DEPENDS $(name) : [ $(i).actualize ] ;
             }
@@ -468,15 +482,16 @@
         }
         return $(name) ;
     }
-    
+
 }
 
+
 # Appends the suffix appropriate to 'type/property-set' combination
 # to the specified name and returns the result.
 rule add-prefix-and-suffix ( specified-name : type ? : property-set )
 {
     local suffix = [ type.generated-target-suffix $(type) : $(property-set) ] ;
-    
+
     # Handle suffixes for which no leading dot is desired.  Those are
     # specified by enclosing them in <...>.  Needed by python so it
     # can create "_d.so" extensions, for example.
@@ -488,9 +503,9 @@
     {
         suffix = .$(suffix) ;
     }
-    
+
     local prefix = [ type.generated-target-prefix $(type) : $(property-set) ] ;
-      
+
     if  [ MATCH ^($(prefix)) : $(specified-name) ]
     {
         prefix = ;
@@ -513,12 +528,12 @@
 #     - the value passed to the 'suffix' method, if any, or
 #     - the suffix which correspond to the target's type.
 #
-class file-target : abstract-file-target 
+class file-target : abstract-file-target
 {
-    import common ;    
+    import common ;
     import errors ;
     import "class" : new ;
-    
+
     rule __init__ (
       name exact ?
         : type ?  # Optional type for this target
@@ -527,25 +542,25 @@
         : path ?
     )
     {
-        abstract-file-target.__init__ $(name) $(exact) : $(type) : $(project) 
-          : $(action) ;   
+        abstract-file-target.__init__ $(name) $(exact) : $(type) : $(project)
+          : $(action) ;
 
         self.path = $(path) ;
     }
-    
+
     rule clone-with-different-type ( new-type )
     {
         return [ new file-target $(self.name) exact : $(new-type)
           : $(self.project) : $(self.action) : $(self.path) ] ;
     }
-            
+
     rule actualize-location ( target )
     {
         if $(self.action)
         {
             # This is a derived file.
             local path = [ path ] ;
-            LOCATE on $(target) = $(path) ;                        
+            LOCATE on $(target) = $(path) ;
 
             # Make sure the path exists.
             DEPENDS $(target) : $(path) ;
@@ -561,14 +576,14 @@
                 DEPENDS $(target) : $(d) ;
 
                 common.MkDir $(d) ;
-            }            
-            
+            }
+
             # For real file target, we create a fake target that
             # depends on the real target. This allows to run
             #
             #    bjam hello.o
             #
-            # without trying to guess the name of the real target.            
+            # without trying to guess the name of the real target.
             # Note the that target has no directory name, and a special
             # grist <e>.
             #
@@ -585,56 +600,58 @@
         else
         {
             SEARCH on $(target) = [ path.native $(self.path) ] ;
-        }        
+        }
     }
-    
+
     # Returns the directory for this target
     rule path ( )
     {
         if ! $(self.path)
         {
             if $(self.action)
-            {       
-                local p = [ $(self.action).properties ] ;                
+            {
+                local p = [ $(self.action).properties ] ;
                 local path = [ $(p).target-path ] ;
-                
+
                 if $(path[2]) = true
-                {        
+                {
                     # Indicates that the path is relative to
                     # build dir.
                     path = [ path.join [ $(self.project).build-dir ]
                        $(path[1]) ] ;
                 }
-                                
+
                 # Store the computed path, so that it's not recomputed
                 # any more
                 self.path = [ path.native $(path) ] ;
-            }            
+            }
         }
         return $(self.path) ;
      }
 
 }
 
+
 class notfile-target : abstract-file-target
 {
     rule __init__ ( name : project : action ? )
     {
         abstract-file-target.__init__ $(name) : : $(project) : $(action) ;
     }
-    
+
     # Returns nothing, to indicate that target path is not known.
     rule path ( )
     {
         return ;
     }
-            
+
     rule actualize-location ( target )
     {
         NOTFILE $(target) ;
         ALWAYS $(target) ;
-    }    
-}    
+    }
+}
+
 
 # Class which represents an action.
 # Both 'targets' and 'sources' should list instances of 'virtual-target'.
@@ -642,34 +659,41 @@
 #     rule action-name ( targets + : sources * : properties * )
 # Targets and sources are passed as actual jam targets. The rule may
 # not establish dependency relationship, but should do everything else.
-class action 
+class action
 {
-    import type toolset property-set indirect class path assert errors ;
-    
+    import type ;
+    import toolset ;
+    import property-set ;
+    import indirect ;
+    import "class" ;
+    import path ;
+    import assert ;
+    import errors ;
+
     rule __init__ ( sources * : action-name + : property-set ? )
-    {        
+    {
         self.sources = $(sources) ;
-    
+
         self.action-name = [ indirect.make-qualified $(action-name) ] ;
-        
-        if ! $(property-set) 
+
+        if ! $(property-set)
         {
             property-set = [ property-set.empty ] ;
         }
-        
+
         if ! [ class.is-instance $(property-set) ]
-        {        
+        {
             errors.error "Property set instance required" ;
         }
-        
+
         self.properties = $(property-set) ;
-    }        
-    
+    }
+
     rule add-targets ( targets * )
     {
         self.targets += $(targets) ;
     }
-        
+
     rule targets ( )
     {
         return $(self.targets) ;
@@ -715,16 +739,16 @@
             toolset.set-target-variables
               [ indirect.get-rule $(self.action-name[1]) ] $(actual-targets)
                 : $(properties) ;
-            
+
             # Reflect ourselves in a variable for the target. This allows
             # looking up additional info for the action given the raw target.
             # For example to debug or output action information from action rules.
             .action on $(actual-targets) = $(__name__) ;
-            
-            indirect.call $(self.action-name) 
-              $(actual-targets) : $(self.actual-sources) : [ $(properties).raw ] 
+
+            indirect.call $(self.action-name)
+              $(actual-targets) : $(self.actual-sources) : [ $(properties).raw ]
                 ;
-            
+
             # Since we set up creating action here, we also set up
             # action for cleaning up
             common.Clean clean-all : $(actual-targets) ;
@@ -747,10 +771,10 @@
             }
             result += [ $(i).actualize $(scanner) ] ;
         }
-        
+
         return $(result) ;
     }
-    
+
     # Creates actual jam targets for sources. Initialized two member
     # variables:.
     # 'self.actual-sources' -- sources which are passed to updating action
@@ -762,10 +786,10 @@
     rule actualize-sources ( sources * : property-set )
     {
         local dependencies = [ $(self.properties).get <dependency> ] ;
-                
-        self.dependency-only-sources += [ 
+
+        self.dependency-only-sources += [
           actualize-source-type $(dependencies) : $(property-set) ] ;
-        self.actual-sources += [ 
+        self.actual-sources += [
           actualize-source-type $(sources) : $(property-set) ] ;
 
         # This is used to help bjam find dependencies in generated headers
@@ -783,7 +807,7 @@
         for local i in $(implicit)
         {
             $(i:G=).actualize ;
-        }        
+        }
     }
 
     # Determined real properties when trying building with 'properties'.
@@ -796,17 +820,18 @@
     }
 }
 
+
 # Action class which does nothing --- it produces the targets with
 # specific properties out of nowhere. It's needed to distinguish virtual
-# targets with different properties that are known to exist, and have no 
+# targets with different properties that are known to exist, and have no
 # actions which create them.
-class null-action : action 
+class null-action : action
 {
     rule __init__ ( property-set ? )
     {
         action.__init__  : .no-action : $(property-set) ;
     }
-        
+
     rule actualize ( )
     {
         if ! $(self.actualized)
@@ -817,16 +842,17 @@
             {
                 $(i).actualize ;
             }
-        }        
+        }
     }
 }
 
+
 # Class which acts exactly like 'action', except that the sources
 # are not scanned for dependencies.
-class non-scanning-action : action 
+class non-scanning-action : action
 {
     rule __init__ ( sources * : action-name + : property-set ? )
-    {        
+    {
         action.__init__ $(sources) : $(action-name) : $(property-set) ;
     }
     rule actualize-source-type ( sources * : property-set )
@@ -835,21 +861,22 @@
         for local i in $(sources)
         {
             result += [ $(i).actualize ] ;
-        }        
+        }
         return $(result) ;
     }
 }
 
 
-# Creates a virtual target with approariate name and type from 'file'.
-# If a target with that name in that project was already created, returns that already
-# created target.
-# FIXME: more correct way would be to compute path to the file, based on name and source location
-# for the project, and use that path to determine if the target was already created.
+# Creates a virtual target with appropriate name and type from 'file'. If a
+# target with that name in that project was already created, returns that
+# already created target.
+# FIXME: more correct way would be to compute path to the file, based on name
+# and source location for the project, and use that path to determine if the
+# target was already created.
 # TODO: passing project with all virtual targets starts to be annoying.
 rule from-file ( file : file-loc : project )
 {
-    import type ; # had to do this here to break a circular dependency
+    import type ;  # had to do this here to break a circular dependency
 
     # Check if we've created a target corresponding to this file.
     local path = [ path.root [ path.root $(file) $(file-loc) ]
@@ -876,52 +903,52 @@
     }
 }
 
-# Registers a new virtual target. Checks if there's already registered target, with the same
-# name, type, project and subvariant properties, and also with the same sources
-# and equal action. If such target is found it is retured and 'target' is not registers.
-# Otherwise, 'target' is registered and returned.
+
+# Registers a new virtual target. Checks if there's already registered target,
+# with the same name, type, project and subvariant properties, and also with the
+# same sources and equal action. If such target is found it is returned and
+# 'target' is not registered. Otherwise, 'target' is registered and returned.
 rule register ( target )
 {
     local signature = [ sequence.join
-       [ $(target).path ] [ $(target).name ] : - ] ;    
+       [ $(target).path ] [ $(target).name ] : - ] ;
 
-            
     local result ;
     for local t in $(.cache.$(signature))
     {
         local a1 = [ $(t).action ] ;
         local a2 = [ $(target).action ] ;
-        
+
         if ! $(result)
         {
             if ! $(a1) && ! $(a2)
             {
                 result = $(t) ;
             }
-            else 
+            else
             {
-                if $(a1) && $(a2) && [ $(a1).action-name ] = [ $(a2).action-name ] && 
+                if $(a1) && $(a2) && [ $(a1).action-name ] = [ $(a2).action-name ] &&
                   [ $(a1).sources ] = [ $(a2).sources ]
                 {
                     local ps1 = [ $(a1).properties ] ;
                     local ps2 = [ $(a2).properties ] ;
                     local p1 = [ $(ps1).base ] [ $(ps1).free ] [ $(ps1).dependency ] ;
                     local p2 = [ $(ps2).base ] [ $(ps2).free ] [ $(ps2).dependency ] ;
-                    if $(p1) = $(p2) 
-                    {                        
+                    if $(p1) = $(p2)
+                    {
                         result = $(t) ;
-                    }                    
+                    }
                 }
-            }                        
+            }
         }
     }
-    
+
     if ! $(result)
     {
-        .cache.$(signature) += $(target) ;     
+        .cache.$(signature) += $(target) ;
         result = $(target) ;
     }
-    
+
     .recent-targets += $(result) ;
     .all-targets += $(result) ;
 
@@ -929,28 +956,30 @@
 }
 
 
-# Each target returned by 'register' is added to a list of
-# 'recent-target', returned by this function. So, this allows
-# us to find all targets created when building a given main
-# target, even if the target
+# Each target returned by 'register' is added to a list of 'recent-target',
+# returned by this function. So, this allows us to find all targets created when
+# building a given main target, even if the target... !!!MISSING TEXT HERE!!!
 rule recent-targets ( )
 {
     return $(.recent-targets) ;
 }
 
+
 rule clear-recent-targets ( )
 {
     .recent-targets = ;
 }
 
-# Returns all virtual targets ever created
+
+# Returns all virtual targets ever created.
 rule all-targets ( )
 {
     return $(.all-targets) ;
 }
 
-# Returns all targets from 'targets' with types
-# equal to 'type' or derived from it.
+
+# Returns all targets from 'targets' with types equal to 'type' or derived from
+# it.
 rule select-by-type ( type : targets * )
 {
     local result ;
@@ -959,12 +988,11 @@
         if [ type.is-subtype [ $(t).type ] $(type) ]
         {
             result += $(t) ;
-        }         
+        }
     }
-    
-    return $(result) ;    
-}
 
+    return $(result) ;
+}
 
 
 rule register-actual-name ( actual-name : virtual-target )
@@ -975,8 +1003,7 @@
         local cs2 = [ $(virtual-target).creating-subvariant ] ;
         local cmt1 = [ $(cs1).main-target ] ;
         local cmt2 = [ $(cs2).main-target ] ;
-        
-        
+
         local action1 = [ $(.actual.$(actual-name)).action ] ;
         local action2 = [ $(virtual-target).action ] ;
         local properties-added ;
@@ -991,26 +1018,26 @@
             properties-removed ?= "none" ;
             properties-added = [ set.difference $(p2) : $(p1) ] ;
             properties-added ?= "none" ;
-        }        
-        errors.error "Duplicate name of actual target:" $(actual-name) 
-          : "previous virtual target" [ $(.actual.$(actual-name)).str ] 
+        }
+        errors.error "Duplicate name of actual target:" $(actual-name)
+          : "previous virtual target" [ $(.actual.$(actual-name)).str ]
           : "created from" [ $(cmt1).full-name ]
           : "another virtual target" [ $(virtual-target).str ]
-          : "created from" [ $(cmt2).full-name ]                
-          : "added properties: " $(properties-added) 
+          : "created from" [ $(cmt2).full-name ]
+          : "added properties: " $(properties-added)
           : "removed properties: " $(properties-removed) ;
     }
     else
     {
         .actual.$(actual-name) = $(virtual-target) ;
-    }        
+    }
 }
 
 
-# Traverses the dependency graph of 'target' and return all targets that will
-# be created before this one is created. If root of some dependency graph is
-# found during traversal, it's either included or not, dependencing of the
-# value of 'include-roots'. In either case, sources of root are not traversed.
+# Traverses the dependency graph of 'target' and return all targets that will be
+# created before this one is created. If root of some dependency graph is found
+# during traversal, it's either included or not, dependencing of the value of
+# 'include-roots'. In either case, sources of root are not traversed.
 rule traverse ( target : include-roots ? : include-sources ? )
 {
     local result ;
@@ -1029,20 +1056,21 @@
             else if $(include-roots)
             {
                 result += $(t) ;
-            }            
+            }
         }
     }
     else if $(include-sources)
     {
         result = $(target) ;
-    }    
+    }
     return $(result) ;
 }
 
-# Takes an 'action' instances and creates new instance of it
-# and all produced target. The rule-name and properties are set
-# to 'new-rule-name' and 'new-properties', if those are specified.
-# Returns the cloned action.
+
+# Takes an 'action' instance and creates a new instance of it and all targets
+# produced by the action. The rule-name and properties are set to
+# 'new-rule-name' and 'new-properties', if those are specified. Returns the
+# cloned action.
 rule clone-action ( action : new-project : new-action-name ? : new-properties ? )
 {
     if ! $(new-action-name)
@@ -1055,43 +1083,44 @@
     }
 
     local action-class = [ modules.peek $(action) : __class__ ] ;
-    local cloned-action = [ class.new $(action-class)  
+    local cloned-action = [ class.new $(action-class)
       [ $(action).sources ] : $(new-action-name) : $(new-properties) ] ;
-                        
+
     local cloned-targets ;
     for local target in [ $(action).targets ]
     {
         local n = [ $(target).name ] ;
         # Don't modify the name of the produced targets.Strip the directory f
-        local cloned-target = [ class.new file-target $(n) exact : [ $(target).type ] 
+        local cloned-target = [ class.new file-target $(n) exact : [ $(target).type ]
           : $(new-project) : $(cloned-action) ] ;
         local d = [ $(target).dependencies ] ;
         if $(d)
-        {            
+        {
             $(cloned-target).depends $(d) ;
-        }                    
+        }
         $(cloned-target).root [ $(target).root ] ;
         $(cloned-target).creating-subvariant [ $(target).creating-subvariant ] ;
-        
+
         cloned-targets += $(cloned-target) ;
-    }        
-                    
-    return $(cloned-action) ;        
+    }
+
+    return $(cloned-action) ;
 }
 
+
 class subvariant
 {
-    import sequence ;    
+    import sequence ;
     import type ;
-    
+
     rule __init__ ( main-target # The instance of main-target class
         : property-set                     # Properties requested for this target
         : sources *
         : build-properties                 # Actually used properties
         : sources-usage-requirements       # Properties propagated from sources
         : created-targets * )              # Top-level created targets
-    {        
-        self.main-target = $(main-target) ;        
+    {
+        self.main-target = $(main-target) ;
         self.properties = $(property-set) ;
         self.sources = $(sources) ;
         self.build-properties = $(build-properties) ;
@@ -1105,74 +1134,72 @@
         {
             self.other-dg += [ $(d:G=).creating-subvariant ] ;
         }
-        
+
         self.other-dg = [ sequence.unique $(self.other-dg) ] ;
     }
-    
-               
+
     rule main-target ( )
     {
         return $(self.main-target) ;
     }
-    
-    rule created-targets ( ) 
+
+    rule created-targets ( )
     {
         return $(self.created-targets) ;
     }
-    
+
     rule requested-properties ( )
     {
         return $(self.properties) ;
     }
-    
+
     rule build-properties ( )
     {
         return $(self.build-properties) ;
     }
-        
+
     rule sources-usage-requirements ( )
     {
         return $(self.sources-usage-requirements) ;
     }
-    
+
     rule set-usage-requirements ( usage-requirements )
     {
         self.usage-requirements = $(usage-requirements) ;
     }
-    
+
     rule usage-requirements ( )
     {
         return $(self.usage-requirements) ;
     }
-            
-    # Returns all targets referenced by this subvariant,
-    # either directly or indirectly, and 
-    # either as sources, or as dependency properties.
-    # Targets referred with dependency property are returned a properties,
-    # not targets.
+
+    # Returns all targets referenced by this subvariant, either directly or
+    # indirectly, and either as sources, or as dependency properties. Targets
+    # referred to using the dependency property are returned as properties, not
+    # targets.
     rule all-referenced-targets ( )
     {
         # Find directly referenced targets.
         local deps = [ $(self.build-properties).dependency ] ;
         local all-targets = $(self.sources) $(deps) ;
-        
+
         # Find other subvariants.
         local r ;
         for local t in $(all-targets)
-        {            
+        {
             r += [ $(t:G=).creating-subvariant ] ;
         }
         r = [ sequence.unique $(r) ] ;
-        for local s in $(r) 
+        for local s in $(r)
         {
             if $(s) != $(__name__)
             {
                 all-targets += [ $(s).all-referenced-targets ] ;
-            }            
+            }
         }
-        return $(all-targets) ;                        
+        return $(all-targets) ;
     }
-               
+
     # Returns the properties which specify implicit include paths to
     # generated headers. This traverses all targets in this subvariant,
     # and subvariants referred by <implcit-dependecy>properties.
@@ -1184,13 +1211,13 @@
         local key = ii$(feature)-$(target-type:E="") ;
         if ! $($(key))-is-nonempty
         {
-            local target-paths = [ all-target-directories $(target-type) ] ;    
+            local target-paths = [ all-target-directories $(target-type) ] ;
             target-paths = [ sequence.unique $(target-paths) ] ;
             local result = $(target-paths:G=$(feature)) ;
             if ! $(result)
             {
                 result = "" ;
-            }            
+            }
             $(key) = $(result) ;
         }
         if $($(key)) = ""
@@ -1200,37 +1227,36 @@
         else
         {
             return $($(key)) ;
-        }        
+        }
     }
-        
+
     rule all-target-directories ( target-type ? )
     {
         if ! $(self.target-directories)
         {
             compute-target-directories $(target-type) ;
-        }                
+        }
         return $(self.target-directories) ;
     }
-    
+
     rule compute-target-directories ( target-type ? )
-    {   
+    {
         local result ;
         for local t in $(self.created-targets)
         {
-            if $(target-type) && ! [ type.is-derived [ $(t).type ] $(target-type) ] 
+            if $(target-type) && ! [ type.is-derived [ $(t).type ] $(target-type) ]
             {
                 # Skip target which is of wrong type.
             }
             else
-            {                
+            {
                 result = [ sequence.merge $(result) : [ $(t).path ] ] ;
-            }            
+            }
         }
         for local d in $(self.other-dg)
         {
             result += [ $(d).all-target-directories $(target-type) ] ;
         }
         self.target-directories = $(result) ;
-    }   
+    }
 }
-
Modified: trunk/tools/build/v2/tools/package.jam
==============================================================================
--- trunk/tools/build/v2/tools/package.jam	(original)
+++ trunk/tools/build/v2/tools/package.jam	2008-01-05 13:13:10 EST (Sat, 05 Jan 2008)
@@ -34,7 +34,6 @@
 import targets ;
 import "class" : new ;
 import option ;
-import errors ;
 import stage ;
 import property ;
 
@@ -77,7 +76,6 @@
     # source header files
     local include-locate = [ option.get includedir : $(prefix)/include ] ;
 
-    
     stage.install $(name)-bin : $(binaries) : $(requirements) <location>$(bin-locate) ;
     stage.install $(name)-lib : 
         $(binaries) $(libraries) 
Modified: trunk/tools/build/v2/tools/stage.jam
==============================================================================
--- trunk/tools/build/v2/tools/stage.jam	(original)
+++ trunk/tools/build/v2/tools/stage.jam	2008-01-05 13:13:10 EST (Sat, 05 Jan 2008)
@@ -1,23 +1,19 @@
-# Copyright 2003 Dave Abrahams 
-# Copyright 2005, 2006 Rene Rivera 
-# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus 
-# 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) 
+# Copyright 2003 Dave Abrahams
+# Copyright 2005, 2006 Rene Rivera
+# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
+# 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)
 
-#  This module defines the 'install' rule, used to copy a set of targets to
-#  a single location
+#  This module defines the 'install' rule, used to copy a set of targets to a
+#  single location
 
 import targets ;
 import "class" : new ;
-import property ;
-import errors : error ;
-import type : type ;
+import errors ;
 import type ;
-import regex ;
 import generators ;
 import feature ;
 import project ;
-import property-set ;
 import virtual-target ;
 import path ;
 
@@ -31,12 +27,20 @@
 
 class install-target-class : basic-target
 {
-    import feature project type errors generators path stage ;    
+    import feature ;
+    import project ;
+    import type ;
+    import errors ;
+    import generators ;
+    import path ;
+    import stage ;
     import "class" : new ;
-    
+    import property ;
+    import property-set ;
+
     rule __init__ ( name-and-dir : project : sources * : requirements * : default-build * )
     {
-        basic-target.__init__ $(name-and-dir) : $(project) : $(sources) : $(requirements) 
+        basic-target.__init__ $(name-and-dir) : $(project) : $(sources) : $(requirements)
           : $(default-build) ;
     }
 
@@ -50,195 +54,192 @@
 
             property-set = [ $(property-set).add-raw $(loc:G=<location>) ] ;
         }
-        
+
         return $(property-set) ;
     }
-            
+
     # Takes a target that is installed and property set which is
     # used when installing.
     rule adjust-properties ( target : build-property-set )
     {
         local ps-raw ;
-        local a = [ $(target).action ] ;       
+        local a = [ $(target).action ] ;
         if $(a)
         {
             local ps = [ $(a).properties ] ;
             ps-raw = [ $(ps).raw ] ;
-                        
+
             # Unless <hardcode-dll-paths>true is in properties, which can
             # happen only if the user has explicitly requested it, nuke all
-            # <dll-path> properties                                  
+            # <dll-path> properties
             if [ $(property-set).get <hardcode-dll-paths> ] != true
             {
                 ps-raw = [ property.change $(ps-raw) : <dll-path> ] ;
             }
-            
+
             # If any <dll-path> properties were specified for installing,
             # add them.
             local l = [ $(build-property-set).get <dll-path> ] ;
             ps-raw += $(l:G=<dll-path>) ;
-            
+
             # Also copy <linkflags> feature from current build
             # set, to be used for relinking.
             local l = [ $(build-property-set).get <linkflags> ] ;
-            ps-raw += $(l:G=<linkflags>) ;            
+            ps-raw += $(l:G=<linkflags>) ;
         }
-        
+
         # Remove the <tag> feature on original targets.
         ps-raw = [ property.change $(ps-raw) : <tag> ] ;
         # And <location>. If stage target has another stage target
         # in sources, then we'll get virtual targets with <location>
         # property set.
         ps-raw = [ property.change $(ps-raw) : <location> ] ;
-        
-        
+
+
         local d = [ $(build-property-set).get <dependency> ] ;
         ps-raw += $(d:G=<dependency>) ;
-        
+
         local d = [ $(build-property-set).get <location> ] ;
         ps-raw += $(d:G=<location>) ;
-        
+
         local ns = [ $(build-property-set).get <install-no-version-symlinks> ] ;
         ps-raw += $(ns:G=<install-no-version-symlinks>) ;
-        
+
         local d = [ $(build-property-set).get <install-source-root> ] ;
         # Make the path absolute: we'll use it to compute relative
         # paths and making the path absolute will help.
         if $(d)
-        {            
+        {
             d = [ path.root $(d) [ path.pwd ] ] ;
             ps-raw += $(d:G=<install-source-root>) ;
-        }        
-        
+        }
+
         if $(ps-raw)
         {
             return [ property-set.create $(ps-raw) ]  ;
-        }        
+        }
         else
         {
             return [ property-set.empty ] ;
-        }        
+        }
     }
-    
-        
+
     rule construct ( name : source-targets * : property-set )
-    {                
-        source-targets = [ 
+    {
+        source-targets = [
           targets-to-stage $(source-targets) : $(property-set) ] ;
-        
-        property-set = [ update-location $(property-set) ] ;          
-        
-        local ename = [ $(property-set).get <name> ] ;              
-                
+
+        property-set = [ update-location $(property-set) ] ;
+
+        local ename = [ $(property-set).get <name> ] ;
+
         if $(ename) && $(source-targets[2])
         {
-            errors.error 
+            errors.error
               "When <name> property is used in 'install', only one source is allowed" ;
         }
-        
-                                       
+
         local result ;
         for local i in $(source-targets)
-        {            
+        {
             local staged-targets ;
-                        
-            local new-properties = 
+
+            local new-properties =
               [ adjust-properties $(i) : $(property-set) ] ;
-                                    
+
             # See if something special should be done when staging this
-            # type. It is indicated by presense of special "staged" type            
-            local t = [ $(i).type ] ;            
+            # type. It is indicated by presense of special "staged" type
+            local t = [ $(i).type ] ;
             if $(t) && [ type.registered INSTALLED_$(t) ]
             {
                 if $(ename)
                 {
-                    error.error "In 'install': <name> property specified with target that requires relinking" ;
+                    errors.error "In 'install': <name> property specified with target that requires relinking" ;
                 }
                 else
                 {
-                    local targets = [ generators.construct $(self.project) $(name) : 
+                    local targets = [ generators.construct $(self.project) $(name) :
                       INSTALLED_$(t) : $(new-properties) : $(i) ] ;
-                    staged-targets += $(targets[2-]) ;                                
-                }                                                
+                    staged-targets += $(targets[2-]) ;
+                }
             }
-            else             
-            {                
+            else
+            {
                 staged-targets = [ stage.copy-file $(self.project) $(ename)
                   : $(i) : $(new-properties) ] ;
             }
-            
+
             if ! $(staged-targets)
-            {                    
+            {
                 errors.error "Unable to generate staged version of " [ $(source).str ] ;
-            }                
-            
-            for t in $(staged-targets) 
+            }
+
+            for t in $(staged-targets)
             {
-                result += [ virtual-target.register $(t) ] ;          
-            }            
+                result += [ virtual-target.register $(t) ] ;
+            }
         }
-        
+
         return [ property-set.empty ] $(result) ;
-    }   
-    
+    }
 
     # Given the list of source targets explicitly passed to 'stage',
     # returns the list of targets which must be staged.
     rule targets-to-stage ( source-targets * : property-set )
-    {   
+    {
         local result ;
-               
+
         # Traverse the dependencies, if needed.
         if [ $(property-set).get <install-dependencies> ] = "on"
         {
             source-targets = [ collect-targets $(source-targets) ] ;
         }
-        
+
         # Filter the target types, if needed
-        local included-types = [ $(property-set).get <install-type> ] ;                               
+        local included-types = [ $(property-set).get <install-type> ] ;
         for local r in $(source-targets)
         {
-            local ty = [ $(r).type ] ;        
+            local ty = [ $(r).type ] ;
             if $(ty)
             {
                 # Don't stage searched libs.
                 if $(ty) != SEARCHED_LIB
                 {
                     if $(included-types)
-                    {                        
+                    {
                         if [ include-type $(ty) : $(included-types) ]
                         {
                             result += $(r) ;
-                        }                                    
-                    }                
+                        }
+                    }
                     else
                     {
-                        result += $(r) ;                        
-                    }   
-                }                                
+                        result += $(r) ;
+                    }
+                }
             }
             else if ! $(included-types)
             {
                 # Don't install typeless target if there's
                 # explicit list of allowed types.
                 result += $(r) ;
-            }                
+            }
         }
-                
+
         return $(result) ;
     }
-    
+
     # CONSIDER: figure out why we can't use virtual-target.traverse here.
     rule collect-targets ( targets * )
     {
         # Find subvariants
-        local s ;        
+        local s ;
         for local t in $(targets)
         {
             s += [ $(t).creating-subvariant ] ;
         }
         s = [ sequence.unique $(s) ] ;
-        
+
         local result = $(targets) ;
         for local i in $(s)
         {
@@ -250,11 +251,11 @@
             if $(r:G) != <use>
             {
                 result2 += $(r:G=) ;
-            }            
-        }        
-        result = [ sequence.unique $(result2) ] ;        
+            }
+        }
+        result = [ sequence.unique $(result2) ] ;
     }
-                
+
     # Returns true iff 'type' is subtype of some element of 'types-to-include'.
     local rule include-type ( type : types-to-include * )
     {
@@ -264,27 +265,27 @@
             if [ type.is-subtype $(type) $(types-to-include[1]) ]
             {
                 found = true ;
-            }            
+            }
             types-to-include = $(types-to-include[2-]) ;
         }
-        
+
         return $(found) ;
-    }            
+    }
 }
 
-# Creates a copy of target 'source'. The 'properties' object should
-# have a <location> property which specifies where the target must
-# be placed.
+
+# Creates a copy of target 'source'. The 'properties' object should have a
+# <location> property which specifies where the target must be placed.
 rule copy-file ( project name ? : source : properties )
-{   
+{
     local targets ;
     name ?= [ $(source).name ] ;
 
-    new-a = [ 
-      new non-scanning-action $(source) : common.copy : $(properties) ] ;    
+    new-a = [
+        new non-scanning-action $(source) : common.copy : $(properties) ] ;
     local source-root = [ $(properties).get <install-source-root> ] ;
-    if $(source-root) 
-    {        
+    if $(source-root)
+    {
         # Get the real path of the target. We probably need to strip
         # relative path from the target name at construction...
         local path = [ $(source).path ] ;
@@ -293,8 +294,8 @@
         # path. The 'source-root' is already absolute, see the
         # 'adjust-properties' method above.
         path = [ path.root $(path) [ path.pwd ] ] ;
-        
-        relative = [ path.relative-to $(source-root) $(path) ] ;        
+
+        relative = [ path.relative-to $(source-root) $(path) ] ;
         # Note: using $(name:D=$(relative)) might be faster
         # here, but then we need to explicitly check that
         # relative is not ".", otherwise we might get paths like
@@ -302,190 +303,198 @@
         #   <prefix>/boost/.
         #
         # try to create it, and mkdir will obviously fail.
-        name = [ path.root $(name:D=) $(relative) ] ;                      
-        targets = [ new file-target $(name) exact : [ $(source).type ] 
+        name = [ path.root $(name:D=) $(relative) ] ;
+        targets = [ new file-target $(name) exact : [ $(source).type ]
           : $(project) : $(new-a) ] ;
-                
-    }        
+    }
     else
     {
-        targets = [ new file-target $(name:D=) exact : [ $(source).type ] 
+        targets = [ new file-target $(name:D=) exact : [ $(source).type ]
           : $(project) : $(new-a) ] ;
     }
-            
+
     return $(targets) ;
 }
 
+
 rule symlink ( name : project : source : properties )
 {
     local a = [ new action $(source) : symlink.ln :
       $(properties) ] ;
-    local targets = [ 
+    local targets = [
      new file-target $(name) exact : [ $(source).type ] : $(project) : $(a) ] ;
-    
+
     return $(targets) ;
 }
 
-rule relink-file ( project : source : property-set  ) 
-{                                
+
+rule relink-file ( project : source : property-set  )
+{
     local action = [ $(source).action ] ;
     local cloned-action = [ virtual-target.clone-action $(action) : $(project) :
       "" : $(property-set) ] ;
-    local result = [ $(cloned-action).targets ] ;                        
-    
+    local result = [ $(cloned-action).targets ] ;
+
     return $(result) ;
 }
 
+
 # Declare installed version of the EXE type. Generator for this type will
 # cause relinking to the new location.
 type.register INSTALLED_EXE : : EXE ;
 
 class installed-exe-generator : generator
 {
-    import type property-set modules stage ;
-    
+    import type ;
+    import property-set ;
+    import modules ;
+    import stage ;
+
     rule __init__ ( )
     {
         generator.__init__ install-exe : EXE : INSTALLED_EXE ;
     }
-    
+
     rule run ( project name ? : property-set : source : multiple ? )
     {
         if [ $(property-set).get <os> ] in NT CYGWIN
         {
             # Relinking is never needed on NT
-            return [ stage.copy-file $(project) 
-              : $(source) : $(property-set) ] ; 
+            return [ stage.copy-file $(project)
+              : $(source) : $(property-set) ] ;
         }
-        else 
+        else
         {
-            return [ stage.relink-file $(project) 
-              : $(source) : $(property-set) ] ;            
-        }                
-    }    
+            return [ stage.relink-file $(project)
+              : $(source) : $(property-set) ] ;
+        }
+    }
 }
 
 generators.register [ new installed-exe-generator ] ;
 
 
 # Installing shared link on Unix might cause a creation of
-# versioned symbolic links. 
+# versioned symbolic links.
 type.register INSTALLED_SHARED_LIB : : SHARED_LIB ;
+
 class installed-shared-lib-generator : generator
 {
-    import type property-set modules stage ;
-    
+    import type ;
+    import property-set ;
+    import modules ;
+    import stage ;
+
     rule __init__ ( )
     {
         generator.__init__ install-shared-lib : SHARED_LIB
           : INSTALLED_SHARED_LIB ;
     }
-    
+
     rule run ( project name ? : property-set : source : multiple ? )
-    {                        
+    {
         if [ $(property-set).get <os> ] = NT
         {
-            local copied = [ stage.copy-file $(project) 
-              : $(source) : $(property-set) ] ; 
-        
+            local copied = [ stage.copy-file $(project)
+              : $(source) : $(property-set) ] ;
+
             copied = [ virtual-target.register $(copied) ] ;
-            
+
             return $(copied) ;
         }
-        else 
+        else
         {
-            local a = [ $(source).action ] ;            
+            local a = [ $(source).action ] ;
             local copied ;
             if ! $(a)
             {
                 # Non-derived file, just copy.
-                copied = [ stage.copy-file $(project) 
-                  : $(source) : $(property-set) ] ; 
+                copied = [ stage.copy-file $(project)
+                  : $(source) : $(property-set) ] ;
             }
             else
-            {                            
+            {
                 local cp = [ $(a).properties ] ;
                 local current-dll-path = [ $(cp).get <dll-path> ] ;
                 local new-dll-path = [ $(property-set).get <dll-path> ] ;
-                                    
+
                 if $(current-dll-path) != $(new-dll-path)
                 {
                     # Rpath changed, need to relink.
-                    copied = [ stage.relink-file 
+                    copied = [ stage.relink-file
                         $(project) : $(source) : $(property-set) ] ;
                 }
                 else
-                {                                        
-                    copied = [ stage.copy-file $(project) 
-                      : $(source) : $(property-set) ] ; 
+                {
+                    copied = [ stage.copy-file $(project)
+                      : $(source) : $(property-set) ] ;
                 }
             }
-                                
+
             copied = [ virtual-target.register $(copied) ] ;
-                                    
+
             local result = $(copied) ;
             # If the name is in the form NNN.XXX.YYY.ZZZ, where all
             # 'X', 'Y' and 'Z' are numbers, we need to create
             # NNN.XXX and NNN.XXX.YYY symbolic links.
-            local m = [ MATCH (.*)\\.([0123456789]+)\\.([0123456789]+)\\.([0123456789]+)$ 
+            local m = [ MATCH (.*)\\.([0123456789]+)\\.([0123456789]+)\\.([0123456789]+)$
               : [ $(copied).name ] ] ;
             if $(m)
             {
                 # Symlink without version at all is used to make
                 # -lsome_library work.
                 result += [ stage.symlink $(m[1]) : $(project)
-                  : $(copied) : $(property-set) ] ;                
-                
+                  : $(copied) : $(property-set) ] ;
+
                 # Symlinks of some libfoo.N and libfoo.N.M are used
                 # so that library can found at runtime, if libfoo.N.M.X
                 # has soname of libfoo.N. That happens when the library
                 # makes some binary compatibility guarantees. If not,
                 # it's possible to skip those symlinks.
-                local suppress = 
+                local suppress =
                   [ $(property-set).get <install-no-version-symlinks> ] ;
-                
+
                 if $(suppress) != "on"
-                {                    
+                {
                     result += [ stage.symlink $(m[1]).$(m[2]) : $(project)
                       : $(copied) : $(property-set) ] ;
                     result += [ stage.symlink $(m[1]).$(m[2]).$(m[3])  : $(project)
                       : $(copied) : $(property-set) ] ;
-                }                
+                }
             }
-                                                
+
             return $(result) ;
-        }                
-    }    
+        }
+    }
 }
 
 generators.register [ new installed-shared-lib-generator ] ;
 
 
-
 # Main target rule for 'install'
 rule install ( name : sources * : requirements * : default-build * )
 {
     local project = [ project.current ] ;
-    
+
     # Unless the user has explicitly asked us to hardcode dll paths, add
     # <hardcode-dll-paths>false in requirements, to override default
     # value.
     if ! <hardcode-dll-paths>true in $(requirements)
     {
         requirements += <hardcode-dll-paths>false ;
-    }        
-        
+    }
+
     if <tag> in $(requirements:G)
     {
-        errors.user-error 
+        errors.user-error
           "The <tag> property is not allowed for the 'install' rule" ;
     }
-           
+
     targets.main-target-alternative
-      [ new install-target-class $(name) : $(project) 
+      [ new install-target-class $(name) : $(project)
         : [ targets.main-target-sources $(sources) : $(name) ]
-        : [ targets.main-target-requirements $(requirements) : $(project) ] 
-        : [ targets.main-target-default-build $(default-build) : $(project) ] 
+        : [ targets.main-target-requirements $(requirements) : $(project) ]
+        : [ targets.main-target-default-build $(default-build) : $(project) ]
       ] ;
 }