#!/usr/bin/make -f

DEB_DESTDIR=$(CURDIR)/debian/tmp

PYVER=2.5
PYTHON=python$(PYVER)

build: build-stamp
build-stamp:
	dh_testdir
	$(PYTHON) setup.py build
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	$(PYTHON) setup.py clean
	-rm -f build-stamp
	-rm -rf build dist python_downloadmanager.egg-info
	-rm -f downloadmanager/*.py[co]
	-rm -f *.py[co]
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_installdirs
	$(PYTHON) setup.py install --root=$(DEB_DESTDIR)
	$(PYTHON) -OO -m compileall -d python-downloadmanager $(DEB_DESTDIR)/usr/lib/$(PYTHON)/site-packages/downloadmanager/
	rm -rf $(DEB_DESTDIR)/usr/lib/$(PYTHON)/site-packages/downloadmanager/*.py
	rm -rf $(DEB_DESTDIR)/usr/lib/$(PYTHON)/site-packages/downloadmanager/*.pyc
	dh_install --sourcedir=$(DEB_DESTDIR) --fail-missing

binary: binary-indep binary-arch
binary-indep: install
binary-arch: install
	dh_testdir
	dh_testroot
	dh_strip
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_installchangelogs
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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

