Commit | Line | Data |
---|---|---|
36043cd6 | 1 | MAN1_TXT=$(wildcard stg*.txt) |
4ec67741 | 2 | |
bd1f46ed | 3 | DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT)) |
4ec67741 | 4 | |
368a44c3 YD |
5 | ARTICLES = |
6 | # with their own formatting rules. | |
7 | SP_ARTICLES = tutorial | |
8 | ||
9 | DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES)) | |
10 | DOC_PDF += $(patsubst %,%.pdf,$(ARTICLES) $(SP_ARTICLES)) | |
11 | ||
4ec67741 | 12 | DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT)) |
4ec67741 YD |
13 | |
14 | prefix?=$(HOME) | |
fd52912d | 15 | htmldir?=$(prefix)/share/doc/stgit |
491c9d5a | 16 | mandir?=$(prefix)/share/man |
4ec67741 | 17 | man1dir=$(mandir)/man1 |
4ec67741 YD |
18 | # DESTDIR= |
19 | ||
20 | ASCIIDOC=asciidoc --unsafe | |
21 | ASCIIDOC_EXTRA = | |
22 | INSTALL?=install | |
23 | ||
24 | # | |
25 | # Please note that there is a minor bug in asciidoc. | |
26 | # The version after 6.0.3 _will_ include the patch found here: | |
27 | # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2 | |
28 | # | |
29 | # Until that version is released you may have to apply the patch | |
30 | # yourself - yes, all 6 characters of it! | |
31 | # | |
32 | ||
33 | all: html man | |
34 | ||
35 | html: $(DOC_HTML) | |
368a44c3 | 36 | pdf: $(DOC_PDF) |
4ec67741 | 37 | |
bd1f46ed | 38 | $(DOC_HTML) $(DOC_MAN1): asciidoc.conf |
4ec67741 | 39 | |
bd1f46ed | 40 | man: man1 |
4ec67741 | 41 | man1: $(DOC_MAN1) |
4ec67741 | 42 | install: man |
bd1f46ed | 43 | $(INSTALL) -d -m755 $(DESTDIR)$(man1dir) |
4ec67741 | 44 | $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir) |
fd52912d DW |
45 | |
46 | install-html: html | |
47 | $(INSTALL) -d -m755 $(DESTDIR)$(htmldir) | |
48 | $(INSTALL) -m644 $(DOC_HTML) $(DESTDIR)$(htmldir) | |
4ec67741 YD |
49 | # |
50 | # Determine "include::" file references in asciidoc files. | |
51 | # | |
52 | doc.dep : $(wildcard *.txt) build-docdep.perl | |
53 | rm -f $@+ $@ | |
54 | perl ./build-docdep.perl >$@+ | |
55 | mv $@+ $@ | |
56 | ||
57 | -include doc.dep | |
58 | ||
59 | clean: | |
bd1f46ed | 60 | rm -f *.xml *.html *.pdf *.1 doc.dep |
4ec67741 YD |
61 | |
62 | %.html : %.txt | |
63 | $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $< | |
64 | ||
bd1f46ed | 65 | %.1 : %.xml |
4ec67741 YD |
66 | xmlto -m callouts.xsl man $< |
67 | ||
68 | %.xml : %.txt | |
69 | $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf $< | |
368a44c3 YD |
70 | |
71 | %.pdf: %.xml | |
72 | xmlto pdf $< | |
73 | ||
74 | # special formatting rules | |
75 | tutorial.html : %.html : %.txt | |
76 | $(ASCIIDOC) -b xhtml11 -d article -f tutorial.conf $(ASCIIDOC_EXTRA) $< | |
77 | tutorial.xml : %.xml : %.txt | |
78 | $(ASCIIDOC) -b docbook -d article -f tutorial.conf $< |