#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# Used by autogen to substitute the source package date into man pages
export MAN_PAGE_DATE = $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" +%Y-%m-%d)

#ifeq ($(DEB_BUILD_ARCH_OS),linux)
	OTHER_CONF_OPTS = --enable-systemd
#endif

%:
	dh $@ --with systemd

override_dh_auto_configure:
	dh_auto_configure -- --disable-rpath --disable-silent-rules \
	    --enable-latency-stats \
	    --without-nuttcp-tests --without-docker-tests \
	    $(OTHER_CONF_OPTS)

override_dh_auto_clean:
	dh_auto_clean
	rm -rf src/*-args.c src/*-args.h tests/passwd.out

override_dh_clean:
	# The *-args.[ch].bak files are included in the source distribution
	dh_clean -X args.c.bak -X args.h.bak

override_dh_auto_test:
	# Most of them need root, actually test them in debci instead
	-dh_auto_test
