#!/usr/bin/make -f

%:
	dh $@ --with python2

LANGUAGES=$(shell find locale/ -maxdepth 1 -mindepth 1 -type d -not -name \.svn -printf "%f ")

override_dh_auto_clean:
	$(MAKE) -C gui/ clean
	dh_auto_clean

override_dh_auto_build:
	$(MAKE) -C gui/ all
	dh_auto_build

override_dh_install:
	dh_install
	chmod -v +x debian/subdownloader/usr/share/pyshared/subdownloader/run.py
	set -e ; for lang in $(LANGUAGES); do \
		localedir=debian/subdownloader/usr/share/locale/$$lang/LC_MESSAGES; \
		dh_installdirs -psubdownloader usr/share/locale/$$lang/LC_MESSAGES; \
		msgfmt --directory=locale $$lang/LC_MESSAGES/subdownloader.po --output-file=$$localedir/subdownloader.mo; \
	done

override_dh_installchangelogs:
	dh_installchangelogs -X ChangeLog
