svn commit: r320220 - in head: share/mk sys/conf
Bryan Drewery
bdrewery at FreeBSD.org
Thu Jun 22 05:34:43 UTC 2017
Author: bdrewery
Date: Thu Jun 22 05:34:41 2017
New Revision: 320220
URL: https://svnweb.freebsd.org/changeset/base/320220
Log:
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
Modified:
head/share/mk/bsd.dep.mk
head/sys/conf/kern.post.mk
Modified: head/share/mk/bsd.dep.mk
==============================================================================
--- head/share/mk/bsd.dep.mk Thu Jun 22 05:30:27 2017 (r320219)
+++ head/share/mk/bsd.dep.mk Thu Jun 22 05:34:41 2017 (r320220)
@@ -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*.
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,11 +276,13 @@ 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
Modified: head/sys/conf/kern.post.mk
==============================================================================
--- head/sys/conf/kern.post.mk Thu Jun 22 05:30:27 2017 (r320219)
+++ head/sys/conf/kern.post.mk Thu Jun 22 05:34:41 2017 (r320220)
@@ -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
More information about the svn-src-head
mailing list