Author: bdrewery
Date: Wed Mar 28 16:28:24 2018
New Revision: 331683
URL: https://svnweb.freebsd.org/changeset/base/331683

Log:
  Avoid looping if SYSDIR already known.
  
  Sponsored by: Dell EMC

Modified:
  head/share/mk/bsd.dtb.mk
  head/share/mk/bsd.kmod.mk
  head/sys/conf/kmod.mk

Modified: head/share/mk/bsd.dtb.mk
==============================================================================
--- head/share/mk/bsd.dtb.mk    Wed Mar 28 16:28:20 2018        (r331682)
+++ head/share/mk/bsd.dtb.mk    Wed Mar 28 16:28:24 2018        (r331683)
@@ -2,12 +2,14 @@
 
 # Search for kernel source tree in standard places.
 .if empty(KERNBUILDDIR)
+.if !defined(SYSDIR)
 .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \
     ${.CURDIR}/../../../../.. /sys /usr/src/sys
-.if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk)
+.if exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk)
 SYSDIR=        ${_dir}
 .endif
 .endfor
+.endif
 .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) || \
     !exists(${SYSDIR}/conf/kmod.mk)
 .error Unable to locate the kernel source tree. Set SYSDIR to override.

Modified: head/share/mk/bsd.kmod.mk
==============================================================================
--- head/share/mk/bsd.kmod.mk   Wed Mar 28 16:28:20 2018        (r331682)
+++ head/share/mk/bsd.kmod.mk   Wed Mar 28 16:28:24 2018        (r331683)
@@ -2,12 +2,14 @@
 
 # Search for kernel source tree in standard places.
 .if empty(KERNBUILDDIR)
+.if !defined(SYSDIR)
 .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \
     ${.CURDIR}/../../../../.. /sys /usr/src/sys
-.if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk)
+.if exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk)
 SYSDIR=        ${_dir:tA}
 .endif
 .endfor
+.endif
 .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) || \
     !exists(${SYSDIR}/conf/kmod.mk)
 .error Unable to locate the kernel source tree. Set SYSDIR to override.

Modified: head/sys/conf/kmod.mk
==============================================================================
--- head/sys/conf/kmod.mk       Wed Mar 28 16:28:20 2018        (r331682)
+++ head/sys/conf/kmod.mk       Wed Mar 28 16:28:24 2018        (r331683)
@@ -82,11 +82,13 @@ OBJCOPY?=   objcopy
 
 # Search for kernel source tree in standard places.
 .if empty(KERNBUILDDIR)
+.if !defined(SYSDIR)
 .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
-.if !defined(SYSDIR) && exists(${_dir}/kern/)
+.if exists(${_dir}/kern/)
 SYSDIR=        ${_dir:tA}
 .endif
 .endfor
+.endif
 .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/)
 .error "can't find kernel source tree"
 .endif
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to