#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export WITH_DYNAMIC_LIBS = 1
export VIRTUALSMARTCARD_DIR=$(CURDIR)/virtualsmartcard
export PSCSRELAY_DIR=$(CURDIR)/pcsc-relay
# Uncomment this to turn on verbose mode.
DH_VERBOSE=1

# here, the python library is built using autoconf/automake build system. Thus, autoreconf buildsystem is forced.
%:
	dh $@ --with autoreconf,python3 --buildsystem=autoconf --sourcedirectory=$(CURDIR)/virtualsmartcard

# adding custom options at configure step
override_dh_autoreconf:
	dh_autoreconf $(CURDIR)/debian/autogen.sh

override_dh_auto_configure:
	dh_auto_configure --sourcedirectory=$(CURDIR)/virtualsmartcard -- --enable-serialconfdir=/etc/reader.conf.d --enable-serialdropdir=/usr/lib/pcsc/drivers/serial


override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3

# this target is to be executed out of automatic compilation steps. The output, vicc.1
# has to be keeped in the git repository
genman:
	go-md2man -in debian/vicc.1.md -out debian/vicc.1
	go-md2man -in debian/vpcd-config.1.md -out debian/vpcd-config.1
	echo "*** This target should not be executed automatically ***"
	echo "*** as a consequence, it always return an error      ***"
	echo "*** be sure to update the man page when the markdown ***"
	echo "*** file is updated                                  ***"
	exit 1
