summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2016-02-19 00:41:24 +0000
committerbdrewery <bdrewery@FreeBSD.org>2016-02-19 00:41:24 +0000
commitb4d80433558820d70653138274fe03bbba9e9eb1 (patch)
treeffa6fca30f9b04427d1e1fa216bba5caf436948a
parent3cb4c4bef1700860d46dd6d300e50e30346fbb84 (diff)
downloadFreeBSD-src-b4d80433558820d70653138274fe03bbba9e9eb1.zip
FreeBSD-src-b4d80433558820d70653138274fe03bbba9e9eb1.tar.gz
Avoid reading .depend.* in simple cases where not needed.
This will speed up some tree-walks with FAST_DEPEND which otherwise would include length(SRCS) .depend files. This also uses a trick suggested by sjg@ to still read them in when specifying _V_READ_DEPEND=1 in the env/make args. Sponsored by: EMC / Isilon Storage Division
-rw-r--r--share/mk/bsd.dep.mk12
-rw-r--r--sys/conf/kern.post.mk11
2 files changed, 21 insertions, 2 deletions
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk
index 99fc972..6f27d7e 100644
--- a/share/mk/bsd.dep.mk
+++ b/share/mk/bsd.dep.mk
@@ -81,6 +81,16 @@ tags: ${SRCS}
.endif
.endif
+# Skip reading .depend when not needed to speed up tree-walks
+# and simple lookups.
+.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
+ make(install*)
+_SKIP_READ_DEPEND= 1
+.if ${MK_DIRDEPS_BUILD} == "no"
+.MAKE.DEPENDFILE= /dev/null
+.endif
+.endif
+
.if defined(SRCS)
CLEANFILES?=
@@ -181,7 +191,7 @@ 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 ${.MAKEFLAGS:M-V} == ""
+.if !defined(_SKIP_READ_DEPEND)
.for __depend_obj in ${DEPENDFILES_OBJS}
.sinclude "${__depend_obj}"
.endfor
diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk
index 52cd186..8983467 100644
--- a/sys/conf/kern.post.mk
+++ b/sys/conf/kern.post.mk
@@ -206,6 +206,15 @@ CFILES_OFED=${CFILES:M*/ofed/*}
# We have "special" -I include paths for MLX5.
CFILES_MLX5=${CFILES:M*/dev/mlx5/*}
+# Skip reading .depend when not needed to speed up tree-walks
+# and simple lookups.
+.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
+ make(install*) || make(kernel-obj) || make(kernel-clean*) || \
+ make(kernel-install*)
+_SKIP_READ_DEPEND= 1
+.MAKE.DEPENDFILE= /dev/null
+.endif
+
kernel-depend: .depend
# The argument list can be very long, so use make -V and xargs to
# pass it to mkdep.
@@ -222,7 +231,7 @@ DEPEND_CFLAGS+= -MT${.TARGET}
CFLAGS+= ${DEPEND_CFLAGS}
DEPENDOBJS+= ${SYSTEM_OBJS} genassym.o
DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:C/^/.depend./}
-.if ${.MAKEFLAGS:M-V} == ""
+.if !defined(_SKIP_READ_DEPEND)
.for __depend_obj in ${DEPENDFILES_OBJS}
.sinclude "${__depend_obj}"
.endfor
OpenPOWER on IntegriCloud