Documentation: clean up the makefile
[guilt.git] / Documentation / Makefile
blobb6c328539af15274e37b80af626127e1cfd9c95c
1 MAN1_TXT= $(wildcard guilt-*.txt)
2 MAN7_TXT=guilt.txt
4 DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
6 DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
7 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
9 USAGE=$(patsubst %.txt,usage-%.txt,$(MAN1_TXT))
10 VERSION=$(shell git describe 2> /dev/null || sed -n -e '/^GUILT_VERSION=/ { s/^GUILT_VERSION="/v/; s/"//; p; q; }' ../guilt)
12 prefix?=$(PREFIX)
13 bindir?=$(prefix)/bin
14 htmldir?=$(prefix)/html
15 mandir?=$(prefix)/man
16 man1dir=$(mandir)/man1
17 man7dir=$(mandir)/man7
18 # DESTDIR=
20 ASCIIDOC=asciidoc
21 ASCIIDOC_EXTRA =
22 INSTALL?=install
23 XMLTO=xmlto
24 XMLTO_EXTRA = --skip-validation
25 PERL=perl
27 all: html man
29 html: $(DOC_HTML)
31 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN7): asciidoc.conf
33 man: man1 man7
34 man1: $(DOC_MAN1)
35 man7: $(DOC_MAN7)
37 install: man
38 $(INSTALL) -d -m755 $(DESTDIR)$(man1dir) $(DESTDIR)$(man7dir)
39 $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
40 $(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
42 install-html: html
43 $(INSTALL) -m644 $(DOC_HTML) $(DESTDIR)$(htmldir)
46 # Determine "include::" file references in asciidoc files.
48 doc.dep : $(wildcard *.txt) build-docdep.perl
49 rm -f $@+ $@
50 $(PERL) ./build-docdep.perl >$@+
51 mv $@+ $@
53 -include doc.dep
55 version.txt:
56 echo "(Generated for Guilt $(VERSION))" > version.txt
58 cmds.txt: cmd-list.sh $(MAN1_TXT)
59 sh ./cmd-list.sh
61 guilt.7 guilt.html: guilt.txt footer.txt version.txt
63 clean:
64 rm -f *.xml *.html *.1 *.7 doc.dep
65 rm -f cmds.txt
66 rm -f usage-*.txt
67 rm -f version.txt
69 usage-%.txt: $(MAN1_TXT) usage.sh
70 sh ./usage.sh
72 %.html : %.txt footer.txt version.txt
73 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<
75 %.1 %.7 : %.xml
76 $(XMLTO) -m callouts.xsl $(XMLTO_EXTRA) man $<
78 %.xml : %.txt footer.txt version.txt
79 $(ASCIIDOC) -b docbook -a version=$(VERSION) -d manpage -f asciidoc.conf $<