From d7beff082b71fb7d1b4ca94d3cc44d64bbbfb2d6 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Wed, 24 Feb 2016 17:19:05 +0000 Subject: FAST_DEPEND: Rework how guessed dependencies are handled. Rather than depend on .depend not existing, check the actual .depend.OBJ file that will be used for that object. If it doesn't exist then use the guessed dependencies. FAST_DEPEND may never have a .depend file. Not having one means all of the previous logic would over-depend all object files on all headers which is not what we wanted. It also means that if a .depend is generated before a build is done for _EXTRADEPEND (such as for PROG or LIB) then all of these dependencies would not be used since the .depend wasn't generated from mkdep and the real .depend.* files are not generated until the build. Sponsored by: EMC / Isilon Storage Division --- share/mk/bsd.dep.mk | 31 +++++++++++++++++++++++-------- share/mk/bsd.lib.mk | 25 ++++++++++++++----------- share/mk/bsd.prog.mk | 11 ++++++----- 3 files changed, 43 insertions(+), 24 deletions(-) (limited to 'share') diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 2c4acd278397..ec2ac1fc58ef 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -94,19 +94,21 @@ _SKIP_READ_DEPEND= 1 .if defined(SRCS) CLEANFILES?= -.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE}) .for _S in ${SRCS:N*.[dhly]} -${_S:R}.o: ${_S} -.endfor +OBJS_DEPEND_GUESS.${_S:R}.o= ${_S} +.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) +${_S:R}.o: ${OBJS_DEPEND_GUESS.${_S:R}.o} .endif +.endfor # Lexical analyzers .for _LSRC in ${SRCS:M*.l:N*/*} .for _LC in ${_LSRC:R}.c ${_LC}: ${_LSRC} ${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC} -.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE}) -${_LC:R}.o: ${_LC} +OBJS_DEPEND_GUESS.${_LC:R}.o= ${_LC} +.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) +${_LC:R}.o: ${OBJS_DEPEND_GUESS.${_LC:R}.o} .endif SRCS:= ${SRCS:S/${_LSRC}/${_LC}/} CLEANFILES+= ${_LC} @@ -136,8 +138,9 @@ CLEANFILES+= ${_YH} ${_YC}: ${_YSRC} ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} .endif -.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE}) -${_YC:R}.o: ${_YC} +OBJS_DEPEND_GUESS.${_YC:R}.o= ${_YC} +.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) +${_YC:R}.o: ${OBJS_DEPEND_GUESS.${_YC:R}.o} .endif .endfor .endfor @@ -195,7 +198,7 @@ DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./} .for __depend_obj in ${DEPENDFILES_OBJS} .sinclude "${__depend_obj}" .endfor -.endif +.endif # !defined(_SKIP_READ_DEPEND) .endif # ${MK_FAST_DEPEND} == "yes" .endif # defined(SRCS) @@ -208,6 +211,18 @@ beforedepend: afterdepend: beforedepend .endif +# Guess some dependencies for when no ${DEPENDFILE}.OBJ is generated yet. +# Done here to support meta mode as well which does not always need +# the CFLAGS modifications or .depend.* included. +.if ${MK_FAST_DEPEND} == "yes" +.for __obj in ${DEPENDOBJS:O:u} +.if !exists(${.OBJDIR}/${DEPENDFILE}.${__obj}) +${__obj}: ${OBJS_DEPEND_GUESS} +${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} +.endif +.endfor +.endif + .if !target(depend) .if defined(SRCS) depend: beforedepend ${DEPENDFILE} afterdepend diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index dc81c1c4828c..036d3d1780dc 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -415,28 +415,31 @@ lint: ${SRCS:M*.c} .include .endif -.include - -.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE}) .if defined(LIB) && !empty(LIB) -.if !exists(${.OBJDIR}/${DEPENDFILE}) -${OBJS} ${STATICOBJS} ${POBJS}: ${SRCS:M*.h} +OBJS_DEPEND_GUESS+= ${SRCS:M*.h} +.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) +${OBJS} ${STATICOBJS} ${POBJS}: ${OBJS_DEPEND_GUESS} .endif .for _S in ${SRCS:N*.[hly]} -${_S:R}.po: ${_S} +OBJS_DEPEND_GUESS.${_S:R}.po= ${_S} +.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) +${_S:R}.po: ${OBJS_DEPEND_GUESS.${_S:R}.po} +.endif .endfor .endif .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) -.if !exists(${.OBJDIR}/${DEPENDFILE}) -${SOBJS}: ${SRCS:M*.h} +.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) +${SOBJS}: ${OBJS_DEPEND_GUESS} .endif .for _S in ${SRCS:N*.[hly]} -${_S:R}.So: ${_S} -.endfor +OBJS_DEPEND_GUESS.${_S:R}.So= ${_S} +.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) +${_S:R}.So: ${OBJS_DEPEND_GUESS.${_S:R}.So} .endif +.endfor .endif +.include .include - .include diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 612eb8effcd4..ec5dec9b4ef8 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -275,12 +275,13 @@ lint: ${SRCS:M*.c} .include .endif -.include - -.if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE}) -${OBJS}: ${SRCS:M*.h} +.if defined(PROG) +OBJS_DEPEND_GUESS+= ${SRCS:M*.h} +.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE}) +${OBJS}: ${OBJS_DEPEND_GUESS} +.endif .endif +.include .include - .include -- cgit v1.2.3