Index: build/virtual-target.jam =================================================================== --- build/virtual-target.jam (revision 38436) +++ build/virtual-target.jam (working copy) @@ -378,40 +378,18 @@ return l$(location-grist) ; } - } - - # 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: - # - value, - # - @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 property is specified, or the rule specified by - # returns nothing, returns the result of calling - # virtual-target.add-suffix - rule _adjust-name ( specified-name ) + } + + # 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 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__) ] ; - local tag = [ $(ps).get ] ; + local result ; if $(tag) { @@ -423,7 +401,7 @@ errors.error "@rulename is present but is not the only feature" ; } - self.name = [ indirect.call $(rule-name) $(specified-name) : + result = [ indirect.call $(rule-name) $(specified-name) : $(self.type) : $(ps) ] ; } else @@ -431,14 +409,57 @@ 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 ] ; + } + - # If there's no tag or the tag rule returned nothing. - if ! $(tag) || ! $(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__) ] ; + + 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: + # - value, + # - @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 property is specified, or the rule specified by + # returns nothing, returns the result of calling + # virtual-target.add-suffix + rule _adjust-name ( specified-name ) + { + local ps = [ tag-properties ] ; + + self.name = [ apply-tag $(specified-name) : $(ps) ] ; + # If tag rule does not exists or returned nothing, + # just add prefix/suffix. + if ! $(self.name) { self.name = [ virtual-target.add-prefix-and-suffix $(specified-name) : $(self.type) : $(ps) ] ; - } + } } rule actualize-no-scanner ( ) Index: tools/builtin.jam =================================================================== --- tools/builtin.jam (revision 38436) +++ tools/builtin.jam (working copy) @@ -333,31 +333,28 @@ rule __init__ ( name : project : shared ? - : real-name ? : search * : action ) { - abstract-file-target.__init__ $(name) : SEARCHED_LIB : $(project) - : $(action) ; + abstract-file-target.__init__ $(name) exact : SEARCHED_LIB : $(project) + : $(action) : ; + local rn = [ apply-tag $(name) : [ tag-properties ] ] ; + if $(rn) + { + self.name = $(rn) ; + } + self.shared = $(shared) ; - self.real-name = $(real-name) ; - self.real-name ?= $(name) ; self.search = $(search) ; } - - + rule shared ( ) { return $(self.shared) ; } - - rule real-name ( ) - { - return $(self.real-name) ; - } - + rule search ( ) { return $(self.search) ; @@ -578,8 +575,8 @@ local search = [ feature.get-values : $(properties) ] ; a = [ new null-action $(property-set) ] ; - local t = [ new searched-lib-target $(name) : $(project) : $(shared) - : [ feature.get-values : $(properties) ] + local lib-name = [ feature.get-values : $(properties) ] ; + local t = [ new searched-lib-target $(lib-name) : $(project) : $(shared) : $(search) : $(a) ] ; @@ -809,7 +806,7 @@ { if [ type.is-derived [ $(s).type ] SEARCHED_LIB ] { - local name = [ $(s).real-name ] ; + local name = [ $(s).name ] ; if [ $(s).shared ] { fsa += $(name) ;