#!/usr/bin/make -f

$(foreach line,$(shell sed -n '\
  s/^ gnat, gnat-\([0-9.]\+\),$$/        GNAT_VERSION:=\1 /p;\
  s/^Package: lib[a-z-]\+\([0-9.]\+\)$$/ SOVERSION:=\1    /p;\
  ' debian/control),$(eval $(line)))

DPKG_EXPORT_BUILDFLAGS := 1
DEB_BUILD_MAINT_OPTIONS := hardening=+all
include /usr/share/dpkg/buildflags.mk
include /usr/share/ada/debian_packaging-$(GNAT_VERSION).mk

%:
	dh $@

.PHONY: override_dh_auto_build
override_dh_auto_build:
	dh_auto_build -- \
	  SOVERSION=$(SOVERSION) \
	  GNATMAKE_OPTIONS='$(BUILDER_OPTIONS)'

.PHONY: override_dh_auto_test
override_dh_auto_test:
	dh_auto_test -- \
	  SOVERSION=$(SOVERSION) \
	  GNATMAKE_OPTIONS='$(BUILDER_OPTIONS)'

# Ignore this target from upstream Makefile.
.PHONY: override_dh_auto_install
