#!/usr/bin/make -f

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

# 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

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

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

override_dh_auto_configure:
	dh_auto_configure -- $(DEBUG) \
	    --with-xmlsec

override_dh_auto_build-indep:
	$(MAKE) doxygen-doc
	$(MAKE) -C schemas

override_dh_auto_install-indep:
	$(MAKE) -C doc     DESTDIR="$(CURDIR)/debian/tmp" install
	$(MAKE) -C schemas DESTDIR="$(CURDIR)/debian/tmp" install

override_dh_auto_test-indep:

override_dh_install:
	cd debian/tmp/usr/share/doc/xmltooling-* && \
	    rm README.txt LICENSE.txt NOTICE.txt OPENSSL.LICENSE LOG4CPP.LICENSE \
	       CURL.LICENSE
	dh_install --fail-missing

override_dh_installdocs:
	dh_installdocs -A doc/README.txt doc/NOTICE.txt
