#!/usr/bin/make -f
# -*- makefile -*-

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

# To enable all, uncomment following line
export DEB_BUILD_MAINT_OPTIONS  = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic -g -pipe $(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),-O0,-O2)
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs -Wl,--as-needed

export SHELL = /bin/sh
export CONFIG_SHELL = ${SHELL}
%:
	dh $@ --with autoreconf,python3

override_dh_auto_configure:
	dh_auto_configure -- \
		--libexecdir=/usr/lib/dnssec-trigger \
		--with-ssl \
		--with-python=/usr/bin/python3 \
		--with-hooks=networkmanager \
		--with-gui=gtk \
		--with-unitdir=$(shell pkgconf --variable=systemdsystemunitdir systemd) \
		--with-rundir=/run \
		--with-keydir=/etc/dnssec-trigger \
		--with-pidfile=/run/dnssec-triggerd.pid \
		--with-unbound-control=/usr/sbin/unbound-control \
		--with-forward-zones-support

override_dh_auto_install:
	dh_auto_install
	find $(CURDIR) -type d -empty -delete

override_dh_installinit:
	dh_installinit --name=dnssec-triggerd

override_dh_auto_clean:
	dh_auto_clean
	-rm test/json-test test/other-test
