#!/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
# do not use colors
export COLOR=0

%:
	dh $@ --parallel

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

override_dh_strip:
	dh_strip --ddeb-migration='libgirara-dbg (<< 0.2.5-1~)'

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
	find doc/build/html -name *.md5 -delete
	rm -f doc/build/html/jquery.js
	ln -s /usr/share/javascript/jquery/jquery.js doc/build/html/jquery.js
endif

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