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