CC = gcc
CFLAGS = -g -Wall `gtk-config --cflags`

LIBS = `gtk-config --libs` -lgtkgl -lGL -lGLU -lm -L/usr/X11R6/lib -lXi -lXmu

OBJS =	main.o		\
	animation.o	\
	config.o	\
	draw.o		\
	engine.o	\
	game.o		\
	global.o	\
	image.o		\
	interface.o	\
	menu.o		\
	models.o	\
	picksquare.o	\
	player.o	\
	preferences.o	\
	san.o		\
	splash.o	\
	texture.o

all: $(OBJS)
	$(CC) $(CFLAGS) -o glchess $(LIBS) $(OBJS)

main.o: main.c global.h main.h models.h texture.h draw.h config.h interface.h splash.h game.h san.h
	$(CC) $(CFLAGS) -c main.c -o main.o
animation.o: animation.c global.h animation.h draw.h
	$(CC) $(CFLAGS) -c animation.c -o animation.o
config.o: config.c config.h player.h
	$(CC) $(CFLAGS) -c config.c -o config.o
draw.o: draw.c global.h draw.h
	$(CC) $(CFLAGS) -c draw.c -o draw.o
engine.o: engine.c engine.h global.h
	$(CC) $(CFLAGS) -c engine.c -o engine.o
game.o: game.c global.h game.h
	$(CC) $(CFLAGS) -c game.c -o game.o
global.o: global.c global.h
	$(CC) $(CFLAGS) -c global.c -o global.o
image.o: image.c image.h
	$(CC) $(CFLAGS) -c image.c -o image.o
interface.o: interface.c global.h interface.h menu.h draw.h picksquare.h animation.h splash.h game.h engine.h
	$(CC) $(CFLAGS) -c interface.c -o interface.o
menu.o: menu.c global.h menu.h preferences.h draw.h splash.h player.h interface.h config.h engine.h
	$(CC) $(CFLAGS) -c menu.c -o menu.o
models.o: models.c models.h
	$(CC) $(CFLAGS) -c models.c -o models.o
picksquare.o: picksquare.c global.h picksquare.h draw.h engine.h
	$(CC) $(CFLAGS) -c picksquare.c -o picksquare.o
player.o: player.c global.h player.h
	$(CC) $(CFLAGS) -c player.c -o player.o
preferences.o: preferences.c global.h preferences.h menu.h draw.h texture.h game.h player.h models.h engine.h picksquare.h
	$(CC) $(CFLAGS) -c preferences.c -o preferences.o
san.o: san.c san.h global.h engine.h
	$(CC) $(CFLAGS) -c san.c -o san.o
splash.o: splash.c global.h splash.h interface.h
	$(CC) $(CFLAGS) -c splash.c -o splash.o
texture.o: texture.c global.h texture.h image.h
	$(CC) $(CFLAGS) -c texture.c -o texture.o

clean:
	rm -f *.o *~ .\#* glchess
