#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_VERSION := $(shell dpkg-parsechangelog|egrep '^Version:'|cut -f 2 -d ' ')
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

DEB_CONFIGURE_EXTRA_FLAGS := \
	--cflags "$(CFLAGS)" \
	--prefix /usr \
	--prefix-lib /usr/lib/$(DEB_HOST_MULTIARCH) \
	--without-xmms \
	--without-audacious \
	--without-beta \
	--runtime-detect \
	--link-deps indirect \
	--without-memory-api \
	--oss-dev /dev/dsp \
	--oss-mixer-dev /dev/mixer \
	--proc-net-arp /proc/net/arp \
	--no-ipx \
	--no-yiff \
	--no-celt \
	--no-celt0 \
	--no-slp \
	--distribution-version-string "Debian-$(DEB_VERSION)"

%:
	dh $@

override_dh_auto_configure:
	./configure $(DEB_CONFIGURE_EXTRA_FLAGS)

override_dh_auto_clean:
	dh_clean
	[ ! -f Makefile.conf ] || $(MAKE) -i distclean
	rm -f debian/roaraudio.init
	rm -f debian/roaraudio.default

override_dh_install:
	cp dist/debian-like/roaraudio debian/roaraudio.init
	cp dist/debian-like/defaults debian/roaraudio.default
	dh_install
