#!/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 FCLAGS:=$(shell dpkg-buildflags --get FCLAGS)
export FFLAGS:=$(shell dpkg-buildflags --get FFLAGS)
export LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

# This has to be exported to make some magic below work.
export DH_OPTIONS

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

build-indep-stamp:
	dh_auto_configure -- --with-blas=blas --with-boost-libdir=/usr/lib/$(DEB_HOST_MULTIARCH) && $(MAKE) -C lib doxygen-doc && touch $@

.PHONY: override_dh_auto_configure
override_dh_auto_configure:
	dh_auto_configure -- --with-boost-libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

.PHONY: build-indep
build-indep: build-indep-stamp

.PHONY: override_dh_strip
override_dh_strip:
	dh_strip --dbg-package=libfreecontact0-dbg

.PHONY: override_dh_compress
override_dh_compress:
	dh_compress -Xlibfreecontact.tag -Xdemo_1000.aln -XPF00071_v25_999.fa -XPF00071_v25_999.xml

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

.PHONY:
get-orig-source:
	mkdir -p ../tarballs
	uscan --verbose --force-download

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	rm -f build-indep-stamp
	dh_auto_clean

%:
	dh $@ --parallel --with bash-completion --with autoreconf

