#!/usr/bin/make -f

%:
	dh $@ --with phpcomposer

override_dh_auto_build:
	# Build Autoload.php for shipping
	phpab \
		--output src/Autoload.php \
		--template debian/Autoload.php.tpl \
		src

override_dh_auto_clean:
	dh_auto_clean
	rm -rf PHPUnit

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	# Build autoload.php for tests
	mkdir --parents vendor
	phpab \
		--output vendor/autoload.php \
		--template debian/autoload.php.tpl \
		tests/_fixture
	# Workaround to ensure the local class takes precedence
	mkdir --parents PHPUnit/Framework
	ln -s ../../src PHPUnit/Framework/MockObject
	# Actually run the tests
	phpunit
else
	@echo "** tests disabled"
endif

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