#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

execute_after_dh_auto_build:
	make doxygen-doc

override_dh_auto_configure:
	dh_auto_configure -- --with-python=no BUILD_PYTHON_EXT=false

# kdumpid statically links the binutils-private libbfd/libopcodes (source
# package binutils) and libiberty (source package libiberty), so record them
# in Built-Using on the package that ships kdumpid.
override_dh_gencontrol:
	dh_gencontrol -plibkdumpfile-utils -- \
		-VBuilt-Using="$$(dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W binutils-dev libiberty-dev | sed -e 's/, $$//')"
	dh_gencontrol --remaining-packages

execute_after_dh_install:
	# remove examples. While we want to make sure they compile,
	# the binaries should not be shipped
	# list individually so we don't accidentally remove an actual
	# binary in the future
	rm debian/tmp/usr/bin/dumpattr
	rm debian/tmp/usr/bin/listxendoms
	rm debian/tmp/usr/bin/showxlat
	# we can't just pass `--disable-static` to dh_auto_configure
	# as those are needed to compile tests
	rm debian/tmp/usr/lib/*/lib*.a
	rm debian/tmp/usr/lib/*/lib*.la
