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