Documentation / Makefileon commit Documentation/Makefile: make most operations "quiet" (bb23009)
   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 = callouts.xsl
  45INSTALL?=install
  46RM ?= rm -f
  47DOC_REF = origin/man
  48HTML_REF = origin/html
  49
  50infodir?=$(prefix)/share/info
  51MAKEINFO=makeinfo
  52INSTALL_INFO=install-info
  53DOCBOOK2X_TEXI=docbook2x-texi
  54DBLATEX=dblatex
  55ifndef PERL_PATH
  56        PERL_PATH = /usr/bin/perl
  57endif
  58
  59-include ../config.mak.autogen
  60-include ../config.mak
  61
  62ifdef ASCIIDOC8
  63ASCIIDOC_EXTRA += -a asciidoc7compatible
  64endif
  65ifdef DOCBOOK_XSL_172
  66ASCIIDOC_EXTRA += -a docbook-xsl-172
  67MANPAGE_XSL = manpage-1.72.xsl
  68endif
  69
  70#
  71# Please note that there is a minor bug in asciidoc.
  72# The version after 6.0.3 _will_ include the patch found here:
  73#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
  74#
  75# Until that version is released you may have to apply the patch
  76# yourself - yes, all 6 characters of it!
  77#
  78
  79QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
  80QUIET_SUBDIR1  =
  81
  82ifneq ($(findstring $(MAKEFLAGS),w),w)
  83PRINT_DIR = --no-print-directory
  84else # "make -w"
  85NO_SUBDIR = :
  86endif
  87
  88ifneq ($(findstring $(MAKEFLAGS),s),s)
  89ifndef V
  90        QUIET_ASCIIDOC  = @echo '   ' ASCIIDOC $@;
  91        QUIET_XMLTO     = @echo '   ' XMLTO $@;
  92        QUIET_DB2TEXI   = @echo '   ' DB2TEXI $@;
  93        QUIET_MAKEINFO  = @echo '   ' MAKEINFO $@;
  94        QUIET_DBLATEX   = @echo '   ' DBLATEX $@;
  95        QUIET_XSLTPROC  = @echo '   ' XSLTPROC $@;
  96        QUIET_GEN       = @echo '   ' GEN $@;
  97        QUIET_STDERR    = 2> /dev/null
  98        QUIET_SUBDIR0   = +@subdir=
  99        QUIET_SUBDIR1   = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
 100                          $(MAKE) $(PRINT_DIR) -C $$subdir
 101        export V
 102endif
 103endif
 104
 105all: html man
 106
 107html: $(DOC_HTML)
 108
 109$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
 110
 111man: man1 man5 man7
 112man1: $(DOC_MAN1)
 113man5: $(DOC_MAN5)
 114man7: $(DOC_MAN7)
 115
 116info: git.info gitman.info
 117
 118pdf: user-manual.pdf
 119
 120install: install-man
 121
 122install-man: man
 123        $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
 124        $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
 125        $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
 126        $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
 127        $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
 128        $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
 129
 130install-info: info
 131        $(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
 132        $(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
 133        if test -r $(DESTDIR)$(infodir)/dir; then \
 134          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
 135          $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
 136        else \
 137          echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
 138        fi
 139
 140install-pdf: pdf
 141        $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
 142        $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
 143
 144install-html: html
 145        sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
 146
 147../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 148        $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
 149
 150-include ../GIT-VERSION-FILE
 151
 152#
 153# Determine "include::" file references in asciidoc files.
 154#
 155doc.dep : $(wildcard *.txt) build-docdep.perl
 156        $(QUIET_GEN)$(RM) $@+ $@ && \
 157        $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
 158        mv $@+ $@
 159
 160-include doc.dep
 161
 162cmds_txt = cmds-ancillaryinterrogators.txt \
 163        cmds-ancillarymanipulators.txt \
 164        cmds-mainporcelain.txt \
 165        cmds-plumbinginterrogators.txt \
 166        cmds-plumbingmanipulators.txt \
 167        cmds-synchingrepositories.txt \
 168        cmds-synchelpers.txt \
 169        cmds-purehelpers.txt \
 170        cmds-foreignscminterface.txt
 171
 172$(cmds_txt): cmd-list.made
 173
 174cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
 175        $(QUIET_GEN)$(RM) $@ && \
 176        $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
 177        date >$@
 178
 179clean:
 180        $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
 181        $(RM) *.texi *.texi+ git.info gitman.info
 182        $(RM) howto-index.txt howto/*.html doc.dep
 183        $(RM) technical/api-*.html technical/api-index.txt
 184        $(RM) $(cmds_txt) *.made
 185
 186$(MAN_HTML): %.html : %.txt
 187        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 188        $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
 189                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
 190        mv $@+ $@
 191
 192%.1 %.5 %.7 : %.xml
 193        $(QUIET_XMLTO)$(RM) $@ && \
 194        xmlto -m $(MANPAGE_XSL) man $<
 195
 196%.xml : %.txt
 197        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 198        $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
 199                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
 200        mv $@+ $@
 201
 202user-manual.xml: user-manual.txt user-manual.conf
 203        $(QUIET_ASCIIDOC)$(ASCIIDOC) -b docbook -d book $<
 204
 205technical/api-index.txt: technical/api-index-skel.txt \
 206        technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
 207        $(QUIET_GEN)cd technical && sh ./api-index.sh
 208
 209$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
 210        $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
 211                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
 212
 213XSLT = docbook.xsl
 214XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
 215
 216user-manual.html: user-manual.xml
 217        $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
 218
 219git.info: user-manual.texi
 220        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
 221
 222user-manual.texi: user-manual.xml
 223        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 224        $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout | \
 225                $(PERL_PATH) fix-texi.perl >$@+ && \
 226        mv $@+ $@
 227
 228user-manual.pdf: user-manual.xml
 229        $(QUIET_DBLATEX)$(RM) $@+ $@ && \
 230        $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
 231        mv $@+ $@
 232
 233gitman.texi: $(MAN_XML) cat-texi.perl
 234        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 235        ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
 236                --to-stdout $(xml) &&) true) | $(PERL_PATH) cat-texi.perl $@ >$@+ && \
 237        mv $@+ $@
 238
 239gitman.info: gitman.texi
 240        $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
 241
 242$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
 243        $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
 244        $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
 245        mv $@+ $@
 246
 247howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 248        $(QUIET_GEN)$(RM) $@+ $@ && \
 249        sh ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
 250        mv $@+ $@
 251
 252$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
 253        $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 $*.txt
 254
 255WEBDOC_DEST = /pub/software/scm/git/docs
 256
 257$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 258        $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
 259        sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \
 260        mv $@+ $@
 261
 262install-webdoc : html
 263        sh ./install-webdoc.sh $(WEBDOC_DEST)
 264
 265quick-install: quick-install-man
 266
 267quick-install-man:
 268        sh ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
 269
 270quick-install-html:
 271        sh ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
 272
 273.PHONY: .FORCE-GIT-VERSION-FILE