Date: Tue, 19 Jan 2021 21:38:19 GMT From: Alex Richardson <arichardson@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 8d30571d454d - main - include: Delete stale symlinks using find(1) instead of a shell loop. Message-ID: <202101192138.10JLcJPZ078473@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=8d30571d454daa5d3ecee54847f805384f09c31d commit 8d30571d454daa5d3ecee54847f805384f09c31d Author: Alex Richardson <arichardson@FreeBSD.org> AuthorDate: 2021-01-19 11:35:12 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> CommitDate: 2021-01-19 21:23:25 +0000 include: Delete stale symlinks using find(1) instead of a shell loop. This reduces the number of execve() syscalls during make includes by 88. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D27622 --- include/Makefile | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/include/Makefile b/include/Makefile index 4533dfea1b67..24762ea641f2 100644 --- a/include/Makefile +++ b/include/Makefile @@ -273,26 +273,19 @@ stage_includes: ${SHARED} SDESTDIR= ${SYSROOT:U${DESTDIR}} # Take care of stale directory-level symlinks. +# Note: The "|| true" after find is needed in case one of the directories does +# not exist (yet). compat: -.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto - if [ -L ${SDESTDIR}${INCLUDEDIR}/$i ]; then \ - rm -f ${SDESTDIR}${INCLUDEDIR}/$i; \ - fi -.endfor + cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ + crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ -f ${SRCTOP}/etc/mtree/BSD.include.dist \ -p ${SDESTDIR}${INCLUDEDIR} > /dev/null copies: .PHONY .META -.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \ - ${_MARCHS} - if [ -d ${SDESTDIR}${INCLUDEDIR}/$i ]; then \ - cd ${SDESTDIR}${INCLUDEDIR}/$i; \ - for h in *.h; do \ - if [ -L $$h ]; then rm -f $$h; fi; \ - done; \ - fi -.endfor + cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ + machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ + -name "*.h" -print -delete || true .for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101192138.10JLcJPZ078473>