#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS := hardening=+all
DH_AUTO_OPTIONS := -v -Smakefile --parallel
DESTDIR         := $(CURDIR)/debian/$(shell dh_listpackages)

DEB_BUILD_MAINT_OPTIONS := hardening=+all
# C23 (GCC 15 default) no longer emits an external definition for a
# non-static 'inline' function, so levdist.c's 'inline int minimum()'
# is left undefined at link time. Restore GNU89 inline semantics,
# which also emits the out-of-line definition.
DEB_CFLAGS_MAINT_APPEND := $(shell getconf LFS_CFLAGS) -Wall -Wextra -fgnu89-inline
DPKG_EXPORT_BUILDFLAGS  := 1

include /usr/share/dpkg/buildflags.mk

include /usr/share/dpkg/architecture.mk

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
  CC  := $(DEB_HOST_GNU_TYPE)-gcc
else
  CC  := gcc
endif

%:
	dh "$@"

override_dh_auto_build:
	dh_auto_build $(DH_AUTO_OPTIONS) -- \
	                STRIP=: CFLAGS="$(CFLAGS)" CC=$(CC)

override_dh_auto_clean:
	dh_auto_clean $(DH_AUTO_OPTIONS)

override_dh_auto_install:
	dh_auto_install $(DH_AUTO_OPTIONS) --destdir="$(DESTDIR)" -- \
	                STRIP=: CFLAGS="$(CFLAGS)" CC=$(CC)
