Here is what I came up with as an extension of Vasiliy's answer. It effectively does what dh_installdeb does but without automatically adding /etc
files. This way you regain full control again over what files are considered conffiles and what are not.
override_dh_installdeb:
dh_installdeb
@echo "Recreating conffiles without auto-adding /etc files"
@for dir in ${CURDIR}/debian/*/DEBIAN; do \
PKG=$$(basename $$(dirname $$dir)); \
FILES=""; \
if [ -f ${CURDIR}/debian/conffiles ]; then \
FILES="${CURDIR}/debian/conffiles"; \
fi; \
if [ -f ${CURDIR}/debian/$${PKG}.conffiles ]; then \
FILES="$$FILES ${CURDIR}/debian/$${PKG}.conffiles"; \
fi; \
if [ -n "$$FILES" ]; then \
cat $$FILES | sort -u > $$dir/conffiles; \
elif [ -f $$dir/conffiles ]; then \
rm $$dir/conffiles; \
fi; \
done
(Of course, use REAL tabs if pasting into your rules file).
This answer uses BASH (or /bin/sh which is either symlinked to BASH or is a variant of it). There may be a way to achieve this by using only makefile internal commands, but I'm not that good with those.
This should work even when building multiple binary packages from the same source and it respects the plain debian/conffiles
as well as the package-specific debian/${pkg}.conffiles
.