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