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