Rework logic for skipping .depend/.meta file read/stat/writes.
- Rename _SKIP_READ_DEPEND to _SKIP_DEPEND since it also avoids writing. - This now uses .NOMETA to avoid reading any .meta files related to DEPENDOBJS. Objects not in OBJS/DEPENDOBJS may still have their .meta files read in if they are in the dependency graph. - This also avoids statting .meta and .depend files in the META_MODE + -DNO_FILEMON case. MFC after: 2 weeks Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
091867a611
commit
210ecc0021
@ -86,10 +86,13 @@ _meta_filemon= 1
|
||||
# Skip reading .depend when not needed to speed up tree-walks and simple
|
||||
# lookups. See _SKIP_BUILD logic in bsd.init.mk for more details.
|
||||
# Also skip generating or including .depend.* files if in meta+filemon mode
|
||||
# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used.
|
||||
.if defined(_SKIP_BUILD) || defined(_meta_filemon)
|
||||
_SKIP_READ_DEPEND= 1
|
||||
# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used
|
||||
# for _meta_filemon but not for _SKIP_DEPEND.
|
||||
.if defined(_SKIP_BUILD)
|
||||
_SKIP_DEPEND= 1
|
||||
.endif
|
||||
.if ${MK_DIRDEPS_BUILD} == "no"
|
||||
.if defined(_SKIP_DEPEND) || defined(_meta_filemon)
|
||||
.MAKE.DEPENDFILE= /dev/null
|
||||
.endif
|
||||
.endif
|
||||
@ -180,6 +183,15 @@ DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
|
||||
DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,}
|
||||
.endif
|
||||
DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
|
||||
.if defined(_SKIP_DEPEND)
|
||||
# Don't bother statting any .meta files for .depend*
|
||||
${DEPENDOBJS}: .NOMETA
|
||||
${DEPENDFILE}: .NOMETA
|
||||
# Unset these to avoid looping/statting on them later.
|
||||
.undef DEPENDSRCS
|
||||
.undef DEPENDOBJS
|
||||
.undef DEPENDFILES_OBJS
|
||||
.endif # defined(_SKIP_DEPEND)
|
||||
DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
|
||||
DEPEND_CFLAGS+= -MT${.TARGET}
|
||||
.if !defined(_meta_filemon)
|
||||
@ -191,7 +203,6 @@ CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
|
||||
.else
|
||||
CFLAGS+= ${DEPEND_CFLAGS}
|
||||
.endif
|
||||
.if !defined(_SKIP_READ_DEPEND)
|
||||
.for __depend_obj in ${DEPENDFILES_OBJS}
|
||||
.if ${MAKE_VERSION} < 20160220
|
||||
.sinclude "${.OBJDIR}/${__depend_obj}"
|
||||
@ -199,7 +210,6 @@ CFLAGS+= ${DEPEND_CFLAGS}
|
||||
.dinclude "${.OBJDIR}/${__depend_obj}"
|
||||
.endif
|
||||
.endfor
|
||||
.endif # !defined(_SKIP_READ_DEPEND)
|
||||
.endif # !defined(_meta_filemon)
|
||||
.endif # defined(SRCS)
|
||||
|
||||
@ -266,12 +276,14 @@ DPSRCS+= ${SRCS}
|
||||
# targets are kept as they be used for generating something. The target is
|
||||
# kept to allow 'make depend' to generate files.
|
||||
${DEPENDFILE}: ${DPSRCS}
|
||||
.if !defined(_SKIP_DEPEND)
|
||||
.if exists(${.OBJDIR}/${DEPENDFILE}) || \
|
||||
((commands(beforedepend) || \
|
||||
(!defined(_meta_filemon) && commands(_EXTRADEPEND)) || \
|
||||
commands(afterdepend)) && !empty(.MAKE.MODE:Mmeta))
|
||||
rm -f ${DEPENDFILE}
|
||||
.endif
|
||||
.endif
|
||||
.if !defined(_meta_filemon) && target(_EXTRADEPEND)
|
||||
_EXTRADEPEND: .USE
|
||||
${DEPENDFILE}: _EXTRADEPEND
|
||||
|
@ -199,12 +199,15 @@ _meta_filemon= 1
|
||||
# Skip reading .depend when not needed to speed up tree-walks and simple
|
||||
# lookups. For install, only do this if no other targets are specified.
|
||||
# Also skip generating or including .depend.* files if in meta+filemon mode
|
||||
# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used.
|
||||
# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used
|
||||
# for _meta_filemon but not for _SKIP_DEPEND.
|
||||
.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(*obj) || \
|
||||
${.TARGETS:M*clean*} == ${.TARGETS} || \
|
||||
${.TARGETS:M*install*} == ${.TARGETS} || \
|
||||
defined(_meta_filemon)
|
||||
_SKIP_READ_DEPEND= 1
|
||||
_SKIP_DEPEND= 1
|
||||
.endif
|
||||
.if defined(_SKIP_DEPEND) || defined(_meta_filemon)
|
||||
.MAKE.DEPENDFILE= /dev/null
|
||||
.endif
|
||||
|
||||
@ -218,6 +221,15 @@ DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:C/^/.depend./}
|
||||
.if ${MAKE_VERSION} < 20160220
|
||||
DEPEND_MP?= -MP
|
||||
.endif
|
||||
.if defined(_SKIP_DEPEND)
|
||||
# Don't bother reading any .meta files
|
||||
${DEPENDOBJS}: .NOMETA
|
||||
.depend: .NOMETA
|
||||
# Unset these to avoid looping/statting on them later.
|
||||
.undef DEPENDSRCS
|
||||
.undef DEPENDOBJS
|
||||
.undef DEPENDFILES_OBJS
|
||||
.endif # defined(_SKIP_DEPEND)
|
||||
DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF.depend.${.TARGET}
|
||||
DEPEND_CFLAGS+= -MT${.TARGET}
|
||||
.if !defined(_meta_filemon)
|
||||
@ -229,7 +241,6 @@ CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
|
||||
.else
|
||||
CFLAGS+= ${DEPEND_CFLAGS}
|
||||
.endif
|
||||
.if !defined(_SKIP_READ_DEPEND)
|
||||
.for __depend_obj in ${DEPENDFILES_OBJS}
|
||||
.if ${MAKE_VERSION} < 20160220
|
||||
.sinclude "${.OBJDIR}/${__depend_obj}"
|
||||
@ -237,7 +248,6 @@ CFLAGS+= ${DEPEND_CFLAGS}
|
||||
.dinclude "${.OBJDIR}/${__depend_obj}"
|
||||
.endif
|
||||
.endfor
|
||||
.endif # !defined(_SKIP_READ_DEPEND)
|
||||
.endif # !defined(_meta_filemon)
|
||||
|
||||
# Always run 'make depend' to generate dependencies early and to avoid the
|
||||
|
Loading…
Reference in New Issue
Block a user