#!/usr/bin/make -f

.PHONY: clean
clean:
	dh_clean
	rm -rf build *.egg-info/ debian/*.[1-9]
	find -name '*.py[co]' -delete

.PHONY: build build-arch build-indep
build build-indep:
	dh_testdir
	set -ex; \
	for python in $(shell pyversions -r); do \
		$$python setup.py build; \
	done
	rst2man debian/greekocr4gamera.rst > debian/greekocr4gamera.1

.PHONY: binary binary-arch binary-indep
binary binary-indep: build-indep
	dh_testdir
	dh_testroot
	dh_prep
	for python in $(shell pyversions -r); do \
		$$python setup.py install --prefix=/usr --root=debian/python-gamera.toolkits.greekocr/; \
	done
	cd debian/*/usr/bin/ && \
		rename.ul '.py' '' greekocr4gamera.py && \
		sed -i -e '1s,^#!.*,#!/usr/bin/python,' greekocr4gamera
	dh_installdocs
	cd debian/*/usr/share/doc/*/html/ && \
		$(CURDIR)/debian/symlink-helper ../src/ .
	dh_installchangelogs
	dh_installman debian/*.[1-9]
	dh_pysupport
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# vim:ts=4 sw=4 noet
