For 'make <directory>' hook into the all_subdir_<directory> targets.

This fixes parallel build issues when trying to depend on ${SUBDIR}.  An
example of this in share/i18n/csmapper/Makefile where mapper.dir depends
on ${SUBDIR} having been traversed and built already.  Before this
change running make in that directory would build the subdirectories
twice.  This led to obscure build races.  While reworking that build
may be possible, the framework should not so easily allow creating such
problems.

Now depending on <directory> will properly redirect to the
all_subdir_<directory> target rather than invoking the inline shell.

This also makes 'make -jX <directory>' now respect any
SUBDIR_DEPEND_<directory> statements when SUBDIR_PARALLEL is defined.
This is not entirely intended and may be changed later.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2016-08-22 22:51:07 +00:00
parent d9bb42153a
commit 34ce63e5aa

View File

@ -122,10 +122,10 @@ _SUBDIR: .USEBEFORE
for dir in ${SUBDIR:N.WAIT}; do ( ${_SUBDIR_SH} ); done
.endif
${SUBDIR:N.WAIT}: .PHONY .MAKE
${_+_}@target=all; \
dir=${.TARGET}; \
${_SUBDIR_SH};
# Create 'make subdir' targets to run the real 'all' target.
.for __dir in ${SUBDIR:N.WAIT}
${__dir}: all_subdir_${DIRPRFX}${__dir} .PHONY
.endfor
.for __target in ${SUBDIR_TARGETS}
# Can ordering be skipped for this and SUBDIR_PARALLEL forced?