#!/usr/bin/make -f

%:
	dh $@ --with python2

binary: binary-arch binary-indep

# build arch-indep files in the binary-indep target to prevent FTBFS on buildd
binary-indep: doc install
	dh $@ --with sphinxdoc

doc:
	make -C faq pdf
	make -C manual all

override_dh_auto_clean:
	make -C faq clean
	make -C manual clean
	rm -rf manual/_build
	cd pyx/data/lfs; rm -f *.lfs *.aux *.log
	dh_auto_clean

override_dh_auto_build:
	cd pyx/data/lfs; python createlfs.py
	dh_auto_build

override_dh_auto_install:
	dh_auto_install
	rm $(CURDIR)/debian/tmp/usr/lib/python2.*/*-packages/pyx/data/lfs/createlfs.*

override_dh_installdocs:
	dh_installdocs -Xobjects.inv

override_dh_compress:
	dh_compress --all -X.pdf

override_dh_fixperms:
	dh_fixperms
	find debian/python-pyx-doc/usr/share/doc/python-pyx-doc/examples/ \
		-type f -print0 | \
		xargs -0r chmod 0644

.PHONY: install doc binary binary-indep doc override_dh_auto_clean override_dh_auto_build override_dh_compress override_dh_installdocs
