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