#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# ROCM_VERSION is required to encode the version that librocm-core returns
CMAKE_FLAGS = \
	-DCMAKE_VERBOSE_MAKEFILE=1 \
	-DCPACK_DEB_COMPONENT_INSTALL=OFF \
	-DCPACK_RPM_COMPONENT_INSTALL=OFF \
	-DDISABLE_CPACK=ON \
	-DROCM_VERSION="$(shell dpkg-parsechangelog -S Version | sed 's/-.*//')"

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_FLAGS)

override_dh_auto_install-arch:
	dh_auto_install
	help2man --no-discard-stderr -S'rdhc' -n'ROCm Deployment Health Check tool' -m'rdhc' -N \
		-o debian/rdhc.1 debian/tmp/usr/bin/rdhc
	sed -i -e 's/Debian/rdhc/g' -e 's/DEBIAN/rdhc/g' debian/rdhc.1
