#!/usr/bin/make -f

# Enable compiler hardening flags.
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

# Force linking with -lpthread, working around a bug in libtool that drops
# the linkage because it uses -nostdlib.  See #468555.
export DEB_LDFLAGS_MAINT_APPEND = -lpthread

DOCS = debian/libxmltooling-doc/usr/share/doc/libxmltooling-doc

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
    DEBUG = --enable-debug
else
    DEBUG =
endif

%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- --disable-dependency-tracking $(DEBUG)

override_dh_installdocs:
	dh_installdocs -A doc/NOTICE.txt
	set -e; if [ -d "$(DOCS)" ] ; then \
	    if [ -f "$(DOCS)/html/jquery.js" ] ; then \
		rm $(DOCS)/html/jquery.js ; \
		ln -s /usr/share/javascript/jquery/jquery.min.js \
		    $(DOCS)/html/jquery.js ; \
	    fi ; \
	fi

override_dh_builddeb:
	dh_builddeb -- -Zxz
