--- /dev/null
+# Example custom makefile for creating .deb without using dpkg tools.
+#
+# Author: Tim Wegener <twegener@madabar.com>
+#
+# This requires deb_hand.mak
+
+# Sources:
+# SOURCE_DIR - directory containing files to be packaged
+# ICON_SOURCE - 26x26 icon file for maemo
+# description.txt - description with summary on first line
+# preinst, postinst, prerm, postrm - optional control shell scripts
+
+PACKAGE = beats-applet
+VERSION = 0.1
+SECTION = user/other
+PRIORITY = optional
+ARCH = armel
+DEPENDS = python2.5, python2.5-gobject, python2.5-gtk2, python2.5-osso, python2.5-hildon, python2.5-mutagen
+MAINTAINER = Paul Philippov <paul@ppds.ws>
+
+SOURCE_DIR = .
+PACKAGE_DIR ?= ..
+ICON_SOURCE = ${SOURCE_DIR}/beats26.png
+CTRL_EXTRAS ?= ${wildcard preinst postinst prerm postrm}
+
+${PACKAGE_DIR}/data: ${SOURCE_DIR}
+ rm -rf $@
+ mkdir -p $@
+ mkdir -p $@/usr/lib/hildon-desktop
+ cp ${SOURCE_DIR}/beats-applet.py $@/usr/lib/hildon-desktop/
+ mkdir -p ${PACKAGE_DIR}/data/usr/share/applications/hildon-home
+ cp ${SOURCE_DIR}/beats-applet.desktop $@/usr/share/applications/hildon-home/
+ mkdir -p ${PACKAGE_DIR}/data/usr/share/pixmaps
+ cp ${SOURCE_DIR}/beats26.png $@/usr/share/pixmaps/beats.png
+ mkdir -p ${PACKAGE_DIR}/data/usr/share/icons/hicolor/26x26/apps
+ cp ${SOURCE_DIR}/beats26.png $@/usr/share/icons/hicolor/26x26/apps/beats.png
+ mkdir -p ${PACKAGE_DIR}/data/usr/share/icons/hicolor/128x128/apps
+ cp ${SOURCE_DIR}/beats128.png $@/usr/share/icons/hicolor/128x128/apps/beats.png
+ mkdir -p ${PACKAGE_DIR}/data/usr/share/icons/hicolor/scalable/apps
+ cp ${SOURCE_DIR}/beats.svg $@/usr/share/icons/hicolor/scalable/apps
+ mkdir -p ${PACKAGE_DIR}/data/usr/share/beats
+ cp ${SOURCE_DIR}/prefs.glade $@/usr/share/beats/
+
+${PACKAGE_DIR}/control: ${PACKAGE_DIR}/data ${CTRL_EXTRAS} description.txt ${ICON_SOURCE}
+ rm -rf $@
+ mkdir -p $@
+
+ifneq (${CTRL_EXTRAS},)
+ cp ${CTRL_EXTRAS} $@
+endif
+
+ echo "Package: ${PACKAGE}" > $@/control
+ echo "Version: ${VERSION}" >> $@/control
+ echo "Section: ${SECTION}" >> $@/control
+ echo "Priority: ${PRIORITY}" >> $@/control
+ echo "Architecture: ${ARCH}" >> $@/control
+ echo "Depends: ${DEPENDS}" >> $@/control
+ echo "Installed-Size: ${shell du -s ${PACKAGE_DIR}/data | cut -f1}" >> $@/control
+ echo "Maintainer: ${MAINTAINER}" >> $@/control
+ echo -n "Description:" >> $@/control
+ cat description.txt | gawk '{print " "$$0;}' >> $@/control
+
+ifneq (${ICON_SOURCE},)
+ echo "Maemo-Icon-26:" >> $@/control
+ base64 ${ICON_SOURCE} | gawk '{print " "$$0;}' >> $@/control
+endif
+
+ cd ${PACKAGE_DIR}/data && find . -type f -exec md5sum {} \; | sed -e 's| \./||' > $@/md5sums
+
+${PACKAGE_DIR}/debian-binary:
+ echo "2.0" > $@
+
+${PACKAGE_DIR}/build: ${PACKAGE_DIR}/debian-binary ${PACKAGE_DIR}/control
+ rm -rf $@
+ mkdir -p $@
+
+ cp ${PACKAGE_DIR}/debian-binary $@/
+ cd ${PACKAGE_DIR}/control && tar czvf $@/control.tar.gz ./*
+ cd ${PACKAGE_DIR}/data && tar czvf $@/data.tar.gz ./*
+
+${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb: ${PACKAGE_DIR}/build
+ ar -rc $@tmp $</debian-binary $</control.tar.gz $</data.tar.gz
+ sed -e 's|^\([^/]\+\)/ \(.*\)|\1 \2|g' $@tmp > $@fail
+ rm -f $@tmp
+ mv $@fail $@
+
+.PHONY: data
+data: ${PACKAGE_DIR}/data
+
+.PHONY: control
+control: ${PACKAGE_DIR}/control
+
+.PHONY: build
+build: ${PACKAGE_DIR}/build
+
+.PHONY: deb
+deb: ${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb
+
+clobber:
+ rm -rf ${PACKAGE_DIR}/debian_binary ${PACKAGE_DIR}/control ${PACKAGE_DIR}/data ${PACKAGE_DIR}/build