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