CFLAGS=-Wall
LDFLAGS=-lm

%_edge.png: %.png
	convert $< -edge 0 $@

images: torusmarble_edge.png toruswhite_edge.png torus_edge.png torus2.png torus2r.png torusb.png torus_top_edge.png torus_fish_edge.png

torusb_0.povinc: blowtorus2 torusb.tmg
	./blowtorus2

blowtorus2: blowtorus2.c
	gcc $< -Wall -L/usr/openwin/lib -ltmg -lm -lxsti -lxview -o $@

torusb.png: torusb.pov common.povinc torusb_0.povinc
	povray +h480 +w640 +a $<

torusmarble.png: torusmarble.pov common.povinc
	povray +h480 +w640 -d +a $<

toruswhite.png: toruswhite.pov common.povinc
	povray +h480 +w640 -d +a $<

torus.png: torus.pov torusmesh.povinc common.povinc
	povray +h480 +w640 -d +a $<

torus_top.png: torus_top.pov torusmesh.povinc common.povinc
	povray +h480 +w640 -d +a $<

torus_fish.png: torus_fish.pov torusmesh.povinc common.povinc
	povray +h480 +w640 -d +a $<

torus2.png: torus2.pov torus2.povinc common.povinc
	povray +h480 +w640 -d +a $<

torus2r.png: torus2r.pov torus2.povinc common.povinc
	povray +h480 +w640 -d +a $<

writemesh: writemesh.o surface.o

writemesh.o: writemesh.c writemesh.h

surface.o: surface.c writemesh.h

torusmesh.povinc: writemesh
	./writemesh -s 1 -o $@

torus2.povinc: writemesh
	./writemesh -s 2 -o $@

