git: 18a9f83630a7 - main - bsd.man.mk: Add checkmanlinks target
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 12 Aug 2025 12:55:26 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=18a9f83630a7d4612066bb690bcec0437c0e2e72
commit 18a9f83630a7d4612066bb690bcec0437c0e2e72
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-12 12:55:01 +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
---
share/mk/bsd.man.mk | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk
index f44048b4e453..66155d1b4cd9 100644
--- a/share/mk/bsd.man.mk
+++ b/share/mk/bsd.man.mk
@@ -288,11 +288,11 @@ manlinksinstall-${__group}:
.endif
.endfor
-manlint:
+manlint: .PHONY checkmanlinks
.if defined(${__group}) && !empty(${__group})
.for __page in ${${__group}}
manlint: ${__page:S/:/\:/g}lint
-${__page:S/:/\:/g}lint: ${__page}
+${__page:S/:/\:/g}lint: .PHONY ${__page}
.if defined(MANFILTER)
${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} -Tlint
.else
@@ -301,4 +301,18 @@ ${__page:S/:/\:/g}lint: ${__page}
.endfor
.endif
+checkmanlinks: .PHONY
+.if defined(${__group}LINKS)
+checkmanlinks: checkmanlinks-${__group}
+checkmanlinks-${__group}: .PHONY
+.for __page __link in ${${__group}LINKS}
+checkmanlinks-${__group}: checkmanlinks-${__group}-${__link}
+checkmanlinks-${__group}-${__link}: .PHONY ${__page}
+ @if ! egrep -q "^(\.\\\\\" )?\.Nm ${__link:R}( ,)?$$" ${.ALLSRC}; then \
+ echo "${__group}LINKS: '.Nm ${__link:R}' not found in ${__page}"; \
+ exit 1; \
+ fi >&2
+.endfor # __page __link in ${${__group}LINKS}
+.endif # defined(${__group}LINKS)
+
.endfor # __group in ${MANGROUPS}