git: 4b89029fef2a - stable/13 - bsd.man.mk: Add checkmanlinks target
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 14 Aug 2025 16:03:19 UTC
The branch stable/13 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=4b89029fef2a67867966a859276ecd4489bc4087
commit 4b89029fef2a67867966a859276ecd4489bc4087
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-08-12 12:54:08 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-08-14 14:00:06 +0000
bsd.man.mk: Add checkmanlinks target
This target checks that every page mentioned in MLINKS exists and that
every link corresponds to a (possibly commented-out) name entry in the
page it links to.
MFC after: 1 week
Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D51862
(cherry picked from commit 18a9f83630a7d4612066bb690bcec0437c0e2e72)
---
share/mk/bsd.man.mk | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk
index 444144e6d626..cd1fa485a5ac 100644
--- a/share/mk/bsd.man.mk
+++ b/share/mk/bsd.man.mk
@@ -238,11 +238,11 @@ maninstall: ${MAN}
.endif
.endfor
-manlint:
+manlint: .PHONY checkmanlinks
.if defined(MAN) && !empty(MAN)
.for __page in ${MAN}
manlint: ${__page}lint
-${__page}lint: ${__page}
+${__page}lint: .PHONY ${__page}
.if defined(MANFILTER)
${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} -Tlint
.else
@@ -250,3 +250,15 @@ ${__page}lint: ${__page}
.endif
.endfor
.endif
+
+checkmanlinks: .PHONY
+.if defined(MLINKS)
+.for __page __link in ${MLINKS}
+checkmanlinks: checkmanlinks-${__link}
+checkmanlinks-${__link}: .PHONY ${__page}
+ @if ! egrep -q "^(\.\\\\\" )?\.Nm ${__link:R}( ,)?$$" ${.ALLSRC}; then \
+ echo "LINKS: '.Nm ${__link:R}' not found in ${__page}"; \
+ exit 1; \
+ fi >&2
+.endfor # __page __link in ${MLINKS}
+.endif # defined(MLINKS)