1MAN1_TXT= \
2 $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
3 $(wildcard git-*.txt)) \
4 gitk.txt
5MAN7_TXT=git.txt
6
7DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
8
9ARTICLES = tutorial
10ARTICLES += tutorial-2
11ARTICLES += core-tutorial
12ARTICLES += cvs-migration
13ARTICLES += diffcore
14ARTICLES += howto-index
15ARTICLES += repository-layout
16ARTICLES += hooks
17ARTICLES += everyday
18ARTICLES += git-tools
19# with their own formatting rules.
20SP_ARTICLES = glossary howto/revert-branch-rebase user-manual
21
22DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
23
24DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
25DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
26
27prefix?=$(HOME)
28bindir?=$(prefix)/bin
29mandir?=$(prefix)/man
30man1dir=$(mandir)/man1
31man7dir=$(mandir)/man7
32# DESTDIR=
33
34ASCIIDOC=asciidoc
35ASCIIDOC_EXTRA =
36INSTALL?=install
37DOC_REF = origin/man
38
39-include ../config.mak.autogen
40
41#
42# Please note that there is a minor bug in asciidoc.
43# The version after 6.0.3 _will_ include the patch found here:
44# http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
45#
46# Until that version is released you may have to apply the patch
47# yourself - yes, all 6 characters of it!
48#
49
50all: html man
51
52html: $(DOC_HTML)
53
54$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN7): asciidoc.conf
55
56man: man1 man7
57man1: $(DOC_MAN1)
58man7: $(DOC_MAN7)
59
60install: man
61 $(INSTALL) -d -m755 $(DESTDIR)$(man1dir) $(DESTDIR)$(man7dir)
62 $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
63 $(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
64
65
66#
67# Determine "include::" file references in asciidoc files.
68#
69doc.dep : $(wildcard *.txt) build-docdep.perl
70 rm -f $@+ $@
71 perl ./build-docdep.perl >$@+
72 mv $@+ $@
73
74-include doc.dep
75
76cmds_txt = cmds-ancillaryinterrogators.txt \
77 cmds-ancillarymanipulators.txt \
78 cmds-mainporcelain.txt \
79 cmds-plumbinginterrogators.txt \
80 cmds-plumbingmanipulators.txt \
81 cmds-synchingrepositories.txt \
82 cmds-synchelpers.txt \
83 cmds-purehelpers.txt \
84 cmds-foreignscminterface.txt
85
86$(cmds_txt): cmd-list.perl $(MAN1_TXT)
87 perl ./cmd-list.perl
88
89git.7 git.html: git.txt core-intro.txt
90
91clean:
92 rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep
93 rm -f $(cmds_txt)
94
95%.html : %.txt
96 $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $<
97
98%.1 %.7 : %.xml
99 xmlto -m callouts.xsl man $<
100
101%.xml : %.txt
102 $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf $<
103
104user-manual.xml: user-manual.txt user-manual.conf
105 $(ASCIIDOC) -b docbook -d book $<
106
107user-manual.html: user-manual.xml
108 xmlto html-nochunks $<
109
110glossary.html : glossary.txt sort_glossary.pl
111 cat $< | \
112 perl sort_glossary.pl | \
113 $(ASCIIDOC) -b xhtml11 - > glossary.html
114
115howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
116 rm -f $@+ $@
117 sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
118 mv $@+ $@
119
120$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
121 $(ASCIIDOC) -b xhtml11 $*.txt
122
123WEBDOC_DEST = /pub/software/scm/git/docs
124
125$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
126 rm -f $@+ $@
127 sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
128 mv $@+ $@
129
130install-webdoc : html
131 sh ./install-webdoc.sh $(WEBDOC_DEST)
132
133quick-install:
134 sh ./install-doc-quick.sh $(DOC_REF) $(mandir)