summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2015-07-04 05:43:45 +0000
committerimp <imp@FreeBSD.org>2015-07-04 05:43:45 +0000
commit3be9366abb896ebd2a95b16ed2172bb49992eba4 (patch)
treee9713c288c78ca4d401b5819e4a6b047c61fa263
parent1dd9989dfb6049d2b6c410289dc24730aadd2a83 (diff)
downloadFreeBSD-src-3be9366abb896ebd2a95b16ed2172bb49992eba4.zip
FreeBSD-src-3be9366abb896ebd2a95b16ed2172bb49992eba4.tar.gz
Cache _MPATH and pass it down into the modules build. Some NFS setups
make the find it does extremely expensive, so compute it only once. Also make sure the 'traditional' module building method works at the expense of a bit of duplicated code.
-rw-r--r--sys/conf/kern.pre.mk7
-rw-r--r--sys/conf/kmod.mk2
2 files changed, 9 insertions, 0 deletions
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index 3081edc..cf1b127 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -198,6 +198,12 @@ SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
SYSTEM_DEP+= ${LDSCRIPT}
+# Calculate path for .m files early, if needed.
+.if !defined(_MPATH)
+__MPATH!=find ${S:tA}/ -name \*_if.m
+_MPATH=${__MPATH:H:O:u}
+.endif
+
# MKMODULESENV is set here so that port makefiles can augment
# them.
@@ -214,6 +220,7 @@ MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
.if defined(DEBUG)
MKMODULESENV+= DEBUG_FLAGS="${DEBUG}"
.endif
+MKMODULESENV+= _MPATH="${_MPATH}"
# Detect kernel config options that force stack frames to be turned on.
DDB_ENABLED!= grep DDB opt_ddb.h || true ; echo
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 989d681..87451df 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -355,8 +355,10 @@ vnode_if_typedef.h:
.endif
# Build _if.[ch] from _if.m, and clean them when we're done.
+.if !defined(_MPATH)
__MPATH!=find ${SYSDIR:tA}/ -name \*_if.m
_MPATH=${__MPATH:H:O:u}
+.endif
.PATH.m: ${_MPATH}
.for _s in ${SRCS:M*_if.[ch]}
.if eixsts(${_s:R}.m})
OpenPOWER on IntegriCloud