#! /usr/bin/make -f
#
# debian/rules
# Part of Debian ‘xkcdpass’ package.
#
# This is free software, and you are welcome to redistribute it under
# certain conditions; see the end of this file for copyright
# information, grant of license, and disclaimer of warranty.

DOCUMENTATION_DIR = debian
MANPAGE_SUFFIX = .1
TEMPFILE_SUFFIX = .tmp
manpage_names = xkcdpass
.INTERMEDIATE: ${DOCUMENTATION_DIR}/*${MANPAGE_SUFFIX}${TEMPFILE_SUFFIX}

manpage_paths = $(addprefix ${DOCUMENTATION_DIR}/,${manpage_names})
manpages = $(addsuffix ${MANPAGE_SUFFIX},${manpage_paths})
GENERATED_FILES += ${DOCUMENTATION_DIR}/*${MANPAGE_SUFFIX}

MAIN_PYTHON_PACKAGE = xkcdpass
export PYBUILD_NAME = ${MAIN_PYTHON_PACKAGE}

# Send HTTP traffic to the “discard” service during packaging actions.
export http_proxy = http://127.0.1.1:9/
export https_proxy = ${http_proxy}

RST_SUFFIX = .txt

RST2MAN = rst2man


%:
	dh $@ --with bash-completion,python3 --buildsystem=pybuild


.PHONY: override_dh_auto_build
override_dh_auto_build: ${manpages}
	dh_auto_build

%.1: %.1${RST_SUFFIX}
	$(RST2MAN) $< > $@${TEMPFILE_SUFFIX}
	cat debian/manpage_encoding_declaration.UTF-8 $@${TEMPFILE_SUFFIX} > $@


.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	dh_auto_clean
	$(RM) -r ${GENERATED_FILES}


# Copyright © 2010–2024 Ben Finney <bignose@debian.org>
#
# This is free software: you may copy, modify, and/or distribute this work
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; version 3 of that license or any later version.
# No warranty expressed or implied.


# Local variables:
# coding: utf-8
# mode: makefile
# End:
# vim: fileencoding=utf-8 filetype=make :
