all: tidy
	@\rm -rf main.ps
	@latex main
	@bibtex main
	@latex main
	@dvips main

twoup: clean all
	@echo ... generating the 2up ps file... plase wait!
	@psnup -d -2 main.ps > main2up.ps
	@echo ... file main2up.ps has been generated... 
	@echo ... generating the 2up pdf file... plase wait!
	@ps2pdf main2up.ps main2up.pdf
	@echo ... file main2up.pdf has been generated... 

print: twoup
	@echo ... printing the 2up ps file... on ${PRINTER}
	@lpr -P ${PRINTER} main2up.ps

allpdf: all pdf pdfview

view:
	@gv -background white main.ps & 

pdf: clean
	@echo ... generating the pdf file... plase wait!
	@ps2pdf main.ps > main.pdf
	@echo ... file main.pdf has been generated... make pdfview to view

pdfview:
	@echo ... viewing main.pdf...
	@acroread main.pdf &

gz: clean
	@gzip main*.ps

tidy:
	@make -s -f ${HOME}/.cleanup tidy

clean: tidy
	@\rm -rf main*.ps.gz
	@\rm -rf main*.pdf
