#!/usr/bin/make -f

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

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

# default is first version
DEFAULTPY=$(shell pyversions -v -d)
PYVERSIONS=$(shell pyversions -v -r)
ALLPY=$(PYVERSIONS:%=%-dbg) $(PYVERSIONS)

CMAKE_PARAMS=-DBUILD_SHARED_LIBS=ON

%:
	dh $@ --with python2

override_dh_strip:
	dh_strip --dbg-package=libgammu-dbg

override_dh_auto_configure-%:
	dh_auto_configure -S cmake -B build-$* -- \
		$(CMAKE_PARAMS) \
		-DBUILD_PYTHON=/usr/bin/python$*

override_dh_auto_configure: $(ALLPY:%=override_dh_auto_configure-%)

override_dh_auto_build-%:
	dh_auto_build -S cmake -B build-$* -- all manual-html
	rm -rf build-$*/docs/manual/html/.doctrees

override_dh_auto_build: $(ALLPY:%=override_dh_auto_build-%)

override_dh_auto_test-%:
	dh_auto_test -S cmake -B build-$* -- ARGS+="-V -E py-setdiverts"

override_dh_auto_test: $(ALLPY:%=override_dh_auto_test-%)

override_dh_auto_install-%:
	dh_auto_install -S cmake -B build-$*

override_dh_auto_install: $(ALLPY:%=override_dh_auto_install-%)

override_dh_compress:
	dh_compress -X.js -Xobjects.inv -X.txt -X.py

override_dh_auto_clean:
	rm -rf build-*

override_dh_makeshlibs:
	dh_makeshlibs -V
