Documentation / Makefileon commit git-branch -D: make it work even when on a yet-to-be-born branch (67affd5)
   1MAN1_TXT= \
   2        $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
   3                $(wildcard git-*.txt)) \
   4        gitk.txt
   5MAN7_TXT=git.txt
   6
   7DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
   8
   9ARTICLES = tutorial
  10ARTICLES += tutorial-2
  11ARTICLES += core-tutorial
  12ARTICLES += cvs-migration
  13ARTICLES += diffcore
  14ARTICLES += howto-index
  15ARTICLES += repository-layout
  16ARTICLES += hooks
  17ARTICLES += everyday
  18ARTICLES += git-tools
  19# with their own formatting rules.
  20SP_ARTICLES = glossary howto/revert-branch-rebase
  21
  22DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
  23
  24DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
  25DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
  26
  27prefix?=$(HOME)
  28bindir?=$(prefix)/bin
  29mandir?=$(prefix)/man
  30man1dir=$(mandir)/man1
  31man7dir=$(mandir)/man7
  32# DESTDIR=
  33
  34INSTALL?=install
  35
  36-include ../config.mak.autogen
  37
  38#
  39# Please note that there is a minor bug in asciidoc.
  40# The version after 6.0.3 _will_ include the patch found here:
  41#   http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
  42#
  43# Until that version is released you may have to apply the patch
  44# yourself - yes, all 6 characters of it!
  45#
  46
  47all: html man
  48
  49html: $(DOC_HTML)
  50
  51$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN7): asciidoc.conf
  52
  53man: man1 man7
  54man1: $(DOC_MAN1)
  55man7: $(DOC_MAN7)
  56
  57install: man
  58        $(INSTALL) -d -m755 $(DESTDIR)$(man1dir) $(DESTDIR)$(man7dir)
  59        $(INSTALL) $(DOC_MAN1) $(DESTDIR)$(man1dir)
  60        $(INSTALL) $(DOC_MAN7) $(DESTDIR)$(man7dir)
  61
  62
  63#
  64# Determine "include::" file references in asciidoc files.
  65#
  66doc.dep : $(wildcard *.txt) build-docdep.perl
  67        rm -f $@+ $@
  68        perl ./build-docdep.perl >$@+
  69        mv $@+ $@
  70
  71-include doc.dep
  72
  73git.7: README
  74
  75README: ../README
  76        cp $< $@
  77
  78
  79clean:
  80        rm -f *.xml *.html *.1 *.7 howto-index.txt howto/*.html doc.dep README
  81
  82%.html : %.txt
  83        asciidoc -b xhtml11 -d manpage -f asciidoc.conf $<
  84
  85%.1 %.7 : %.xml
  86        xmlto -m callouts.xsl man $<
  87
  88%.xml : %.txt
  89        asciidoc -b docbook -d manpage -f asciidoc.conf $<
  90
  91git.html: git.txt README
  92
  93glossary.html : glossary.txt sort_glossary.pl
  94        cat $< | \
  95        perl sort_glossary.pl | \
  96        asciidoc -b xhtml11 - > glossary.html
  97
  98howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
  99        rm -f $@+ $@
 100        sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
 101        mv $@+ $@
 102
 103$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
 104        asciidoc -b xhtml11 $*.txt
 105
 106WEBDOC_DEST = /pub/software/scm/git/docs
 107
 108$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 109        rm -f $@+ $@
 110        sed -e '1,/^$$/d' $< | asciidoc -b xhtml11 - >$@+
 111        mv $@+ $@
 112
 113install-webdoc : html
 114        sh ./install-webdoc.sh $(WEBDOC_DEST)