Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jan 2017 23:07:40 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r311193 - stable/11/share/mk
Message-ID:  <201701032307.v03N7ex2047600@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Tue Jan  3 23:07:40 2017
New Revision: 311193
URL: https://svnweb.freebsd.org/changeset/base/311193

Log:
  MFC r308599:
  
    Consolidate the "don't build" optimizations into _SKIP_BUILD.

Modified:
  stable/11/share/mk/bsd.dep.mk
  stable/11/share/mk/bsd.init.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/mk/bsd.dep.mk
==============================================================================
--- stable/11/share/mk/bsd.dep.mk	Tue Jan  3 23:06:39 2017	(r311192)
+++ stable/11/share/mk/bsd.dep.mk	Tue Jan  3 23:07:40 2017	(r311193)
@@ -77,12 +77,10 @@ _meta_filemon=	1
 .endif
 
 # 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.
+# 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 !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
-    ${.TARGETS:M*install*} == ${.TARGETS} || \
-    make(analyze) || defined(_meta_filemon) || make(print-dir)
+.if defined(_SKIP_BUILD) || defined(_meta_filemon)
 _SKIP_READ_DEPEND=	1
 .if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir)
 .MAKE.DEPENDFILE=	/dev/null

Modified: stable/11/share/mk/bsd.init.mk
==============================================================================
--- stable/11/share/mk/bsd.init.mk	Tue Jan  3 23:06:39 2017	(r311192)
+++ stable/11/share/mk/bsd.init.mk	Tue Jan  3 23:07:40 2017	(r311193)
@@ -16,11 +16,27 @@ __<bsd.init.mk>__:
 .include <bsd.own.mk>
 .MAIN: all
 
-.if ${.MAKE.LEVEL:U1} == 0 && ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*)
-# this tells lib.mk and prog.mk to not actually build anything
-_SKIP_BUILD = not building at level 0
+# Some targets need to know when something may build.  This is used to
+# optimize targets that are only needed when building something, such as
+# (not) reading in depend files.  For DIRDEPS_BUILD, it will only calculate
+# the dependency graph at .MAKE.LEVEL==0, so nothing should be built there.
+# Skip "build" logic if:
+# - DIRDEPS_BUILD at MAKELEVEL 0
+# - make -V is used without an override
+# - make install is used without other targets.  This is to avoid breaking
+#   things like 'make all install' or 'make foo install'.
+# - non-build targets are called
+.if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL:U1} == 0 && \
+    ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*)
+_SKIP_BUILD=	not building at level 0
+.elseif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \
+    ${.TARGETS:M*install*} == ${.TARGETS} || \
+    make(clean*) || make(obj) || make(analyze) || make(print-dir) || \
+    make(destroy*)
+# Skip building, but don't show a warning.
+_SKIP_BUILD=
 .endif
-.if ${.MAKE.LEVEL} > 0 && !empty(_SKIP_BUILD)
+.if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL} > 0 && !empty(_SKIP_BUILD)
 .warning ${_SKIP_BUILD}
 .endif
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701032307.v03N7ex2047600>