#!/usr/bin/make -f
# see FEATURE AREAS in dpkg-buildflags(1)
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 =

# arm64 only: fec/libfec.a is configured by add_subdirectory(fec) before the
# top-level -fPIE/-pie options are added, so its objects stay position
# dependent while dablin/dablin_gtk are linked as PIE. ld.bfd refuses that on
# arm64 (R_AARCH64_ADR_PREL_PG_HI21 against __stack_chk_guard) and tells us to
# recompile with -fPIC. amd64/loong64 are unaffected and keep their previous
# flags, so the change is restricted to arm64.
ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH),arm64)
override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_POSITION_INDEPENDENT_CODE=ON
endif

%:
	dh $@
