FAST_DEPEND: Workaround hacks in the wild that have '..' or '/' in OBJS.

This is mostly working around the converts/iconv port having '../ces/file.o'
in its OBJS list which resulted in '.depend../ces/file.o'.  Now it will have
'.depend.._ces_file.o'.

Other implementations have :T which would result in '.depend.file.o' here, but
that could lead to collisions.

X-MFC-With:	r291554
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2015-12-01 03:09:54 +00:00
parent 593e465913
commit b6725ecdb2

View File

@ -60,15 +60,18 @@ DEPENDFILES= ${DEPENDFILE}
.if ${MK_FAST_DEPEND} == "yes" && ${.MAKE.MODE:Unormal:Mmeta*} == "" .if ${MK_FAST_DEPEND} == "yes" && ${.MAKE.MODE:Unormal:Mmeta*} == ""
DEPENDFILES+= ${DEPENDFILE}.* DEPENDFILES+= ${DEPENDFILE}.*
DEPEND_MP?= -MP DEPEND_MP?= -MP
DEPEND_CFLAGS+= -MD -MF${DEPENDFILE}.${.TARGET} # Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to
# avoid collisions.
DEPEND_FILTER= C,/,_,g
DEPEND_CFLAGS+= -MD -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
DEPEND_CFLAGS+= -MT${.TARGET} DEPEND_CFLAGS+= -MT${.TARGET}
CFLAGS+= ${DEPEND_CFLAGS} CFLAGS+= ${DEPEND_CFLAGS}
DEPENDOBJS+= ${OBJS} ${POBJS} ${SOBJS} DEPENDOBJS+= ${OBJS} ${POBJS} ${SOBJS}
.for __obj in ${DEPENDOBJS:O:u} .for __obj in ${DEPENDOBJS:O:u}
.if ${.MAKEFLAGS:M-V} == "" .if ${.MAKEFLAGS:M-V} == ""
.sinclude "${DEPENDFILE}.${__obj}" .sinclude "${DEPENDFILE}.${__obj:${DEPEND_FILTER}}"
.endif .endif
DEPENDFILES_OBJS+= ${DEPENDFILE}.${__obj} DEPENDFILES_OBJS+= ${DEPENDFILE}.${__obj:${DEPEND_FILTER}}
.endfor .endfor
.endif # ${MK_FAST_DEPEND} == "yes" .endif # ${MK_FAST_DEPEND} == "yes"