Author: brooks
Date: Thu Jan 17 18:32:30 2013
New Revision: 245565
URL: http://svnweb.freebsd.org/changeset/base/245565

Log:
  Rework the mtree portion of etc/Makefile's distrib-dirs target to run
  mtree in a shell loop so there is only one mtree commandline.  Move the
  implementation of LOCAL_MTREE into etc/Makefile.
  
  Sponsored by: DARPA, AFRL
  Reviewed by:  mtree :)

Modified:
  head/Makefile.inc1
  head/etc/Makefile

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1  Thu Jan 17 18:28:26 2013        (r245564)
+++ head/Makefile.inc1  Thu Jan 17 18:32:30 2013        (r245565)
@@ -717,7 +717,7 @@ distributeworld installworld: installche
 .endfor
        -mkdir ${DESTDIR}/${DISTDIR}/base
        ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
-           DESTDIR=${DESTDIR}/${DISTDIR}/base
+           LOCAL_MTREE=${LOCAL_MTREE} DESTDIR=${DESTDIR}/${DISTDIR}/base
 .endif
        ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
            ${IMAKEENV} rm -rf ${INSTALLTMP}
@@ -1248,11 +1248,7 @@ cross-tools:
 # hierarchy - ensure that all the needed directories are present
 #
 hierarchy hier:
-       cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
-.for _mtree in ${LOCAL_MTREE}
-       mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/${_mtree} \
-           -p ${DESTDIR}/
-.endfor
+       cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
 
 #
 # libraries - build all libraries, and install them under ${DESTDIR}.

Modified: head/etc/Makefile
==============================================================================
--- head/etc/Makefile   Thu Jan 17 18:28:26 2013        (r245564)
+++ head/etc/Makefile   Thu Jan 17 18:32:30 2013        (r245565)
@@ -293,26 +293,37 @@ distribution:
 
 MTREE_CMD?=    mtree
 
-distrib-dirs:
-       ${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f 
${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
-       ${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f 
${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
-       ${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f 
${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
-       ${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f 
${.CURDIR}/mtree/BSD.include.dist \
-               -p ${DESTDIR}/usr/include
+MTREES=                mtree/BSD.root.dist             /               \
+               mtree/BSD.var.dist              /var            \
+               mtree/BSD.usr.dist              /usr            \
+               mtree/BSD.include.dist          /usr/include
 .if ${MK_BIND_LIBS} != "no"
-       ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f 
${.CURDIR}/mtree/BIND.include.dist \
-           -p ${DESTDIR}/usr/include
+MTREES+=       mtree/BIND.include.dist         /usr/include
 .endif
 .if ${MK_BIND_MTREE} != "no"
-       ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f 
${.CURDIR}/mtree/BIND.chroot.dist \
-           -p ${DESTDIR}/var/named
+MTREES+=       mtree/BIND.chroot.dist          /var/named
 .endif
 .if ${MK_GROFF} != "no"
-       ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f 
${.CURDIR}/mtree/BSD.groff.dist -p ${DESTDIR}/usr
+MTREES+=       mtree/BSD.groff.dist            /usr
 .endif
 .if ${MK_SENDMAIL} != "no"
-       ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f 
${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
+MTREES+=       mtree/BSD.sendmail.dist         /
 .endif
+.for mtree in ${LOCAL_MTREE}
+MTREES+=       ../${mtree}                     /
+.endfor
+
+distrib-dirs:
+       @set ${MTREES}; \
+       while test $$# -ge 2; do \
+               m=${.CURDIR}/$$1; \
+               shift; \
+               d=${DESTDIR}$$1; \
+               shift; \
+               ${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
+                   -f $$m -p $$d; \
+               ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
+       done; true
        cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
        cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
        cd ${DESTDIR}/usr/share/man/en.UTF-8; ln -sf ../man* .
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to