]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
build: add autotools support for the 'doc' subdir
authorGiorgio Dal Molin <giorgio.nicole@arcor.de>
Wed, 12 Nov 2014 16:41:05 +0000 (17:41 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 12 Nov 2014 20:43:45 +0000 (21:43 +0100)
'nft' documentation is originally contained in the XML file 'doc/nft.xml'.
Processing this file with the proper tools we can obtain a PDF document,
 'nft.pdf', and a unix man page, 'nft.8'.

To produce the PDF we need the tool 'dblatex' (current release
pypi.python.org/pypi/dblatex/0.3.5).

To produce the man page we use the tool 'docbook2man'; it is part of the
package 'docbook2X' (docbook2x.sourceforge.net). On some linux
distributions the tool can have slightly different names as 'docbook2x-man'
or 'db2x_docbook2man' so we search for all three names and use the first
one found and issue the command:

 # ${DB2MAN} --xinclude $<

Signed-off-by: Giorgio Dal Molin <giorgio.nicole@arcor.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Makefile.am
configure.ac
doc/Makefile.am [new file with mode: 0644]
doc/Makefile.in [deleted file]

index 8d301f62c817d7fb64d686933e9fa0cf9e03d894..b7fdc42c57661284971718dea206b146e090e39c 100644 (file)
@@ -1,4 +1,5 @@
 ACLOCAL_AMFLAGS        = -I m4
 
 SUBDIRS =      src     \
-               include
+               include \
+               doc
index e71dcedf141911e08962daf44c94f8e1eb3e0de8..7bbd86ef6608aaaa5cebecdc17bab55386510e79 100644 (file)
@@ -49,29 +49,24 @@ then
         exit 1
 fi
 
-AC_CHECK_PROG(CONFIG_MAN1, [docbook2x-man], [y], [n])
-if test "$CONFIG_MAN1" == "y"
-then
-       CONFIG_MAN=y
-       DB2MAN=docbook2x-man
-else
-       AC_CHECK_PROG(CONFIG_MAN2, [db2x_docbook2man], [y], [n])
-       if test "$CONFIG_MAN2" == "y"
-       then
-               CONFIG_MAN=y
-               DB2MAN=db2x_docbook2man
-       else
-               AC_MSG_WARN([docbookx2-man/db2x_docbook2man not found, no manpages will be built])
-       fi
-fi
-AC_SUBST(CONFIG_MAN)
+AC_CHECK_PROG(DOCBOOK2X_MAN, [docbook2x-man], [docbook2x-man], [no])
+AC_CHECK_PROG(DOCBOOK2MAN, [docbook2man], [docbook2man], [no])
+AC_CHECK_PROG(DB2X_DOCBOOK2MAN, [db2x_docbook2man], [db2x_docbook2man], [no])
+AS_IF([test "$DOCBOOK2X_MAN" != "no"], [DB2MAN="$DOCBOOK2X_MAN"],
+       [AS_IF([test "$DOCBOOK2MAN" != "no"], [DB2MAN="$DOCBOOK2MAN"],
+               [AS_IF([test "$DB2X_DOCBOOK2MAN" != "no"], [DB2MAN="$DB2X_DOCBOOK2MAN"],
+                       [AC_MSG_WARN([docbookx2-man/db2x_docbook2man not found, no manpages will be built])]
+               )]
+       )]
+)
 AC_SUBST(DB2MAN)
+AM_CONDITIONAL([BUILD_MAN], [test -n "$DB2MAN"])
 
-AC_CHECK_PROG(CONFIG_PDF, dblatex, y, n)
-if test "$CONFIG_PDF" != "y"
-then
-       AC_MSG_WARN([dblatex not found, no PDF manpages will be built])
-fi
+AC_CHECK_PROG(DBLATEX, [dblatex], [found], [no])
+AS_IF([test "$DBLATEX" == "no"],
+       [AC_MSG_WARN([dblatex not found, no PDF manpages will be built])]
+)
+AM_CONDITIONAL([BUILD_PDF], [test "$DBLATEX" == "found"])
 
 # Checks for libraries.
 PKG_CHECK_MODULES([LIBMNL], [libmnl >= 1.0.3])
@@ -125,6 +120,7 @@ AC_CONFIG_FILES([                                   \
                include/Makefile                        \
                include/linux/Makefile                  \
                include/linux/netfilter/Makefile        \
+               doc/Makefile                            \
                ])
 AC_OUTPUT
 
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644 (file)
index 0000000..a92de7f
--- /dev/null
@@ -0,0 +1,19 @@
+if BUILD_MAN
+man_MANS = nft.8
+endif
+
+if BUILD_PDF
+pdf_DATA = nft.pdf
+endif
+
+pdfdir=${docdir}/pdf
+
+.xml.pdf:
+       ${AM_V_GEN}dblatex -q -t pdf -o $@ $<
+
+.xml.8:
+       ${AM_V_GEN}${DB2MAN} --xinclude $<
+
+EXTRA_DIST = nft.xml
+
+CLEANFILES = nft.pdf nft.8 *~
diff --git a/doc/Makefile.in b/doc/Makefile.in
deleted file mode 100644 (file)
index 1ec856c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-mandocs-@CONFIG_MAN@   += doc/nft.8
-pdfdocs-@CONFIG_PDF@   += doc/nft.pdf
-
-all:           $(mandocs-y) $(pdfdocs-y)
-clean:
-               @echo -e "  CLEAN\t\tdoc"
-               $(RM) $(mandocs-y) $(pdfdocs-y)
-
-install:       $(mandocs-y) $(pdfdocs-y)
-               @echo -e "  INSTALL\tdoc"
-               if test -n "$(mandocs-y)"; then \
-                       $(MKDIR_P) $(DESTDIR)/${mandir}/man8 ;\
-                       $(INSTALL) -m 755 -p $(mandocs-y) \
-                                       $(DESTDIR)/${mandir}/man8/ ;\
-               fi
-               if test -n "$(pdfdocs-y)"; then \
-                       $(MKDIR_P) $(DESTDIR)/${pdfdir} ;\
-                       $(INSTALL) -m 755 -p $(pdfdocs-y) \
-                                       $(DESTDIR)/${pdfdir}/ ;\
-               fi