#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

DEB_CONFIGURE_EXTRA_FLAGS := \
	--prefix /usr \
	--prefix-lib /usr/lib/$(DEB_HOST_MULTIARCH)/

%:
	dh $@

override_dh_auto_clean:
	[ ! -f Makefile.conf ] || $(MAKE) distclean

override_dh_auto_configure:
	./configure $(DEB_CONFIGURE_EXTRA_FLAGS)

override_dh_install:
	mkdir -p $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/
	cp -f bash_completion $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/muroar
	dh_install
	strip --remove-section=.comment \
		$(CURDIR)/debian/libmuroar-dev/usr/lib/$(DEB_HOST_MULTIARCH)/libmuroar.a

override_dh_strip:
	dh_strip --dbg-package=libmuroar0-dbg
