
$(outdir)/%.tex: %.tex
	cp $< $@

$(outdir)/%.dvi: $(outdir)/%.tex
	(cd $(outdir); tex \\nonstopmode \\input $(<F))

$(outdir)/%.dvi: $(outdir)/%.latex
	(cd $(outdir)&& \
	  latex \\nonstopmode \\input $(<F)&&\
	  (bibtex $(basename $(<F)) || true) && \
	  latex \\nonstopmode \\input $(<F)&&\
	  (makeindex $(basename $(<F)) || true) && \
	  latex \\nonstopmode \\input $(<F) )


$(outdir)/%.ps: $(outdir)/%.dvi
	cd $(outdir) && dvips $(DVIPS_FLAGS) -t $(DVIPS_PAPERSIZE) -o $(@F) $(<F)

$(outdir)-$(PAPERSIZE)/%.ps: $(outdir)-$(PAPERSIZE)/%.dvi
	cd $(outdir)-$(PAPERSIZE) && dvips $(DVIPS_FLAGS)  -t$(PAPERSIZE) -o $(@F) $(<F)

