#!/usr/bin/make -f
export DH_VERBOSE=1
export DH_OPTIONS=-v


%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	mkdir -p build-aux
	aclocal --install
	autoheader
	automake --add-missing
	autoreconf
	dh_auto_configure -- --with-kernel-dir=$(CURDIR)/debian --with-systemdsystemunitdir=/lib/systemd/system/multi-user.target.wants --enable-snmp-keepalived --enable-snmp-rfc --disable-lvs --enable-sha1 --enable-dbus --disable-snmp-reply-v3-for-v2 --enable-json --enable-bfd --with-tmp-dir=/run/keepalived/ --enable-debug
	#--enable-deferred-intf --disable-snmp-reply-v3-for-v2

override_dh_strip:
	dh_strip --dbgsym-migration='keepalived-dbg (<<1.2.24-git66c870aa+vyatta34)'

override_dh_installinit:
	dh_installinit -pkeepalived --no-start --noscripts

override_dh_installsystemd:
	dh_installsystemd -pkeepalived --no-start --no-enable keepalived.service

override_dh_auto_install:
	dh_auto_install
	rm -rf $(DEB_DESTDIR)/etc/keepalived/samples
	rm -rf $(DEB_DESTDIR)/etc/keepalived/keepalived.conf
	rm -rf $(DEB_DESTDIR)/etc/init.d/keepalived.init
	rm -rf $(DEB_DESTDIR)/etc/sysconfig
	rm -rf $(DEB_DESTDIR)/usr/man


pre-build::
	rm -f debian/files

override_dh_auto_clean:
	dh_auto_clean
	-rm config.status
	-rm config.log
