Documentation / Makefileon commit Merge branch 'maint' (0748494)
   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
  20ARTICLES += git-bisect-lk2009
  21# with their own formatting rules.
  22SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
  23API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
  24SP_ARTICLES += $(API_DOCS)
  25SP_ARTICLES += technical/api-index
  26
  27DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
  28
  29DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
  30DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
  31DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
  32
  33prefix?=$(HOME)
  34bindir?=$(prefix)/bin
  35htmldir?=$(prefix)/share/doc/git-doc
  36pdfdir?=$(prefix)/share/doc/git-doc
  37mandir?=$(prefix)/share/man
  38man1dir=$(mandir)/man1
  39man5dir=$(mandir)/man5
  40man7dir=$(mandir)/man7
  41# DESTDIR=
  42
  43ASCIIDOC=asciidoc
  44ASCIIDOC_EXTRA =
  45MANPAGE_XSL = manpage-normal.xsl
  46XMLTO_EXTRA =
  47INSTALL?=install
  48RM ?= rm -f
  49DOC_REF = origin/man
  50HTML_REF = origin/html
  51
  52infodir?=$(prefix)/share/info
  53MAKEINFO=makeinfo
  54INSTALL_INFO=install-info
  55DOCBOOK2X_TEXI=docbook2x-texi
  56DBLATEX=dblatex
  57ifndef PERL_PATH
  58        PERL_PATH = /usr/bin/perl
  59endif
  60
  61-include ../config.mak.autogen
  62-include ../config.mak
  63
  64#
  65# For asciidoc ...
  66#       -7.1.2, no extra settings are needed.
  67#       8.0-,   set ASCIIDOC8.
  68#
  69
  70#
  71# For docbook-xsl ...
  72#       -1.68.1,        set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
  73#       1.69.0,         no extra settings are needed?
  74#       1.69.1-1.71.0,  set DOCBOOK_SUPPRESS_SP?
  75#       1.71.1,         no extra settings are needed?
  76#       1.72.0,         set DOCBOOK_XSL_172.
  77#       1.73.0-,        set ASCIIDOC_NO_ROFF
  78#
  79
  80#
  81# If you had been using DOCBOOK_XSL_172 in an attempt to get rid
  82# of 'the ".ft C" problem' in your generated manpages, and you
  83# instead ended up with weird characters around callouts, try
  84# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
  85#
  86
  87ifdef ASCIIDOC8
  88ASCIIDOC_EXTRA += -a asciidoc7compatible -a no-inline-literal
  89endif
  90ifdef DOCBOOK_XSL_172
  91ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
  92MANPAGE_XSL = manpage-1.72.xsl
  93else
  94        ifdef ASCIIDOC_NO_ROFF
  95        # docbook-xsl after 1.72 needs the regular XSL, but will not
  96        # pass-thru raw roff codes from asciidoc.conf, so turn them off.
  97        ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
  98        endif
  99endif
 100ifdef MAN_BOLD_LITERAL
 101XMLTO_EXTRA += -m manpage-bold-literal.xsl
 102endif
 103ifdef DOCBOOK_SUPPRESS_SP
 104XMLTO_EXTRA += -m manpage-suppress-sp.xsl
 105endif
 106
 107# If your target system uses GNU groff, it may try to render
 108# apostrophes as a "pretty" apostrophe using unicode.  This breaks
 109# cut&paste, so you should set GNU_ROFF to force them to be ASCII
 110# apostrophes.  Unfortunately does not work with non-GNU roff.
 111ifdef GNU_ROFF
 112XMLTO_EXTRA += -m manpage-quote-apos.xsl
 113endif
 114
 115SHELL_PATH ?= $(SHELL)
 116# Shell quote;
 117SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 118
 119#
 120# Please note that there is a minor bug in asciidoc.
 121# The version after 6.0.3 _will_ include the patch found here:
 122#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
 123#
 124# Until that version is released you may have to apply the patch
 125# yourself - yes, all 6 characters of it!
 126#
 127
 128QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
 129QUIET_SUBDIR1  =
 130
 131ifneq ($(findstring $(MAKEFLAGS),w),w)
 132PRINT_DIR = --no-print-directory
 133else # "make -w"
 134NO_SUBDIR = :
 135endif
 136
 137ifneq ($(findstring $(MAKEFLAGS),s),s)
 138ifndef V
 139        QUIET_ASCIIDOC  = @echo '   ' ASCIIDOC $@;
 140        QUIET_XMLTO     = @echo '   ' XMLTO $@;
 141        QUIET_DB2TEXI   = @echo '   ' DB2TEXI $@;
 142        QUIET_MAKEINFO  = @echo '   ' MAKEINFO $@;
 143        QUIET_DBLATEX   = @echo '   ' DBLATEX $@;
 144        QUIET_XSLTPROC  = @echo '   ' XSLTPROC $@;
 145        QUIET_GEN       = @echo '   ' GEN $@;
 146        QUIET_STDERR    = 2> /dev/null
 147        QUIET_SUBDIR0   = +@subdir=
 148        QUIET_SUBDIR1   = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
 149                          $(MAKE) $(PRINT_DIR) -C $$subdir
 150        export V
 151endif
 152endif
 153
 154all: html man
 155
 156html: $(DOC_HTML)
 157
 158$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
 159
 160man: man1 man5 man7
 161man1: $(DOC_MAN1)
 162man5: $(DOC_MAN5)
 163man7: $(DOC_MAN7)
 164
 165info: git.info gitman.info
 166
 167pdf: user-manual.pdf
 168
 169install: install-man
 170
 171install-man: man
 172        $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
 173        $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
 174        $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
 175        $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
 176        $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
 177        $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
 178
 179install-info: info
 180        $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
 181        $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
 182        if test -r $(DESTDIR)$(infodir)/dir; then \
 183          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
 184          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
 185        else \
 186          echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
 187        fi
 188
 189install-pdf: pdf
 190        $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
 191        $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
 192
 193install-html: html
 194        '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
 195
 196../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 197        $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
 198
 199-include ../GIT-VERSION-FILE
 200
 201#
 202# Determine "include::" file references in asciidoc files.
 203#
 204doc.dep : $(wildcard *.txt) build-docdep.perl
 205        $(QUIET_GEN)$(RM) $@+ $@ && \
 206        $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
 207        mv $@+ $@
 208
 209-include doc.dep
 210
 211cmds_txt = cmds-ancillaryinterrogators.txt \
 212        cmds-ancillarymanipulators.txt \
 213        cmds-mainporcelain.txt \
 214        cmds-plumbinginterrogators.txt \
 215        cmds-plumbingmanipulators.txt \
 216        cmds-synchingrepositories.txt \
 217        cmds-synchelpers.txt \
 218        cmds-purehelpers.txt \
 219        cmds-foreignscminterface.txt
 220
 221$(cmds_txt): cmd-list.made
 222
 223cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 224        $(QUIET_GEN)$(RM) $@ && \
 225        $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
 226        date >$@
 227
 228clean:
 229        $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
 230        $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
 231        $(RM) howto-index.txt howto/*.html doc.dep
 232        $(RM) technical/api-*.html technical/api-index.txt
 233        $(RM) $(cmds_txt) *.made
 234
 235$(MAN_HTML): %.html : %.txt
 236        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 237        $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
 238                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
 239        mv $@+ $@
 240
 241%.1 %.5 %.7 : %.xml
 242        $(QUIET_XMLTO)$(RM) $@ && \
 243        xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
 244
 245%.xml : %.txt
 246        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 247        $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
 248                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
 249        mv $@+ $@
 250
 251user-manual.xml: user-manual.txt user-manual.conf
 252        $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book $<
 253
 254technical/api-index.txt: technical/api-index-skel.txt \
 255        technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
 256        $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
 257
 258$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
 259        $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
 260                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
 261
 262XSLT = docbook.xsl
 263XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
 264
 265user-manual.html: user-manual.xml
 266        $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
 267
 268git.info: user-manual.texi
 269        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
 270
 271user-manual.texi: user-manual.xml
 272        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 273        $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
 274        $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
 275        rm $@++ && \
 276        mv $@+ $@
 277
 278user-manual.pdf: user-manual.xml
 279        $(QUIET_DBLATEX)$(RM) $@+ $@ && \
 280        $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
 281        mv $@+ $@
 282
 283gitman.texi: $(MAN_XML) cat-texi.perl
 284        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 285        ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
 286                --to-stdout $(xml) &&) true) > $@++ && \
 287        $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
 288        rm $@++ && \
 289        mv $@+ $@
 290
 291gitman.info: gitman.texi
 292        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
 293
 294$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
 295        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 296        $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
 297        mv $@+ $@
 298
 299howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 300        $(QUIET_GEN)$(RM) $@+ $@ && \
 301        '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
 302        mv $@+ $@
 303
 304$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
 305        $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt
 306
 307WEBDOC_DEST = /pub/software/scm/git/docs
 308
 309$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 310        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 311        sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
 312        mv $@+ $@
 313
 314install-webdoc : html
 315        '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
 316
 317quick-install: quick-install-man
 318
 319quick-install-man:
 320        '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
 321
 322quick-install-html:
 323        '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
 324
 325.PHONY: .FORCE-GIT-VERSION-FILE