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