#!/usr/bin/make -f
# You must remove unused comment lines for the released package.
export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)


CMAKE_FLAGS = \
        -DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=:STRING="lib/$(DEB_HOST_MULTIARCH)" \
        -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_HOST_MULTIARCH)" \
        -DCMAKE_VERBOSE_MAKEFILE=ON \
        -DCMAKE_C_FLAGS_RELEASE="$(CFLAGS)" \
        -DCMAKE_CXX_FLAGS_RELEASE="$(CXXFLAGS)" \
        -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$(LDFLAGS)" \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DCMAKE_SKIP_INSTALL_RPATH=TRUE

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



# debmake generated override targets
# This is example for Cmake (See http://bugs.debian.org/641051 )
override_dh_auto_configure:
	mkdir -p build
	dh_auto_configure --builddirectory=build -- $(CMAKE_FLAGS) $(CMAKE_ARCH_FLAGS)

override_dh_install:
	mkdir -p debian/tmp/usr/share/doc/libreflexxes1-dbg && cp debian/README.Debug debian/tmp/usr/share/doc/libreflexxes1-dbg/
	dh_install --list-missing

override_dh_strip:
	dh_strip --dbg-package=libreflexxes1-dbg

