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