#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYBUILD_NAME = lrcalc

export CFLAGS += -I$(CURDIR)
export LDFLAGS += -L$(CURDIR)/src/.libs

%:
	dh $@ --with python3

execute_after_dh_auto_clean:
	rm -f lrcalc.maple
	rm -rf lrcalc python/lrcalc.c python/*.egg-info python/build .pybuild

override_dh_auto_build:
	ln -sfn src lrcalc
	dh_auto_build
	dh_auto_build --buildsystem=pybuild --sourcedirectory=python

override_dh_auto_test:
	dh_auto_test
	dh_auto_test --buildsystem=pybuild --sourcedirectory=python

override_dh_auto_install:
	dh_auto_install
	dh_auto_install --buildsystem=pybuild --sourcedirectory=python

override_dh_install:
	dh_install
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --exclude-la \
		    --movedev debian/tmp/usr/include/* usr/include \
		    debian/tmp/usr/lib/*/*.so
	find debian -name "lib*.la" -delete
