#!/usr/bin/make -f

DEB_CFLAGS_MAINT_APPEND=-DMULTI_ARCH

# why -DFORCE_PTHREAD_NONVER: see README and
# timetest.c and https://github.com/wolfcw/libfaketime/issues/278
# (FORCE_MONOTONIC_FIX should now be autodetected)
ifneq (,$(filter $(DEB_HOST_ARCH),ppc64el riscv64 x32 loong64))
DEB_CFLAGS_MAINT_APPEND += -DFORCE_PTHREAD_NONVER
endif

DEB_CFLAGS_MAINT_APPEND += -DFAKE_RANDOM -DFAKE_PID

export DEB_CFLAGS_MAINT_APPEND

export DEB_BUILD_MAINT_OPTIONS = hardening=+all abi=-time64

# make sure dh_makeshlibs does not modify post{inst,rm} scripts:
# (avoids lintian's postinst-has-useless-call-to-ldconfig)
override_dh_makeshlibs:
	dh_makeshlibs --noscripts

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test
	$(MAKE) -C test randomtest test_library_constructors test_variable_data
endif

%:
	PREFIX=/usr dh $@
