#!/usr/bin/make -f

export DEB_LDFLAGS_MAINT_APPEND += -Wl,-z,defs -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

# Unfortunately dh does not play well with having a directory named "build" in
# the top level source directory. Trying to create a phony target named "build"
# in this rules file confuses dh in certain situations. Workaround this by
# reimplementing all the build targets manually.
.PHONY: build build-arch build-indep
build: build-arch build-indep
build-arch: debian/build-arch-stamp
build-indep: debian/build-indep-stamp

debian/configure-stamp:
	dh_testdir
	dh_autoreconf
	dh_auto_configure -- \
		--disable-samples \
		--enable-reuseaddr \
		--without-documentation
	touch $@

debian/build-arch-stamp: debian/configure-stamp
	dh_auto_build
	# Tests disabled because they access the network.
	touch $@

debian/build-indep-stamp: debian/configure-stamp
	doxygen Doxyfile
	touch $@

override_dh_auto_install-indep:

override_dh_install:
	dh_install -X.md5 -X.map
