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

#export DH_VERBOSE=1

ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel))
	DEBUG=-g1
else
	DEBUG=
endif

export FCCPP   = /lib/cpp -C -ansi -ffreestanding
export FCFLAGS = $(shell dpkg-buildflags --get FFLAGS) $(DEBUG) -pipe -funroll-loops -ffast-math -ffree-line-length-none
export CFLAGS = $(shell dpkg-buildflags --get CFLAGS) $(DEBUG)

%:
	dh $@ --max-parallel=4 --with autoreconf --buildsystem autoconf

override_dh_auto_clean:
	dh_auto_clean
	dh_auto_clean --buildsystem cmake
	-rm -f testsuite/regression/lda_c/lda_c_pk09.*

override_dh_auto_configure:
	dh_auto_configure -- --enable-shared
	dh_auto_configure --buildsystem cmake --	\
		-DCMAKE_BUILD_TYPE=Release		\
		-DENABLE_XHOST=OFF

override_dh_auto_build:
	dh_auto_build
	dh_auto_build --buildsystem cmake

override_dh_auto_test:
	-dh_auto_test -- -k
	-dh_auto_test --buildsystem cmake -- -k

override_dh_auto_install:
	dh_auto_install
	dh_auto_install --buildsystem cmake
