#
# MTetrinet
#

APP = mtetrinet
PREFIX = /usr/local

PKGS = gtk+-2.0 gconf-2.0

OBJS = gtk.o misc.o sockets.o tetrinet.o tetris.o

DEFS = -DPACKAGE=\"$(APP)\" -DHAVE_IPV6 -Dmain=tmain -Dfprintf=tfprintf
CFLAGS = -Wall -O2 $(DEFS) `pkg-config --cflags $(PKGS)`
LDFLAGS = `pkg-config --libs $(PKGS)`

all: $(APP)

version.h: debian/changelog
	awk '!/^$$/ { print "#define VERSION \"" $$2 "\"";exit }' $< | tr -d \(\) > $@

%.o: %.c
	gcc $(CFLAGS) -o $@ -c $<

$(APP): $(OBJS)
	gcc $(LDFLAGS) -o $@ $(OBJS)

clean:
	rm -f mtetrinet *.o *~ \#*\# */*~ version.h

dep: version.h
	makedepend -Y *.c
# DO NOT DELETE

gtk.o: io.h tetrinet.h tetris.h misc.h version.h
misc.o: misc.h
sockets.o: sockets.h tetrinet.h
tetrinet.o: tetrinet.h io.h server.h sockets.h tetris.h version.h
tetris.o: tetrinet.h tetris.h io.h sockets.h
