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