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