#!/usr/bin/make -f

PYVER=2.5
PYGTKVER=2.0

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

d=debian/tmp
d_base=debian/python$(PYVER)-hildon
d_dev=debian/python$(PYVER)-hildon-dev

ifeq ($(DEB_BUILD_ARCH),armel)
   CFLAGS=-Os -mthumb -mfloat-abi=softfp -Wall -Wstrict-prototypes
else
   CFLAGS=-Os -Wall -Wstrict-prototypes
endif

CLEANFILES = hildon.c *.pyo *.lo *.la *.in

build: build-stamp
build-stamp:
	dh_testdir
	CFLAGS="$(CFLAGS)" python$(PYVER) setup.py build
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp 
	CFLAGS="$(CFLAGS)" python$(PYVER) setup.py clean -a
	dh_clean $(CLEANFILES)

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	python$(PYVER) setup.py install --prefix=$(d)/usr --skip-build
	python$(PYVER) -OO -m compileall $(d)/usr/lib

binary-indep: build install
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installman
	dh_install --source=$(d) -v
	dh_link
	dh_strip
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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