summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-05-21 17:40:19 +0000
committerYang Tse <yangsita@gmail.com>2009-05-21 17:40:19 +0000
commitba2217050bf269df6cc0b793f9407062d36039ca (patch)
tree70449e13f49de8abe4ebcdc7e551ff4f027fcb55 /Makefile.am
parent42be22e1b1e3d7209e626375ee741b05f8357ea4 (diff)
downloadc-ares-ba2217050bf269df6cc0b793f9407062d36039ca.tar.gz
c-ares-ba2217050bf269df6cc0b793f9407062d36039ca.tar.bz2
c-ares-ba2217050bf269df6cc0b793f9407062d36039ca.zip
Allow generation of .html and .pdf versions of c-ares man pages.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am46
1 files changed, 45 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 373669c..de2ae90 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,7 +46,9 @@ noinst_PROGRAMS =$(PROGS)
EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
Makefile.m32 Makefile.netware Makefile.vc6 $(man_MANS) $(MSVCFILES) \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
- TODO ares_build.h.in buildconf.bat
+ TODO ares_build.h.in buildconf.bat $(PDFPAGES)
+
+CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
DISTCLEANFILES = ares_build.h
@@ -111,6 +113,48 @@ adig_LDADD = $(top_builddir)/$(lib_LTLIBRARIES)
acountry_SOURCES = acountry.c ares_getopt.c ares_getopt.h
acountry_LDADD = $(top_builddir)/$(lib_LTLIBRARIES)
+SOURCEDMANDIR = man3
+SOURCEDMANPAGES = ares_init.3
+SOURCINGMANPAGES = ares_init_options.3
+
+clean-local: clean-sourced-manpages
+
+clean-sourced-manpages:
+ @srcdmandir='$(SOURCEDMANDIR)'; \
+ echo "rm -rf $(top_builddir)/$$srcdmandir"; \
+ rm -rf $(top_builddir)/$$srcdmandir
+
+sourced-manpages: clean-sourced-manpages
+ @srcdmandir='$(SOURCEDMANDIR)'; \
+ srcdmanfiles='$(SOURCEDMANPAGES)'; \
+ mkdir $(top_builddir)/$$srcdmandir; \
+ for file in $$srcdmanfiles; do \
+ if test -f $(top_srcdir)/$$file; then \
+ echo "cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file"; \
+ cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file; \
+ fi; \
+ done
+
+$(SOURCINGMANPAGES): sourced-manpages
+
+MAN2HTML = roffit --mandir=. < $< >$@
+
+SUFFIXES = .3 .html
+
+html: $(HTMLPAGES)
+
+.3.html:
+ $(MAN2HTML)
+
+pdf: $(PDFPAGES)
+
+.3.pdf:
+ @(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \
+ groff -Tps -man $< >$$foo.ps; \
+ ps2pdf $$foo.ps $@; \
+ rm $$foo.ps; \
+ echo "converted $< to $@")
+
# Make files named *.dist replace the file without .dist extension
dist-hook:
find $(distdir) -name "*.dist" -exec rm {} \;