#!/usr/bin/make -f

# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS := hardening=+all

include /usr/share/dpkg/pkg-info.mk
VERSION_UPSTREAM = $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -e 's/\+[^+]*//')
export SETUPTOOLS_SCM_PRETEND_VERSION = $(VERSION_UPSTREAM)

# afdko's bundled C sources declare "typedef char bool", which GCC >= 15
# rejects because bool is a keyword from C23 onwards (default language level).
# Build the C code as gnu17 so the historical typedef is still valid.
# GCC >= 14 also promotes some former warnings to errors by default (e.g. the
# benign uint16_t*/unsigned char* mismatch in t1write.c); keep them as warnings.
export XFLAGS=$(shell dpkg-buildflags --get CFLAGS; dpkg-buildflags --get CPPFLAGS; dpkg-buildflags --get LDFLAGS) -std=gnu17 -Wno-error=incompatible-pointer-types

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_clean:
	-dh_auto_clean
