#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

%:
	dh $@ --buildsystem=pybuild

ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
docs = {destdir}/usr/share/python-greenlet-doc/html
PYBUILD_AFTER_CLEAN = rm -rf $(docs)
PYBUILD_AFTER_INSTALL = \
	PYTHONPATH={destdir}/{install_dir} \
	{interpreter} -m sphinx -N -b html {dir}/docs/ $(docs)
export PYBUILD_AFTER_CLEAN PYBUILD_AFTER_INSTALL
endif

execute_after_dh_auto_install:
	find $(CURDIR)/debian/tmp/ -name core -type f -delete

override_dh_compress:
	dh_compress -X.html

.PHONY: override_dh_compress
