#!/usr/bin/make -f
PACKAGE = $(shell dh_listpackages|head -n1)
PYTHON2  = $(shell pyversions -r)

# Not to get undefined symbol: dmixml_GetContent
export CFLAGS=${CFLAGS-} -std=gnu89

%:
	dh $@ --with python2

override_dh_auto_clean:
	dh_auto_clean
	$(MAKE) clean

override_dh_auto_build:
	set -e ;\
	for python in $(PYTHON2) ; do \
		$$python src/setup.py build ;\
		$$python-dbg src/setup-dbg.py build ;\
	done

override_dh_auto_install:
	set -e ;\
	for python in $(PYTHON2) ; do \
		$$python     src/setup.py     install --root=debian/$(PACKAGE)     --install-layout=deb ;\
		$$python-dbg src/setup-dbg.py install --root=debian/$(PACKAGE)-dbg --install-layout=deb ;\
	done

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	$(MAKE) -C unit-tests test
endif

override_dh_installdocs:
	dh_installdocs --link-doc=$(PACKAGE)
