#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

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

CHANGELOG_DATE ?= $(shell LC_ALL=C date -u -d @$(SOURCE_DATE_EPOCH) +"%d %B %Y")

multiarch = $(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	$(RM) config.nice test/atconfig
	$(RM) debian/man/*.1

override_dh_auto_test:
#ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
#	sctp_exclude_list="-x testsctp"; \
#	lib/core/test/testcore $$sctp_exclude_list || exit
#endif

override_dh_installman:
	cd debian/man ; CHANGELOG_DATE="$(CHANGELOG_DATE)" ./genmanpages.sh
	dh_installman

# do not generate ldconfig trigger for nextepc-core
override_dh_makeshlibs:
	dh_makeshlibs -n

override_dh_installsystemd:
	dh_installsystemd --no-enable --no-start

override_dh_auto_install:
	dh_auto_install
	$(RM) debian/tmp/usr/lib/nextepc/freeDiameter/*.la
	$(RM) debian/tmp/usr/lib/nextepc/*.la
