Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Oct 2015 21:30:28 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r289856 - head/share/mk
Message-ID:  <201510232130.t9NLUSVL021953@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Fri Oct 23 21:30:27 2015
New Revision: 289856
URL: https://svnweb.freebsd.org/changeset/base/289856

Log:
  Rework r289778 to always parallelize known targets, without ordering.
  
  - Rather than allow 'make clean*' to ignore dependencies, make a static
    list of targets in STANDALONE_SUBDIR_TARGETS that are known to be safe.
    This allows a user to override them if needed and avoids adding this feature
    to user-defined targets that are in ${SUBDIR_TARGETS}. [1]
  - This now also allows to force SUBDIR_PARALLEL when calling these
    targets, since no dependencies are needed.
  
  Reported by:	ian [1]
  Sponsored by:	EMC / Isilon Storage Division
  MFC after:	3 weeks
  X-MFC-With:	r289778

Modified:
  head/share/mk/bsd.subdir.mk

Modified: head/share/mk/bsd.subdir.mk
==============================================================================
--- head/share/mk/bsd.subdir.mk	Fri Oct 23 21:30:18 2015	(r289855)
+++ head/share/mk/bsd.subdir.mk	Fri Oct 23 21:30:27 2015	(r289856)
@@ -28,6 +28,10 @@
 # 	See ALL_SUBDIR_TARGETS for list of targets that will recurse.
 # 	Custom targets can be added to SUBDIR_TARGETS in src.conf.
 #
+# 	Targets defined in STANDALONE_SUBDIR_TARGETS will always be ran
+# 	with SUBDIR_PARALLEL and will not respect .WAIT or SUBDIR_DEPEND_
+# 	values.
+#
 
 .if !target(__<bsd.subdir.mk>__)
 __<bsd.subdir.mk>__:
@@ -38,6 +42,10 @@ ALL_SUBDIR_TARGETS= all all-man buildcon
 		    realinstall regress tags \
 		    ${SUBDIR_TARGETS}
 
+# Described above.
+STANDALONE_SUBDIR_TARGETS?= obj checkdpadd clean cleandepend cleandir \
+			    cleanilinks cleanobj
+
 .include <bsd.init.mk>
 
 .if !defined(NEED_SUBDIR)
@@ -83,19 +91,17 @@ ${SUBDIR:N.WAIT}: .PHONY .MAKE
 	    dir=${.TARGET}; \
 	    ${_SUBDIR_SH};
 
-# .WAIT and dependencies can be skipped for some targets.
-.if defined(SUBDIR_PARALLEL)
-.if make(obj) || make(clean*)
-_skip_subdir_ordering=	1
-SUBDIR:=	${SUBDIR:N.WAIT}
-.else
-_skip_subdir_ordering=	0
-.endif
-.endif	# defined(SUBDIR_PARALLEL)
 # Work around parsing of .if nested in .for by putting .WAIT string into a var.
 __wait= .WAIT
 .for __target in ${ALL_SUBDIR_TARGETS}
-.ifdef SUBDIR_PARALLEL
+# Can ordering be skipped for this and SUBDIR_PARALLEL forced?
+.if make(${__target}) && ${STANDALONE_SUBDIR_TARGETS:M${__target}}
+_is_standalone_target=	1
+SUBDIR:=	${SUBDIR:N.WAIT}
+.else
+_is_standalone_target=	0
+.endif
+.if defined(SUBDIR_PARALLEL) || ${_is_standalone_target} == 1
 __subdir_targets=
 .for __dir in ${SUBDIR}
 .if ${__wait} == ${__dir}
@@ -103,7 +109,7 @@ __subdir_targets+= .WAIT
 .else
 __subdir_targets+= ${__target}_subdir_${__dir}
 __deps=
-.if ${_skip_subdir_ordering} == 0
+.if ${_is_standalone_target} == 0
 .for __dep in ${SUBDIR_DEPEND_${__dir}}
 __deps+= ${__target}_subdir_${__dep}
 .endfor
@@ -115,12 +121,12 @@ ${__target}_subdir_${__dir}: .PHONY .MAK
 	    ${_SUBDIR_SH};
 .endif
 .endif
-.endfor
+.endfor	# __dir in ${SUBDIR}
 ${__target}: ${__subdir_targets}
 .else
 ${__target}: _SUBDIR
-.endif
-.endfor
+.endif	# SUBDIR_PARALLEL || _is_standalone_target
+.endfor	# __target in ${ALL_SUBDIR_TARGETS}
 
 # This is to support 'make includes' calling 'make buildincludes' and
 # 'make installincludes' in the proper order, and to support these



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