#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_autoreconf:
	 dh_autoreconf autoreconf -- --force --install --no-recursive --include=BuildTools
	 (cd Cbc && autoreconf --force --install --no-recursive --include=../BuildTools)

override_dh_auto_build:
	dh_auto_build
	make doxydoc
	$(RM) doxydoc/html/*.md5 doxydoc/html/*.dot doxydoc/html/*.map
	$(RM) doxydoc/html/installdox
	$(RM) doxydoc/html/formula.repository

override_dh_auto_configure:
	dh_auto_configure -- --enable-static --enable-cbc-parallel --enable-dot --enable-dependency-linking

override_dh_strip:
	dh_strip
	find . -name '*.a' \( \! -name '*_g.a' \) \
    -exec strip --strip-debug \
    --remove-section=.comment \
    --remove-section=.note {} \;

override_dh_install:
	find debian/tmp -name "*.la" -delete
	$(RM) -r debian/tmp/usr/share
	dh_install

override_dh_fixperms-indep:
	dh_fixperms
	find debian/coinor-libcbc-doc -name '*.cpp' -exec chmod -x '{}' \;
