#!/usr/bin/make -f

# pyhotn versions to build against
PYVERS=$(shell pyversions -r)
# get latest python version supported (2.6 for Squeeze, 2.7 for Wheezy)
LASTPYVER := $(shell pyversions -s | sed 's~.*python~~')

%:
	dh $@ --with=python2


override_dh_auto_configure:
override_dh_auto_build:
override_dh_auto_install:
	for pyvers in $(PYVERS) ; do \
	PYTHON="$$pyvers" \
	PKG_CONFIG_PATH="" \
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--libexecdir=/usr/lib \
		--docdir=/usr/share/doc/ldas \
		--datadir=/usr/share \
		--disable-auto-ldcg-inclusion \
		--with-optimization=high \
		--enable-python && \
	$(MAKE) V=1 && \
	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install && \
	$(MAKE) check && \
	$(MAKE) clean ; \
	done
# Remove unwanted files
	dh_install

override_dh_auto_test:

override_dh_shlibdeps:
	echo Using $(LASTPYVER): $(SHLIBDEPS)
	LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(SHLIBDEPS) \
	    dh_shlibdeps
