#!/usr/bin/make -f

# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.
#export DH_VERBOSE = 1


# See FEATURE AREAS in dpkg-buildflags(1).
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Output every command that modifies files on the build system for debugging
# export DH_VERBOSE = 1

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# See ENVIRONMENT in dpkg-buildflags(1).
# Package maintainers to append CFLAGS.
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# Package maintainers to append LDFLAGS.
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


# Ensure the build system is refreshed to handle generated source files
%:
	dh $@ --with autoreconf


# dh_make generated override targets.
# This is an example for Cmake (see <https://bugs.debian.org/641051>).
#override_dh_auto_configure:
#	dh_auto_configure -- \
#	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

# Fix: Enable maintainer mode to ensure enums.c and enums.h are generated
override_dh_auto_configure:
	dh_auto_configure -- --enable-maintainer-mode

override_dh_install:
	# Remove libtool archive files before installation
	find debian/tmp -name '*.la' -delete
	dh_install
	# Modern way to check for uninstalled files in compat 12+
	dh_missing --fail-missing

override_dh_makeshlibs:
	# Skip making shlibs for internal plugins
	dh_makeshlibs -X/xfdashboard/plugins/