all: print front web
print: protext-label.pdf protext-cover.pdf texcollection2005-label.pdf texlive2005-label.pdf texcollection2005-cover.pdf texlive2005-cover.pdf
front: protext-front.pdf texcollection2005-front.pdf texlive2005-front.pdf
web: protext-large.png texcollection2005-large.png texlive2005-large.png protext.png texcollection2005.png texlive2005.png protext-small.png texcollection2005-small.png texlive2005-small.png

PS2PDF=ps2pdf13

DRAFT=0
LABELOPTION=0
# 1000x1000 pixels
HIGHRES=203.2
# 200x200 pixels
RES=40.6
# 100x100 pixels
SMALLRES=20.3

protext-inlay.pdf: protext-inlay.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

protext-inlay.ps: protext-inlay.dvi
	dvips $<

protext-inlay.dvi: protext-inlay.tex
	latex $<

protext-cover.pdf: protext-cover.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

protext-cover.ps: protext-cover.tex cover.sty
	latex "\chardef\Status=$(DRAFT)\input{$<}"
	dvips `basename $< .tex`
	rm -f protext-cover.dvi

protext-front.pdf: protext-front.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

protext-front.ps: protext-cover.tex cover.sty
	latex "\chardef\Status=2\input{$<}"
	dvips -o $@ `basename $< .tex`
	rm -f protext-cover.dvi

protext-large.png: protext-web.ps
	cat $< | gs -sDEVICE=png16m -sOutputFile=$@ -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -r$(HIGHRES) - -c quit

protext.png: protext-web.ps
	cat $< | gs -sDEVICE=png16m -sOutputFile=$@ -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -r$(RES) - -c quit

protext-small.png: protext-web.ps
	cat $< | gs -sDEVICE=png16m -sOutputFile=$@ -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -r$(SMALLRES) - -c quit

protext-web.ps: protext-cover.tex cover.sty
	latex "\chardef\Status=3\input{$<}"
	dvips -o $@ `basename $< .tex`
	rm -f protext-cover.dvi

protext-label.pdf: protext-label.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

protext-label.ps: protext-label.tex label.sty
	latex "\chardef\Status=$(LABELOPTION)\input{$<}"
	dvips `basename $< .tex`.dvi
	rm `basename $< .tex`.dvi

texcollection2005-cover.pdf: texcollection2005-cover.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

texcollection2005-cover.ps: texcollection2005-cover.tex cover.sty
	latex "\chardef\Status=$(DRAFT)\input{$<}"
	dvips -o $@ `basename $< .tex`
	rm -f `basename $< .tex`.dvi

texcollection2005-front.pdf: texcollection2005-front.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

texcollection2005-front.ps: texcollection2005-cover.tex cover.sty
	latex "\chardef\Status=2\input{$<}"
	dvips -o $@ `basename $< .tex`
	rm -f `basename $< .tex`.dvi

texcollection2005-large.png: texcollection2005-web.ps
	cat $< | gs -sDEVICE=png16m -sOutputFile=$@ -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -r$(HIGHRES) - -c quit

texcollection2005.png: texcollection2005-web.ps
	cat $< | gs -sDEVICE=png16m -sOutputFile=$@ -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -r$(RES) - -c quit

texcollection2005-small.png: texcollection2005-web.ps
	cat $< | gs -sDEVICE=png16m -sOutputFile=$@ -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -r$(SMALLRES) - -c quit

texcollection2005-web.ps: texcollection2005-cover.tex cover.sty
	latex "\chardef\Status=3\input{$<}"
	dvips -o $@ `basename $< .tex`
	rm -f `basename $< .tex`.dvi

texcollection2005-label.pdf: texcollection2005-label.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

texcollection2005-label.ps: texcollection2005-label.tex label.sty
	latex "\chardef\Status=$(LABELOPTION)\input{$<}"
	dvips `basename $< .tex`.dvi
	rm `basename $< .tex`.dvi

texlive2005-label.pdf: texlive2005-label.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

texlive2005-label.ps: texlive2005-label.tex label.sty
	latex "\chardef\Status=$(LABELOPTION)\input{$<}"
	dvips `basename $< .tex`.dvi
	rm `basename $< .tex`.dvi

texlive2005-cover.pdf: texlive2005-cover.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

texlive2005-cover.ps: texlive2005-cover.tex cover.sty
	latex "\chardef\Status=$(DRAFT)\input{$<}"
	dvips -o $@ `basename $< .tex`
	rm -f `basename $< .tex`.dvi

texlive2005-front.pdf: texlive2005-front.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

texlive2005-front.ps: texlive2005-cover.tex cover.sty
	latex "\chardef\Status=2\input{$<}"
	dvips -o $@ `basename $< .tex`
	rm -f `basename $< .tex`.dvi

texlive2005-large.png: texlive2005-web.ps
	cat $< | gs -sDEVICE=png16m -sOutputFile=$@ -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -r$(HIGHRES) - -c quit

texlive2005.png: texlive2005-web.ps
	cat $< | gs -sDEVICE=png16m -sOutputFile=$@ -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -r$(RES) - -c quit

texlive2005-small.png: texlive2005-web.ps
	cat $< | gs -sDEVICE=png16m -sOutputFile=$@ -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -r$(SMALLRES) - -c quit

texlive2005-web.ps: texlive2005-cover.tex cover.sty
	latex "\chardef\Status=3\input{$<}"
	dvips -o $@ `basename $< .tex`
	rm -f `basename $< .tex`.dvi

ctan-label.pdf: ctan-label.ps
	$(PS2PDF) -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $<

ctan-label.ps: ctan-label.dvi
	dvips $<

ctan-label.dvi: ctan-label.tex
	latex $<

clean:
	rm -f *.log *.aux *.dvi *.ps
