#!/usr/bin/make -f

export DH_VERBOSE = 1

# Enable hardening and unified FAT LTO with throttled limits (matching RPM prjconf)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=+lto
export DEB_CFLAGS_MAINT_APPEND   = -ffat-lto-objects --param=max-inline-insns-auto=100 -flto-partition=max
export DEB_CXXFLAGS_MAINT_APPEND = -ffat-lto-objects --param=max-inline-insns-auto=100 -flto-partition=max
export DEB_LDFLAGS_MAINT_APPEND  = -ffat-lto-objects --param=max-inline-insns-auto=100 -flto-partition=max

%:
	dh $@ --buildsystem=cmake+ninja --builddirectory=build-tde2e

override_dh_auto_configure:
	# Keep TD_ENABLE_LTO=OFF so CMake does not append -fno-fat-lto-objects
	dh_auto_configure --builddirectory=build-tde2e -- \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DBUILD_SHARED_LIBS:BOOL=ON \
		-DTD_E2E_ONLY:BOOL=ON \
		-DTD_ENABLE_LTO:BOOL=OFF \
		-DTD_INSTALL_STATIC_LIBRARIES:BOOL=ON

override_dh_auto_test:
	# Testing disabled for tde2e-only build