#!/usr/bin/make -f
%:
	dh $@ --with phpcomposer,sphinxdoc -X_static/css -X_static/fonts -X_static/js

override_dh_auto_build:
	# Class loader for normal use (shipped)
	phpab   --output lib/OpenCloud/autoload.php \
		--template debian/autoload.php.tpl \
		lib/OpenCloud
	# Class loader for tests (not shipped)
	mkdir --parent vendor
	phpab   --output vendor/autoload.php \
		--template debian/autoload.php.tpl \
		--basedir vendor \
		lib/OpenCloud tests/OpenCloud
	# Build API documentation
	apigen generate \
		--source lib \
		--destination build/api
	# Build user documentation
	$(MAKE) -C doc html latexpdf

override_dh_auto_clean:
	rm -rf build vendor
	dh_auto_clean -O--sourcedirectory=doc

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

override_dh_compress:
	dh_compress -X.pdf

override_dh_installchangelogs:
	dh_installchangelogs $(CURDIR)/debian/upstream-changelog

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