diff --git a/v2/build/generators.jam b/v2/build/generators.jam index 77802458d..d935f6ee4 100644 --- a/v2/build/generators.jam +++ b/v2/build/generators.jam @@ -1054,66 +1054,7 @@ local rule find-viable-generators ( target-type : property-set ) return $(result) ; } - - -# Given a vector of vectors, of of them represents results of running some -# generator, returns the 'best' result, it it exists. Otherwise, exit with -# and error. Result is returned as plain jam list. -local rule select-dependency-graph ( options ) -{ - if [ $(options).size ] = 0 - { - return ; - } - else if [ $(options).size ] = 1 - { - return [ $(options).get-at 1 ] ; - } - else - { - # We have several alternatives and need to check if they - # are the same. - for local r in [ $(options).get ] - { - normalize-target-list $(r) ; - local v = [ $(r).get ] ; - generators.dout $(v[2-]) ; - } - - # One note why we can compare object names directly, - # without using deep copy. All the targets here are - # produced by some generators, and generators should - # pass the targets they've returned via 'virtual-target.register'. - # So, two elements can only be equivalent, if they are just - # the same object. - local f = [ $(options).at 1 ] ; - f = [ $(f).get ] ; - f = $(f[2-]) ; - local mismatch ; - for local r in [ $(options).get ] - { - local v = [ $(r).get ] ; - v = $(v[2-]) ; - if $(f) != $(v) - { - mismatch = true ; - } - } - - if ! $(mismatch) - { - local v = [ $(options).at 1 ] ; - return [ $(v).get ] ; - } - else - { - error [ $(options).size ] "possible generations for " - $(target-types) "Can't handle this now." ; - } - } -} - .construct-stack = ; # Attempts to construct target by finding viable generators, running them @@ -1122,12 +1063,11 @@ local rule construct-really ( project name ? : target-type : property-set : sources * ) { viable-generators = [ find-viable-generators $(target-type) : $(property-set) ] ; - - local results = [ new vector ] ; - + generators.dout [ indent ] "*** " [ sequence.length $(viable-generators) ] " viable generators" ; + local result ; for local g in $(viable-generators) { # This variable will be restored on exit from this scope. @@ -1138,11 +1078,18 @@ local rule construct-really ( if $(r) { - $(results).push-back [ new vector $(r) ] ; + if $(result) + { + error "Ambiguity found when searching for best transformation" ; + } + else + { + result = $(r) ; + } } } - return [ select-dependency-graph $(results) ] ; + return $(result) ; } @@ -1164,43 +1111,26 @@ local rule construct-really ( rule construct ( project name ? : target-type : property-set * : sources * : allowed-type * ) { - allowed-type ?= $(target-type) ; if (.construct-stack) { ensure-type $(sources) ; } - - # Intermediate targets are not passed to generators - # and just returned unmodified. - local intermediate ; - if ! $(.construct-stack) - { - local sources2 ; - for local s in $(sources) - { - if ! [ $(s).intermediate ] - { - sources2 += $(s) ; - } - else - { - intermediate += $(s) ; - } - } - sources = $(sources2) ; - } .construct-stack += 1 ; increase-indent ; + + if $(.debug) + { + generators.dout [ indent ] "*** construct" $(target-type) ; - generators.dout [ indent ] "*** construct" $(target-type) ; - - for local s in $(sources) - { - generators.dout [ indent ] " from" $(s) ; + 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) : $(target-type) : $(property-set) : $(sources) ] ; @@ -1208,30 +1138,7 @@ rule construct ( project name ? : target-type : property-set * : sources * decrease-indent ; .construct-stack = $(.construct-stack[2-]) ; - - if ! $(.construct-stack) - { - result += $(intermediate) ; - } - - # For all targets of 'allowed-type', reset the 'intermediate' attribute. - if ! $(.construct-stack) && $(allowed-type) != * # This is first invocation in stack - { - local result2 ; - for local t in $(result[2-]) - { - local type = [ $(t).type ] ; - # Return only targets of the requested type, unless 'return-all' - # is specified. If we don't do this, then all targets calling - # 'construct' will get unused target returned, which will break - # checking for unused sources a bit harder. - if $(type) && ( $(type) = $(target-type) || [ type.is-derived $(type) $(allowed-type) ] ) - { - $(t).set-intermediate ; - } - } - } - + return $(result) ; } diff --git a/v2/build/virtual-target.jam b/v2/build/virtual-target.jam index ba58096c6..1ee2156b6 100644 --- a/v2/build/virtual-target.jam +++ b/v2/build/virtual-target.jam @@ -257,18 +257,6 @@ class abstract-file-target : virtual-target return $(self.root) ; } - rule set-intermediate ( value ? ) - { - self.intermediate = $(value) ; - } - - rule intermediate ( ) - { - return $(self.intermediate) ; - } - - - # 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 @@ -506,7 +494,7 @@ class file-target : abstract-file-target abstract-file-target.__init__ $(name) $(exact) : $(type) : $(project) : $(action) ; - self.path = $(path) ; + self.path = $(path) ; } rule actualize-location ( target ) @@ -783,7 +771,7 @@ rule from-file ( file : file-loc : project ) local type = [ type.type $(file) ] ; local result ; - result = [ new file-target $(file) + result = [ new file-target $(file) : $(type) : $(project) : #action @@ -801,7 +789,8 @@ rule from-file ( file : file-loc : project ) rule register ( target ) { local signature = [ sequence.join - [ $(target).name ] : - ] ; + [ $(target).name ] : - ] ; + local result ; for local t in $(.cache.$(signature)) diff --git a/v2/tools/acc.jam b/v2/tools/acc.jam index 8dce8c7c4..e52ff4deb 100644 --- a/v2/tools/acc.jam +++ b/v2/tools/acc.jam @@ -10,9 +10,11 @@ import toolset : flags ; import feature ; +import generators ; feature.extend toolset : acc ; toolset.inherit acc : unix ; +generators.override builtin.lib-generator : acc.prebuilt ; feature.subfeature toolset acc : version ; # Configures the acc toolset. diff --git a/v2/tools/como-linux.jam b/v2/tools/como-linux.jam index e6a278a2d..9a913f513 100644 --- a/v2/tools/como-linux.jam +++ b/v2/tools/como-linux.jam @@ -11,13 +11,16 @@ import toolset ; import feature ; import toolset : flags ; import common ; +import generators ; import unix ; import como ; + feature.extend-subfeature toolset como : platform : linux ; toolset.inherit-generators como-linux como linux : unix ; +generators.override builtin.lib-generator : como-linux.prebuilt ; toolset.inherit-flags como-linux : unix ; toolset.inherit-rules como-linux : gcc ; diff --git a/v2/tools/darwin.jam b/v2/tools/darwin.jam index a2a8a775d..72d871807 100644 --- a/v2/tools/darwin.jam +++ b/v2/tools/darwin.jam @@ -11,10 +11,12 @@ import feature : feature ; import toolset : flags ; import type ; import common ; +import generators ; toolset.register darwin ; import gcc ; toolset.inherit-generators darwin : gcc ; +generators.override builtin.lib-generator : darwin.prebuilt ; toolset.inherit-rules darwin : gcc ; toolset.inherit-flags darwin : gcc ; diff --git a/v2/tools/gcc.jam b/v2/tools/gcc.jam index 9653f48c7..60dead6dd 100644 --- a/v2/tools/gcc.jam +++ b/v2/tools/gcc.jam @@ -21,6 +21,7 @@ feature.extend toolset : gcc ; import unix ; toolset.inherit-generators gcc : unix : unix.link unix.link.dll ; +generators.override builtin.lib-generator : gcc.prebuilt ; toolset.inherit-flags gcc : unix ; toolset.inherit-rules gcc : unix ; diff --git a/v2/tools/intel-linux.jam b/v2/tools/intel-linux.jam index 1d3772a11..afbe4995a 100644 --- a/v2/tools/intel-linux.jam +++ b/v2/tools/intel-linux.jam @@ -12,11 +12,13 @@ import intel ; import gcc ; import common ; import errors ; +import generators ; feature.extend-subfeature toolset intel : platform : linux ; toolset.inherit-generators intel-linux intel linux : gcc ; +generators.override builtin.lib-generator : intel-linux.prebuilt ; toolset.inherit-rules intel-linux : gcc ; toolset.inherit-flags intel-linux : gcc : off on full space ; diff --git a/v2/tools/stage.jam b/v2/tools/stage.jam index f856ae6f2..43442b349 100644 --- a/v2/tools/stage.jam +++ b/v2/tools/stage.jam @@ -180,14 +180,7 @@ class install-target-class : basic-target } else { - # Intermediate targets are those with - # "unrequested" types. Unless specific list - # of target types is given, we don't install - # such targets. - if ! [ $(r).intermediate ] - { - result += $(r) ; - } + result += $(r) ; } } } diff --git a/v2/tools/sun.jam b/v2/tools/sun.jam index 4d012748a..80c4e3733 100644 --- a/v2/tools/sun.jam +++ b/v2/tools/sun.jam @@ -14,6 +14,7 @@ import common ; feature.extend toolset : sun ; toolset.inherit sun : unix ; +generators.override builtin.lib-generator : sun.prebuilt ; feature.subfeature toolset sun : version ; feature.extend stdlib : sun-stlport ; diff --git a/v2/tools/unix.jam b/v2/tools/unix.jam index 4e5d7697f..3feff168b 100644 --- a/v2/tools/unix.jam +++ b/v2/tools/unix.jam @@ -138,7 +138,7 @@ generators.register [ new unix-prebuilt-lib-generator unix.prebuilt : : LIB : unix ] ; - +generators.override builtin.lib-generator : unix.prebuilt ; # Declare generators diff --git a/v2/tools/vacpp.jam b/v2/tools/vacpp.jam index 26117688b..5b72469a7 100644 --- a/v2/tools/vacpp.jam +++ b/v2/tools/vacpp.jam @@ -11,9 +11,11 @@ import toolset : flags ; import feature ; import common ; +import generators ; feature.extend toolset : vacpp ; toolset.inherit vacpp : unix ; +generators.override builtin.lib-generator : vacpp.prebuilt ; feature.subfeature toolset vacpp : version ; # Configures the vacpp toolset.