From 49ce46e7fdfc20a18e59c981c7f5d90cedd3cbb2 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 7 Aug 2006 05:27:15 +0000 Subject: [PATCH] Undo addition of generator.can-build. Use generator.run to get the same effect. [SVN r34834] --- src/build/generators.jam | 28 ++++++++++------------------ src/build/targets.jam | 3 ++- src/tools/gcc.jam | 12 +++++++----- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/build/generators.jam b/src/build/generators.jam index b46a91c67..b538d210b 100644 --- a/src/build/generators.jam +++ b/src/build/generators.jam @@ -222,13 +222,6 @@ class generator } } - # Indicates if this generator can handle building the given target - # combination. - rule can-build ( target-type : property-set : sources * ) - { - return true ; - } - # Returns another generator which differers from $(self) in # - id # - value to feature in properties @@ -273,6 +266,8 @@ class generator # 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 # all generated targets. See 'generated-targets' method. @@ -937,7 +932,7 @@ local rule ensure-type ( targets * ) # # Note: this algorithm explicitly ignores generators for base classes if there's # at least one generator for requested target-type. -local rule find-viable-generators-aux ( target-type : property-set : sources * ) +local rule find-viable-generators-aux ( target-type : property-set ) { # Select generators that can create the required target type. local viable-generators = ; @@ -991,27 +986,24 @@ local rule find-viable-generators-aux ( target-type : property-set : sources * ) { generators.dout [ indent ] "trying generator" [ $(g).id ] "(" [ $(g).source-types ] -> [ $(g).target-types ] ")" ; - if [ $(g).can-build $(target-type) : $(property-set) : $(sources) ] + local m = [ $(g).match-rank $(property-set) ] ; + if $(m) { - local m = [ $(g).match-rank $(property-set) ] ; - if $(m) - { - generators.dout [ indent ] " is viable" ; - viable-generators += $(g) ; - } + generators.dout [ indent ] " is viable" ; + viable-generators += $(g) ; } } return $(viable-generators) ; } -rule find-viable-generators ( target-type : property-set : sources * ) +rule find-viable-generators ( target-type : property-set ) { local key = $(target-type).$(property-set) ; local l = $(.fv.$(key)) ; if ! $(l) { - l = [ find-viable-generators-aux $(target-type) : $(property-set) : $(sources) ] ; + l = [ find-viable-generators-aux $(target-type) : $(property-set) ] ; if ! $(l) { l = none ; @@ -1071,7 +1063,7 @@ rule find-viable-generators ( target-type : property-set : sources * ) local rule construct-really ( project name ? : target-type : property-set : sources * ) { - viable-generators = [ find-viable-generators $(target-type) : $(property-set) : $(sources) ] ; + viable-generators = [ find-viable-generators $(target-type) : $(property-set) ] ; generators.dout [ indent ] "*** " [ sequence.length $(viable-generators) ] " viable generators" ; diff --git a/src/build/targets.jam b/src/build/targets.jam index b898f815b..c23c87fcc 100644 --- a/src/build/targets.jam +++ b/src/build/targets.jam @@ -1350,7 +1350,7 @@ class typed-target : basic-target # Are there any top-level generators for this type/property set. if ! [ generators.find-viable-generators - $(self.type) : $(property-set) : $(source-targets) ] + $(self.type) : $(property-set) ] { ECHO "error: no generators were found for type '$(self.type)'" ; ECHO "error: and the requested properties" ; @@ -1358,6 +1358,7 @@ class typed-target : basic-target ECHO "See http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html" ; ECHO "To debug this problem, try the --debug-generators option." ; + EXIT ; } } diff --git a/src/tools/gcc.jam b/src/tools/gcc.jam index 393b7978d..0c5d4edda 100644 --- a/src/tools/gcc.jam +++ b/src/tools/gcc.jam @@ -254,8 +254,9 @@ actions compile.asm # since it's not supported by gcc/libc. class gcc-linking-generator : unix-linking-generator { - rule can-build ( target-type : property-set : sources * ) + rule run ( project name ? : property-set : sources + ) { + #~ TODO: Replace this with the use of a target-os property. local no-static-link = ; if [ modules.peek : UNIX ] { @@ -274,7 +275,7 @@ class gcc-linking-generator : unix-linking-generator reason = "On gcc, DLL can't be build with 'static'." ; } - else if [ type.is-derived $(target-type) EXE ] + else if [ type.is-derived $(self.target-types[1]) EXE ] { for local s in $(sources) { @@ -290,16 +291,17 @@ class gcc-linking-generator : unix-linking-generator } if $(reason) { - ECHO warn: + ECHO warning: $(reason) ; - ECHO warn: + ECHO warning: "It's suggested to use 'static' together" "with the 'static'." ; return ; } else { - return true ; + return [ unix-linking-generator.run $(project) $(name) + : $(property-set) : $(sources) ] ; } } }