#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DPKG_EXPORT_BUILDFLAGS := 1
DEB_BUILD_MAINT_OPTIONS := hardening=+all
DEB_LDFLAGS_MAINT_APPEND := \
  -Wl,--no-allow-shlib-undefined \
  -Wl,--no-copy-dt-needed-entries \
  -Wl,--no-undefined
include /usr/share/dpkg/buildflags.mk
include /usr/share/ada/packaging.mk

%:
	dh $@

# Ignore or replace upstream build system.
.PHONY: $(addprefix override_dh_auto_,configure build test install clean)

project := -Pdebian/adacgi.gpr
static :=
shared := -Xsoversion=$(adacgi_SO_VERSION)

override_dh_auto_build:
	gprbuild $(project) $(static) -p $(GPRBUILDFLAGS)
	gprbuild $(project) $(shared) -p $(GPRBUILDFLAGS)

override_dh_auto_install:
	gprinstall $(project) $(static) $(static_GPRINSTALLFLAGS)
	gprinstall $(project) $(shared) $(call shared_GPRINSTALLFLAGS,adacgi)

.PHONY: override_dh_installchangelogs
override_dh_installchangelogs:
	dh_installchangelogs debian/upstream_changelog.txt
