#!/usr/bin/make -f
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

binaries := $(shell dh_listpackages)

ifneq ($(filter gmpc-data,$(binaries)),)
configure_flags += --with-help
else
configure_flags += --without-help
endif

%:
	dh $@

override_dh_auto_configure:
	find . -name '*.vala' | grep -v '^./.pc' | sed -s 's/vala$$/c/' | xargs rm
	dh_auto_configure \
		-- \
		--disable-unique \
		$(configure_flags) \
		${NULL}
	[ ! -d .pc ] || find .pc -type f -name '*.c' -exec echo '{}' >> po/POTFILES.skip \;

override_dh_clean:
	dh_clean
	rm -f intltool-extract intltool-merge intltool-update config.log

override_dh_auto_clean:
	grep -v '^.pc' po/POTFILES.skip > po/POTFILES.skip.tmp
	mv po/POTFILES.skip.tmp po/POTFILES.skip
	dh_auto_clean

override_dh_missing:
	dh_missing --fail-missing

override_dh_installchangelogs:
	dh_installchangelogs -XChangeLog
