[ovs-dev] [manpages 2/2] docs: Add Makefile rule to check syntax of manpages.

Ben Pfaff blp at nicira.com
Wed Aug 24 18:54:53 UTC 2011


This should catch future nroff syntax errors immediately, instead of much
later.
---
 Makefile.am           |   15 ++++++++++++++-
 configure.ac          |    1 +
 lib/automake.mk       |    2 +-
 m4/openvswitch.m4     |   12 ++++++++++++
 ofproto/automake.mk   |    2 +-
 ovsdb/automake.mk     |    2 +-
 utilities/automake.mk |    2 +-
 7 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 91218e1..2090501 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,7 +45,8 @@ EXTRA_DIST = \
 	REPORTING-BUGS \
 	SubmittingPatches \
 	WHY-OVS \
-	boot.sh
+	boot.sh \
+	$(MAN_FRAGMENTS)
 bin_PROGRAMS =
 sbin_PROGRAMS =
 bin_SCRIPTS =
@@ -57,6 +58,7 @@ dist_sbin_SCRIPTS =
 dist_scripts_SCRIPTS =
 INSTALL_DATA_LOCAL =
 man_MANS =
+MAN_FRAGMENTS =
 noinst_DATA =
 noinst_HEADERS =
 noinst_LIBRARIES =
@@ -148,6 +150,17 @@ rate-limit-check:
 	    exit 1; \
 	 fi
 
+if HAVE_GROFF
+ALL_LOCAL += manpage-check
+manpage-check: $(MANS) $(MAN_FRAGMENTS)
+	@manpages=; \
+	for d in $(MANS); do \
+		manpages="$$manpages `test -f $$d || echo $(VPATH)/`$$d"; \
+	done; \
+	LANG=en_US.UTF-8 groff -w mac -w delim -w escape -w input -w missing -w tab -T utf8 -man -p -z $$manpages && touch $@
+CLEANFILES += manpage-check
+endif
+
 dist-hook: $(DIST_HOOKS)
 all-local: $(ALL_LOCAL)
 clean-local: $(CLEAN_LOCAL)
diff --git a/configure.ac b/configure.ac
index 492c7bc..e03946a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,7 @@ OVS_CHECK_VALGRIND
 OVS_CHECK_SOCKET_LIBS
 OVS_CHECK_LINKER_SECTIONS
 OVS_CHECK_XENSERVER_VERSION
+OVS_CHECK_GROFF
 
 OVS_ENABLE_OPTION([-Wall])
 OVS_ENABLE_OPTION([-Wno-sign-compare])
diff --git a/lib/automake.mk b/lib/automake.mk
index d55465b..2f5b5fd 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -236,7 +236,7 @@ EXTRA_DIST += \
 	lib/dh4096.pem \
 	lib/dirs.c.in
 
-EXTRA_DIST += \
+MAN_FRAGMENTS += \
 	lib/common.man \
 	lib/common-syn.man \
 	lib/daemon.man \
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index e9edc49..7aaf67a 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -361,3 +361,15 @@ AC_DEFUN([OVS_CHECK_LINKER_SECTIONS],
    fi
    AM_CONDITIONAL(
      [USE_LINKER_SECTIONS], [test $ovs_cv_use_linker_sections = yes])])
+
+dnl Checks for groff.
+AC_DEFUN([OVS_CHECK_GROFF],
+  [AC_CACHE_CHECK(
+    [for groff],
+    [ovs_cv_groff],
+    [if (groff -v) >/dev/null 2>&1; then
+       ovs_cv_groff=yes
+     else
+       ovs_cv_groff=no
+     fi])
+   AM_CONDITIONAL([HAVE_GROFF], [test "$ovs_cv_groff" = yes])])
diff --git a/ofproto/automake.mk b/ofproto/automake.mk
index df83aef..ae35b7f 100644
--- a/ofproto/automake.mk
+++ b/ofproto/automake.mk
@@ -29,4 +29,4 @@ ofproto_libofproto_a_SOURCES = \
 	ofproto/pinsched.c \
 	ofproto/pinsched.h
 
-EXTRA_DIST += ofproto/ofproto-unixctl.man
+MAN_FRAGMENTS += ofproto/ofproto-unixctl.man
diff --git a/ovsdb/automake.mk b/ovsdb/automake.mk
index 5c9a8fb..39bc65f 100644
--- a/ovsdb/automake.mk
+++ b/ovsdb/automake.mk
@@ -29,7 +29,7 @@ ovsdb_libovsdb_a_SOURCES = \
 	ovsdb/trigger.h \
 	ovsdb/transaction.c \
 	ovsdb/transaction.h
-EXTRA_DIST += \
+MAN_FRAGMENTS += \
 	ovsdb/remote-active.man \
 	ovsdb/remote-passive.man
 
diff --git a/utilities/automake.mk b/utilities/automake.mk
index dc731bf..2cfdf8e 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -32,11 +32,11 @@ EXTRA_DIST += \
 	utilities/ovs-save \
 	utilities/ovs-tcpundump.1.in \
 	utilities/ovs-tcpundump.in \
-	utilities/ovs-vlan-bugs.man \
 	utilities/ovs-vlan-test.in \
 	utilities/ovs-vlan-bug-workaround.8.in \
 	utilities/ovs-vlan-test.8.in \
 	utilities/ovs-vsctl.8.in
+MAN_FRAGMENTS += utilities/ovs-vlan-bugs.man
 DISTCLEANFILES += \
 	utilities/ovs-appctl.8 \
 	utilities/ovs-ctl \
-- 
1.7.4.4




More information about the dev mailing list