#
#       Makefile for PhotoRealistic RenderMan Simple & Hard Example
#
RMAN=  /usr/local/prman

# This was changed from gcc to cc because of the SGI bug
ifeq ($(HOSTTYPE), iris4d)
  CC= cc -ansi -g
else #otherwise, an HP
  CC= gcc -ansi -g
endif
CFLAGS =  -I${RMAN}/tutorial -I${RMAN}/include 
LIBS = ${RMAN}/lib/libprmansdk.a -lm -lstdc++
.SUFFIXES: .pic .rib .gen .o .c

pics:   simple.pic hard.pic

rib:    simple.rib hard.rib scene.rib

exec:	simple.gen hard.gen scene.gen

all:	pics

.c.o:
	${CC} ${CFLAGS} -c $<

.o.gen:
	$CC} ${CFLAGS} -o $@ $< ${LIBS}

.gen.rib:
	./$< >$@

simple.pic:cube.o simple.rib
	${RMAN}/bin/render simple.rib
hard.pic:cube.o hard.rib
	${RMAN}/bin/render hard.rib
scene.pic:scene.o
	${RMAN}/bin/render scene.rib
#	netrender `ars` hard.rib

.rib.pic:
	render $*.rib
# To save images after rendering, replace this comment
# with the appropriate image saving command for your system.

simple.gen: cube.o simple.o
	${CC} ${CFLAGS} -o $@ simple.o cube.o ${LIBS}
hard.gen: cube.o hard.o
	${CC} ${CFLAGS} -o $@ hard.o cube.o ${LIBS}
scene.gen: scene.o
	${CC} ${CFLAGS} -o $@ scene.o cube.o ${LIBS}

clean:
	@echo 'Removing all .slo, .o, .gen, .rib, and .tif files in this directory'
	-rm -f *.slo
	-rm -f *.o
	-rm -f *.gen
	-rm -f *.rib
	-rm -f *.tif
	-rm -f *~