#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PACKAGE := $(shell head -1 $(CURDIR)/debian/changelog | sed 's/^\([^ ]\+\) .*/\1/')
PREFIX := $(CURDIR)/debian/$(PACKAGE)
PYTHON := python2.5

build: build-stamp

build-stamp: 
	dh_testdir
	python setup.py build
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	rm -f *.pyc
	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs
	cp $(CURDIR)/$(PACKAGE).py $(PREFIX)/usr/lib/hildon-desktop/
	cp $(CURDIR)/$(PACKAGE).desktop $(PREFIX)/usr/share/applications/hildon-home/
	cp $(CURDIR)/$(PACKAGE).app.desktop $(PREFIX)/usr/share/applications/hildon/$(PACKAGE).desktop
	cp $(CURDIR)/$(PACKAGE).service $(PREFIX)/usr/share/dbus-1/services/
	cp -r $(CURDIR)/icons $(PREFIX)/usr/share/$(PACKAGE)/
	cp -r $(CURDIR)/maemo-icons/* $(PREFIX)/usr/share/icons/hicolor/
	cp -r $(CURDIR)/img $(PREFIX)/usr/share/$(PACKAGE)/
	dh_link usr/lib/hildon-desktop/$(PACKAGE).py usr/bin/$(PACKAGE)

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	#dh_installmenu
	#dh_python
	dh_compress
	dh_fixperms
	dh_installdeb
	#dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: build install

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
