Documentation / Makefileon commit builtin/grep: convert to struct object_id (1db1108)
   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/signature-format
  80TECH_DOCS += technical/trivial-merge
  81SP_ARTICLES += $(TECH_DOCS)
  82SP_ARTICLES += technical/api-index
  83
  84DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
  85
  86DOC_MAN1 = $(patsubst %.txt,%.1,$(MAN1_TXT))
  87DOC_MAN5 = $(patsubst %.txt,%.5,$(MAN5_TXT))
  88DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
  89
  90prefix ?= $(HOME)
  91bindir ?= $(prefix)/bin
  92htmldir ?= $(prefix)/share/doc/git-doc
  93infodir ?= $(prefix)/share/info
  94pdfdir ?= $(prefix)/share/doc/git-doc
  95mandir ?= $(prefix)/share/man
  96man1dir = $(mandir)/man1
  97man5dir = $(mandir)/man5
  98man7dir = $(mandir)/man7
  99# DESTDIR =
 100
 101ASCIIDOC = asciidoc
 102ASCIIDOC_EXTRA =
 103ASCIIDOC_HTML = xhtml11
 104ASCIIDOC_DOCBOOK = docbook
 105ASCIIDOC_CONF = -f asciidoc.conf
 106ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
 107                -agit_version=$(GIT_VERSION)
 108TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
 109TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
 110MANPAGE_XSL = manpage-normal.xsl
 111XMLTO = xmlto
 112XMLTO_EXTRA =
 113INSTALL ?= install
 114RM ?= rm -f
 115MAN_REPO = ../../git-manpages
 116HTML_REPO = ../../git-htmldocs
 117
 118MAKEINFO = makeinfo
 119INSTALL_INFO = install-info
 120DOCBOOK2X_TEXI = docbook2x-texi
 121DBLATEX = dblatex
 122ASCIIDOC_DBLATEX_DIR = /etc/asciidoc/dblatex
 123DBLATEX_COMMON = -p $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.xsl -s $(ASCIIDOC_DBLATEX_DIR)/asciidoc-dblatex.sty
 124ifndef PERL_PATH
 125        PERL_PATH = /usr/bin/perl
 126endif
 127
 128-include ../config.mak.autogen
 129-include ../config.mak
 130
 131#
 132# For docbook-xsl ...
 133#       -1.68.1,        no extra settings are needed?
 134#       1.69.0,         set ASCIIDOC_ROFF?
 135#       1.69.1-1.71.0,  set DOCBOOK_SUPPRESS_SP?
 136#       1.71.1,         set ASCIIDOC_ROFF?
 137#       1.72.0,         set DOCBOOK_XSL_172.
 138#       1.73.0-,        no extra settings are needed
 139#
 140
 141ifdef DOCBOOK_XSL_172
 142ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
 143MANPAGE_XSL = manpage-1.72.xsl
 144else
 145        ifndef ASCIIDOC_ROFF
 146        # docbook-xsl after 1.72 needs the regular XSL, but will not
 147        # pass-thru raw roff codes from asciidoc.conf, so turn them off.
 148        ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
 149        endif
 150endif
 151ifndef NO_MAN_BOLD_LITERAL
 152XMLTO_EXTRA += -m manpage-bold-literal.xsl
 153endif
 154ifdef DOCBOOK_SUPPRESS_SP
 155XMLTO_EXTRA += -m manpage-suppress-sp.xsl
 156endif
 157
 158# Newer DocBook stylesheet emits warning cruft in the output when
 159# this is not set, and if set it shows an absolute link.  Older
 160# stylesheets simply ignore this parameter.
 161#
 162# Distros may want to use MAN_BASE_URL=file:///path/to/git/docs/
 163# or similar.
 164ifndef MAN_BASE_URL
 165MAN_BASE_URL = file://$(htmldir)/
 166endif
 167XMLTO_EXTRA += -m manpage-base-url.xsl
 168
 169# If your target system uses GNU groff, it may try to render
 170# apostrophes as a "pretty" apostrophe using unicode.  This breaks
 171# cut&paste, so you should set GNU_ROFF to force them to be ASCII
 172# apostrophes.  Unfortunately does not work with non-GNU roff.
 173ifdef GNU_ROFF
 174XMLTO_EXTRA += -m manpage-quote-apos.xsl
 175endif
 176
 177ifdef USE_ASCIIDOCTOR
 178ASCIIDOC = asciidoctor
 179ASCIIDOC_CONF =
 180ASCIIDOC_HTML = xhtml5
 181ASCIIDOC_DOCBOOK = docbook45
 182ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
 183ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
 184DBLATEX_COMMON =
 185endif
 186
 187SHELL_PATH ?= $(SHELL)
 188# Shell quote;
 189SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 190
 191ifdef DEFAULT_PAGER
 192DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
 193ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
 194endif
 195
 196ifdef DEFAULT_EDITOR
 197DEFAULT_EDITOR_SQ = $(subst ','\'',$(DEFAULT_EDITOR))
 198ASCIIDOC_EXTRA += -a 'git-default-editor=$(DEFAULT_EDITOR_SQ)'
 199endif
 200
 201QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
 202QUIET_SUBDIR1  =
 203
 204ifneq ($(findstring $(MAKEFLAGS),w),w)
 205PRINT_DIR = --no-print-directory
 206else # "make -w"
 207NO_SUBDIR = :
 208endif
 209
 210ifneq ($(findstring $(MAKEFLAGS),s),s)
 211ifndef V
 212        QUIET_ASCIIDOC  = @echo '   ' ASCIIDOC $@;
 213        QUIET_XMLTO     = @echo '   ' XMLTO $@;
 214        QUIET_DB2TEXI   = @echo '   ' DB2TEXI $@;
 215        QUIET_MAKEINFO  = @echo '   ' MAKEINFO $@;
 216        QUIET_DBLATEX   = @echo '   ' DBLATEX $@;
 217        QUIET_XSLTPROC  = @echo '   ' XSLTPROC $@;
 218        QUIET_GEN       = @echo '   ' GEN $@;
 219        QUIET_LINT      = @echo '   ' LINT $@;
 220        QUIET_STDERR    = 2> /dev/null
 221        QUIET_SUBDIR0   = +@subdir=
 222        QUIET_SUBDIR1   = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
 223                          $(MAKE) $(PRINT_DIR) -C $$subdir
 224        export V
 225endif
 226endif
 227
 228all: html man
 229
 230html: $(DOC_HTML)
 231
 232man: man1 man5 man7
 233man1: $(DOC_MAN1)
 234man5: $(DOC_MAN5)
 235man7: $(DOC_MAN7)
 236
 237info: git.info gitman.info
 238
 239pdf: user-manual.pdf
 240
 241install: install-man
 242
 243install-man: man
 244        $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
 245        $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
 246        $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
 247        $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
 248        $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
 249        $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
 250
 251install-info: info
 252        $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
 253        $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
 254        if test -r $(DESTDIR)$(infodir)/dir; then \
 255          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
 256          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
 257        else \
 258          echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
 259        fi
 260
 261install-pdf: pdf
 262        $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
 263        $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
 264
 265install-html: html
 266        '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
 267
 268../GIT-VERSION-FILE: FORCE
 269        $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
 270
 271-include ../GIT-VERSION-FILE
 272
 273#
 274# Determine "include::" file references in asciidoc files.
 275#
 276docdep_prereqs = \
 277        mergetools-list.made $(mergetools_txt) \
 278        cmd-list.made $(cmds_txt)
 279
 280doc.dep : $(docdep_prereqs) $(wildcard *.txt) build-docdep.perl
 281        $(QUIET_GEN)$(RM) $@+ $@ && \
 282        $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
 283        mv $@+ $@
 284
 285-include doc.dep
 286
 287cmds_txt = cmds-ancillaryinterrogators.txt \
 288        cmds-ancillarymanipulators.txt \
 289        cmds-mainporcelain.txt \
 290        cmds-plumbinginterrogators.txt \
 291        cmds-plumbingmanipulators.txt \
 292        cmds-synchingrepositories.txt \
 293        cmds-synchelpers.txt \
 294        cmds-purehelpers.txt \
 295        cmds-foreignscminterface.txt
 296
 297$(cmds_txt): cmd-list.made
 298
 299cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 300        $(QUIET_GEN)$(RM) $@ && \
 301        $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
 302        date >$@
 303
 304mergetools_txt = mergetools-diff.txt mergetools-merge.txt
 305
 306$(mergetools_txt): mergetools-list.made
 307
 308mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
 309        $(QUIET_GEN)$(RM) $@ && \
 310        $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
 311                . ../git-mergetool--lib.sh && \
 312                show_tool_names can_diff "* " || :' >mergetools-diff.txt && \
 313        $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && \
 314                . ../git-mergetool--lib.sh && \
 315                show_tool_names can_merge "* " || :' >mergetools-merge.txt && \
 316        date >$@
 317
 318clean:
 319        $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
 320        $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
 321        $(RM) *.pdf
 322        $(RM) howto-index.txt howto/*.html doc.dep
 323        $(RM) technical/*.html technical/api-index.txt
 324        $(RM) $(cmds_txt) $(mergetools_txt) *.made
 325        $(RM) manpage-base-url.xsl
 326
 327$(MAN_HTML): %.html : %.txt asciidoc.conf
 328        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 329        $(TXT_TO_HTML) -d manpage -o $@+ $< && \
 330        mv $@+ $@
 331
 332$(OBSOLETE_HTML): %.html : %.txto asciidoc.conf
 333        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 334        $(TXT_TO_HTML) -o $@+ $< && \
 335        mv $@+ $@
 336
 337manpage-base-url.xsl: manpage-base-url.xsl.in
 338        sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
 339
 340%.1 %.5 %.7 : %.xml manpage-base-url.xsl
 341        $(QUIET_XMLTO)$(RM) $@ && \
 342        $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
 343
 344%.xml : %.txt asciidoc.conf
 345        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 346        $(TXT_TO_XML) -d manpage -o $@+ $< && \
 347        mv $@+ $@
 348
 349user-manual.xml: user-manual.txt user-manual.conf
 350        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 351        $(TXT_TO_XML) -d book -o $@+ $< && \
 352        mv $@+ $@
 353
 354technical/api-index.txt: technical/api-index-skel.txt \
 355        technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
 356        $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh
 357
 358technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
 359$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt asciidoc.conf
 360        $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
 361
 362XSLT = docbook.xsl
 363XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
 364
 365user-manual.html: user-manual.xml $(XSLT)
 366        $(QUIET_XSLTPROC)$(RM) $@+ $@ && \
 367        xsltproc $(XSLTOPTS) -o $@+ $(XSLT) $< && \
 368        mv $@+ $@
 369
 370git.info: user-manual.texi
 371        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
 372
 373user-manual.texi: user-manual.xml
 374        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 375        $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
 376        $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
 377        rm $@++ && \
 378        mv $@+ $@
 379
 380user-manual.pdf: user-manual.xml
 381        $(QUIET_DBLATEX)$(RM) $@+ $@ && \
 382        $(DBLATEX) -o $@+ $(DBLATEX_COMMON) $< && \
 383        mv $@+ $@
 384
 385gitman.texi: $(MAN_XML) cat-texi.perl texi.xsl
 386        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 387        ($(foreach xml,$(sort $(MAN_XML)),xsltproc -o $(xml)+ texi.xsl $(xml) && \
 388                $(DOCBOOK2X_TEXI) --encoding=UTF-8 --to-stdout $(xml)+ && \
 389                rm $(xml)+ &&) true) > $@++ && \
 390        $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
 391        rm $@++ && \
 392        mv $@+ $@
 393
 394gitman.info: gitman.texi
 395        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
 396
 397$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
 398        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 399        $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
 400        mv $@+ $@
 401
 402howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 403        $(QUIET_GEN)$(RM) $@+ $@ && \
 404        '$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@+ && \
 405        mv $@+ $@
 406
 407$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
 408        $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
 409
 410WEBDOC_DEST = /pub/software/scm/git/docs
 411
 412howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
 413$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 414        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 415        sed -e '1,/^$$/d' $< | \
 416        $(TXT_TO_HTML) - >$@+ && \
 417        mv $@+ $@
 418
 419install-webdoc : html
 420        '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
 421
 422# You must have a clone of 'git-htmldocs' and 'git-manpages' repositories
 423# next to the 'git' repository itself for the following to work.
 424
 425quick-install: quick-install-man
 426
 427require-manrepo::
 428        @if test ! -d $(MAN_REPO); \
 429        then echo "git-manpages repository must exist at $(MAN_REPO)"; exit 1; fi
 430
 431quick-install-man: require-manrepo
 432        '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(MAN_REPO) $(DESTDIR)$(mandir)
 433
 434require-htmlrepo::
 435        @if test ! -d $(HTML_REPO); \
 436        then echo "git-htmldocs repository must exist at $(HTML_REPO)"; exit 1; fi
 437
 438quick-install-html: require-htmlrepo
 439        '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REPO) $(DESTDIR)$(htmldir)
 440
 441print-man1:
 442        @for i in $(MAN1_TXT); do echo $$i; done
 443
 444lint-docs::
 445        $(QUIET_LINT)$(PERL_PATH) lint-gitlink.perl
 446
 447.PHONY: FORCE