CC = gcc
CFLAGS = -Wall -W -pedantic -ggdb
#CLIBS = -lglfw3 -lGL -lX11 -lXrandr -lm -lpng -lXcursor -lXxf86vm -lXinerama -lXi -lpthread -lGLEW
CLIBS = -lglfw3 -lGL -lX11 -lXrandr -lm -lpng -lXxf86vm -lXi -lpthread -lGLEW -lfmod

DEMO = dv

$(DEMO): main.o texture.o mesh3d.o shader.o matrix.o $(DEMO).o
	$(CC) *.o $(CLIBS) $(CFLAGS) -o $(DEMO)
	mv $(DEMO) ../

# Common demo stuff
main.o: main.c
	$(CC) main.c -c
texture.o: texture.c texture.h
	$(CC) $(CFLAGS) texture.c -c
mesh3d.o: mesh3d.c mesh3d.h
	$(CC) $(CFLAGS) mesh3d.c -c
shader.o: shader.c shader.h
	$(CC) $(CFLAGS) shader.c -c
matrix.o: matrix.c matrix.h
	$(CC) $(CFLAGS) matrix.c -c
$(DEMO).o: mesh3d.h texture.h $(DEMO).c $(DEMO).h
	$(CC) $(CFLAGS) $(DEMO).c -c

clean:
	@echo Cleaning up...
	@rm -f *.o *~ core* 
	@echo Done.
