#!/usr/bin/make -f

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


# magic debhelper rule
%:
	dh  --with python2 $@

PYVERS:= `pyversions -s`

override_dh_auto_configure:
	dh_auto_configure -- --enable-pythonmodule --enable-silex --with-qt=/usr --enable-pythonmodule --enable-silex --with-qt-bin=/usr/bin --with-qt-lib=/usr/lib  --with-qt-include=/usr/include/qt4 --with-hdf5=/usr/include,/usr/lib

override_dh_auto_build:
	dh_auto_build
	for p in $(PYVERS) ; do   \
		 dh_auto_configure -- --enable-pythonmodule --enable-silex --with-qt=/usr --enable-pythonmodule --enable-silex --with-qt-bin=/usr/bin --with-qt-lib=/usr/lib  --with-qt-include=/usr/include/qt4 --with-hdf5=/usr/include,/usr/lib PYTHON=$$p ; \
		$(MAKE) -C tools/python; \
		mkdir -p  debian/tmp/usr/lib/pyshared/$$p ;  \
		cp tools/python/.libs/Silo.so debian/Silo.so.$$p  ; \
	done

override_dh_auto_install:
	dh_auto_install
	# move the python modules to where dh_pysupport will spot them ...
	for p in $(PYVERS); do \
		mkdir -p debian/python-silo/usr/lib/$$p/site-packages ; \
		chrpath -d debian/Silo.so.$$p ; \
		cp debian/Silo.so.$$p debian/python-silo/usr/lib/$$p/site-packages/Silo.so ; \
	done

override_dh_auto_clean:
	dh_clean
	rm -f debian/Silo.so.* config.status config.log
	-$(MAKE) -k distclean
