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