#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all reproducible=+all future=+lfs
export DEB_CXXFLAGS_MAINT_APPEND = -fvisibility-inlines-hidden

include /usr/share/dpkg/architecture.mk

ENABLE_TESTING = $(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),OFF,ON)

%:
	dh $@ --buildsystem=cmake --with pkgkde_symbolshelper

override_dh_auto_configure:
	dh_auto_configure --buildsystem=cmake -- \
		-DBUILD_SHARED_LIBS=ON \
		-DHOST_TRIPLET=$(DEB_HOST_MULTIARCH) \
		-DFOONATHAN_MEMORY_BUILD_TESTS=$(ENABLE_TESTING) \
		-DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF \
		-DFOONATHAN_MEMORY_BUILD_TOOLS=ON \
		-DFOONATHAN_MEMORY_SOVERSION=0d

execute_after_dh_auto_build-indep:
	[ -n "$(filter nodoc,$(DEB_BUILD_OPTIONS))" ] || doxygen doc/Doxyfile

execute_after_dh_auto_install:
	rm debian/tmp/usr/share/foonathan_memory/LICENSE \
	   debian/tmp/usr/share/foonathan_memory/README.md \
	   debian/tmp/usr/bin/nodesize_dbg

execute_after_dh_installdocs-indep:
	[ -n "$(filter nodoc,$(DEB_BUILD_OPTIONS))" ] || dh_doxygen
