summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-10-23 21:30:27 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-10-23 21:30:27 +0000
commit493f9f8597336a38541583d5113b2500f6256b94 (patch)
tree781bb0c0f66feafe3bc6926f9b63014c61b4aea2 /share/mk
parentfeb0daeb4157f9428ee387c9f8ec07f37c6cba9a (diff)
downloadFreeBSD-src-493f9f8597336a38541583d5113b2500f6256b94.zip
FreeBSD-src-493f9f8597336a38541583d5113b2500f6256b94.tar.gz
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
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.subdir.mk34
1 files changed, 20 insertions, 14 deletions
diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk
index 8275afd..0a22fbe 100644
--- a/share/mk/bsd.subdir.mk
+++ b/share/mk/bsd.subdir.mk
@@ -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 buildconfig checkdpadd clean cleandepend \
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 .MAKE ${__deps}
${_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
OpenPOWER on IntegriCloud