#!/usr/bin/make -f
%:
	dh $@

include /usr/share/dpkg/default.mk

override_dh_auto_build:
	phpab --output src/autoload.php src

execute_before_dh_auto_test:
	# Mimic install path for tests
	mkdir --parents vendor
	phpabtpl \
		--require-file ../src/autoload.php \
		--require mikehaertl/php-shellcommand \
		> debian/autoload.tests.php.tpl
	phpab \
		--output vendor/autoload.php \
		--template debian/autoload.tests.php.tpl \
		tests

override_dh_auto_test:
	phpunit --no-coverage

execute_before_dh_installman:
	mkdir --parents $(CURDIR)/debian/tmp
	help2man \
		--help-option=\  \
		--version-string=$(DEB_VERSION_UPSTREAM) \
		--source="html-to-markdown $(DEB_VERSION_UPSTREAM)" \
		--no-info \
		--include=$(CURDIR)/debian/html-to-markdown.1.in \
		"$(CURDIR)/bin/html-to-markdown -h | tail -n+3" \
		> $(CURDIR)/debian/tmp/html-to-markdown.1
