#
# Copyright (C) 2010 Till Harbaum <till@harbaum.org>.
#
# This file is part of NeHeGLES.
#
# NeHeGLES is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NeHeGLES is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NeHeGLES.  If not, see <http://www.gnu.org/licenses/>.
#

APP = nehegles
prefix = /usr/local
datarootdir = /opt
datadir = /opt
EXTRA_OBJS = @EXTRA_OBJS@
VERSION = $${VERSION_PREFIX}1.0$${VERSION_SUFFIX}
MAEMO_VERSION_MAJOR = 5

bindir = ${exec_prefix}/bin

OBJS = main.o misc.o about.o menu.o icon.o list.o

DEFS = -DVERSION=\"$(VERSION)\" -DPREFIX=\"$(prefix)\" -DDATADIR=\"$(datadir)/$(APP)/\" -DAPP=\"$(APP)\"
CFLAGS = -Wall -O2 $(DEFS) -g -O2 -I/usr/include/gconf/2 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include    -DUSE_MAEMO -DMAEMO_CHANGES -DMAEMO_GTK -I/usr/include/hildon-1 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -I/usr/include/dbus-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/dbus-1.0/include   -DENABLE_BROWSER_INTERFACE -DMAEMO_VERSION=\"5.0-beta\" -DMAEMO_VERSION_MAJOR=5
LDFLAGS =  -lgconf-2 -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0   -lhildon-1 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0   -losso -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lglib-2.0   

all: $(APP)

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

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

install:
	install -d $(DESTDIR)$(prefix)$(bindir)
	if [ "$(MAEMO_VERSION_MAJOR)" == "5" ]; then \
		echo "Optifying binary"; \
		install -d $(DESTDIR)$(datadir)/$(APP); \
		install $(APP) $(DESTDIR)$(datadir)/$(APP)/$(APP).bin; \
		ln -s $(datadir)/$(APP)/$(APP).bin $(DESTDIR)$(prefix)$(bindir)/$(APP); \
	else \
		echo "Not Optifying binary"; \
		install $(APP) $(DESTDIR)$(prefix)$(bindir); \
	fi

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

dep:
	makedepend -Y -fMakefile.in *.c

# DO NOT DELETE

about.o: config.h misc.h icon.h about.h
icon.o: icon.h misc.h
list.o: config.h list.h
main.o: config.h menu.h
menu.o: config.h about.h
misc.o: config.h misc.h
