FAST_DEPEND: Only try to use dependencies from C/C++ SRCS as mkdep did.

Rather than try to guess at all of the OBJS variables just use SRCS
using the same patterns that mkdep does.  This also fixes a mistake
where dependencies were being generated with FAST_DEPEND when they were
not for mkdep.  This happens when OBJS!=SRCS as is the case in
gnu/lib/csu where SRCS has 1 file and OBJS has several other files that
does not even contain the 1 SRCS file.  Generally in these cases the
OBJS have custom dependencies defined in their Makefile.  If we generate
dependencies for those and then load a .depend file, then .IMPSRC may
contain duplicate sources and lead to errors such as:
  cc: error: cannot specify -o when generating multiple output files

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2015-12-07 16:08:16 +00:00
parent 4d293dd8dc
commit 69afbf0275

View File

@ -66,7 +66,10 @@ DEPEND_FILTER= C,/,_,g
DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
DEPEND_CFLAGS+= -MT${.TARGET}
CFLAGS+= ${DEPEND_CFLAGS}
DEPENDOBJS+= ${OBJS} ${POBJS} ${SOBJS}
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}
.if ${.MAKEFLAGS:M-V} == ""
.sinclude "${DEPENDFILE}.${__obj:${DEPEND_FILTER}}"