Makefile 2.6 KB
Newer Older
1 2 3 4
MAN1_TXT= \
	$(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
		$(wildcard git-*.txt)) \
	gitk.txt
D
David Greaves 已提交
5
MAN7_TXT=git.txt
6

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

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

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

D
David Greaves 已提交
24 25 26
DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))

27
prefix?=$(HOME)
28 29
bindir?=$(prefix)/bin
mandir?=$(prefix)/man
30 31
man1dir=$(mandir)/man1
man7dir=$(mandir)/man7
32
# DESTDIR=
33

34
INSTALL?=install
35
DOC_REF = origin/man
36

37 38
-include ../config.mak.autogen

D
David Greaves 已提交
39 40 41 42 43 44 45 46 47 48
#
# 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
49 50 51

html: $(DOC_HTML)

52
$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN7): asciidoc.conf
D
David Greaves 已提交
53 54 55 56

man: man1 man7
man1: $(DOC_MAN1)
man7: $(DOC_MAN7)
57

J
Junio C Hamano 已提交
58
install: man
59
	$(INSTALL) -d -m755 $(DESTDIR)$(man1dir) $(DESTDIR)$(man7dir)
60 61
	$(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
	$(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
62

63

64 65 66
#
# Determine "include::" file references in asciidoc files.
#
67
doc.dep : $(wildcard *.txt) build-docdep.perl
68 69 70
	rm -f $@+ $@
	perl ./build-docdep.perl >$@+
	mv $@+ $@
71

72
-include doc.dep
73

74 75 76 77
git.7: README

README: ../README
	cp $< $@
78

79

80
clean:
81
	rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep README
82 83

%.html : %.txt
84
	asciidoc -b xhtml11 -d manpage -f asciidoc.conf $<
85

86
%.1 %.7 : %.xml
87
	xmlto -m callouts.xsl man $<
88 89

%.xml : %.txt
90
	asciidoc -b docbook -d manpage -f asciidoc.conf $<
J
Junio C Hamano 已提交
91

92
git.html: git.txt README
J
Junio C Hamano 已提交
93

94 95 96 97 98
glossary.html : glossary.txt sort_glossary.pl
	cat $< | \
	perl sort_glossary.pl | \
	asciidoc -b xhtml11 - > glossary.html

99 100 101 102 103
howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
	rm -f $@+ $@
	sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
	mv $@+ $@

J
Junio C Hamano 已提交
104 105
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
	asciidoc -b xhtml11 $*.txt
106 107 108

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

109 110
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
	rm -f $@+ $@
111
	sed -e '1,/^$$/d' $< | asciidoc -b xhtml11 - >$@+
112 113
	mv $@+ $@

114 115
install-webdoc : html
	sh ./install-webdoc.sh $(WEBDOC_DEST)
116 117 118

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