#! /usr/bin/make -f

# For reproducible builds
export LC_ALL=C.UTF-8
export LANG=C.UTF-8

export PYBUILD_NAME=click-man

%:
	dh $@ --buildsystem=pybuild

# Move the command line interfaces to their own package.
override_dh_install:
	mkdir -p debian/click-man/usr/bin
	mv debian/python3-click-man/usr/bin/* debian/click-man/usr/bin

# Use it on itself.
# It normally includes a datestamp, so we replace that.
override_dh_installman:
	mkdir -p debian/tmp/manpages
	PYTHONPATH=$$(pwd) python3 debian/gen-own-manpages.py $$(dpkg-parsechangelog --show-field version)
	sed -i 's/^[.]TH.*/.TH CLICK-MAN 1/' debian/tmp/manpages/click-man.1
	dh_installman -O--buildsystem=pybuild
