#!/usr/bin/make -f

PKGFILES = pkg/*.service pkg/*.upstart pkg/*.logrotate
SALT_BIN = common minion master syndic

%:
	make -C doc html
	make -C doc man && cp -p doc/_build/man/* doc/man
	cp $(PKGFILES) debian
	for d in $(SALT_BIN); do \
	    cp pkg/salt.postrm debian/salt-$${d}.postrm; done
	dh $@ 

dh_override_auto_build:
	python setup.py build

override_dh_installdeb:
	dh_installdeb
	find . -type f -regex .*/usr/bin/.* -exec sed -i -e 's/^\(#!\/usr\/bin\/\)env \(python\)$$/\1\2/' {} \;
