#!/usr/bin/make -f

%:
	dh $@ --with quilt

override_dh_auto_configure:
	./configure --prefix=/usr \
	--enable-all --disable-mythnetvision

#	exit 1

override_dh_auto_install-arch:
	for plugin in mytharchive mythbrowser \
	mythgame mythmusic mythnews mythweather \
	mythzoneminder; do \
		$(MAKE) -C $$plugin install INSTALL_ROOT=$(CURDIR)/debian/$$plugin; \
	done

	dh_installdirs -pmythmusic etc/mythtv usr/share/mythtv/sql
	dh_installdirs -pmythweather etc/mythtv

	rm -rf debian/mytharchive/usr/share

override_dh_auto_install-indep:
	$(MAKE) -C mytharchive install INSTALL_ROOT=$(CURDIR)/debian/mytharchive-data

	rm -rf debian/mytharchive-data/usr/bin
	rm -rf debian/mytharchive-data/usr/lib

	chmod 0755 debian/mytharchive-data/usr/share/mythtv/mytharchive/scripts/*

override_dh_installdocs:
	dh_installdocs
	dh_installdocs -pmytharchive mytharchive/TODO mytharchive/README mytharchive/AUTHORS
	dh_installdocs -pmythbrowser mythbrowser/README mythbrowser/AUTHORS
	dh_installdocs -pmythmusic mythmusic/README mythmusic/AUTHORS
	dh_installdocs -pmythnews mythnews/README mythnews/AUTHORS
	dh_installdocs -pmythweather mythweather/README mythweather/AUTHORS
	dh_installdocs -pmythzoneminder mythzoneminder/AUTHORS mythzoneminder/README

	dh_installdocs -pmytharchive-data  mytharchive/TODO mytharchive/README mytharchive/AUTHORS

override_dh_clean:

	[ ! -f Makefile ] || $(MAKE) distclean

	dh_clean Makefile mythconfig.mak config.pro config.log cleanup/Makefile \
	mythmusic/mythmusic/config.h mythmusic/mythmusic/config.pro config.ep \
	mythgallery/dcrawplugin/config.h mythgallery/mythgallery/config.pro \
	mythzoneminder/mythzoneminder.pro mythgame/mythgame/config.h

override_dh_install override_dh_auto_test:
