#!/usr/bin/make -f
%:
	dh $@ --with phpcomposer,sphinxdoc -XREADME.markdown

override_dh_auto_build:
	cd docs && ./bin/generate-docs.sh
	dh_auto_build

override_dh_auto_clean:
	rm -rf docs/build
	dh_auto_clean

override_dh_fixperms:
	dh_fixperms
	chmod -x $(CURDIR)/debian/php-doctrine-orm/usr/bin/doctrine.php \
		$(CURDIR)/debian/php-doctrine-orm/usr/share/php/Doctrine/ORM/Tools/Pagination/Paginator.php

override_dh_install:
	mkdir $(CURDIR)/debian/tmp
	cp $(CURDIR)/bin/doctrine-pear.php $(CURDIR)/debian/tmp/doctrine.php
	dh_install --list-missing

override_dh_installchangelogs:
	dh_installchangelogs debian/upstream/changelog

override_dh_installman:
	cd $(CURDIR)/lib && \
		help2man --help-option=\  --no-info \
		--name='Doctrine command line interface' \
		"php $(CURDIR)/bin/doctrine-pear.php" \
		> $(CURDIR)/debian/tmp/doctrine.1
	dh_installman

override_dh_link:
	rm -r debian/doctrine-orm-doc/usr/share/doc/php-doctrine-orm/html/_static/bootstrap
	rm -r debian/doctrine-orm-doc/usr/share/doc/php-doctrine-orm/html/pdf
	dh_link

get-orig-source:
	uscan --force --verbose --rename
