MakeLocate rule: Avoid directory dependency, if already located

Only create the directory dependency for a target, if that's where the
target will actually end up. If it has already been located before, do
nothing.
This commit is contained in:
Ingo Weinhold
2013-06-07 15:31:03 +02:00
parent 69de9c6e3c
commit 52a43b19ff
+12 -4
View File
@@ -535,7 +535,8 @@ rule MainFromObjects
} }
# Override Jam 2.5rc3 MakeLocate and MkDir to deal more intelligently # Override Jam 2.5rc3 MakeLocate and MkDir to deal more intelligently
# with grist set on the supplied directory name. # with grist set on the supplied directory name. Also do nothing for already
# located files.
rule MakeLocate rule MakeLocate
{ {
local dir = $(2[1]) ; local dir = $(2[1]) ;
@@ -545,9 +546,16 @@ rule MakeLocate
if ! $(dir:G) { if ! $(dir:G) {
dir = $(dir:G=dir) ; dir = $(dir:G=dir) ;
} }
LOCATE on $(1) += $(dir:G=) ; # don't relocate once located
Depends $(1) : $(dir) ; local target ;
MkDir $(dir) ; for target in $(1) {
# don't relocate once located
LOCATE on $(target) += $(dir:G=) ;
if [ on $(target) return $(LOCATE) ] = $(dir:G=) {
Depends $(target) : $(dir) ;
MkDir $(dir) ;
}
}
} }
} }