#!/usr/bin/make -f
export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

%:
	dh $@ --buildsystem=cmake

override_dh_auto_clean:

	dh_quilt_unpatch

	rm -f debian/topfd.1
	rm -f debian/toppic.1
	rm -f debian/topmg.1
	rm -f debian/topdiff.1

	rm -rf obj-x86_64-linux-gnu

	dh_clean


override_dh_auto_configure:

	dh_quilt_patch

	rst2man debian/topfd.1.rst > debian/topfd.1
	rst2man debian/toppic.1.rst > debian/toppic.1
	rst2man debian/topmg.1.rst > debian/topmg.1
	rst2man debian/topdiff.1.rst > debian/topdiff.1

	dh_auto_configure -- \
		-DCMAKE_BUILD_TYPE=Release

override_dh_dwz:
	echo "Skipping dh_dwz because of Unknown debugging section .debug_addr error."
	# dh_dwz --no-dwz-multifile
