CFLAGS:=-Wall $(shell sdl-config --cflags) \
	$(shell pkg-config glib-2.0 --cflags) -DMAEMO

LDFLAGS:=$(shell sdl-config --libs) \
	$(shell pkg-config glib-2.0 --libs) \
	-lSDL_image -lSDL_mixer

SRC     := board.c graphics.c main.c sge_core.c sound.c
OBJ     := $(patsubst %.c, %.o, $(SRC))

all: gweled
PREFIX:=/opt/maemo/usr

BINDIR=$(DESTDIR)/$(PREFIX)/bin
DATADIR=$(DESTDIR)/$(PREFIX)/share/gweled

install: all
	install -d $(BINDIR)
	install -m 0755 gweled $(BINDIR)
	install -d $(DATADIR)/pixmaps
	install -d $(DATADIR)/sounds
	install -m 0644 sounds/* $(DATADIR)/sounds/
	install -m 0644 pixmaps/* $(DATADIR)/pixmaps
	
install-hildon:	
	install -d $(DESTDIR)/usr/share/icons/hicolor/64x64/apps/
	install -d $(DESTDIR)/usr/share/applications/hildon/
	install -m 0644 icon/* $(DESTDIR)/usr/share/icons/hicolor/64x64/apps/
	cat gweled.desktop.in | sed -e "s|@PREFIX|$(PREFIX)|g" > gweled.desktop
	install -m 0644 gweled.desktop $(DESTDIR)/usr/share/applications/hildon/gweled.desktop

uninstall:

$(OBJ): %.o : %.c
	$(CC) -c $(<) $(I) $(CFLAGS) -DDATADIR=\"$(PREFIX)/share/gweled/\"

gweled:  $(OBJ)
	$(CC) $(CFLAGS) $(LDFLAGS) $(^) -o $(@) 
	strip gweled

clean:
	rm -f *.o gweled
