summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-11-09 23:37:04 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-11-09 23:37:04 +0000
commitff421684e76825a024077a1a68e8179de1469bb5 (patch)
tree368a2ab7cf1dcb36cb619c07a1133edfa323fefa /share/mk
parent6b877e2ca0be7b39525d8cc09b859f4ebe225a99 (diff)
downloadFreeBSD-src-ff421684e76825a024077a1a68e8179de1469bb5.zip
FreeBSD-src-ff421684e76825a024077a1a68e8179de1469bb5.tar.gz
FAST_DEPEND: Fix building of wrong source files in some cases.
Similar to the original reason for these dependency hints to be added, in r124637, the missing-dependency file case can lead to building of the wrong source. A clear example of this is in gnu/lib/libstdc++ where the .PATH contains both contrib/gcc and contrib/libstdc++/src. contrib/gcc has a debug.c. contrib/libstdc++/src has a debug.cc. When building for the objects of debug.o, debug.So, and debug.po, it is ambiguous for which src file to use due to the suffix transformation rules, even though the proper one is listed first in .PATH. This was normally avoided due to these dependency hints for the initial build, and then mkdep would add an explicit 'debug.o: debug.cc' dependency into the .depend file. WITH_FAST_DEPEND does not generate the .depend file with these, but puts them into .depend.debug.o instead. Rather than extending the exists() check to each object's .depend.* file, just enable the hint when when using WITH_FAST_DEPEND. It fixes the problem and seems to be safe enough to use since it is mapping SRCS back to OBJS, rather than letting make make assumptions from OBJS to SRCS. A similar check mapping objects to headers is present in some mk files but was not extended here for FAST_DEPEND since it has not yet been found to be a problem. X-MFC-With: r290433 MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.dep.mk6
-rw-r--r--share/mk/bsd.lib.mk4
2 files changed, 6 insertions, 4 deletions
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk
index a0e9892..ffe3926 100644
--- a/share/mk/bsd.dep.mk
+++ b/share/mk/bsd.dep.mk
@@ -88,7 +88,7 @@ tags: ${SRCS}
.if defined(SRCS)
CLEANFILES?=
-.if !exists(${.OBJDIR}/${DEPENDFILE})
+.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE})
.for _S in ${SRCS:N*.[dhly]}
${_S:R}.o: ${_S}
.endfor
@@ -99,7 +99,7 @@ ${_S:R}.o: ${_S}
.for _LC in ${_LSRC:R}.c
${_LC}: ${_LSRC}
${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC}
-.if !exists(${.OBJDIR}/${DEPENDFILE})
+.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE})
${_LC:R}.o: ${_LC}
.endif
SRCS:= ${SRCS:S/${_LSRC}/${_LC}/}
@@ -130,7 +130,7 @@ CLEANFILES+= ${_YH}
${_YC}: ${_YSRC}
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
.endif
-.if !exists(${.OBJDIR}/${DEPENDFILE})
+.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE})
${_YC:R}.o: ${_YC}
.endif
.endfor
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 7226f3f..b74c034 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -417,9 +417,11 @@ lint: ${SRCS:M*.c}
.include <bsd.dep.mk>
-.if !exists(${.OBJDIR}/${DEPENDFILE})
+.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE})
.if defined(LIB) && !empty(LIB)
+.if ${MK_FAST_DEPEND} == "no"
${OBJS} ${STATICOBJS} ${POBJS}: ${SRCS:M*.h}
+.endif
.for _S in ${SRCS:N*.[hly]}
${_S:R}.po: ${_S}
.endfor
OpenPOWER on IntegriCloud