#
# Copyright (C) 2009-2010 Till Harbaum <till@harbaum.org>.
#
# This file is part of Maep.
#
# Maep 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.
#
# Maep 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 Maep.  If not, see <http://www.gnu.org/licenses/>.
#

APP = maep
prefix = /usr
datarootdir = ${prefix}/share
datadir = ${prefix}/share
EXTRA_OBJS =  converter.o osm-gps-map.o osm-gps-map-osd-classic.o
VERSION = $${VERSION_PREFIX}1.3.4$${VERSION_SUFFIX}
MAEMO_VERSION_MAJOR = 

bindir = ${exec_prefix}/bin

OBJS = main.o menu.o gps.o misc.o icon.o about.o track.o net_io.o geonames.o graph.o hxm.o $(EXTRA_OBJS) 

DEFS = -DVERSION=\"$(VERSION)\" -DPREFIX=\"$(prefix)\" -DDATADIR=\"$(datadir)/$(APP)/\" -DAPP=\"$(APP)\"
CFLAGS = -Wall -O2 $(DEFS) -g -O2   -pthread -DORBIT2=1 -I/usr/include/gnome-vfs-2.0 -I/usr/include/gnome-vfs-module-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -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   -I/usr/include/libxml2   -pthread -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -DORBIT2=1 -pthread -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -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     -D_REENTRANT -pthread -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/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -DORBIT2=1 -pthread -I/usr/include/libgnome-2.0 -I/usr/include/orbit-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libbonobo-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/bonobo-activation-2.0   -DENABLE_BROWSER_INTERFACE   -DUSE_LIBGPS
LDFLAGS =  -lcurl   -pthread -lgnomevfs-2 -lgconf-2 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0   -lxml2   -pthread -lsoup-2.4 -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0   -lgconf-2 -lglib-2.0   -lbluetooth   -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lcairo -lgio-2.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0   -pthread -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lgmodule-2.0 -lORBit-2 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0   -lgps   

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
converter.o: osm-gps-map-types.h osm-gps-map.h config.h converter.h
gps.o: gps.h track.h osm-gps-map.h config.h
icon.o: icon.h misc.h
main.o: config.h menu.h track.h osm-gps-map.h osm-gps-map-osd-classic.h gps.h
menu.o: config.h about.h track.h osm-gps-map.h
misc.o: config.h misc.h
osm-gps-map.o: config.h converter.h osm-gps-map-types.h osm-gps-map.h
osm-gps-map-osd-classic.o: config.h osm-gps-map.h converter.h
osm-gps-map-osd-classic.o: osm-gps-map-osd-classic.h
track.o: config.h track.h osm-gps-map.h converter.h misc.h
