#!/usr/bin/make -f
%:
	dh $@ --with autoreconf

# Plase private libraries in private directory
override_dh_auto_configure:
	dh_auto_configure -- --libdir=/usr/lib/bs1770gain

override_dh_strip:
	dh_strip --dbg-package=bs1770gain-dbg

# Avoid this lintian warning: E: bs1770gain: non-empty-dependency_libs-in-la-file usr/lib/bs1770gain/libffsox-2.la
override_dh_install:
	sed -i "/dependency_libs/ s/'.*'/''/" `find -name '*.la'`
	dh_install

# Hack around the fact that we replace the build system.  Remove the
# old one and recreate an autotools based system.
#
override_dh_autoreconf:
	if [ ! -f configure.orig ] ; then mv configure configure.orig ; fi
	for m in Makefile */Makefile ; do if grep -q config.mak $$m ; then mv $$m $$m.orig; fi; done
	dh_autoreconf
override_dh_autoreconf_clean:
	dh_autoreconf_clean
	if [ -f configure.orig ] ; then cp configure.orig configure; fi
override_dh_auto_clean:
	if [ -f Makefile.am ] && [ -f Makefile ]; then $(MAKE) distclean || true; fi
	#dh_auto_clean
	$(RM) *.in */*.in */*.la
	$(RM) aclocal.m4 ar-lib compile config.guess config.sub depcomp install-sh
	$(RM) libtool ltmain.sh missing
	$(RM) m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4
	for m in Makefile */Makefile ; do if grep -q config.mak $$m.orig ; then cp $$m.orig $$m; fi; done
	$(RM) config.log config.status
	$(RM) */*.lo */*.o bs1770gain/bs1770gain
	$(RM) -r */.libs
