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