#!/usr/bin/make -f

#export DH_VERBOSE=1

# FC set to f77 by default in make
# Read default compiler name unless FC is actually set
ifeq ($(FC),f77)
  FC:=$(shell basename $(shell readlink /etc/alternatives/f77))
endif

# Fixes for 32-bit archss
ARCH_32BIT:=   i386 armel armhf mipsel hppa hurd-i386 m68k powerpc sh4 x32
DO_ODB:= $(if $(filter $(DEB_TARGET_ARCH), $(ARCH_32BIT)),OFF,ON)

# The magic debhelper  rule
%:
	dh $@ --buildsystem=ecbuild

CMAKE_CFLAGS:= -DENABLE_FORTRAN=ON \
		-DENABLE_RPATH=OFF \
		-DENABLE_ODB=$(DO_ODB) \
		-DENABLE_RELATIVE_RPATHS=OFF

override_dh_auto_configure:
	dh_auto_configure -- \
                      ${BUILD_FLAGS} -DCMAKE_Fortran_COMPILER=$(FC)

override_dh_auto_test:
	echo "Metkit fetches data from the internet, and hence the tests can't be run contained at build-time"

