#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DH_VERBOSE = 1

DEB_BUILD_MAINT_OPTIONS := hardening=+all
DPKG_EXPORT_BUILDFLAGS := 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/ada/packaging.mk

%:
	dh $@

# The -m gprbuild flag prevents a lot of unneeded compilations.
# TODO: forward upstream
make_args := \
  datadir=/usr/share/whitakers-words \
  GPRBUILD_OPTIONS='$(GPRBUILDFLAGS) -m'

# The dictionaries are generated by executables, so -arch and -indep
# targets almost have the same build-dependencies and there is not
# much point in separating them.
# Moreover, the tests require both the executable and the dictionaries.

override_dh_auto_build: debian/whitakers-words.1
	dh_auto_build -- $(make_args)
	cp --update bin/words bin/whitakers-words

debian/whitakers-words.1: %.1: %.asciidoc
	asciidoctor -b manpage $<

override_dh_auto_test:
	dh_auto_test -- $(make_args)
