# No autotools madness here. Just a simple Makefile to satisfy dpkg-buildpackage


NAME=maemo-pan

# installation destination
LIBDIR=/usr/lib/${NAME}

# files to copy into destination
EXEC_FILES=pan-daemon pan-control
INIT_FILE=maemo-pan



_LIBDIR=${DESTDIR}${LIBDIR}
_SYSVINITDIR=${DESTDIR}/etc/init.d


all:
	glib-genmarshal --prefix=marshal marshal.list --header >marshal.h
	glib-genmarshal --prefix=marshal marshal.list --body   >marshal.c
	gcc -Os -o pan-daemon pan-daemon.c marshal.c \
	       `pkg-config glib-2.0 dbus-1 dbus-glib-1 --cflags --libs`    

clean:
	@true

install-lib:
	mkdir -p ${_LIBDIR}
	cp -r ${EXEC_FILES} ${_LIBDIR}
	find ${_LIBDIR} -name ".svn" -exec rm -rf "{}" \; ; true
	find ${_LIBDIR} -name "*~" -exec rm -f "{}" \; ; true
	find ${_LIBDIR} -name "*.pyc" -exec rm -f "{}" \; ; true
	chmod a+x ${_LIBDIR}/pan-daemon ${_LIBDIR}/pan-control
	
install-sysvinit:
	mkdir -p ${_SYSVINITDIR}
	cp ${INIT_FILE} ${_SYSVINITDIR}
	chmod a+x ${_SYSVINITDIR}/${INIT_FILE}

install: install-lib install-sysvinit
	@true
