
# Rolf Niepraschk, niepraschk@ptb.de, 2003-05-19

.SUFFIXES : .tex .dvi .ps .pdf .eps 

MAIN = ps4pdf-test

PDFLATEX = pdflatex
LATEX = latex
DVIPSFLAGS = -Ppdf -G0 

#ARCHNAME = $(MAIN)-$(shell date +%y%m%d).zip
ARCHNAME = ps4pdf-$(shell date +%y%m%d).tar.gz

PICS_SRC = 4-10-8.inl penguin.eps

all : $(MAIN).pdf

ps : $(MAIN).ps

$(MAIN).pdf : $(MAIN).tex $(PICS_SRC) $(MAIN)-pics.pdf 
	$(PDFLATEX) $<
	
$(MAIN).ps : $(MAIN).tex $(PICS_SRC) 
	latex '\PassOptionsToPackage{inactive}{ps4pdf} \input{$<}'
	dvips $(DVIPSFLAGS) -o $@ $(basename $<).dvi	
				
$(MAIN)-pics.pdf : $(MAIN)-pics.ps $(PICS)
	ps2pdf $< $@
	
$(MAIN)-pics.ps : $(MAIN).tex $(PICS_SRC)
	latex $<
	dvips $(DVIPSFLAGS) -o $@ $(basename $<).dvi		
	
%.pdf : %.eps
	epstopdf $< -o=$@

clean : 
	$(RM) $(addprefix $(MAIN), .log .aux) \
	  $(addprefix $(MAIN)-pics, .ps .log .aux) 
	 
veryclean : clean
	$(RM) $(addprefix $(MAIN)-pics, .pdf .ps .dvi) \
	$(addprefix $(MAIN), .pdf .ps .dvi)
	
arch : 	
	tar cvzf $(ARCHNAME) $(MAIN).tex $(PICS_SRC) ps4pdf.sty Makefile \
          README create-eps
	@ echo	    
	@ echo $(ARCHNAME)	
	
.INTERMEDIATE : $(MAIN)-pics.ps	$(MAIN).dvi
