#!/usr/bin/make -f

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

CPU:=$(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
ifeq ($(CPU), amd64)
  export FCFLAGS= -mcmodel=medium
endif

# magic debhelper rule
%:
	dh $@

override_dh_auto_build:
	$(MAKE) -f makefile.gfs_gfortran LDFLAGS=$(LDFLAGS) FCFLAGS=$(FCFLAGS)
	rm -f *.o *.mod
	$(MAKE) -f makefile.ecmwf_gfortran LDFLAGS=$(LDFLAGS) FCFLAGS=$(FCFLAGS)

override_dh_auto_clean:
	$(MAKE) -f makefile.gfs_gfortran clean
	$(MAKE) -f makefile.ecmwf_gfortran clean
	rm -f *.mod erf.f90.185r.combine flexpart.gfs flexpart.ecmwf

