# Makefile to process POV-Ray lab hand-in files - STATIC IMAGES
# Last edited on 2011-04-28 04:04:33 by stolfi

STATIC_NRAYS := 2

# STATIC_HIST_OPTIONS := +HTN +HNout/${NAME}_hist.png
STATIC_HIST_OPTIONS := 

.PHONY:: \
  large-portrait \
  large-square \
  large-landscape \
  medium-portrait \
  medium-square \
  medium-landscape \
  small-portrait \
  small-square \
  small-landscape \
  image \

clean::
	-/bin/rm -f out/${NAME}.png 
	-/bin/rm -f out/${NAME}-*-i.png ${NAME}-i.png
	-/bin/rm -f out/${NAME}-*.log ${NAME}.log

large-portrait: 
	${MAKE} WIDTH=600 HEIGHT=800 image

large-square: 
	${MAKE} WIDTH=800 HEIGHT=800 image

large-landscape: 
	${MAKE} WIDTH=800 HEIGHT=600 image

# For the overlay pics we need 500x750 images:
medium-portrait: 
	${MAKE} WIDTH=500 HEIGHT=750 image

medium-square: 
	${MAKE} WIDTH=750 HEIGHT=750 image

medium-landscape: 
	${MAKE} WIDTH=750 HEIGHT=500 image

small-portrait: 
	${MAKE} WIDTH=240 HEIGHT=320 image

small-square: 
	${MAKE} WIDTH=320 HEIGHT=320 image

small-landscape: 
	${MAKE} WIDTH=320 HEIGHT=240 image

ifneq "/${WIDTH}" "/"
ifneq "/${HEIGHT}" "/"
#=======================================================================

image: out/${NAME}.png 

out/${NAME}.png: ${NAME}.pov ${INC_IMG_FILES}
	-/bin/rm -f out/${NAME}.png
	${POVRAY} +K0.5000 \
            +FN +Q9 \
            +W${WIDTH} +H${HEIGHT} \
            +AM1 +A0.0 +R${STATIC_NRAYS} \
            ${STATIC_HIST_OPTIONS} \
            +D +SP32 +EP4 \
            +L${POVINC} \
            +L${POVTTF} \
	    +I${NAME}.pov \
	    +Oout/${NAME}.png \
          2>&1 | povray-output-filter.gawk
	@-if [[ "/${SHOW}" == "/YES" ]]; then \
          if [[ -s out/${NAME}.png ]]; then \
            ${IMVIEW} out/${NAME}.png ; \
          else \
            echo "** file out/${NAME}.png missing" ; \
          fi ; \
        fi

endif
endif