CC = gcc
CFLAGS = -Wall -W -pedantic `pkg-config --cflags gtk+-3.0` -ggdb
CLIBS = -L/usr/lib64/nvidia-304xx -lGL -lX11 -lXrandr -lm -lpng -lvorbisfile -lasound `pkg-config --libs gtk+-3.0`

DEMO = smallworlds

$(DEMO): main.o texture.o mesh3d.o shader.o cg_music.o cg_x11.o cg_dialog.o cg_time.o matrix.o renderer.o antscene.o embryo.o molscene.o pdb.o greetings.o fractal.o sky.o atom.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.c cg_time.h
	$(CC) $(CFLAGS) cg_time.c -c
matrix.o: matrix.c matrix.h
	$(CC) $(CFLAGS) matrix.c -c
renderer.o: renderer.c renderer.h
	$(CC) $(CFLAGS) renderer.c -c
antscene.o: antscene.c antscene.h
	$(CC) $(CFLAGS) antscene.c -c
embryo.o: embryo.c embryo.h
	$(CC) $(CFLAGS) embryo.c -c
molscene.o: molscene.h molscene.c
	$(CC) $(CFLAGS) molscene.c -c
pdb.o: pdb.c pdb.h
	$(CC) $(CFLAGS) pdb.c -c
greetings.o: greetings.c greetings.h
	$(CC) $(CFLAGS) greetings.c -c
fractal.o: fractal.c fractal.h
	$(CC) $(CFLAGS) fractal.c -c
sky.o: sky.c sky.h
	$(CC) $(CFLAGS) sky.c -c
atom.o: atomscene.c atomscene.h
	$(CC) $(CFLAGS) atomscene.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.
