From c2db8be79341d12e48595ded23715b476e46003b Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 1 Sep 2007 22:10:46 +0000 Subject: [PATCH] Previously, I've accidentally committed a patch to make affect names of searched libraries. This commit greatly simplifies that. [SVN r39105] --- v2/build/virtual-target.jam | 107 +++++++++++++++--------------------- v2/tools/builtin.jam | 8 +-- v2/tools/types/lib.jam | 4 ++ 3 files changed, 48 insertions(+), 71 deletions(-) diff --git a/v2/build/virtual-target.jam b/v2/build/virtual-target.jam index 738c6c8c2..c05ca5029 100644 --- a/v2/build/virtual-target.jam +++ b/v2/build/virtual-target.jam @@ -378,65 +378,8 @@ class abstract-file-target : virtual-target return l$(location-grist) ; } - } - - # Applies the feature to the specified name, - # and returns the new name. If there no - # or rule retuend nothing, return empty string. - # 'ps' is the property set to be used when calling - # the 'tag' rule. Typically, that should be - # obtained from 'tag-properties'. - rule apply-tag ( specified-name : ps ) - { - local tag = [ $(ps).get ] ; - local result ; + } - if $(tag) - { - local rule-name = [ MATCH ^@(.*) : $(tag) ] ; - if $(rule-name) - { - if $(tag[2]) - { - errors.error "@rulename is present but is not the only feature" ; - } - - result = [ indirect.call $(rule-name) $(specified-name) : - $(self.type) : $(ps) ] ; - } - else - { - errors.error - "The value of the feature must be '@rule-nane'" ; - } - } - return $(result) ; - } - - rule tag-properties ( ) - { - local ps ; - if $(self.action) - { - ps = [ $(self.action).properties ] ; - } - else - { - 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 - #~ name changes based on the sources of the target. For example to - #~ make unique names of object files based on the source file. - #~ --grafik - ps = [ property-set.create [ $(ps).raw ] $(__name__) ] ; - - return $(ps) ; - } - # Given the target name specified in constructor, returns the # name which should be really used, by looking at the properties. # The tag properties come in two flavour: @@ -450,16 +393,52 @@ class abstract-file-target : virtual-target # virtual-target.add-suffix rule _adjust-name ( specified-name ) { - local ps = [ tag-properties ] ; + local ps ; + if $(self.action) + { + ps = [ $(self.action).properties ] ; + } + else + { + ps = [ property-set.empty ] ; + } - self.name = [ apply-tag $(specified-name) : $(ps) ] ; - # If tag rule does not exists or returned nothing, - # just add prefix/suffix. - if ! $(self.name) + #~ 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 + #~ name changes based on the sources of the target. For example to + #~ make unique names of object files based on the source file. + #~ --grafik + ps = [ property-set.create [ $(ps).raw ] $(__name__) ] ; + + local tag = [ $(ps).get ] ; + + if $(tag) + { + local rule-name = [ MATCH ^@(.*) : $(tag) ] ; + if $(rule-name) + { + if $(tag[2]) + { + errors.error "@rulename is present but is not the only feature" ; + } + + self.name = [ indirect.call $(rule-name) $(specified-name) : + $(self.type) : $(ps) ] ; + } + else + { + errors.error + "The value of the 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 ( ) diff --git a/v2/tools/builtin.jam b/v2/tools/builtin.jam index b052683bd..9db2ee2eb 100644 --- a/v2/tools/builtin.jam +++ b/v2/tools/builtin.jam @@ -337,15 +337,9 @@ class searched-lib-target : abstract-file-target : action ) { - abstract-file-target.__init__ $(name) exact : SEARCHED_LIB : $(project) + abstract-file-target.__init__ $(name) : SEARCHED_LIB : $(project) : $(action) : ; - local rn = [ apply-tag $(name) : [ tag-properties ] ] ; - if $(rn) - { - self.name = $(rn) ; - } - self.shared = $(shared) ; self.search = $(search) ; } diff --git a/v2/tools/types/lib.jam b/v2/tools/types/lib.jam index e47a0c6fe..6421aab07 100644 --- a/v2/tools/types/lib.jam +++ b/v2/tools/types/lib.jam @@ -26,3 +26,7 @@ type SHARED_LIB : dylib : LIB : MACOSX ; type SHARED_LIB : so : LIB ; type SEARCHED_LIB : : LIB ; +# This is needed so that when we create a target of SEARCHED_LIB +# type, there's no prefix or suffix automatically added. +type.set-generated-target-prefix SEARCHED_LIB : : "" ; +type.set-generated-target-suffix SEARCHED_LIB : : "" ;