# Makefile para processar as entregas do exercĂ­cio tp04 de POV-Ray
# Last edited on 2003-04-14 09:55:08 by stolfi

WIDTH = 640
HEIGHT = 480

NRAYS = 2

OTHERINPUTS = 

# No need to change below here

NAME = main

ICONNAME = icon

POVPUB = /home/staff/stolfi/programs/c-curitiba/povray-3.1a-1/PUB/i686-Linux-2.2
POVRAY = ${POVPUB}/bin/x-povray
POVINC = ${POVPUB}/povinc
POVTTF = /home/staff/stolfi/PUB/povray/tt-fonts
IMVIEW = /usr/X11R6/bin/display
CONVERT = /usr/X11R6/bin/convert

.PHONY: all cleanup  image showimage all-images index

all: image showimage

cleanup: 
	-/bin/rm -f ${NAME}.png ${NAME}.gif

image: ${NAME}.gif

showimage: ${NAME}.gif
	-${IMVIEW} ${NAME}.gif

${NAME}.gif: ${NAME}.png
	-/bin/rm -f ${NAME}.gif
	${CONVERT} ${NAME}.png ${NAME}.gif

${NAME}.png: ${NAME}.pov ${OTHERINPUTS}
	-/bin/rm -f ${NAME}.png
	nice ${POVRAY} +A0 +FN +Q9 +R${NRAYS} \
            +W${WIDTH} +H${HEIGHT} \
            +D +SP32 +EP4 \
            +L$${HOME}/lib/povray +L${POVINC} +L${POVTTF} \
	    +I${NAME}.pov \
	    +O${NAME}.png \
	  3>&2 > ${NAME}.log

${ICONNAME}.gif: ${NAME}.gif
	cat ${NAME}.gif \
          | giftopnm \
          | pnmscale -ysize 60 \
          | pnmdepth 255 \
          | ppmquant 254 \
          | ppmtogif > ${ICONNAME}.gif
        
all-images: rausrs.txt
	../../../tools/make-all-images \
          `cat rausrs.txt | egrep -v '^ *([#]|$$)' | gawk '//{print $$1;}' `

index: title.txt rausrs.txt
	../../../tools/make-labday-image-page "`cat title.txt`"