#!/usr/bin/make -f

UPSTREAM := $(shell head -1 debian/changelog | sed 's/.*(//;s/-.?*).*//')

%:
	dh $@ --with phpcomposer

override_dh_auto_build:
	cp -a phpdox.php phpdox
	sed -i s/%development%/$(UPSTREAM)/ phpdox

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	phpunit
else
	echo "** tests disabled"
endif

override_dh_installchangelogs:
	dh_installchangelogs -k README.markdown

override_dh_installman:
	mkdir debian/tmp
	cd debian/phpdox/usr/share/php && \
		help2man --no-info \
		--name='phpDox command line interface' \
		../../bin/phpdox \
		> $(CURDIR)/debian/tmp/phpdox.1
	dh_installman
