From 4c94302da471863ee605b239bbec98b279dd15ea Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 23 May 2006 14:22:46 +0000 Subject: [PATCH] Merge from trunk [SVN r34063] --- v2/build/generators.jam | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/v2/build/generators.jam b/v2/build/generators.jam index 66588a715..c19651f8b 100644 --- a/v2/build/generators.jam +++ b/v2/build/generators.jam @@ -105,6 +105,7 @@ class generator import virtual-target ; import "class" : new ; import property ; + import path ; EXPORT class@generator : indent increase-indent decrease-indent generators.dout ; @@ -414,8 +415,20 @@ class generator } } - # Names of sources might include directory. We should strip it. - name = $(name:D=) ; + # See if we need to add directory to the target name. + local dir = [ $(sources[1]).name ] ; + dir = $(dir:D) ; + if $(dir) && + # Never append '..' to target path. + ! [ MATCH .*(\\.\\.).* : $(dir) ] + && + ! [ path.is-rooted $(dir) ] + { + # Relative path is always relative to the source + # directory. Retain it, so that users can have files + # with the same in two different subdirectories. + name = $(dir)/$(name) ; + } } # Assign an action for each target