#! /usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs -Wl,-O1

VERSION = $(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/.*: //p')

%:
	dh $@

ifeq (, $(filter nocheck, $(DEB_BUILD_OPTIONS)))
CONFFLAGS = -Dtests=enabled
else
CONFFLAGS = -Dtests=disabled
endif

override_dh_auto_configure:
	dh_auto_configure -- \
		-Dgtk_doc=true \
		-Dintrospection=enabled \
		$(CONFFLAGS)

override_dh_makeshlibs:
	dh_makeshlibs -- -c4

override_dh_gencontrol:
	# Ubuntu has an epoch on gudev
	if dpkg-vendor --is ubuntu; then \
		dh_gencontrol -- "-v1:$(VERSION)"; \
	else \
		dh_gencontrol; \
	fi
