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

#export DH_VERBOSE=1

%:
	dh $@ --with python2,sphinxdoc

override_dh_auto_build-indep:
	dh_auto_build --indep
	$(MAKE) -C doc/api html
	mv doc/api/build/html doc/api/build/api
	$(MAKE) -C doc/web html

override_dh_sphinxdoc:
	dh_sphinxdoc || :

override_dh_python2:
	dh_python2
	# ugly hack because:
	# < POX> looks like doko bumped the minimum dependency because pycompile wasn't
	#        propagating python's py_compile exit status
	# and yet it works just fine on squeeze…
	sed -i 's/2\.6\.6-7~/2.6.6-3~/' debian/vmm.substvars

override_dh_installdocs:
	dh_installdocs
	mv debian/vmm/usr/share/doc/vmm/INSTALL \
	   debian/vmm/usr/share/doc/vmm/HOWTO

override_dh_fixperms:
	dh_fixperms
	chmod -R o=,g=rX,u=rwX debian/vmm/etc/vmm

override_dh_compress:
	dh_compress -X.pgsql -X.cf -X.py
	# dh_compress seems to give precedence to -X, so we must manually
	# compress the following manpage, whose name matches the second
	# exclusion pattern:
	gzip -9 debian/vmm/usr/share/man/man5/vmm.cfg.5

override_dh_clean:
	dh_clean
	$(MAKE) -C doc/api clean
	$(MAKE) -C doc/web clean
	python setup.py clean
	rm -rf VirtualMailManager.egg-info
