#!/usr/bin/make -f
# -*- makefile -*-
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

-include /usr/share/dpkg/buildtools.mk
PKG_CONFIG ?= pkg-config

CPPFLAGS+=$(shell $(PKG_CONFIG) --cflags rtaudio)
CFLAGS+=-DDEB_BUILD
CXXFLAGS+=-DDEB_BUILD
LDFLAGS+=$(shell $(PKG_CONFIG) --libs   rtaudio)

export CPPFLAGS
export CFLAGS
export CXXFLAGS
export LDFLAGS

export QT_SELECT=qt5
DEB_SRCDIR = src

%:
	dh $@ --sourcedirectory=$(DEB_SRCDIR) --buildsystem=qmake

override_dh_clean:
	dh_clean
	rm -rf WWW
	rm -f jacktrip.1

override_dh_auto_configure:
	dh_auto_configure
	cp $(DEB_SRCDIR)/Makefile.Release $(DEB_SRCDIR)/Makefile

override_dh_auto_build:
	dh_auto_build
	doxygen jacktrip_doxygen
	find WWW -name "*.md5" -delete
	find WWW -name "*.map" -delete
	help2man -N -n "high-quality system for audio network performances" debian/jacktrip-help2man > jacktrip.1

override_dh_installchangelogs:
	dh_installchangelogs CHANGESLOG.txt


licensecheck:
	licensecheck --deb-machine -r * \
		-i 'documentation/img/.*|debian/(changelog|copyright(|_hints|_newhints))$$' \
		> debian/copyright_newhints
	cmp debian/copyright_hints debian/copyright_newhints \
		&& rm debian/copyright_newhints
