[ovs-dev] [PATCH] docs: New 'man-pdf' Makefile target to generate PDF versions of manpages.

Ben Pfaff blp at nicira.com
Mon Nov 28 15:26:59 PST 2011


It might be nice to actually install these, but there's no standard place
to install them.  Nevertheless, it's nice to have the target around
because it shows how to generate PDFs.  It should make it easier for me to
regenerate the PDF for ovs-vswitchd.conf.db(5) on openvswitch.org, for
example.

Reported-by: Alan Shieh <ashieh at nicira.com>
Bug #8153.
---
 AUTHORS           |    1 +
 Makefile.am       |   19 +++++++++++++++++++
 NEWS              |    3 ++-
 configure.ac      |    1 +
 m4/openvswitch.m4 |   12 ++++++++++++
 5 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 00aa15e..3e136d9 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -54,6 +54,7 @@ provided helpful bug reports or suggestions.
 Aaron M. Ucko           ucko at debian.org
 Aaron Rosen             arosen at clemson.edu
 Ahmed Bilal             numan252 at gmail.com
+Alan Shieh              ashieh at nicira.com
 Alex Yip                alex at nicira.com
 Alexey I. Froloff       raorn at altlinux.org
 Bob Ball                bob.ball at citrix.com
diff --git a/Makefile.am b/Makefile.am
index c0a7ade..60b2698 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -165,6 +165,25 @@ manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
 CLEANFILES += manpage-check
 endif
 
+if HAVE_GROFF
+if HAVE_PS2PDF
+# The 'man-pdf' target doesn't get built by default because there's no good
+# place to install the PDF versions of the manpages.  It's included mainly
+# because the magic ps2pdf options to embed fonts are needed to make the output
+# look decent in the Chrome PDF viewer were really hard to find.
+man-pdf: $(man_MANS:=.pdf) $(dist_man_MANS:=.pdf) $(noinst_man_MANS:=.pdf)
+SUFFIXES += .1.pdf .5.pdf .8.pdf .1 .5 .8
+PS2PDF_FLAGS = -dEmbedAllFonts=true -dPDFSETTINGS=/printer
+man2pdf = LANG=en_US.UTF-8 groff -p -T ps -man $< | ps2pdf $(PS2PDF_FLAGS) - $@
+.1.1.pdf:
+	$(man2pdf)
+.5.5.pdf:
+	$(man2pdf)
+.8.8.pdf:
+	$(man2pdf)
+endif
+endif
+
 include $(srcdir)/manpages.mk
 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
 	@$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
diff --git a/NEWS b/NEWS
index 33732ff..37de06a 100644
--- a/NEWS
+++ b/NEWS
@@ -23,7 +23,8 @@ post-v1.3.0
         and connectivity issues. This tool currently is not included in RH or
         Xen packages.
     - RHEL packaging now supports integration with Red Hat network scripts.
-
+    - New "man-pdf" Makefile target to generate PDF versions of manpages,
+      for convenience.
 
 v1.3.0 - xx xxx xxxx
 ------------------------
diff --git a/configure.ac b/configure.ac
index 7bac871..a51b8db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,7 @@ OVS_CHECK_SOCKET_LIBS
 OVS_CHECK_LINKER_SECTIONS
 OVS_CHECK_XENSERVER_VERSION
 OVS_CHECK_GROFF
+OVS_CHECK_PS2PDF
 
 OVS_ENABLE_OPTION([-Wall])
 OVS_ENABLE_OPTION([-Wno-sign-compare])
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index c59d5d4..0c90d7a 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -354,3 +354,15 @@ AC_DEFUN([OVS_CHECK_GROFF],
        ovs_cv_groff=no
      fi])
    AM_CONDITIONAL([HAVE_GROFF], [test "$ovs_cv_groff" = yes])])
+
+dnl Checks for ps2pdf.
+AC_DEFUN([OVS_CHECK_PS2PDF],
+  [AC_CACHE_CHECK(
+    [for ps2pdf],
+    [ovs_cv_ps2pdf],
+    [if (echo quit | ps2pdf - -) >/dev/null 2>&1; then
+       ovs_cv_ps2pdf=yes
+     else
+       ovs_cv_ps2pdf=no
+     fi])
+   AM_CONDITIONAL([HAVE_PS2PDF], [test "$ovs_cv_ps2pdf" = yes])])
-- 
1.7.4.4




More information about the dev mailing list