#!/usr/bin/make -f

# DH_VERBOSE := 1

BUILDARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

include /usr/share/dpkg/default.mk

# Location of the example files, will be converted to the
# probabel-examples package
DEBEXAMPLES:=$(DEB_SOURCE)-examples

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --disable-silent-rules

override_dh_installdocs-indep:
	dh_installdocs -i

override_dh_installdocs-arch:
	dh_installdocs -a
	rm debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/COPYING
	rm debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/INSTALL
	rm debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/LICENSE
	rm debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/ChangeLog

override_dh_installchangelogs:
	dh_installchangelogs doc/ChangeLog

override_dh_install-arch:
	dh_install -a --fail-missing
	rm debian/$(DEB_SOURCE)/usr/bin/probabel.pl
	mv debian/$(DEB_SOURCE)/etc/probabel_config.cfg.example debian/$(DEB_SOURCE)/etc/probabel_config.cfg

ifeq ($(BUILDARCH),$(filter $(BUILDARCH), mips s390x hppa powerpc ppc64 sparc64))
# On big endian architectures the tests are failing due to
# some binary format output that is compared with a file that
# was created on a low endian architecture and those files
# are dependent from the architecture (with no influence on
# the final result.  See
#   https://github.com/GenABEL-Project/ProbABEL/issues/45
override_dh_auto_test:
	dh_auto_test || true
endif
