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

include /usr/share/dpkg/pkg-info.mk

%:
	dh $@ --buildsystem=pybuild -Ddeveloper

execute_after_dh_auto_build-indep: debian/deken.1

debian/deken.1:
	-help2man -N -n "Externals wrangler for Pure Data" debian/help2man/deken > $@

execute_after_dh_install:
	echo "version = '$(DEB_VERSION)'" > _version.py
	for f in debian/deken/usr/lib/python*/dist-packages/deken*/deken.hy; do cp _version.py "$${f%/*}/"; done
	rm -f _version.py

execute_after_dh_fixperms:
	find debian/deken/ -type f -name "*.hy" -exec chmod a+x {} \;

DEB_COPYRIGHT_CHECK_IGNORE_REGEX = \
	debian/.*|.*\.gif
# licensecheck v1
.PHONY: licensecheck
licensecheck:
	LANG=C.UTF-8 licensecheck \
		-i "^($(DEB_COPYRIGHT_CHECK_IGNORE_REGEX))$$" \
		--check '.*' --recursive --deb-machine --lines 0 * \
		> debian/copyright_newhints
	cmp debian/copyright_hints debian/copyright_newhints \
		&& rm debian/copyright_newhints
