RENAISSANCE = ..
WFF = ../../wff
INTERPRETER = $(RENAISSANCE)/Chaucer
GLIB = $(RENAISSANCE)/Lib
#CFLAGS = -O -I$(GLIB) -I$(INTERPRETER) -I$(WFF)/include
CFLAGS = -DASCII -g -I$(GLIB) -I$(INTERPRETER) -I$(WFF)/include
LIBS = $(GLIB)/libgraphics.a -ll -lm
LINTLIBS = $(INTERPRETER)/llib-linterpreter.ln $(GLIB)/llib-lglib.ln

RAYTRACE.O = main.o ray.o raytrace.o scene.o Scene.o \
         primitive.o classify.o boundingbox.o   \
         torus.o PolyRoots.o sample.o \
	 eqsplit.o stratified.o HighInt.o meshray.o \
	 CSGlights.o  trigtables.o material.o  LowDensitySampling.o meter.o

WFF.O = $(WFF)/MIPSbin/wff.o

CFILES = main.c ray.c raytrace.c scene.c Scene.c\
         primitive.c classify.c boundingbox.c \
         torus.c  PolyRoots.c sample.c \
	 eqsplit.c stratified.c HighInt.c meshray.c \
	 CSGlights.c trigtables.c  material.c LowDensitySampling.c meter.c

INTERPRETER.O = $(INTERPRETER)/interpreter.a

RAYTRACE.H = ray.h raytrace.h classify.h \
             sample.h eqsplit.h stratified.h HighInt.h material.h \
	     $(INTERPRETER)/scenedef.h

Durer : $(RAYTRACE.O) $(INTERPRETER.O) $(WFF.O)
	cc $(CFLAGS) -o Durer $(RAYTRACE.O) $(INTERPRETER.O) $(WFF.O) $(LIBS)


lint: $(CFILES)
	lint -u -I$(GLIB) -I$(INTERPRETER) -I$(WFF)/include -DREAL=double\
		$(CFILES) $(LINTLIBS)
	

testinv : testinv.o $(INTERPRETER)/util.o 4D.o
	cc -o testinv testinv.o $(INTERPRETER)/util.o 4D.o -lm 

install: Durer
	install -c -o derose -g graphics -m 775 -s Durer /usr/graphics/bin/Durer

boundvol.o : $(RAYTRACE.H) boundvol.h
classify.o : $(RAYTRACE.H)  
primitive.o :$(RAYTRACE.H)  primitive.h fast.c
ray.o :      ray.h fast.c
raytrace.o : $(RAYTRACE.H)  3DDDA.h CSGlights.h
scene.o :    $(RAYTRACE.H)  boundvol.h classify.h scene.h primitive.h 
seads.o :    $(RAYTRACE.H)  seads.h fast.c
3DDDA.o :    $(RAYTRACE.H)  3DDDA.h scene.h seads.h fast.c
torus.o :    $(RAYTRACE.H) 

#  Polyroots has some extra compile time parameters:
#   If TABLE_LOOKUP is set, part of the computation is done by table lookup.
#     -- faster but less accurate.
#   REAL should be defined to either float or double.  float is faster 
#   if you can force the compiler to do calcuations involving floats
#   in single precision (-f on ultrix, -fsingle on Sun Unix).
#   The roots are "polished" to double precision accuracy by Newton-Raphson.
#
PolyRoots.o :  PolyRoots.c
	cc -c $(CFLAGS) -f -DREAL=float PolyRoots.c

sample.o   :  $(RAYTRACE.H) 
meshray.o  :  $(RAYTRACE.H) 
material.o :  $(RAYTRACE.H) $(INTERPRETER)/machine.h 
CSGlights.o : $(RAYTRACE.H)  
trigtables.o : trigtables.h
LowDensitySampling.o: $(RAYTRACE.H) LowDensitySampling.h
	cc -c $(CFLAGS)  $*.c

clean :	rm -f $(OFILES)

