#!/usr/bin/make -f
# A debian/rules file using python-central.

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

export DH_COMPAT=5

PYVERS=$(shell pyversions -vr)

build: build-stamp

build-stamp: $(PYVERS:%=build-python%) build-python-scripts
	touch $@

build-python%:
	python$* setup.py build_py
	touch $@

build-python-scripts:
	python setup.py build_scripts
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f *-stamp
	rm -rf build
	find . -name '*.py[co]' | xargs rm -f
	dh_clean

install: build install-prereq $(PYVERS:%=install-python%) install-python-scripts
	# Script fixing would appear here.

install-prereq:
	dh_testdir
	dh_testroot
	dh_clean -k

install-python%:
	python$* setup.py install_lib --install-dir $(CURDIR)/debian/python-rdfcalendar/usr/lib/python$*/site-packages

install-python-scripts:
	python setup.py install_scripts --install-dir $(CURDIR)/debian/python-rdfcalendar/usr/bin

# Build architecture-independent files here.

binary-indep: install
	tools/apidocs.sh
	dh_testdir -i
	dh_testroot -i
	dh_pycentral -i
	dh_installdocs -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.

binary-arch:
	# Empty rule for this package.

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