#!/usr/bin/make -f

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

%:
	dh $@ --with python3

override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_INSTALL_LIBDIR="lib/${DEB_HOST_MULTIARCH}/bear"

override_dh_auto_test:
	# The tests fail if /usr/lib/ccache is in PATH so we remove it here. The tests
	# do not fail if CC or CXX are set to use ccache.
	PATH=$(shell echo $$PATH | \
		sed -e 's;:/usr/lib/ccache/\?;;' \
			-e 's;^/usr/lib/ccache/\?;;') \
		dh_auto_test

override_dh_auto_install:
	dh_auto_install
	# Remove unwanted files.
	rm -rf debian/bear/usr/share/doc/bear

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog.md
