#!/usr/bin/make -f
#export DH_VERBOSE=1

# To tun the test suite kernel needs some module
KCAPI_RNG ?= $(shell grep CONFIG_CRYPTO_USER_API_RNG /boot/config-$(shell uname -r) | cut -f2 -d=)

%:
	dh $@ --parallel

#  --enable-kcapi-test     Compile kcapi test program
#  --enable-kcapi-speed    Compile kcapi-speed test program
#  --enable-kcapi-hasher   Compile hasher application
#  --enable-kcapi-rngapp   Compile rng read application
#  --enable-kcapi-encapp   Compile enc application
#  --enable-kcapi-dgstapp  Compile dgst application

kcapi_tools = \
 --enable-kcapi-rngapp \
 --enable-kcapi-encapp \
 --enable-kcapi-dgstapp

override_dh_auto_configure:
	dh_auto_configure -- $(kcapi_tools)

override_dh_auto_build-indep: 
	dh_auto_build -- html
	dh_auto_build -- man

override_dh_auto_install-indep:
	dh_auto_install -- install-html

# No tests needed for docs
override_dh_auto_test-indep:

override_dh_auto_build-arch: 
	dh_auto_build

override_dh_auto_install-arch:
	dh_auto_install -- install-man

override_dh_auto_test-arch:
ifeq ($(KCAPI_RNG), m)
	# required to be run within 'test' subdir:
	(cd test ; ENABLE_FUZZ_TEST=1 NO_32BIT_TEST=1 ./test-invocation.sh)
endif

get-orig-source:
	uscan --verbose --force-download --rename
