Add support for generating manpages.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 9 Sep 2014 20:33:53 +0000 (22:33 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Tue, 9 Sep 2014 20:33:53 +0000 (22:33 +0200)
Makefile.am
configure.ac

index fbf4bc1..0ee85ae 100644 (file)
@@ -37,6 +37,7 @@ configsdir = $(sysconfdir)/ddns
 CLEANFILES =
 DISTCLEANFILES =
 EXTRA_DIST =
 CLEANFILES =
 DISTCLEANFILES =
 EXTRA_DIST =
+noinst_DATA =
 
 @INTLTOOL_POLICY_RULE@
 
 
 @INTLTOOL_POLICY_RULE@
 
@@ -46,6 +47,12 @@ update-po:
 
 # ------------------------------------------------------------------------------
 
 
 # ------------------------------------------------------------------------------
 
+AM_V_XSLT   = $(AM_V_XSLT_$(V))
+AM_V_XSLT_  = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
+AM_V_XSLT_0 = @echo "  XSLT    " $@;
+
+# ------------------------------------------------------------------------------
+
 dist_doc_DATA = \
        COPYING
 
 dist_doc_DATA = \
        COPYING
 
@@ -75,6 +82,58 @@ ddnsdir = $(pythondir)/ddns
 
 # ------------------------------------------------------------------------------
 
 
 # ------------------------------------------------------------------------------
 
+if ENABLE_MANPAGES
+MANPAGES = \
+       man/ddns.1 \
+       man/ddns.conf.5
+
+MANPAGES_XML  = $(patsubst %.1,%.xml,$(patsubst %.5,%.xml,$(MANPAGES)))
+MANPAGES_HTML = $(patsubst %.xml,%.html,$(MANPAGES_XML))
+
+man: $(MANPAGES) $(MANPAGES_HTML)
+
+man_MANS = \
+       $(MANPAGES)
+
+noinst_DATA += \
+       $(MANPAGES_HTML)
+
+CLEANFILES += \
+       $(man_MANS) \
+       $(MANPAGES_HTML)
+
+EXTRA_DIST += \
+       $(MANPAGES_XML) \
+       man/custom-html.xsl
+
+XSLTPROC_FLAGS = \
+       --nonet \
+       --stringparam man.output.quietly 1 \
+       --stringparam funcsynopsis.style ansi \
+       --stringparam man.th.extra1.suppress 1 \
+       --stringparam man.authors.section.enabled 1 \
+       --stringparam man.copyright.section.enabled 1
+
+XSLTPROC_COMMAND_MAN = \
+       $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
+               http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+XSLTPROC_COMMAND_HTML = \
+       $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
+
+man/%.1: man/%.xml
+       $(XSLTPROC_COMMAND_MAN)
+
+man/%.5: man/%.xml
+       $(XSLTPROC_COMMAND_MAN)
+
+man/%.html: man/%.xml man/custom-html.xsl
+       $(XSLTPROC_COMMAND_HTML)
+
+endif
+
+# ------------------------------------------------------------------------------
+
 substitutions = \
        '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
        '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
 substitutions = \
        '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
        '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
index 4199a19..2d4c568 100644 (file)
@@ -51,6 +51,8 @@ AC_PROG_LN_S
 AC_PROG_MKDIR_P
 AC_PROG_SED
 
 AC_PROG_MKDIR_P
 AC_PROG_SED
 
+AC_PATH_PROG([XSLTPROC], [xsltproc])
+
 # Python
 AM_PATH_PYTHON([2.7])
 
 # Python
 AM_PATH_PYTHON([2.7])
 
@@ -62,6 +64,14 @@ fi
 
 save_LIBS="$LIBS"
 
 
 save_LIBS="$LIBS"
 
+# ------------------------------------------------------------------------------
+have_manpages=no
+AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages]))
+AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes])
+AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
+
+# ------------------------------------------------------------------------------
+
 AC_CONFIG_FILES([
        Makefile
        po/Makefile.in
 AC_CONFIG_FILES([
        Makefile
        po/Makefile.in
@@ -76,4 +86,6 @@ AC_MSG_RESULT([
        sysconfdir        : ${sysconfdir}
 
        nsupdate          : ${NSUPDATE}
        sysconfdir        : ${sysconfdir}
 
        nsupdate          : ${NSUPDATE}
+
+       Generate manpages : ${have_manpages}
 ])
 ])