Stop using _SUBDIR internally for non-SUBDIR_PARALLEL builds.
This is unifying more of the logic. Rather than create targets such as 'all: all_subdir_foo' when using SUBDIR_PARALLEL and using 'all: _SUBDIR' when not using SUBDIR_PARALLEL, always use the expanded out <target>_subdir_<directory> pattern. When not using SUBDIR_PARALLEL, have each directory-target depend on the previously defined targets as to respect the *order* of SUBDIR. Using 'make -N' now prints all directory traversals individually rather than using a loop, since a loop is no longer used to traverse. This is part of an effort to cleanup handling of some edge cases involving 'make <directory>' and making it simpler in the sense that the pattern used to build is the same for all modes. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
0e921ddc21
commit
46aba11fa0
@ -114,6 +114,8 @@ _SUBDIR_SH= \
|
||||
cd ${.CURDIR}/$${dir}; \
|
||||
${MAKE} $${target} DIRPRFX=${DIRPRFX}$${dir}/
|
||||
|
||||
# This is kept for compatibility only. The normal handling of attaching to
|
||||
# SUBDIR_TARGETS will create a target for each directory.
|
||||
_SUBDIR: .USEBEFORE
|
||||
.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
|
||||
@${_+_}target=${.TARGET:realinstall=install}; \
|
||||
@ -139,29 +141,31 @@ 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 ${__dir} == .WAIT
|
||||
__subdir_targets+= .WAIT
|
||||
.else
|
||||
__subdir_targets+= ${__target}_subdir_${DIRPRFX}${__dir}
|
||||
__deps=
|
||||
.if ${_is_standalone_target} == 0
|
||||
.if defined(SUBDIR_PARALLEL)
|
||||
# Apply SUBDIR_DEPEND dependencies for SUBDIR_PARALLEL.
|
||||
.for __dep in ${SUBDIR_DEPEND_${__dir}}
|
||||
__deps+= ${__target}_subdir_${DIRPRFX}${__dep}
|
||||
.endfor
|
||||
.endif
|
||||
.else
|
||||
# For non-parallel builds, directories depend on all targets before them.
|
||||
__deps:= ${__subdir_targets}
|
||||
.endif # defined(SUBDIR_PARALLEL)
|
||||
.endif # ${_is_standalone_target} == 0
|
||||
${__target}_subdir_${DIRPRFX}${__dir}: .PHONY .MAKE .SILENT ${__deps}
|
||||
@${_+_}target=${__target:realinstall=install}; \
|
||||
dir=${__dir}; \
|
||||
${_SUBDIR_SH};
|
||||
.endif
|
||||
__subdir_targets+= ${__target}_subdir_${DIRPRFX}${__dir}
|
||||
.endif # ${__dir} == .WAIT
|
||||
.endfor # __dir in ${SUBDIR}
|
||||
${__target}: ${__subdir_targets} .PHONY
|
||||
.else
|
||||
${__target}: _SUBDIR .PHONY
|
||||
.endif # SUBDIR_PARALLEL || _is_standalone_target
|
||||
.endif # make(${__target})
|
||||
.endfor # __target in ${SUBDIR_TARGETS}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user