#!/usr/bin/make -f

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh ${@} --with autotools_dev

override_dh_auto_clean:
	[ ! -f config.mak ] || $(MAKE) distclean

	rm -rf doc/html doc/latex

override_dh_auto_configure:
	./configure --prefix=/usr --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --enable-static --disable-opts --disable-strip --with-dvdread=/usr/include/dvdread CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

override_dh_auto_build:
	dh_auto_build

	cd doc && doxygen doxy.conf

override_dh_auto_install:
	dh_auto_install

	# Removing unused files
	rm -f debian/tmp/usr/lib/*/*.la
	rm -rf debian/tmp/usr/share/aclocal

override_dh_install:
	dh_install --fail-missing

override_dh_makeshlibs:
	dh_makeshlibs -s -V "libdvdnav4 (>= 4.2.0+20120524)"

override_dh_strip:
	dh_strip --dbg-package=libdvdnav-dbg

override_dh_builddeb:
	dh_builddeb -- -Zxz -z9
