CC = gcc
CFLAGS = -Wall -W -pedantic `pkg-config --cflags gtk+-2.0` -ggdb
CLIBS = -lGL -lX11 -lXrandr -lm -lpng12 -lvorbisfile -lasound `pkg-config --libs gtk+-2.0`

DEMO = biopunk

$(DEMO): main.o texture.o mesh3d.o cg_music.o cg_x11.o cg_dialog.o cg_time.o shader.o matrix.o pdb.o celldivide.o bone.o $(DEMO).o
	$(CC) $(CLIBS) *.o -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
cg_music.o: cg_music.c cg_music.h
	$(CC) $(CFLAGS) cg_music.c -c
cg_x11.o: cg_x11.c cg_x11.h
	$(CC) $(CFLAGS) cg_x11.c -c
cg_dialog.o: cg_dialog.c cg_dialog.h
	$(CC) $(CFLAGS) cg_dialog.c -c
cg_time.o: cg_time.h cg_time.c
	$(CC) $(CFLAGS) cg_time.c -c
matrix.o: matrix.h matrix.c
	$(CC) $(CFLAGS) matrix.c -c
pdb.o: pdb.c pdb.h
	$(CC) $(CFLAGS) pdb.c -c
celldivide.o: celldivide.c celldivide.h
	$(CC) $(CFLAGS) celldivide.c -c
bone.o: bone.c bone.h
	$(CC) $(CFLAGS) bone.c -c
$(DEMO).o: mesh3d.h texture.h shader.h bone.h cg_time.h matrix.h pdb.h celldivide.h $(DEMO).c $(DEMO).h
	$(CC) $(CFLAGS) $(DEMO).c -c

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