#!/usr/bin/make -f

#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# UTF-8 locale required for tests
export LC_ALL=C.UTF-8

%:
	dh $@ --with python3

override_dh_auto_build:
	dh_auto_build
	$(MAKE) update-manual

wrong_encoding_files = \
$(CURDIR)/debian/tmp/usr/share/solfege/exercises/standard/lesson-files/barnesanger \
$(CURDIR)/debian/tmp/usr/share/solfege/exercises/standard/lesson-files/progression-atte \
$(CURDIR)/debian/tmp/usr/share/solfege/exercises/standard/lesson-files/volkslieder1 \
$(CURDIR)/debian/tmp/usr/share/solfege/exercises/standard/lesson-files/volkslieder2

override_dh_auto_install:
	dh_auto_install
	for ifile in  $(wrong_encoding_files); do \
	    iconv --from-code=iso-8859-1 --to-code=utf-8 --output=$$ifile $$ifile; \
	done

# Fix #1050524 by using this target instead of override_dh_link,
# because of jdupes behavior change.
execute_after_dh_link-indep:
	jdupes -rl debian/solfege-doc/usr/share/doc
