.DELETE_ON_ERROR:

GS_OPTIONS=-dSAFER -dNOPAUSE -q -dBATCH -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dAlignToPixels=0 -r$(DPI) -sDEVICE=png16m -sPAPERSIZE=a4 $(GS_OPTIONS2)

# render width = 2x display width, for high-res displays
DISPLAY_WIDTH=310
DPI=75

%.png: %.ps.gz
	zcat $< | gs $(GS_OPTIONS) -sOutputFile=$@ -
%.png: %.pdf
	gs $(GS_OPTIONS) -sOutputFile=$@ $<

#%-cam-security-research.png: %-cam-security-research.pdf
#	gs $(GS_OPTIONS) -r26 -sOutputFile=$@ $<

%.html: %-b.html
	/anfs/www/tools/bin/ucampas $*

all: index.html

POSTERS=$(wildcard *.pdf)

# render both pages of a two-page poster
mgk25-compounds-1.png: mgk25-compounds.pdf
	gs $(GS_OPTIONS) -dFirstPage=1 -dLastPage=1 -sOutputFile=$@ $<
mgk25-compounds-2.png: mgk25-compounds.pdf
	gs $(GS_OPTIONS) -dFirstPage=2 -dLastPage=2 -sOutputFile=$@ $<
# render only first page of Robert's summary posters
%-securityresearch.png: GS_OPTIONS2:=-dFirstPage=1 -dLastPage=1
# adjust resolution for rendering Robert’s A1 posters
2012-rnw24-securityresearch.png: DPI:=26.5
2013-rnw24-securityresearch.png: DPI:=27.1

index-b.html: Makefile posterpage $(POSTERS:%.pdf=%.png)
	./posterpage $(POSTERS) >$@

print-a1: $(POSTER)
	acroread -toPostScript -level3 -size a4 <$(POSTER) | lpr -Predwood -a1

# ... under development ...
print-a2: $(POSTER)
	acroread -toPostScript -level3 -expand -size 1191x1684 -landscape <$(POSTER) | lpr -Predwood

clean:
	rm -f index-b.html index.html *.png *~
