Replace all of the duplicated logic for recursing into a subdir with one
implementation. It is duplicated at run-time but is more easily maintainable now. Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
e92818f2e6
commit
65d88005ef
@ -63,30 +63,25 @@ distribute: .MAKE
|
|||||||
.endfor
|
.endfor
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# Subdir code shared among 'make <subdir>', 'make <target>' and SUBDIR_PARALLEL.
|
||||||
|
_SUBDIR_SH= \
|
||||||
|
if test -d ${.CURDIR}/$${dir}.${MACHINE_ARCH}; then \
|
||||||
|
dir=$${dir}.${MACHINE_ARCH}; \
|
||||||
|
fi; \
|
||||||
|
${ECHODIR} "===> ${DIRPRFX}$${dir} ($${target})"; \
|
||||||
|
cd ${.CURDIR}/$${dir}; \
|
||||||
|
${MAKE} $${target} DIRPRFX=${DIRPRFX}$${dir}/
|
||||||
|
|
||||||
_SUBDIR: .USE .MAKE
|
_SUBDIR: .USE .MAKE
|
||||||
.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
|
.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
|
||||||
@${_+_}for entry in ${SUBDIR:N.WAIT}; do \
|
@${_+_}target=${.TARGET:S,realinstall,install,:S,^_sub.,,}; \
|
||||||
if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
|
for dir in ${SUBDIR:N.WAIT}; do ${_SUBDIR_SH}; done
|
||||||
${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \
|
|
||||||
edir=$${entry}.${MACHINE_ARCH}; \
|
|
||||||
cd ${.CURDIR}/$${edir}; \
|
|
||||||
else \
|
|
||||||
${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \
|
|
||||||
edir=$${entry}; \
|
|
||||||
cd ${.CURDIR}/$${edir}; \
|
|
||||||
fi; \
|
|
||||||
${MAKE} ${.TARGET:S,realinstall,install,:S,^_sub.,,} \
|
|
||||||
DIRPRFX=${DIRPRFX}$$edir/; \
|
|
||||||
done
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
${SUBDIR:N.WAIT}: .PHONY .MAKE
|
${SUBDIR:N.WAIT}: .PHONY .MAKE
|
||||||
${_+_}@if test -d ${.TARGET}.${MACHINE_ARCH}; then \
|
${_+_}@target=all; \
|
||||||
cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \
|
dir=${.TARGET}; \
|
||||||
else \
|
${_SUBDIR_SH};
|
||||||
cd ${.CURDIR}/${.TARGET}; \
|
|
||||||
fi; \
|
|
||||||
${MAKE} all
|
|
||||||
|
|
||||||
# Work around parsing of .if nested in .for by putting .WAIT string into a var.
|
# Work around parsing of .if nested in .for by putting .WAIT string into a var.
|
||||||
__wait= .WAIT
|
__wait= .WAIT
|
||||||
@ -104,17 +99,9 @@ __deps+= ${__target}_subdir_${__dep}
|
|||||||
.endfor
|
.endfor
|
||||||
${__target}_subdir_${__dir}: .PHONY .MAKE ${__deps}
|
${__target}_subdir_${__dir}: .PHONY .MAKE ${__deps}
|
||||||
.if !defined(NO_SUBDIR)
|
.if !defined(NO_SUBDIR)
|
||||||
@${_+_}if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \
|
@${_+_}target=${__target:realinstall=install}; \
|
||||||
${ECHODIR} "===> ${DIRPRFX}${__dir}.${MACHINE_ARCH} (${__target:realinstall=install})"; \
|
dir=${__dir}; \
|
||||||
edir=${__dir}.${MACHINE_ARCH}; \
|
${_SUBDIR_SH};
|
||||||
cd ${.CURDIR}/$${edir}; \
|
|
||||||
else \
|
|
||||||
${ECHODIR} "===> ${DIRPRFX}${__dir} (${__target:realinstall=install})"; \
|
|
||||||
edir=${__dir}; \
|
|
||||||
cd ${.CURDIR}/$${edir}; \
|
|
||||||
fi; \
|
|
||||||
${MAKE} ${__target:realinstall=install} \
|
|
||||||
DIRPRFX=${DIRPRFX}$$edir/
|
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
.endfor
|
.endfor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user