CC=g++
FLAGS=-g
LIB=-lglut -lGLU

cube: cube.o control.o matrix.o textures.o twist.o
	$(CC) $(FLAGS) $(LIB) -o $@ $^

cube.o: cube.cpp cube.h
	$(CC) $(FLAGS) $(LIB) -c $<

control.o: control.c cube.h
	$(CC) $(FLAGS) $(LIB) -c $<

twist.o: twist.c twist.h cube.h
	$(CC) $(FLAGS) $(LIB) -c $<

%.o: %.c %.h
	$(CC) $(FLAGS) -c $<

run: cube
	./cube
