Skip to content

Commit 0cf0611

Browse files
blucashemminger
authored andcommitted
Makefile: check manpages for syntax errors
Pass the same parameters Lintian uses in Debian. $ make check <...> Checking manpages for syntax errors... <standard input>:48: warning: macro `Q' not defined Error in tc-taprio.8 Makefile:27: recipe for target 'check' failed Signed-off-by: Luca Boccassi <bluca@debian.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
1 parent 8242808 commit 0cf0611

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ distclean: clobber
115115

116116
check: all
117117
cd testsuite && $(MAKE) && $(MAKE) alltests
118+
@if command -v man >/dev/null 2>&1; then \
119+
echo "Checking manpages for syntax errors..."; \
120+
$(MAKE) -C man check; \
121+
else \
122+
echo "man not installed, skipping checks for syntax errors."; \
123+
fi
118124

119125
cscope:
120126
cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc

man/Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
INSTALL=install
33
INSTALLDIR=install -m 0755 -d
44
INSTALLMAN=install -m 0644
5+
# Pass the same parameters as Lintian uses on Debian.
6+
MAN_CHECK=LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings \
7+
--encoding=UTF-8 --local-file --troff-device=utf8 --ditroff
8+
# Hide man output, count and print errors.
9+
MAN_REDIRECT=2>&1 >/dev/null | tee /dev/fd/2 | wc -l
510

611
SUBDIRS = man3 man7 man8
712

8-
all clean install:
13+
all clean install check:
914
@for subdir in $(SUBDIRS); do $(MAKE) -C $$subdir $@ || exit $$?; done
1015

1116
distclean: clean
1217

13-
.PHONY: install clean distclean
18+
.PHONY: install clean distclean check
1419

1520
.EXPORT_ALL_VARIABLES:

man/man3/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ install:
1111
$(INSTALLDIR) $(DESTDIR)$(MANDIR)/man3
1212
$(INSTALLMAN) $(MAN3PAGES) $(DESTDIR)$(MANDIR)/man3
1313

14-
.PHONY: install clean distclean
14+
check:
15+
@for page in $(MAN3PAGES); do test 0 -eq $$($(MAN_CHECK) $$page \
16+
$(MAN_REDIRECT)) || { echo "Error in $$page"; exit 1; }; done
17+
18+
.PHONY: install clean distclean check

man/man7/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ install:
1111
$(INSTALLDIR) $(DESTDIR)$(MANDIR)/man7
1212
$(INSTALLMAN) $(MAN7PAGES) $(DESTDIR)$(MANDIR)/man7
1313

14-
.PHONY: install clean distclean
14+
check:
15+
@for page in $(MAN7PAGES); do test 0 -eq $$($(MAN_CHECK) $$page \
16+
$(MAN_REDIRECT)) || { echo "Error in $$page"; exit 1; }; done
17+
18+
.PHONY: install clean distclean check

man/man8/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ install:
2323
$(INSTALLDIR) $(DESTDIR)$(MANDIR)/man8
2424
$(INSTALLMAN) $(MAN8PAGES) $(DESTDIR)$(MANDIR)/man8
2525

26-
.PHONY: install clean distclean
26+
check: all
27+
@for page in $(MAN8PAGES); do test 0 -eq $$($(MAN_CHECK) $$page \
28+
$(MAN_REDIRECT)) || { echo "Error in $$page"; exit 1; }; done
29+
30+
.PHONY: install clean distclean check

0 commit comments

Comments
 (0)