Index: convert.jam =================================================================== --- convert.jam (revision 77789) +++ convert.jam (working copy) @@ -9,7 +9,7 @@ # # For example: # -# convert objects obj : a.cpp b.cpp ; +# convert objects obj : a.cpp b.cpp c.c d.s ; # import targets ; @@ -29,19 +29,61 @@ rule construct ( name : source-targets * : property-set ) { - local r = [ generators.construct $(self.project) : $(self.type) - : [ property-set.create [ $(property-set).raw ] # [ feature.expand - $(self.type) ] - # ] - : $(source-targets) ] ; - if ! $(r) + local usage-requirements ; + local result ; + while $(source-targets) { - errors.error "unable to construct" [ full-name ] ; + local stype ; + local s-one-type ; + local s-other-types ; + for s in $(source-targets) + { + if ! $(stype) + { + stype = [ $(s).type ] ; + } + if [ $(s).type ] = $(stype) + { + s-one-type += $(s) ; + } else + { + s-other-types += $(s) ; + } + } + source-targets = $(s-other-types) ; + local r = [ generators.construct $(self.project) : $(self.type) + : [ property-set.create [ $(property-set).raw ] # [ feature.expand + $(self.type) ] + # ] + : $(s-one-type) : true ] ; + if ! $(r) + { + errors.error "unable to construct" [ full-name ] ; + } + if [ class.is-a $(r[1]) : property-set ] + { + if $(usage-requirements) + && $(usage-requirements) != $(r[1]) + { + errors.error "too many usage-requirements by construct" [ full-name ] "\n" + [ $(usage-requirements).raw ] "\n" + [ $(r[1]).raw ] ; + } else if ! $(usage-requirements) + { + usage-requirements = $(r[1]) ; + } + result = [ sequence.merge $(result) : $(r[2-]) ] ; + } else + { + result = [ sequence.merge $(result) : $(r) ] ; + } } - - return $(r) ; + if ! $(usage-requirements) + { + usage-requirements = [ property-set.empty ] ; + } + return $(usage-requirements) $(result) ; } - } rule convert ( name type : sources * : requirements * : default-build *