#
# Makefile for the misc demos of sipp version 2.0.
#

# These values are used if not overruled from the command line
CC = cc
CFLAGS = -O -I../libsipp


SRCS = torustest.c cylindertest.c ellipsoid.c blocktest.c chain.c \
	teapot.c structure.c planettest.c isy90.c
PROGRAMS = torustest cylindertest ellipsoid blocktest chain \
	teapot structure planettest isy90


all:
	@echo "If you want to make only the pretty images, type 'make pretty'."
	@echo "If you want to make only the test images, type   'make tests'."
	@echo "If you want to make all images, type             'make images'."
	@echo
	@echo "If you want to make the programs, but not the images,"
	@echo "type 'make programs'."
	@echo


# ================================================================


programs: ../libsipp/libsipp.a $(PROGRAMS)

../libsipp/libsipp.a:
	cd ..; $(MAKE) library


# ================================================================


teapot: teapot.o ../libsipp/libsipp.a
	$(CC) -o teapot teapot.o ../libsipp/libsipp.a -lm
	
chain: chain.o ../libsipp/libsipp.a
	$(CC) -o chain chain.o ../libsipp/libsipp.a -lm

structure: structure.o ../libsipp/libsipp.a
	$(CC) -o structure structure.o ../libsipp/libsipp.a -lm

planettest: planettest.o ../libsipp/libsipp.a
	$(CC) -o planettest planettest.o ../libsipp/libsipp.a -lm

isy90: isy90.o ../libsipp/libsipp.a
	$(CC) -o isy90 isy90.o ../libsipp/libsipp.a -lm

ellipsoid:    ellipsoid.o ../libsipp/libsipp.a
	$(CC) -o ellipsoid ellipsoid.o ../libsipp/libsipp.a -lm

torustest: torustest.o ../libsipp/libsipp.a
	$(CC) -o torustest torustest.o ../libsipp/libsipp.a -lm

cylindertest: cylindertest.o ../libsipp/libsipp.a
	$(CC) -o cylindertest cylindertest.o ../libsipp/libsipp.a -lm

blocktest: blocktest.o ../libsipp/libsipp.a
	$(CC) -o blocktest blocktest.o ../libsipp/libsipp.a -lm


# ================================================================


clean:
	$(RM) *~ .*~ *.o $(PROGRAMS) *.ppm

tags:
	etags $(SRCS)


# ================================================================

PRETTY = chain.ppm teapot.ppm structure.ppm planet.ppm isy90.ppm
TESTS = torus.ppm cylinder.ppm ellipsoid.ppm block.ppm
IMAGES = $(PRETTY) $(TESTS)

images: $(IMAGES)
pretty: $(PRETTY)
tests:  $(TESTS)

chain.ppm: chain
	chain 
teapot.ppm: teapot
	teapot 
structure.ppm: structure
	structure
planet.ppm: planettest
	planettest
isy90.ppm: isy90
	isy90
torus.ppm: torustest
	torustest
cylinder.ppm: cylindertest
	cylindertest
ellipsoid.ppm: ellipsoid
	ellipsoid
block.ppm: blocktest
	blocktest
