Documentation / Makefileon commit docs: drop asciidoc7compatible flag (bf17126)
   1MAN1_TXT= \
   2        $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
   3                $(wildcard git-*.txt)) \
   4        gitk.txt gitweb.txt git.txt
   5MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \
   6        gitrepository-layout.txt gitweb.conf.txt
   7MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \
   8        gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \
   9        gitdiffcore.txt gitnamespaces.txt gitrevisions.txt gitworkflows.txt
  10MAN7_TXT += gitcredentials.txt
  11
  12MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
  13MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
  14MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
  15
  16DOC_HTML=$(MAN_HTML)
  17
  18ARTICLES = howto-index
  19ARTICLES += everyday
  20ARTICLES += git-tools
  21ARTICLES += git-bisect-lk2009
  22# with their own formatting rules.
  23SP_ARTICLES = user-manual
  24SP_ARTICLES += howto/revert-branch-rebase
  25SP_ARTICLES += howto/using-merge-subtree
  26SP_ARTICLES += howto/using-signed-tag-in-pull-request
  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
  40pdfdir?=$(prefix)/share/doc/git-doc
  41mandir?=$(prefix)/share/man
  42man1dir=$(mandir)/man1
  43man5dir=$(mandir)/man5
  44man7dir=$(mandir)/man7
  45# DESTDIR=
  46
  47ASCIIDOC=asciidoc
  48ASCIIDOC_EXTRA =
  49MANPAGE_XSL = manpage-normal.xsl
  50XMLTO_EXTRA =
  51INSTALL?=install
  52RM ?= rm -f
  53MAN_REPO = ../../git-manpages
  54HTML_REPO = ../../git-htmldocs
  55
  56infodir?=$(prefix)/share/info
  57MAKEINFO=makeinfo
  58INSTALL_INFO=install-info
  59DOCBOOK2X_TEXI=docbook2x-texi
  60DBLATEX=dblatex
  61ifndef PERL_PATH
  62        PERL_PATH = /usr/bin/perl
  63endif
  64
  65-include ../config.mak.autogen
  66-include ../config.mak
  67
  68#
  69# For docbook-xsl ...
  70#       -1.68.1,        no extra settings are needed?
  71#       1.69.0,         set ASCIIDOC_ROFF?
  72#       1.69.1-1.71.0,  set DOCBOOK_SUPPRESS_SP?
  73#       1.71.1,         set ASCIIDOC_ROFF?
  74#       1.72.0,         set DOCBOOK_XSL_172.
  75#       1.73.0-,        no extra settings are needed
  76#
  77
  78ifdef DOCBOOK_XSL_172
  79ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
  80MANPAGE_XSL = manpage-1.72.xsl
  81else
  82        ifndef ASCIIDOC_ROFF
  83        # docbook-xsl after 1.72 needs the regular XSL, but will not
  84        # pass-thru raw roff codes from asciidoc.conf, so turn them off.
  85        ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
  86        endif
  87endif
  88ifdef MAN_BOLD_LITERAL
  89XMLTO_EXTRA += -m manpage-bold-literal.xsl
  90endif
  91ifdef DOCBOOK_SUPPRESS_SP
  92XMLTO_EXTRA += -m manpage-suppress-sp.xsl
  93endif
  94
  95# Newer DocBook stylesheet emits warning cruft in the output when
  96# this is not set, and if set it shows an absolute link.  Older
  97# stylesheets simply ignore this parameter.
  98#
  99# Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
 100# or similar.
 101ifndef MAN_BASE_URL
 102MAN_BASE_URL = file://$(htmldir)/
 103endif
 104XMLTO_EXTRA += -m manpage-base-url.xsl
 105
 106# If your target system uses GNU groff, it may try to render
 107# apostrophes as a "pretty" apostrophe using unicode.  This breaks
 108# cut&paste, so you should set GNU_ROFF to force them to be ASCII
 109# apostrophes.  Unfortunately does not work with non-GNU roff.
 110ifdef GNU_ROFF
 111XMLTO_EXTRA += -m manpage-quote-apos.xsl
 112endif
 113
 114SHELL_PATH ?= $(SHELL)
 115# Shell quote;
 116SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 117
 118ifdef DEFAULT_PAGER
 119DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
 120ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
 121endif
 122
 123ifdef DEFAULT_EDITOR
 124DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
 125ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
 126endif
 127
 128#
 129# Please note that there is a minor bug in asciidoc.
 130# The version after 6.0.3 _will_ include the patch found here:
 131#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
 132#
 133# Until that version is released you may have to apply the patch
 134# yourself - yes, all 6 characters of it!
 135#
 136
 137QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
 138QUIET_SUBDIR1  =
 139
 140ifneq ($(findstring $(MAKEFLAGS),w),w)
 141PRINT_DIR = --no-print-directory
 142else # "make -w"
 143NO_SUBDIR = :
 144endif
 145
 146ifneq ($(findstring $(MAKEFLAGS),s),s)
 147ifndef V
 148        QUIET_ASCIIDOC  = @echo '   ' ASCIIDOC $@;
 149        QUIET_XMLTO     = @echo '   ' XMLTO $@;
 150        QUIET_DB2TEXI   = @echo '   ' DB2TEXI $@;
 151        QUIET_MAKEINFO  = @echo '   ' MAKEINFO $@;
 152        QUIET_DBLATEX   = @echo '   ' DBLATEX $@;
 153        QUIET_XSLTPROC  = @echo '   ' XSLTPROC $@;
 154        QUIET_GEN       = @echo '   ' GEN $@;
 155        QUIET_STDERR    = 2> /dev/null
 156        QUIET_SUBDIR0   = +@subdir=
 157        QUIET_SUBDIR1   = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
 158                          $(MAKE) $(PRINT_DIR) -C $$subdir
 159        export V
 160endif
 161endif
 162
 163all: html man
 164
 165html: $(DOC_HTML)
 166
 167$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
 168
 169man: man1 man5 man7
 170man1: $(DOC_MAN1)
 171man5: $(DOC_MAN5)
 172man7: $(DOC_MAN7)
 173
 174info: git.info gitman.info
 175
 176pdf: user-manual.pdf
 177
 178install: install-man
 179
 180install-man: man
 181        $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
 182        $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
 183        $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
 184        $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
 185        $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
 186        $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
 187
 188install-info: info
 189        $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
 190        $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
 191        if test -r $(DESTDIR)$(infodir)/dir; then \
 192          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
 193          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
 194        else \
 195          echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
 196        fi
 197
 198install-pdf: pdf
 199        $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
 200        $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
 201
 202install-html: html
 203        '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
 204
 205../GIT-VERSION-FILE: FORCE
 206        $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
 207
 208-include ../GIT-VERSION-FILE
 209
 210#
 211# Determine "include::" file references in asciidoc files.
 212#
 213doc.dep : $(wildcard *.txt) build-docdep.perl
 214        $(QUIET_GEN)$(RM) $@+ $@ && \
 215        $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
 216        mv $@+ $@
 217
 218-include doc.dep
 219
 220cmds_txt = cmds-ancillaryinterrogators.txt \
 221        cmds-ancillarymanipulators.txt \
 222        cmds-mainporcelain.txt \
 223        cmds-plumbinginterrogators.txt \
 224        cmds-plumbingmanipulators.txt \
 225        cmds-synchingrepositories.txt \
 226        cmds-synchelpers.txt \
 227        cmds-purehelpers.txt \
 228        cmds-foreignscminterface.txt
 229
 230$(cmds_txt): cmd-list.made
 231
 232cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 233        $(QUIET_GEN)$(RM) $@ && \
 234        $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
 235        date >$@
 236
 237clean:
 238        $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
 239        $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
 240        $(RM) *.pdf
 241        $(RM) howto-index.txt howto/*.html doc.dep
 242        $(RM) technical/api-*.html technical/api-index.txt
 243        $(RM) $(cmds_txt) *.made
 244        $(RM) manpage-base-url.xsl
 245
 246$(MAN_HTML): %.html : %.txt
 247        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 248        $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
 249                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
 250        mv $@+ $@
 251
 252manpage-base-url.xsl: manpage-base-url.xsl.in
 253        sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
 254
 255%.1 %.5 %.7 : %.xml manpage-base-url.xsl
 256        $(QUIET_XMLTO)$(RM) $@ && \
 257        xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
 258
 259%.xml : %.txt
 260        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 261        $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
 262                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
 263        mv $@+ $@
 264
 265user-manual.xml: user-manual.txt user-manual.conf
 266        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 267        $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d book -o $@+ $< && \
 268        mv $@+ $@
 269
 270technical/api-index.txt: technical/api-index-skel.txt \
 271        technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
 272        $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
 273
 274$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
 275        $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
 276                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
 277
 278XSLT = docbook.xsl
 279XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
 280
 281user-manual.html: user-manual.xml $(XSLT)
 282        $(QUIET_XSLTPROC)$(RM) $@+ $@ && \
 283        xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
 284        mv $@+ $@
 285
 286git.info: user-manual.texi
 287        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
 288
 289user-manual.texi: user-manual.xml
 290        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 291        $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
 292        $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
 293        rm $@++ && \
 294        mv $@+ $@
 295
 296user-manual.pdf: user-manual.xml
 297        $(QUIET_DBLATEX)$(RM) $@+ $@ && \
 298        $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
 299        mv $@+ $@
 300
 301gitman.texi: $(MAN_XML) cat-texi.perl
 302        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 303        ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
 304                --to-stdout $(xml) &&) true) > $@++ && \
 305        $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
 306        rm $@++ && \
 307        mv $@+ $@
 308
 309gitman.info: gitman.texi
 310        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
 311
 312$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
 313        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 314        $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
 315        mv $@+ $@
 316
 317howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 318        $(QUIET_GEN)$(RM) $@+ $@ && \
 319        '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
 320        mv $@+ $@
 321
 322$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
 323        $(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt
 324
 325WEBDOC_DEST = /pub/software/scm/git/docs
 326
 327$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 328        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 329        sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
 330        mv $@+ $@
 331
 332install-webdoc : html
 333        '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
 334
 335# You must have a clone of git-htmldocs and git-manpages repositories
 336# next to the git repository itself for the following to work.
 337
 338quick-install: quick-install-man
 339
 340require-manrepo::
 341        @if test ! -d $(MAN_REPO); \
 342        then echo "git-manpages repository must exist at $(MAN_REPO)"; exit 1; fi
 343
 344quick-install-man: require-manrepo
 345        '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(mandir)
 346
 347require-htmlrepo::
 348        @if test ! -d $(HTML_REPO); \
 349        then echo "git-htmldocs repository must exist at $(HTML_REPO)"; exit 1; fi
 350
 351quick-install-html: require-htmlrepo
 352        '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)
 353
 354.PHONY: FORCE