#!/usr/bin/make -f

#export DH_VERBOSE=1
export PYBUILD_NAME=ufl
export PYBUILD_DISABLE=test
#export PYBUILD_TEST_ARGS={dir}/test
#export PYBUILD_TEST_PYTEST=1

DEB_DESTDIR = $(CURDIR)/debian/tmp
USCAN_DESTDIR := $(CURDIR)

PY3VER_DEFAULT := $(shell py3versions -dv)

%:
	dh $@ --with sphinxdoc --buildsystem=pybuild

execute_after_dh_clean:
	rm -rf *.egg-info
	rm -rf doc/sphinx/source/api-doc

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
execute_after_dh_auto_clean:
	$(MAKE) -C doc/sphinx clean

execute_after_dh_auto_install:
	PYTHONPATH=$(CURDIR)/debian/python3-ufl/usr/lib/python$(PY3VER_DEFAULT)/dist-packages:${PYTHONPATH} $(MAKE) -C doc/sphinx html
endif

override_dh_compress:
	dh_compress -X.py -X.ufl

.PHONY: get-orig-source
get-orig-source:
	uscan --force-download --verbose --destdir $(USCAN_DESTDIR)
