From 34ce63e5aa1b2ede4da89e4871e89c77d6740733 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Mon, 22 Aug 2016 22:51:07 +0000 Subject: [PATCH] For 'make ' hook into the all_subdir_ 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 will properly redirect to the all_subdir_ target rather than invoking the inline shell. This also makes 'make -jX ' now respect any SUBDIR_DEPEND_ 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 --- share/mk/bsd.subdir.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 1296ecfa4ba7..dfe0afab577d 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -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?