#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CONFIGURE_OPTS += --enable-debug
endif

ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	CONFIGURE_OPTS += --disable-tests
endif

%:
	dh $@

override_dh_auto_configure:
	@echo 'blhc: ignore-line-regexp: .+[/ ](tap\.c|open\.cpp).*'
	dh_auto_configure -- \
		--includedir="\$${prefix}/include/$(DEB_HOST_MULTIARCH)" \
		$(CONFIGURE_OPTS)

override_dh_auto_build:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	# build manpages; these are included in tarballs but we regenerate them
	dev-bin/make-man-pages.pl
endif
	dh_auto_build

override_dh_installchangelogs:
	dh_installchangelogs Changes.md
