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