# -*- Makefile -*-
# $Id: Makefile,v 1.8 2004/01/27 08:15:15 cher Exp $

# Copyright (C) 2002 Alexander Chernov <cher@ispras.ru>

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

LATEXFLAGS = -file-line-error-style -interaction=nonstopmode -src-specials
LATEX = latex

all : userguide refmanual
clean:
	-rm -f *~ *.bak *.aux *.dvi *.log *.ps *.pdf *.toc *.gz *.out *.tmp

userguide: userguide.ps.gz userguide.ps userguide.pdf userguide.dvi
refmanual: refmanual.ps.gz refmanual.ps refmanual.pdf refmanual.dvi

userguide.dvi : userguide.tex adv.sty
	${LATEX} ${LATEXFLAGS} $<
	${LATEX} ${LATEXFLAGS} $< >/dev/null 2>&1

refmanual.dvi : refmanual.tex adv.sty rm_contest_xml.tex rm_serve_cfg.tex rm_test_inf.tex rm_ejudge.tex gpl.tex gplrus.tex gfdl.tex gfdlrus.tex rm_libchecker.tex rm_master.tex rm_tables.tex
	${LATEX} ${LATEXFLAGS} $<
	${LATEX} ${LATEXFLAGS} $< >/dev/null 2>&1

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

%.gz : %
	gzip -c -9 < $< > $@

%.pdf : %.ps
	ps2pdf14 $<
