diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 87491fe368e1..bacdfc24b52b 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -170,12 +170,12 @@ DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} .if !empty(DEPENDSRCS) DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,} .endif -.for __obj in ${DEPENDOBJS:O:u} +DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./} .if ${.MAKEFLAGS:M-V} == "" -.sinclude "${DEPENDFILE}.${__obj:${DEPEND_FILTER}}" -.endif -DEPENDFILES_OBJS+= ${DEPENDFILE}.${__obj:${DEPEND_FILTER}} +.for __depend_obj in ${DEPENDFILES_OBJS} +.sinclude "${__depend_obj}" .endfor +.endif .endif # ${MK_FAST_DEPEND} == "yes" .endif # defined(SRCS) diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 42f67f644d7e..ecff2454e363 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -206,12 +206,12 @@ DEPEND_CFLAGS+= -MD -MP -MF.depend.${.TARGET} DEPEND_CFLAGS+= -MT${.TARGET} CFLAGS+= ${DEPEND_CFLAGS} DEPENDOBJS+= ${SYSTEM_OBJS} -.for __obj in ${DEPENDOBJS:O:u} +DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:C/^/.depend./} .if ${.MAKEFLAGS:M-V} == "" -.sinclude ".depend.${__obj}" -.endif -DEPENDFILES_OBJS+= .depend.${__obj} +.for __depend_obj in ${DEPENDFILES_OBJS} +.sinclude "${__depend_obj}" .endfor +.endif .endif # ${MK_FAST_DEPEND} == "yes" .NOPATH: .depend ${DEPENDFILES_OBJS}