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