#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

# Avoid calculatin differences in timing that make the build
# fail on i386 (see https://bugs.debian.org/981771)
ifneq (,$(filter $(DEB_HOST_ARCH), i386))
    export DEB_CFLAGS_MAINT_APPEND += -ffloat-store
endif

# Used by debian/libndpi-wireshark.{install,links}. Evaluated when referenced.
WIRESHARK_PLUGINDIR = $(shell pkg-config --variable=plugindir wireshark)
export WIRESHARK_PLUGINDIR

%:
	dh $@

override_dh_auto_configure:
	NO_CONFIGURE=1 ./autogen.sh
	dh_auto_configure -- --prefix=/usr

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd tests && LD_LIBRARY_PATH=$(CURDIR)/src/lib ./do.sh
endif

.PHONY: override_dh_auto_configure
