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