Documentation / Makefileon commit Documentation: rename docbook-xsl-172 attribute to git-asciidoc-no-roff (8fa2b45)
   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 gitworkflows.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
  35pdfdir?=$(prefix)/share/doc/git-doc
  36mandir?=$(prefix)/share/man
  37man1dir=$(mandir)/man1
  38man5dir=$(mandir)/man5
  39man7dir=$(mandir)/man7
  40# DESTDIR=
  41
  42ASCIIDOC=asciidoc
  43ASCIIDOC_EXTRA =
  44MANPAGE_XSL = manpage-normal.xsl
  45INSTALL?=install
  46RM ?= rm -f
  47DOC_REF = origin/man
  48HTML_REF = origin/html
  49
  50infodir?=$(prefix)/share/info
  51MAKEINFO=makeinfo
  52INSTALL_INFO=install-info
  53DOCBOOK2X_TEXI=docbook2x-texi
  54DBLATEX=dblatex
  55ifndef PERL_PATH
  56        PERL_PATH = /usr/bin/perl
  57endif
  58
  59-include ../config.mak.autogen
  60-include ../config.mak
  61
  62#
  63# For asciidoc ...
  64#       -7.1.2, no extra settings are needed.
  65#       8.0-,   set ASCIIDOC8.
  66#
  67
  68#
  69# For docbook-xsl ...
  70#       -1.68.1,        set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
  71#       1.69.0-1.71.1,  no extra settings are needed?
  72#       1.72.0,         set DOCBOOK_XSL_172.
  73#       1.73.0-,        set ASCIIDOC_NO_ROFF
  74#
  75
  76#
  77# If you had been using DOCBOOK_XSL_172 in an attempt to get rid
  78# of 'the ".ft C" problem' in your generated manpages, and you
  79# instead ended up with weird characters around callouts, try
  80# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
  81#
  82
  83ifdef ASCIIDOC8
  84ASCIIDOC_EXTRA += -a asciidoc7compatible
  85endif
  86ifdef DOCBOOK_XSL_172
  87ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
  88MANPAGE_XSL = manpage-1.72.xsl
  89else
  90        ifdef ASCIIDOC_NO_ROFF
  91        # docbook-xsl after 1.72 needs the regular XSL, but will not
  92        # pass-thru raw roff codes from asciidoc.conf, so turn them off.
  93        ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
  94        endif
  95endif
  96
  97#
  98# Please note that there is a minor bug in asciidoc.
  99# The version after 6.0.3 _will_ include the patch found here:
 100#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
 101#
 102# Until that version is released you may have to apply the patch
 103# yourself - yes, all 6 characters of it!
 104#
 105
 106all: html man
 107
 108html: $(DOC_HTML)
 109
 110$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
 111
 112man: man1 man5 man7
 113man1: $(DOC_MAN1)
 114man5: $(DOC_MAN5)
 115man7: $(DOC_MAN7)
 116
 117info: git.info gitman.info
 118
 119pdf: user-manual.pdf
 120
 121install: install-man
 122
 123install-man: man
 124        $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
 125        $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
 126        $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
 127        $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
 128        $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
 129        $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
 130
 131install-info: info
 132        $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
 133        $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
 134        if test -r $(DESTDIR)$(infodir)/dir; then \
 135          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
 136          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
 137        else \
 138          echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
 139        fi
 140
 141install-pdf: pdf
 142        $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
 143        $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
 144
 145install-html: html
 146        sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
 147
 148../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 149        $(MAKE) -C ../ GIT-VERSION-FILE
 150
 151-include ../GIT-VERSION-FILE
 152
 153#
 154# Determine "include::" file references in asciidoc files.
 155#
 156doc.dep : $(wildcard *.txt) build-docdep.perl
 157        $(RM) $@+ $@
 158        $(PERL_PATH) ./build-docdep.perl >$@+
 159        mv $@+ $@
 160
 161-include doc.dep
 162
 163cmds_txt = cmds-ancillaryinterrogators.txt \
 164        cmds-ancillarymanipulators.txt \
 165        cmds-mainporcelain.txt \
 166        cmds-plumbinginterrogators.txt \
 167        cmds-plumbingmanipulators.txt \
 168        cmds-synchingrepositories.txt \
 169        cmds-synchelpers.txt \
 170        cmds-purehelpers.txt \
 171        cmds-foreignscminterface.txt
 172
 173$(cmds_txt): cmd-list.made
 174
 175cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 176        $(RM) $@
 177        $(PERL_PATH) ./cmd-list.perl ../command-list.txt
 178        date >$@
 179
 180clean:
 181        $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
 182        $(RM) *.texi *.texi+ git.info gitman.info
 183        $(RM) howto-index.txt howto/*.html doc.dep
 184        $(RM) technical/api-*.html technical/api-index.txt
 185        $(RM) $(cmds_txt) *.made
 186
 187$(MAN_HTML): %.html : %.txt
 188        $(RM) $@+ $@
 189        $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
 190                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
 191        mv $@+ $@
 192
 193%.1 %.5 %.7 : %.xml
 194        $(RM) $@
 195        xmlto -m $(MANPAGE_XSL) man $<
 196
 197%.xml : %.txt
 198        $(RM) $@+ $@
 199        $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
 200                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
 201        mv $@+ $@
 202
 203user-manual.xml: user-manual.txt user-manual.conf
 204        $(ASCIIDOC) -b docbook -d book $<
 205
 206technical/api-index.txt: technical/api-index-skel.txt \
 207        technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
 208        cd technical && sh ./api-index.sh
 209
 210$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
 211        $(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
 212                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
 213
 214XSLT = docbook.xsl
 215XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
 216
 217user-manual.html: user-manual.xml
 218        xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
 219
 220git.info: user-manual.texi
 221        $(MAKEINFO) --no-split -o $@ user-manual.texi
 222
 223user-manual.texi: user-manual.xml
 224        $(RM) $@+ $@
 225        $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout | \
 226                $(PERL_PATH) fix-texi.perl >$@+
 227        mv $@+ $@
 228
 229user-manual.pdf: user-manual.xml
 230        $(RM) $@+ $@
 231        $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $<
 232        mv $@+ $@
 233
 234gitman.texi: $(MAN_XML) cat-texi.perl
 235        $(RM) $@+ $@
 236        ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
 237                --to-stdout $(xml);)) | $(PERL_PATH) cat-texi.perl $@ >$@+
 238        mv $@+ $@
 239
 240gitman.info: gitman.texi
 241        $(MAKEINFO) --no-split --no-validate $*.texi
 242
 243$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
 244        $(RM) $@+ $@
 245        $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
 246        mv $@+ $@
 247
 248howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 249        $(RM) $@+ $@
 250        sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
 251        mv $@+ $@
 252
 253$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
 254        $(ASCIIDOC) -b xhtml11 $*.txt
 255
 256WEBDOC_DEST = /pub/software/scm/git/docs
 257
 258$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 259        $(RM) $@+ $@
 260        sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
 261        mv $@+ $@
 262
 263install-webdoc : html
 264        sh ./install-webdoc.sh $(WEBDOC_DEST)
 265
 266quick-install: quick-install-man
 267
 268quick-install-man:
 269        sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
 270
 271quick-install-html:
 272        sh ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
 273
 274.PHONY: .FORCE-GIT-VERSION-FILE