ALL: all-redirect
SHELL = /bin/sh

srcdir = .
.SUFFIXES: .pdf .dvi .tex

# The tests on files that use -s really need to also check for a valid
# link.  However, the -h test is not available in all shells,
# so we allow the ln to fail without exiting make (the -f option for
# ln is also non-standard, so we can't use that either)
.tex.dvi:
	@-if [ ! -s ../mpiman.sty ] ; then \
	(cd .. && ln -s $(srcdir)/../mpiman.sty mpiman.sty) ; fi
	@-if [ ! -s code.sty ] ; then \
	ln -s $(srcdir)/../refman/code.sty code.sty ; fi
	@if [ ! -s user.bib ] ; then \
	 ln -s $(srcdir)/user.bib user.bib ; fi
	-latex $< </dev/null >/dev/null 2>&1
	-bibtex $* </dev/null
	-latex $< </dev/null >/dev/null 2>&1
	latex $<

.dvi.pdf:
	dvipdfm $*
.dvi.ps:
	dvips $*

all-redirect: user.pdf

mandoc:

htmldoc:

latexdoc: ALL

clean:
	-rm -f *.toc *.out *.dvi user.ps user.pdf *.aux *.blg *.bbl

distclean: clean
	-rm -f code.sty
