# $Id: Makefile,v 1.7 2002/03/10 21:37:39 richdawe Exp $
#
# Makefile for zippo's documentation
# Copyright (C) 1999-2001 by Richard Dawe
#

SHELL=/bin/sh

TXIDOCS     = dsm.txi zippo.txi dsmcheck.txi libzippo.txi
INFODOCS    = $(patsubst %.txi,%.inf,$(TXIDOCS))
HTMLDOCS    = $(patsubst %.txi,%.htm,$(TXIDOCS))
TEXTDOCS    = ../install.txt ../zippo.txt

# Optional documetation
OPTTEXTDOCS = dsm.txt
OPTDVIDOCS  = $(patsubst %.txi,%.dvi,$(TXIDOCS))
OPTPSDOCS   = $(patsubst %.txi,%.ps,$(TXIDOCS))

.PHONY: all clean distclean

default:	$(INFODOCS) $(HTMLDOCS) $(TEXTDOCS)

all:	$(INFODOCS) $(HTMLDOCS) $(TEXTDOCS) \
	$(OPTTEXTDOCS) $(OPTDVIDOCS) $(OPTPSDOCS)

%.htm:	%.txi
	$(MAKEINFO) --no-split --html $< -o $@

%.inf:	%.txi
	test -d ../info || mkdir ../info
	$(MAKEINFO) --no-split $< -o $@
	cp -v -u $@ ../info

%.dvi:	%.txi
	texi2dvi --clean $<

%.ps:	%.dvi
	dvips -q $< -o $@

#
# Some text files require building from info docs
#
# NB: -f ./<Info file> used, since info will look for <Info file> in info
# directories unless we override with our path.
#
../install.txt:	zippo.inf
	info -f ./$< 'Installation'    >  $@	
	info -f ./$< 'Getting Started' >> $@

# Some text files require building from texinfo docs
../zippo.txt:	zippo.txi
	$(MAKEINFO) --no-split --no-headers $< -o $@

dsm.txt:	dsm.txi
	$(MAKEINFO) --no-split --no-headers $< -o $@

clean:
	-rm -f $(INFODOCS) $(HTMLDOCS) $(TEXTDOCS)
	-rm -f $(OPTTEXTDOCS) $(OPTDVIDOCS) $(OPTPSDOCS)

distclean:	clean
	-rm -f *.\$$\$$\$$
	-rm -f *~
