From d7e12a7ee38f59c8a25dd3a71a4807e135fb37cb Mon Sep 17 00:00:00 2001 From: bapt Date: Sun, 4 Nov 2018 06:47:21 +0000 Subject: [PATCH] Simplify a bit distrib-dirs target Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D3915 --- etc/Makefile | 50 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/etc/Makefile b/etc/Makefile index df8f99e4c3de..8fefeabe6767 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -157,35 +157,29 @@ distrib-cleanup: .PHONY done distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY - @set ${MTREES}; \ - while test $$# -ge 2; do \ - m=${.CURDIR}/$$1; \ - shift; \ - d=${DESTDIR}$$1; \ - shift; \ - test -d $$d || mkdir -p $$d; \ - ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \ - ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \ - ${MTREE_FILTER} $$m | \ - ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \ - -p $$d; \ - done; true +.for _m _d in ${MTREES} + @m=${.CURDIR}/${_m}; \ + d=${DESTDIR}${_d}; \ + test -d $$d || mkdir -p $$d; \ + ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \ + ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \ + ${MTREE_FILTER} $$m | \ + ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \ + -p $$d; \ +.endfor .if defined(NO_ROOT) - @set ${MTREES}; \ - while test $$# -ge 2; do \ - m=${.CURDIR}/$$1; \ - shift; \ - d=$$1; \ - test "$$d" == "/" && d=""; \ - d=${DISTBASE}$$d; \ - shift; \ - test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \ - ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \ - "sed s#^\.#.$$d# | ${METALOG.add}" ; \ - ${MTREE_FILTER} $$m | \ - ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \ - ${METALOG.add} ; \ - done; true +.for _m _d in ${MTREES} + @m=${.CURDIR}/${_m}; \ + d=${_d}; \ + test "$$d" == "/" && d=""; \ + d=${DISTBASE}$$d; \ + test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \ + ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \ + "sed s#^\.#.$$d# | ${METALOG.add}" ; \ + ${MTREE_FILTER} $$m | \ + ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \ + ${METALOG.add} ; \ +.endfor .endif .if ${MK_NLS} != "no" set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \