#!/usr/bin/make -f

LDFLAGS+=-Wl,--as-needed
WAF = ./waf
PYVERS=$(shell pyversions -s)

ifeq ($(shell dpkg-query -s doxygen graphviz 1>/dev/null 2>&1 && echo yes),yes)
CONFIGURE_EXTRA_FLAGS += --docs
endif

%:
	dh $@ --with python2

override_dh_auto_configure:
override_dh_auto_build:
override_dh_auto_install:
	for pyver in $(PYVERS); do \
		PYTHON="$$pyver" $(WAF) configure \
				--prefix=/usr \
				--mandir=/usr/share/man \
				--strict \
				--debug \
				--bindings \
				--dyn-manifest \
				$(CONFIGURE_EXTRA_FLAGS) && \
		PYTHON="$$pyver" $(WAF) && \
		PYTHON="$$pyver" $(WAF) install -f --destdir=$(CURDIR)/debian/tmp ; \
	done

override_dh_auto_clean:
	$(WAF) distclean
	rm -rf build .waf*
	dh_auto_clean
