#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Pull the build flags in as make variables that honour the maint options
# above and export them. A direct `$(shell dpkg-buildflags ...)` would not
# see DEB_BUILD_MAINT_OPTIONS, because make does not export variables to
# $(shell) calls during parsing, which silently dropped bindnow.
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

# Merge CPPFLAGS into CFLAGS because upstream config.mk assigns CPPFLAGS
# with `=` (overriding env), losing _FORTIFY_SOURCE otherwise.
export CFLAGS := $(CFLAGS) $(CPPFLAGS)

%:
	dh $@

# Upstream's `install` target unconditionally strips the binary; suppress
# that so dh_strip can produce a proper -dbgsym package.
override_dh_auto_install:
	dh_auto_install -- PREFIX=/usr STRIP=true
