#!/usr/bin/make -f

CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS   := $(shell dpkg-buildflags --get CFLAGS)
LDFLAGS  := $(shell dpkg-buildflags --get LDFLAGS)
export CPPFLAGS CFLAGS LDFLAGS

%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	./configure CFLAGS="-Wall ${CFLAGS}" LDFLAGS="${LDFLAGS}" \
			--disable-silent-rules \
			--prefix=/usr \
			--sysconfdir=/etc \
			--localstatedir=/var/lib

override_dh_auto_install:
	dh_auto_install
	# Assign 'setuid' flag; see README.Debian
	chmod 04755 debian/rush/usr/sbin/rush

override_dh_fixperms:
	# Do not reset the manually set 'setuid' flag!
	dh_fixperms --exclude usr/sbin/rush
