aboutsummaryrefslogtreecommitdiff
path: root/Makefile.inc1
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-01-11 19:38:11 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-07-13 15:22:24 +0000
commite3f9397aea99eabe85e8cfdc8721c0283adb2ec4 (patch)
treebe6a52f1232c6880e6c71ae72d54630e8ae729fd /Makefile.inc1
parent913ebccc8e16c74126728faeafda5139f3784cdc (diff)
downloadsrc-e3f9397aea99eabe85e8cfdc8721c0283adb2ec4.tar.gz
src-e3f9397aea99eabe85e8cfdc8721c0283adb2ec4.zip
Add list-old-{dirs,files,libs} targets.
These targets generate a raw list of the candidate old files roughly corresponding to the values of OLD_DIRS, OLD_FILES, and OLD_LIBS. Currently list-old-files also includes uncompressed manpages in addition to compressed manpages. Use these targets in the implementation of check-old-* and delete-old-* to replace duplicated logic. Reviewed by: imp, emaste Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33327 (cherry picked from commit 21baf42c57f080835496c5f4f349e9523d22a956)
Diffstat (limited to 'Makefile.inc1')
-rw-r--r--Makefile.inc140
1 files changed, 25 insertions, 15 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 10ee2148f97a..6bb616d7bc0c 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -3181,7 +3181,8 @@ SUBDIR_PARALLEL=
.if make(check-old) || make(check-old-dirs) || \
make(check-old-files) || make(check-old-libs) || \
make(delete-old) || make(delete-old-dirs) || \
- make(delete-old-files) || make(delete-old-libs)
+ make(delete-old-files) || make(delete-old-libs) || \
+ make(list-old-dirs) || make(list-old-files) || make(list-old-libs)
#
# check for / delete old files section
@@ -3200,6 +3201,11 @@ RM_I=-i
RM_I=-v
.endif
+list-old-files: .PHONY
+ @cd ${.CURDIR}; \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
+ -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | sort
+
delete-old-files: .PHONY
@echo ">>> Removing old files (only deletes safe to delete libs)"
# Ask for every old file if the user really wants to remove it.
@@ -3209,8 +3215,7 @@ delete-old-files: .PHONY
# the Makefile parser segfault.
@exec 3<&0; \
cd ${.CURDIR}; \
- ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
- -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | sort | \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-files | \
while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
@@ -3239,8 +3244,7 @@ delete-old-files: .PHONY
check-old-files: .PHONY
@echo ">>> Checking for old files"
@cd ${.CURDIR}; \
- ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
- -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-files | \
while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
echo "${DESTDIR}/$${file}"; \
@@ -3250,7 +3254,7 @@ check-old-files: .PHONY
echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
fi; \
done; \
- done | sort
+ done
# Check for catpages without corresponding manpages.
@find ${DESTDIR}/usr/share/man/cat* ! -type d 2>/dev/null | \
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
@@ -3261,13 +3265,17 @@ check-old-files: .PHONY
fi; \
done | sort
+list-old-libs: .PHONY
+ @cd ${.CURDIR}; \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
+ -V OLD_LIBS | xargs -n1 | sort
+
delete-old-libs: .PHONY
@echo ">>> Removing old libraries"
@echo "${OLD_LIBS_MESSAGE}" | fmt
@exec 3<&0; \
cd ${.CURDIR}; \
- ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
- -V OLD_LIBS | xargs -n1 | sort | \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-libs | \
while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
@@ -3286,8 +3294,7 @@ delete-old-libs: .PHONY
check-old-libs: .PHONY
@echo ">>> Checking for old libraries"
@cd ${.CURDIR}; \
- ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
- -V OLD_LIBS | xargs -n1 | \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-libs | \
while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
echo "${DESTDIR}/$${file}"; \
@@ -3297,13 +3304,17 @@ check-old-libs: .PHONY
echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
fi; \
done; \
- done | sort
+ done
+
+list-old-dirs: .PHONY
+ @cd ${.CURDIR}; \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
+ -V OLD_DIRS | xargs -n1 | sort -r
delete-old-dirs: .PHONY
@echo ">>> Removing old directories"
@cd ${.CURDIR}; \
- ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
- -V OLD_DIRS | xargs -n1 | sort -r | \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-dirs | \
while read dir; do \
if [ -d "${DESTDIR}/$${dir}" ]; then \
rmdir -v "${DESTDIR}/$${dir}" || true; \
@@ -3321,8 +3332,7 @@ delete-old-dirs: .PHONY
check-old-dirs: .PHONY
@echo ">>> Checking for old directories"
@cd ${.CURDIR}; \
- ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
- -V OLD_DIRS | xargs -n1 | sort -r | \
+ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-dirs | \
while read dir; do \
if [ -d "${DESTDIR}/$${dir}" ]; then \
echo "${DESTDIR}/$${dir}"; \