#!/usr/bin/make -f

# Enable compiler hardening flags.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
    DEBUG = --enable-debug
else
    DEBUG =
endif

%:
	dh $@ --parallel --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- $(DEBUG)

override_dh_auto_test:
	dh_auto_test -- SAMLTEST_SKIP_NETWORKED=1 SAMLTEST_DATA=../samltest/data

docdir = debian/tmp/usr/share/doc/opensaml-*
override_dh_install:
	cd $(docdir) && \
	    rm README.txt LICENSE.txt NOTICE.txt LOG4CPP.LICENSE
	# The tag file is unreproducible (it captures the full build path),
	# but is used as a "stamp" file during the build.
	cd $(docdir) && rm -f api/opensaml.tag api/html/*.md5 api/html/*.map
	dh_install --fail-missing

override_dh_installdocs:
	dh_installdocs -A doc/NOTICE.txt doc/README.txt
