Makefile 4.4 KB
Newer Older
1 2 3 4
MAN1_TXT= \
	$(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
		$(wildcard git-*.txt)) \
	gitk.txt
L
Lars Hjemli 已提交
5
MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt
D
David Greaves 已提交
6
MAN7_TXT=git.txt
7

8
DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT))
J
Junio C Hamano 已提交
9

J
Junio C Hamano 已提交
10
ARTICLES = tutorial
11
ARTICLES += tutorial-2
12
ARTICLES += core-tutorial
J
Junio C Hamano 已提交
13 14 15 16
ARTICLES += cvs-migration
ARTICLES += diffcore
ARTICLES += howto-index
ARTICLES += repository-layout
J
Junio C Hamano 已提交
17
ARTICLES += hooks
J
Junio C Hamano 已提交
18
ARTICLES += everyday
19
ARTICLES += git-tools
20
ARTICLES += glossary
J
Junio C Hamano 已提交
21
# with their own formatting rules.
22
SP_ARTICLES = howto/revert-branch-rebase user-manual
J
Junio C Hamano 已提交
23 24

DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
25

D
David Greaves 已提交
26
DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
27
DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
D
David Greaves 已提交
28 29
DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))

30
prefix?=$(HOME)
31
bindir?=$(prefix)/bin
32
mandir?=$(prefix)/share/man
33
man1dir=$(mandir)/man1
34
man5dir=$(mandir)/man5
35
man7dir=$(mandir)/man7
36
# DESTDIR=
37

38
ASCIIDOC=asciidoc
39
ASCIIDOC_EXTRA =
40 41 42
ifdef ASCIIDOC8
ASCIIDOC_EXTRA += -a asciidoc7compatible
endif
43
INSTALL?=install
44
RM ?= rm -f
45
DOC_REF = origin/man
46

47 48 49 50 51
infodir?=$(prefix)/share/info
MAKEINFO=makeinfo
INSTALL_INFO=install-info
DOCBOOK2X_TEXI=docbook2x-texi

52
-include ../config.mak.autogen
53
-include ../config.mak
54

D
David Greaves 已提交
55 56 57 58 59 60 61 62 63 64
#
# Please note that there is a minor bug in asciidoc.
# The version after 6.0.3 _will_ include the patch found here:
#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
#
# Until that version is released you may have to apply the patch
# yourself - yes, all 6 characters of it!
#

all: html man
65 66 67

html: $(DOC_HTML)

68
$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
D
David Greaves 已提交
69

70
man: man1 man5 man7
D
David Greaves 已提交
71
man1: $(DOC_MAN1)
72
man5: $(DOC_MAN5)
D
David Greaves 已提交
73
man7: $(DOC_MAN7)
74

75 76
info: git.info

J
Junio C Hamano 已提交
77
install: man
78 79 80
	$(INSTALL) -d -m755 $(DESTDIR)$(man1dir)
	$(INSTALL) -d -m755 $(DESTDIR)$(man5dir)
	$(INSTALL) -d -m755 $(DESTDIR)$(man7dir)
81
	$(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
J
Junio C Hamano 已提交
82
	$(INSTALL) -m644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
83
	$(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
84

85 86 87 88 89 90 91 92
install-info: info
	$(INSTALL) -d -m755 $(DESTDIR)$(infodir)
	$(INSTALL) -m644 git.info $(DESTDIR)$(infodir)
	if test -r $(DESTDIR)$(infodir)/dir; then \
	  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
	else \
	  echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
	fi
93

94 95 96 97 98
../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
	$(MAKE) -C ../ GIT-VERSION-FILE

-include ../GIT-VERSION-FILE

99 100 101
#
# Determine "include::" file references in asciidoc files.
#
102
doc.dep : $(wildcard *.txt) build-docdep.perl
103
	$(RM) $@+ $@
104 105
	perl ./build-docdep.perl >$@+
	mv $@+ $@
106

107
-include doc.dep
108

109 110 111 112 113
cmds_txt = cmds-ancillaryinterrogators.txt \
	cmds-ancillarymanipulators.txt \
	cmds-mainporcelain.txt \
	cmds-plumbinginterrogators.txt \
	cmds-plumbingmanipulators.txt \
114 115 116 117
	cmds-synchingrepositories.txt \
	cmds-synchelpers.txt \
	cmds-purehelpers.txt \
	cmds-foreignscminterface.txt
118

119 120 121
$(cmds_txt): cmd-list.made

cmd-list.made: cmd-list.perl $(MAN1_TXT)
122
	$(RM) $@
123
	perl ./cmd-list.perl
124
	date >$@
125

126
git.7 git.html: git.txt
127

128
clean:
129
	$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 *.texi *.texi+ howto-index.txt howto/*.html doc.dep
130
	$(RM) $(cmds_txt) *.made
131 132

%.html : %.txt
133
	$(RM) $@+ $@
134
	$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
135
		$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
136
	mv $@+ $@
137

138
%.1 %.5 %.7 : %.xml
139
	$(RM) $@
140
	xmlto -m callouts.xsl man $<
141 142

%.xml : %.txt
143
	$(RM) $@+ $@
144
	$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
145
		$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
146
	mv $@+ $@
J
Junio C Hamano 已提交
147

148
user-manual.xml: user-manual.txt user-manual.conf
149
	$(ASCIIDOC) -b docbook -d book $<
150

J
Junio C Hamano 已提交
151
XSLT = docbook.xsl
152
XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
153

154
user-manual.html: user-manual.xml
155
	xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
156

157 158 159 160 161 162 163
git.info: user-manual.xml
	$(RM) $@ $*.texi $*.texi+
	$(DOCBOOK2X_TEXI) user-manual.xml --to-stdout >$*.texi+
	perl fix-texi.perl <$*.texi+ >$*.texi
	$(MAKEINFO) --no-split $*.texi
	$(RM) $*.texi $*.texi+

164
howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
165
	$(RM) $@+ $@
166 167 168
	sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
	mv $@+ $@

J
Junio C Hamano 已提交
169
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
170
	$(ASCIIDOC) -b xhtml11 $*.txt
171 172 173

WEBDOC_DEST = /pub/software/scm/git/docs

174
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
175
	$(RM) $@+ $@
176
	sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
177 178
	mv $@+ $@

179 180
install-webdoc : html
	sh ./install-webdoc.sh $(WEBDOC_DEST)
181 182 183

quick-install:
	sh ./install-doc-quick.sh $(DOC_REF) $(mandir)
184 185

.PHONY: .FORCE-GIT-VERSION-FILE