Documentation / Makefileon commit Merge branch 'lt/reflog-expire' (9e36d11)
   1MAN1_TXT= \
   2        $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
   3                $(wildcard git-*.txt)) \
   4        gitk.txt git.txt
   5MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \
   6        gitrepository-layout.txt
   7MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \
   8        gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \
   9        gitdiffcore.txt gitworkflows.txt
  10
  11MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
  12MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
  13MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
  14
  15DOC_HTML=$(MAN_HTML)
  16
  17ARTICLES = howto-index
  18ARTICLES += everyday
  19ARTICLES += git-tools
  20# with their own formatting rules.
  21SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual
  22API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
  23SP_ARTICLES += $(API_DOCS)
  24SP_ARTICLES += technical/api-index
  25
  26DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
  27
  28DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
  29DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
  30DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
  31
  32prefix?=$(HOME)
  33bindir?=$(prefix)/bin
  34htmldir?=$(prefix)/share/doc/git-doc
  35pdfdir?=$(prefix)/share/doc/git-doc
  36mandir?=$(prefix)/share/man
  37man1dir=$(mandir)/man1
  38man5dir=$(mandir)/man5
  39man7dir=$(mandir)/man7
  40# DESTDIR=
  41
  42ASCIIDOC=asciidoc
  43ASCIIDOC_EXTRA =
  44MANPAGE_XSL = manpage-normal.xsl
  45XMLTO_EXTRA =
  46INSTALL?=install
  47RM ?= rm -f
  48DOC_REF = origin/man
  49HTML_REF = origin/html
  50
  51infodir?=$(prefix)/share/info
  52MAKEINFO=makeinfo
  53INSTALL_INFO=install-info
  54DOCBOOK2X_TEXI=docbook2x-texi
  55DBLATEX=dblatex
  56ifndef PERL_PATH
  57        PERL_PATH = /usr/bin/perl
  58endif
  59
  60-include ../config.mak.autogen
  61-include ../config.mak
  62
  63#
  64# For asciidoc ...
  65#       -7.1.2, no extra settings are needed.
  66#       8.0-,   set ASCIIDOC8.
  67#
  68
  69#
  70# For docbook-xsl ...
  71#       -1.68.1,        set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
  72#       1.69.0,         no extra settings are needed?
  73#       1.69.1-1.71.0,  set DOCBOOK_SUPPRESS_SP?
  74#       1.71.1,         no extra settings are needed?
  75#       1.72.0,         set DOCBOOK_XSL_172.
  76#       1.73.0-,        set ASCIIDOC_NO_ROFF
  77#
  78
  79#
  80# If you had been using DOCBOOK_XSL_172 in an attempt to get rid
  81# of 'the ".ft C" problem' in your generated manpages, and you
  82# instead ended up with weird characters around callouts, try
  83# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
  84#
  85
  86ifdef ASCIIDOC8
  87ASCIIDOC_EXTRA += -a asciidoc7compatible
  88endif
  89ifdef DOCBOOK_XSL_172
  90ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
  91MANPAGE_XSL = manpage-1.72.xsl
  92else
  93        ifdef ASCIIDOC_NO_ROFF
  94        # docbook-xsl after 1.72 needs the regular XSL, but will not
  95        # pass-thru raw roff codes from asciidoc.conf, so turn them off.
  96        ASCIIDOC_EXTRA += -a git-asciidoc-no-roff
  97        endif
  98endif
  99ifdef MAN_BOLD_LITERAL
 100XMLTO_EXTRA += -m manpage-bold-literal.xsl
 101endif
 102ifdef DOCBOOK_SUPPRESS_SP
 103XMLTO_EXTRA += -m manpage-suppress-sp.xsl
 104endif
 105
 106#
 107# Please note that there is a minor bug in asciidoc.
 108# The version after 6.0.3 _will_ include the patch found here:
 109#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
 110#
 111# Until that version is released you may have to apply the patch
 112# yourself - yes, all 6 characters of it!
 113#
 114
 115QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
 116QUIET_SUBDIR1  =
 117
 118ifneq ($(findstring $(MAKEFLAGS),w),w)
 119PRINT_DIR = --no-print-directory
 120else # "make -w"
 121NO_SUBDIR = :
 122endif
 123
 124ifneq ($(findstring $(MAKEFLAGS),s),s)
 125ifndef V
 126        QUIET_ASCIIDOC  = @echo '   ' ASCIIDOC $@;
 127        QUIET_XMLTO     = @echo '   ' XMLTO $@;
 128        QUIET_DB2TEXI   = @echo '   ' DB2TEXI $@;
 129        QUIET_MAKEINFO  = @echo '   ' MAKEINFO $@;
 130        QUIET_DBLATEX   = @echo '   ' DBLATEX $@;
 131        QUIET_XSLTPROC  = @echo '   ' XSLTPROC $@;
 132        QUIET_GEN       = @echo '   ' GEN $@;
 133        QUIET_STDERR    = 2> /dev/null
 134        QUIET_SUBDIR0   = +@subdir=
 135        QUIET_SUBDIR1   = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
 136                          $(MAKE) $(PRINT_DIR) -C $$subdir
 137        export V
 138endif
 139endif
 140
 141all: html man
 142
 143html: $(DOC_HTML)
 144
 145$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
 146
 147man: man1 man5 man7
 148man1: $(DOC_MAN1)
 149man5: $(DOC_MAN5)
 150man7: $(DOC_MAN7)
 151
 152info: git.info gitman.info
 153
 154pdf: user-manual.pdf
 155
 156install: install-man
 157
 158install-man: man
 159        $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
 160        $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
 161        $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
 162        $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
 163        $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
 164        $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
 165
 166install-info: info
 167        $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
 168        $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
 169        if test -r $(DESTDIR)$(infodir)/dir; then \
 170          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
 171          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
 172        else \
 173          echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
 174        fi
 175
 176install-pdf: pdf
 177        $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
 178        $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
 179
 180install-html: html
 181        sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
 182
 183../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 184        $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
 185
 186-include ../GIT-VERSION-FILE
 187
 188#
 189# Determine "include::" file references in asciidoc files.
 190#
 191doc.dep : $(wildcard *.txt) build-docdep.perl
 192        $(QUIET_GEN)$(RM) $@+ $@ && \
 193        $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
 194        mv $@+ $@
 195
 196-include doc.dep
 197
 198cmds_txt = cmds-ancillaryinterrogators.txt \
 199        cmds-ancillarymanipulators.txt \
 200        cmds-mainporcelain.txt \
 201        cmds-plumbinginterrogators.txt \
 202        cmds-plumbingmanipulators.txt \
 203        cmds-synchingrepositories.txt \
 204        cmds-synchelpers.txt \
 205        cmds-purehelpers.txt \
 206        cmds-foreignscminterface.txt
 207
 208$(cmds_txt): cmd-list.made
 209
 210cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 211        $(QUIET_GEN)$(RM) $@ && \
 212        $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
 213        date >$@
 214
 215clean:
 216        $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
 217        $(RM) *.texi *.texi+ *.texi++ git.info gitman.info
 218        $(RM) howto-index.txt howto/*.html doc.dep
 219        $(RM) technical/api-*.html technical/api-index.txt
 220        $(RM) $(cmds_txt) *.made
 221
 222$(MAN_HTML): %.html : %.txt
 223        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 224        $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
 225                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
 226        mv $@+ $@
 227
 228%.1 %.5 %.7 : %.xml
 229        $(QUIET_XMLTO)$(RM) $@ && \
 230        xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
 231
 232%.xml : %.txt
 233        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 234        $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
 235                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
 236        mv $@+ $@
 237
 238user-manual.xml: user-manual.txt user-manual.conf
 239        $(QUIET_ASCIIDOC)$(ASCIIDOC) -b docbook -d book $<
 240
 241technical/api-index.txt: technical/api-index-skel.txt \
 242        technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
 243        $(QUIET_GEN)cd technical && sh ./api-index.sh
 244
 245$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
 246        $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
 247                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
 248
 249XSLT = docbook.xsl
 250XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
 251
 252user-manual.html: user-manual.xml
 253        $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
 254
 255git.info: user-manual.texi
 256        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
 257
 258user-manual.texi: user-manual.xml
 259        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 260        $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
 261        $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
 262        rm $@++ && \
 263        mv $@+ $@
 264
 265user-manual.pdf: user-manual.xml
 266        $(QUIET_DBLATEX)$(RM) $@+ $@ && \
 267        $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
 268        mv $@+ $@
 269
 270gitman.texi: $(MAN_XML) cat-texi.perl
 271        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 272        ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
 273                --to-stdout $(xml) &&) true) > $@++ && \
 274        $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
 275        rm $@++ && \
 276        mv $@+ $@
 277
 278gitman.info: gitman.texi
 279        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
 280
 281$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
 282        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 283        $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
 284        mv $@+ $@
 285
 286howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 287        $(QUIET_GEN)$(RM) $@+ $@ && \
 288        sh ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
 289        mv $@+ $@
 290
 291$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
 292        $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 $*.txt
 293
 294WEBDOC_DEST = /pub/software/scm/git/docs
 295
 296$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 297        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 298        sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \
 299        mv $@+ $@
 300
 301install-webdoc : html
 302        sh ./install-webdoc.sh $(WEBDOC_DEST)
 303
 304quick-install: quick-install-man
 305
 306quick-install-man:
 307        sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
 308
 309quick-install-html:
 310        sh ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
 311
 312.PHONY: .FORCE-GIT-VERSION-FILE