#!/usr/bin/make -f
# -*- makefile -*-

export PYBUILD_NAME = pycodcif
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with python3 --no-parallel

override_dh_auto_install:
	dh_auto_install -- PREFIX=$(CURDIR)/debian/tmp/usr
	dh_auto_install -O--buildsystem=pybuild -- --dir src/components/pycodcif

override_dh_install-arch:
	for TPL in debian/templates/*; \
	do sed -e "s@##DEB_HOST_MULTIARCH##@$(DEB_HOST_MULTIARCH)@g" \
		$${TPL} > debian/$$(basename $${TPL}); \
	done
	rm $(CURDIR)/debian/tmp/usr/bin/cif_parse_old_star doc/man/cif_parse_old_star.1
	dh_install
	rm -rf $(CURDIR)/debian/cod-tools/usr/share/perl5/COD/CIF/Parser
	rm $(CURDIR)/debian/cod-tools/usr/share/perl5/COD/Precision.pm
	rm $(CURDIR)/debian/cod-tools/usr/share/perl5/COD/UserMessage.pm

override_dh_installchangelogs:
	dh_installchangelogs CHANGELOG

override_dh_clean:
	dh_clean
	for TPL in debian/templates/*; \
	do rm -f debian/$$(basename $${TPL}); \
	done
	rm -rf .pybuild
