#!/usr/bin/make -f
# -*- makefile -*-

export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed

# do not strip
export SFLAGS=
# build with verbose output
export VERBOSE=1
# install into multiarch libdir
export LIBDIR=/usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
# disable check's timeout funtionality
export CK_DEFAULT_TIMEOUT=0
# use little endian mo files everywhere
export MSGFMTFLAGS=--endianness little

%:
	dh $@ --parallel

override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	xvfb-run -a $(MAKE) test
endif

override_dh_strip:
	dh_strip --dbg-package=libgirara-dbg

override_dh_auto_build-indep:
	# build documentation if doxygen is available and remove the copy of jquery
	# and replace it with the one from libjs-jquery
ifneq "$(wildcard /usr/bin/doxygen)" ""
	$(MAKE) doc
	rm -f doc/html/installdox
	rm doc/html/jquery.js
	ln -s /usr/share/javascript/jquery/jquery.js doc/html/jquery.js
endif

override_dh_auto_test-indep override_dh_auto_install-indep:
	# no tests and install for indep
