CC=gcc

WARNING_FLAGS=-Wall -Wextra -Werror-implicit-function-declaration -Wshadow -Wstrict-prototypes -pedantic-errors
CFLAGS=-g -O2 -std=c99 $(WARNING_FLAGS)
LDFLAGS=-g -lGL -lglut -lGLU

.c.o:
	$(CC) -c $(CFLAGS) $<

all: main
main: vectors.o intersect.o main.o polys.o
	$(CC) $(LDFLAGS) -o main vectors.o intersect.o main.o polys.o

clean:
	rm -f *.o
	rm -f main

polys.o     : polys.h
intersect.o : intersect.h polys.h vectors.h intersect.c 
intersect.o : vectors.h polys.h intersect.h
main.o      : intersect.h polys.h main.c
polys.o     : polys.h polys.c
vectors.o	: vectors.h vectors.c
