#!/usr/bin/make -f

# DH_VERBOSE := 1

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

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

ifeq ($(DEB_HOST_ARCH),arm64)
  export DEB_CXXFLAGS_MAINT_APPEND = -march=armv8-a+nosimd
endif

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 --with-eigen-include-path=/usr/include/eigen3

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
	rm debian/$(DEB_SOURCE)/usr/bin/probabel.pl
	mv debian/$(DEB_SOURCE)/etc/probabel_config.cfg.example debian/$(DEB_SOURCE)/etc/probabel_config.cfg
