mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 00:33:57 +00:00
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
This commit is contained in:
parent
92b25384be
commit
ccfb12d63a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=289856
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue