#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

PYVERS=$(shell pyversions -r debian/control)

configure: configure-stamp
configure-stamp:
	dh_testdir
	rm -f configure
	touch configure-stamp

build: configure build-stamp
build-stamp: 
	dh_testdir
	for python in $(PYVERS); do \
		$$python setup.py build ; \
	done
	touch build-stamp

clean: configure
	dh_testdir
	dh_testroot 
	rm -fr *-stamp build
	for python in $(PYVERS); do \
		$$python setup.py clean ; \
	done
	dh_clean

install-arch: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	# psycopg2
	for python in $(PYVERS); \
        do $$python setup.py install --root=$(CURDIR)/debian/python-psycopg2 --no-compile; \
    done

install-indep: build
	# Zope package
	dh_installzope -p zope-psycopgda2 ZPsycopgDA

# Build architecture-independent files here.
binary-indep: build install-indep
	dh_testdir
	dh_testroot
	dh_installdocs -i AUTHORS debian/README.zpsycopgda2
	dh_installchangelogs -i
	dh_link -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install-arch
	dh_testdir
	dh_testroot
	dh_installdocs -a README AUTHORS doc tests
	dh_installchangelogs -a ChangeLog
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a
	dh_pycentral -a
	dh_python -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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