#!/usr/bin/make -f

DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

%:
	dh $@

override_dh_auto_configure:
	# set OPENVAS_FEED_LOCK_PATH to /var/lib/openvas/feed-update.lock
	# and not to /var/run/...  # because /var/run is created by the gvm
	# services and does not exist when we run greenbone-nvt-sync
	dh_auto_configure -- -DLOCALSTATEDIR=/var -DSYSCONFDIR=/etc -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DOPENVAS_FEED_LOCK_PATH=/var/lib/openvas/feed-update.lock -DOPENVAS_RUN_DIR=/var/run/ospd

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_build:
	dh_auto_build
	if [ -e /usr/include/cgreen/cgreen.h ]; then \
		cd $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE) && make tests; \
	fi

override_dh_auto_test:
	if [ -e /usr/include/cgreen/cgreen.h ]; then \
	    	dh_auto_test; \
	fi
