From owner-svn-src-head@freebsd.org Sun Nov 13 00:11:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0617FC3EBD6; Sun, 13 Nov 2016 00:11:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0DA61DF9; Sun, 13 Nov 2016 00:11:03 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAD0B2Xf094105; Sun, 13 Nov 2016 00:11:02 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAD0B2tl094103; Sun, 13 Nov 2016 00:11:02 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201611130011.uAD0B2tl094103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 13 Nov 2016 00:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308599 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Nov 2016 00:11:04 -0000 Author: bdrewery Date: Sun Nov 13 00:11:02 2016 New Revision: 308599 URL: https://svnweb.freebsd.org/changeset/base/308599 Log: Consolidate the "don't build" optimizations into _SKIP_BUILD. _SKIP_BUILD will be set when nothing is expected to be built. This can be used to optimize some tree-walks and operations which don't need to load dependency files or generate dependencies via beforebuild-style hacks. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.dep.mk head/share/mk/bsd.init.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Sun Nov 13 00:10:59 2016 (r308598) +++ head/share/mk/bsd.dep.mk Sun Nov 13 00:11:02 2016 (r308599) @@ -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: head/share/mk/bsd.init.mk ============================================================================== --- head/share/mk/bsd.init.mk Sun Nov 13 00:10:59 2016 (r308598) +++ head/share/mk/bsd.init.mk Sun Nov 13 00:11:02 2016 (r308599) @@ -16,11 +16,27 @@ ____: .include .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