# Makefile for the BATTS Manual
#
# $Header: /var/cvs/batts/doc/Makefile,v 1.6 2001/12/03 21:28:56 lasser Exp $
#

# What is the file called? What's the destination directory?
TOPBASE=batts
TOPFILE=$(TOPBASE).sgml
HTMLDIR=./html
INSTALLDIR=/var/www/www.xisp.net/public/htdocs/batts-manual/

# List all of the SGML source files
SRCS = $(TOPFILE) reference.sgml see-also.sgml gpl-appendix.sgml \
	about-batts.sgml installing-batts.sgml tutorial.sgml

# Validate checks that the SGML is correct
validate: $(TOPFILE)
	@nsgmls -s $(TOPFILE) && echo "$(TOPFILE) Validated."
check: validate

# Make the PostScript manual
postscript: $(TOPBASE).ps
ps: postscript

# Make the HTML manual
web: $(HTMLDIR)/$(TOPBASE).html

all:	postscript web

install: web
	install -g apache -m 664 $(HTMLDIR)/* $(INSTALLDIR)


# If the HTML directory isn't there, make it
$(HTMLDIR):
	mkdir $(HTMLDIR)

# A rule for making the HTML files
$(HTMLDIR)/%.html: %.sgml $(HTMLDIR) $(SRCS)
	docbook2html -o $(HTMLDIR) $<

# A rule for making text files
%.txt: %.pdf
	pdftotext $<

# A rule for making PDF files
%.pdf: %.sgml $(SRCS)
	docbook2pdf $<

# A rule for making the PS files
%.ps: %.sgml $(SRCS)
	docbook2ps $<

# How to remove stuff
clean:
	-rm $(TOPBASE).ps
	-rm $(HTMLDIR)/*
