#!/usr/bin/make -f

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

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

LDFLAGS += -Wl,-z,defs,--as-needed

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

%:
	dh $@ --with autoreconf

# gettext version too old
override_dh_autoreconf:
	dh_autoreconf --exclude=mkinstalldirs

override_dh_auto_configure:
	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

override_dh_compress:
	dh_compress -XFAQ -XREADME
