#!/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_CXXFLAGS_MAINT_APPEND = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Environment information.
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# Common build options.
CMAKE_BUILD_OPTIONS = \
	-DBUILD_RUNTIME=ON \
	-DBUILD_CLIENT=ON \
	-DBUILD_TEST=OFF \
	-DBUILD_LOADLIBRARIES=OFF \
	-DBUILD_SHARED_LIBS=ON \
	-DSUFFIX_LIB=/${DEB_HOST_MULTIARCH}

%:
	dh $@ --parallel \
		--sourcedirectory=src \
		--dbg-package=libclfft2-dbg

override_dh_auto_configure-arch:
	dh_auto_configure -- ${CMAKE_BUILD_OPTIONS} \
		-DBUILD_EXAMPLES=OFF

override_dh_auto_configure-indep:
	dh_auto_configure -- ${CMAKE_BUILD_OPTIONS} \
		-DBUILD_EXAMPLES=ON

override_dh_auto_build-indep:
	echo "I: Generating Doxygen documentation"
	cd docs/ && doxygen clFFT.doxy

override_dh_auto_clean-indep:
	rm -rf docs/html
	rm -f docs/doxygen_sqlite3.db

override_dh_installdocs-indep:
	dh_installdocs --indep
	dh_doxygen --indep

override_dh_compress:
	dh_compress --exclude=examples
