Documentation / Makefileon commit Merge branch 'jc/checkout' (8f1b063)
   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 githooks.txt
   6MAN7_TXT=git.txt gitcli.txt gittutorial.txt gittutorial-2.txt \
   7        gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt
   8
   9MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
  10MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
  11MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
  12
  13DOC_HTML=$(MAN_HTML)
  14
  15ARTICLES = diffcore
  16ARTICLES += howto-index
  17ARTICLES += repository-layout
  18ARTICLES += everyday
  19ARTICLES += git-tools
  20# with their own formatting rules.
  21SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
  22API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
  23SP_ARTICLES += $(API_DOCS)
  24SP_ARTICLES += technical/api-index
  25
  26DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
  27
  28DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
  29DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
  30DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
  31
  32prefix?=$(HOME)
  33bindir?=$(prefix)/bin
  34htmldir?=$(prefix)/share/doc/git-doc
  35mandir?=$(prefix)/share/man
  36man1dir=$(mandir)/man1
  37man5dir=$(mandir)/man5
  38man7dir=$(mandir)/man7
  39# DESTDIR=
  40
  41ASCIIDOC=asciidoc
  42ASCIIDOC_EXTRA =
  43MANPAGE_XSL = callouts.xsl
  44INSTALL?=install
  45RM ?= rm -f
  46DOC_REF = origin/man
  47
  48infodir?=$(prefix)/share/info
  49MAKEINFO=makeinfo
  50INSTALL_INFO=install-info
  51DOCBOOK2X_TEXI=docbook2x-texi
  52ifndef PERL_PATH
  53        PERL_PATH = /usr/bin/perl
  54endif
  55
  56-include ../config.mak.autogen
  57-include ../config.mak
  58
  59ifdef ASCIIDOC8
  60ASCIIDOC_EXTRA += -a asciidoc7compatible
  61endif
  62ifdef DOCBOOK_XSL_172
  63ASCIIDOC_EXTRA += -a docbook-xsl-172
  64MANPAGE_XSL = manpage-1.72.xsl
  65endif
  66
  67#
  68# Please note that there is a minor bug in asciidoc.
  69# The version after 6.0.3 _will_ include the patch found here:
  70#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
  71#
  72# Until that version is released you may have to apply the patch
  73# yourself - yes, all 6 characters of it!
  74#
  75
  76all: html man
  77
  78html: $(DOC_HTML)
  79
  80$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
  81
  82man: man1 man5 man7
  83man1: $(DOC_MAN1)
  84man5: $(DOC_MAN5)
  85man7: $(DOC_MAN7)
  86
  87info: git.info gitman.info
  88
  89install: man
  90        $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
  91        $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
  92        $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
  93        $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
  94        $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
  95        $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
  96
  97install-info: info
  98        $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
  99        $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
 100        if test -r $(DESTDIR)$(infodir)/dir; then \
 101          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
 102          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
 103        else \
 104          echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
 105        fi
 106
 107install-html: html
 108        sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
 109
 110../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 111        $(MAKE) -C ../ GIT-VERSION-FILE
 112
 113-include ../GIT-VERSION-FILE
 114
 115#
 116# Determine "include::" file references in asciidoc files.
 117#
 118doc.dep : $(wildcard *.txt) build-docdep.perl
 119        $(RM) $@+ $@
 120        $(PERL_PATH) ./build-docdep.perl >$@+
 121        mv $@+ $@
 122
 123-include doc.dep
 124
 125cmds_txt = cmds-ancillaryinterrogators.txt \
 126        cmds-ancillarymanipulators.txt \
 127        cmds-mainporcelain.txt \
 128        cmds-plumbinginterrogators.txt \
 129        cmds-plumbingmanipulators.txt \
 130        cmds-synchingrepositories.txt \
 131        cmds-synchelpers.txt \
 132        cmds-purehelpers.txt \
 133        cmds-foreignscminterface.txt
 134
 135$(cmds_txt): cmd-list.made
 136
 137cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 138        $(RM) $@
 139        $(PERL_PATH) ./cmd-list.perl ../command-list.txt
 140        date >$@
 141
 142git.7 git.html: git.txt
 143
 144clean:
 145        $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
 146        $(RM) *.texi *.texi+ git.info gitman.info
 147        $(RM) howto-index.txt howto/*.html doc.dep
 148        $(RM) technical/api-*.html technical/api-index.txt
 149        $(RM) $(cmds_txt) *.made
 150
 151$(MAN_HTML): %.html : %.txt
 152        $(RM) $@+ $@
 153        $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
 154                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
 155        mv $@+ $@
 156
 157%.1 %.5 %.7 : %.xml
 158        $(RM) $@
 159        xmlto -m $(MANPAGE_XSL) man $<
 160
 161%.xml : %.txt
 162        $(RM) $@+ $@
 163        $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
 164                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
 165        mv $@+ $@
 166
 167user-manual.xml: user-manual.txt user-manual.conf
 168        $(ASCIIDOC) -b docbook -d book $<
 169
 170technical/api-index.txt: technical/api-index-skel.txt \
 171        technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
 172        cd technical && sh ./api-index.sh
 173
 174$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
 175        $(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
 176                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
 177
 178XSLT = docbook.xsl
 179XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
 180
 181user-manual.html: user-manual.xml
 182        xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
 183
 184git.info: user-manual.texi
 185        $(MAKEINFO) --no-split -o $@ user-manual.texi
 186
 187user-manual.texi: user-manual.xml
 188        $(RM) $@+ $@
 189        $(DOCBOOK2X_TEXI) user-manual.xml --to-stdout | $(PERL_PATH) fix-texi.perl >$@+
 190        mv $@+ $@
 191
 192gitman.texi: $(MAN_XML) cat-texi.perl
 193        $(RM) $@+ $@
 194        ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --to-stdout $(xml);)) | \
 195        $(PERL_PATH) cat-texi.perl $@ >$@+
 196        mv $@+ $@
 197
 198gitman.info: gitman.texi
 199        $(MAKEINFO) --no-split $*.texi
 200
 201$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
 202        $(RM) $@+ $@
 203        $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
 204        mv $@+ $@
 205
 206howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 207        $(RM) $@+ $@
 208        sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
 209        mv $@+ $@
 210
 211$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
 212        $(ASCIIDOC) -b xhtml11 $*.txt
 213
 214WEBDOC_DEST = /pub/software/scm/git/docs
 215
 216$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 217        $(RM) $@+ $@
 218        sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
 219        mv $@+ $@
 220
 221install-webdoc : html
 222        sh ./install-webdoc.sh $(WEBDOC_DEST)
 223
 224quick-install:
 225        sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
 226
 227.PHONY: .FORCE-GIT-VERSION-FILE