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