#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

# Upstream links the EFI stub as a static PIE (-static-pie), which requires
# position-independent objects.  Builds that rely on the toolchain defaulting to
# PIE produce absolute relocations (R_X86_64_32 against .rodata) and the link
# fails; force PIE explicitly.
export CFLAGS := $(CFLAGS) -fPIE

%:
	PREFIX=/usr dh $@

override_dh_clean:
	dh_clean
	sed -e "s,@DEBIAN_VERSION@,$(DEB_VERSION)," \
	    -e "s,@UPSTREAM_VERSION@,$(DEB_VERSION_UPSTREAM)," \
	    debian/sbat.in > debian/sbat
