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