#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

# Parallel regression run
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
PARALLEL = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
PARALLEL =
endif

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@

override_dh_auto_build:
	@echo 'blhc: ignore-line-regexp: .*q2c'
	dh_auto_build -- all
	dh_auto_build -- html pdf

override_dh_auto_test:
	# Post the testsuite results to the build log on failures
	dh_auto_test -- TESTSUITEFLAGS='$(PARALLEL)' || { cat $(CURDIR)/tests/testsuite.log; false; }

override_dh_auto_configure:
	dh_auto_configure -- --disable-rpath --without-perl-module $(CONFIGUREFLAGS)

override_dh_install:
	# Delete the .la files
	find debian -name '*.la' -delete
	find debian/pspp/usr/share -empty -type d -delete
	dh_install

override_dh_compress:
	dh_compress --exclude=.pdf --exclude=.xml
