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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# Hardening flags.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Environment information.
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

# Build without Altivec to prevent FTBFS on ppc64el.
ifeq ($(DEB_HOST_ARCH),ppc64el)
DEB_CFLAGS_MAINT_APPEND += -mno-altivec
endif

%:
	dh $@ --parallel --sourcedirectory=src

override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DBUILD_RUNTIME=ON \
		-DBUILD_TEST=OFF \
		-DBUILD_PERFORMANCE=OFF \
		-DBUILD_SAMPLE=OFF \
		-DBUILD_CLIENT=ON \
		-DBUILD_KTEST=OFF \
		-DBUILD_SHARED_LIBS=ON \

override_dh_auto_build:
	dh_auto_build
	echo "I: Generating Doxygen documentation"
	cd doc/ && doxygen clBLAS.doxy && rm html/jquery.js

override_dh_auto_clean:
	dh_auto_clean
	$(RM) -f doc/doxygen_sqlite3.db
	$(RM) -rf doc/html

override_dh_strip:
	dh_strip --dbg-package=libclblas2-dbg
