################################################################
# SWI-Prolog `DB' package
# Author:    Jan Wielemaker. jan@swi.psy.uva.nl
# Copyright: LGPL (see COPYING or www.gnu.org
################################################################

.SUFFIXES: .tex .dvi .doc .pl

PCEHOME=/staff/jan/src/xpce

DOCTOTEX=./doc2tex
LATEX=latex
DOC=plweb
PDF=$(DOC).pdf
HTML=$(DOC).html
RUNTEX=./runtex

TEX=	extension.tex introduction.tex protocol.tex web.tex \
	facet.tex plweb.tex serql.tex xdig.tex

SRC=$(DOC).doc swipl.sty $(DOC).bib $(DOC).bbl figs/*.pdf
SUP=Makefile tlp.cls $(DOCTOTEX) $(RUNTEX)

################################################################
# Documentation
################################################################

all:		$(TEX) pdf

doc:		$(PDF) $(HTML)
pdf:		$(PDF)
xhtml:		$(TEX)
		latex2html $(DOC)

$(PDF)::
		$(RUNTEX) --pdf $(DOC)

$(TEX):		$(DOCTOTEX)

.doc.tex:
		$(DOCTOTEX) $*.doc > $*.tex

zip:
		rm -f $(DOC).zip
		zip -r $(DOC).zip $(SRC) $(SUP)
########################################################
# Utility Lourens: make available on the web
# make scp.L => remote copy to web access of $(PDF) protected by password
####################################
REMOTE.L=lourens@fluit.cs.vu.nl:www/aistaff/
scp.%:
	$(MAKE)
	chmod go+r $(PDF)
	- scp -p $(PDF) $(REMOTE.$*)

################################################################
# Clean
################################################################

clean:
		for f in $(TEXT); do \
		   if [ -f `basename $$f tex`.doc ]; then rm -f $$f; fi ;\
		done
		$(RUNTEX) --clean $(DOC)
