about summary refs log tree commit homepage
path: root/Makefile
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-07-26 13:02:16 -0700
committerEric Wong <normalperson@yhbt.net>2009-07-26 13:52:00 -0700
commit69805624b2dcb0ec30eeb57c64ffac85bfe61fff (patch)
treedf7ecaf9de367ab1c6395b479e60ab0cf9cef7ef /Makefile
parent76d3c42764674158e76a0c021ee2a2801d327256 (diff)
downloadpcu-69805624b2dcb0ec30eeb57c64ffac85bfe61fff.tar.gz
Switch to pandoc for all documentation
pandoc can generate stand-alone HTML, an automatic TOC, and
the only Markdown processor I know of capable of generating
manpages.

Markdown is also a more standard syntax than txt2man and
appropriate for generating HTML versions of manpages.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 13 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index d846d32..f896181 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,10 @@ prefix = $(HOME)
 bindir = $(prefix)/bin
 mandir = $(prefix)/share/man
 INSTALL = install
-TXT2MAN = txt2man
+PANDOC = pandoc
+PANDOC_OPTS = -s -f markdown --email-obfuscation=none --sanitize-html
+pandoc = $(PANDOC) $(PANDOC_OPTS)
+pandoc_html = $(pandoc) --toc -t html --no-wrap
 STRIP ?= strip
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
         @./GIT-VERSION-GEN
@@ -42,13 +45,17 @@ install-strip: strip
         $(MAKE) install
 
 %.1: %.1.txt
-        $(TXT2MAN) -r 'pcu $(GIT_VERSION)' \
-          -v 'Page Cache Utilities Reference Manual' \
-          -t $(basename $@) -s 1 < $< > $@+
+        $(pandoc) -t man < $< > $@+
+        mv $@+ $@
+%.1.html: %.1.txt
+        $(pandoc_html) -T $(basename $@) < $< > $@+
         mv $@+ $@
 
 man1 := $(addsuffix .1,$(PCU_BIN))
+html := index.html $(addsuffix .html, $(man1))
+html: $(html)
 man: $(man1)
+doc: html man
 install-man: install-man1
 install-man1: $(man1)
         $(INSTALL) -d -m 755 '$(DESTDIR)$(mandir)/man1'
@@ -60,12 +67,11 @@ dist: GIT-VERSION-FILE
         mv $(DISTNAME).tar.gz+ $(DISTNAME).tar.gz
 clean:
         $(RM) $(PCU_BIN) $(DISTNAME).tar.gz* GIT-VERSION-FILE
-        $(RM) $(man1)
+        $(RM) $(man1) $(html)
 
 index.html: title = $(shell sed -ne 1p < $<)
 index.html: README
-        markdown $< | (tidy -q 2>/dev/null || true) | \
-          sed 's,<title></title>,<title>$(title)</title>,' > $@+
+        $(pandoc_html) -T "$(title)" < $< > $@+
         mv $@+ $@
 
 .PHONY: .FORCE-GIT-VERSION-FILE install install-man man