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