#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

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

Description := $(shell sed -e ':a; N; s/\n/$${Newline}/; ta' < debian/Description)

.PHONY: override_dh_auto_configure
override_dh_auto_configure:
	dh_auto_configure -- OPTIMIZE="$(CPPFLAGS) $(CFLAGS)" LD="$(shell perl -V::ld:) $(LDFLAGS)"

.PHONY: override_dh_gencontrol
override_dh_gencontrol:
	dh_gencontrol -- '-VDescription=$(Description)'

.PHONY: get-orig-source
get-orig-source:
	uscan --verbose --force-download --destdir=..

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	rm -f Makefile.old
	dh_auto_clean

%:
	dh $@ --parallel
