#!/usr/bin/make -f

BUILT_FILES := scripts/xdg-*.in scripts/man/*.1 scripts/README

%:
	dh $@

override_dh_auto_build:
	set -e; for i in $(BUILT_FILES); do \
		f=$${i%.in}; \
		if [ -e $$f ] && ! [ -e $$f.build-orig ]; then \
			mv $$f $$f.build-orig; \
		fi; \
	done
	cd scripts && LC_ALL=C.UTF-8 make scripts man

override_dh_auto_clean:
	dh_auto_clean
	set -e; for i in $(BUILT_FILES); do \
		f=$${i%.in}; \
		if [ -e $$f.build-orig ]; then \
			mv $$f.build-orig $$f; \
		fi; \
	done
	rm -f scripts/html/index.html

# Use automatic tests that don't require a user action
override_dh_auto_test:
	make autotest

# Specify the upstream changelog
override_dh_installchangelogs:
	dh_installchangelogs ChangeLog
