Documentation / Makefileon commit When generating manpages, delete outdated targets first. (50cff52)
   1MAN1_TXT= \
   2        $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
   3                $(wildcard git-*.txt)) \
   4        gitk.txt
   5MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt
   6MAN7_TXT=git.txt
   7
   8DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT))
   9
  10ARTICLES = tutorial
  11ARTICLES += tutorial-2
  12ARTICLES += core-tutorial
  13ARTICLES += cvs-migration
  14ARTICLES += diffcore
  15ARTICLES += howto-index
  16ARTICLES += repository-layout
  17ARTICLES += hooks
  18ARTICLES += everyday
  19ARTICLES += git-tools
  20ARTICLES += glossary
  21# with their own formatting rules.
  22SP_ARTICLES = howto/revert-branch-rebase user-manual
  23
  24DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
  25
  26DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
  27DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
  28DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
  29
  30prefix?=$(HOME)
  31bindir?=$(prefix)/bin
  32mandir?=$(prefix)/share/man
  33man1dir=$(mandir)/man1
  34man5dir=$(mandir)/man5
  35man7dir=$(mandir)/man7
  36# DESTDIR=
  37
  38ASCIIDOC=asciidoc
  39ASCIIDOC_EXTRA =
  40ifdef ASCIIDOC8
  41ASCIIDOC_EXTRA += -a asciidoc7compatible
  42endif
  43INSTALL?=install
  44RM ?= rm -f
  45DOC_REF = origin/man
  46
  47-include ../config.mak.autogen
  48-include ../config.mak
  49
  50#
  51# Please note that there is a minor bug in asciidoc.
  52# The version after 6.0.3 _will_ include the patch found here:
  53#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
  54#
  55# Until that version is released you may have to apply the patch
  56# yourself - yes, all 6 characters of it!
  57#
  58
  59all: html man
  60
  61html: $(DOC_HTML)
  62
  63$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
  64
  65man: man1 man5 man7
  66man1: $(DOC_MAN1)
  67man5: $(DOC_MAN5)
  68man7: $(DOC_MAN7)
  69
  70install: man
  71        $(INSTALL) -d -m755 $(DESTDIR)$(man1dir)
  72        $(INSTALL) -d -m755 $(DESTDIR)$(man5dir)
  73        $(INSTALL) -d -m755 $(DESTDIR)$(man7dir)
  74        $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
  75        $(INSTALL) -m644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
  76        $(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
  77
  78
  79../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
  80        $(MAKE) -C ../ GIT-VERSION-FILE
  81
  82-include ../GIT-VERSION-FILE
  83
  84#
  85# Determine "include::" file references in asciidoc files.
  86#
  87doc.dep : $(wildcard *.txt) build-docdep.perl
  88        $(RM) $@+ $@
  89        perl ./build-docdep.perl >$@+
  90        mv $@+ $@
  91
  92-include doc.dep
  93
  94cmds_txt = cmds-ancillaryinterrogators.txt \
  95        cmds-ancillarymanipulators.txt \
  96        cmds-mainporcelain.txt \
  97        cmds-plumbinginterrogators.txt \
  98        cmds-plumbingmanipulators.txt \
  99        cmds-synchingrepositories.txt \
 100        cmds-synchelpers.txt \
 101        cmds-purehelpers.txt \
 102        cmds-foreignscminterface.txt
 103
 104$(cmds_txt): cmd-list.made
 105
 106cmd-list.made: cmd-list.perl $(MAN1_TXT)
 107        perl ./cmd-list.perl
 108        date >$@
 109
 110git.7 git.html: git.txt core-intro.txt
 111
 112clean:
 113        $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 howto-index.txt howto/*.html doc.dep
 114        $(RM) $(cmds_txt) *.made
 115
 116%.html : %.txt
 117        $(RM) $@+ $@
 118        $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
 119                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
 120        mv $@+ $@
 121
 122%.1 %.5 %.7 : %.xml
 123        $(RM) $@
 124        xmlto -m callouts.xsl man $<
 125
 126%.xml : %.txt
 127        $(RM) $@+ $@
 128        $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
 129                $(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
 130        mv $@+ $@
 131
 132user-manual.xml: user-manual.txt user-manual.conf
 133        $(ASCIIDOC) -b docbook -d book $<
 134
 135XSLT = docbook.xsl
 136XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
 137
 138user-manual.html: user-manual.xml
 139        xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
 140
 141howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
 142        $(RM) $@+ $@
 143        sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
 144        mv $@+ $@
 145
 146$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
 147        $(ASCIIDOC) -b xhtml11 $*.txt
 148
 149WEBDOC_DEST = /pub/software/scm/git/docs
 150
 151$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 152        $(RM) $@+ $@
 153        sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
 154        mv $@+ $@
 155
 156install-webdoc : html
 157        sh ./install-webdoc.sh $(WEBDOC_DEST)
 158
 159quick-install:
 160        sh ./install-doc-quick.sh $(DOC_REF) $(mandir)
 161
 162.PHONY: .FORCE-GIT-VERSION-FILE