#!/usr/bin/make -f
# -*- makefile -*-

# Multiarch (if supported).
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)

# Configuration flags.
CONFIGURE_ARGS=

# If multiarch is supported, override CMAKE_INSTALL_LIB
ifneq ($(DEB_HOST_MULTIARCH),)
CONFIGURE_ARGS+=-DCMAKE_INSTALL_LIBDIR:STRING="lib/${DEB_HOST_MULTIARCH}"
endif

.PHONY: override_dh_auto_configure   \
        override_dh_auto_build-indep \
        override_dh_auto_install     \
        override_dh_auto_test        \
        override_dh_strip

override_dh_auto_configure:
	dh_auto_configure --  \
	    -DCMAKE_INSTALL_PREFIX:PATH=/usr \
	    -DBUILD_EXAMPLES:BOOL=False \
            $(CONFIGURE_ARGS) 

override_dh_auto_build-indep:
	dh_auto_build -- doxygen

override_dh_auto_install:
	dh_auto_install --buildsystem=cmake 
	
	# Remove extra LICENSE and INSTALL file
	rm debian/tmp/usr/share/doc/simbody/LICENSE.txt
	rm debian/tmp/usr/share/doc/simbody/INSTALL.txt

override_dh_strip:
	dh_strip -a --dbg-package=libsimbody3.4-dbg

%:
	dh $@ --parallel --buildsystem=cmake
