# -*- mode: makefile -*-
# -----------------------------------------------------------------
# Programmer(s): Daniel R. Reynolds @ SMU
# -----------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2023, Lawrence Livermore National Security
# and Southern Methodist University.
# All rights reserved.
#
# See the top-level LICENSE and NOTICE files for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# SUNDIALS Copyright End
# -----------------------------------------------------------------
# Makefile for IDA OpenMP examples
#
# This file is generated from a template using variables
# set at configuration time. It can be used as a template for
# other user Makefiles.
# -----------------------------------------------------------------

SHELL = sh

prefix     = /usr
includedir = ${prefix}/fortran
libdir     = ${prefix}/lib/aarch64-linux-gnu

F90      = /usr/bin/mpif90
F90FLAGS = -O3 -fopenmp -DSUNDIALS_INT32_T -cpp
F90LIBS  =  -lm

# -----------------------------------------------------------------------------------------

INCLUDES  = -I${includedir}
LIBRARIES = -lsundials_fida_mod -lsundials_ida -lsundials_nvecopenmp \
            -lsundials_fnvecopenmp_mod ${F90LIBS}
LINKFLAGS = -Wl,-rpath,/usr/lib/aarch64-linux-gnu

# -----------------------------------------------------------------------------------------

EXAMPLES = 
EXAMPLES_DEPENDENCIES = 

OBJECTS = ${EXAMPLES:=.o}
OBJECTS_DEPENDENCIES = ${EXAMPLES_DEPENDENCIES:=.o}

# -----------------------------------------------------------------------------------------

.SUFFIXES : .o .f90

.f90.o :
	${F90} ${F90FLAGS} ${INCLUDES} -c $<

# -----------------------------------------------------------------------------------------

all: examples

examples: ${OBJECTS_DEPENDENCIES} ${OBJECTS}
	@for i in ${EXAMPLES} ; do \
	  echo "${F90} -o $${i} $${i}.o ${OBJECTS_DEPENDENCIES} ${F90FLAGS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LINKFLAGS}" ; \
	  ${F90} -o $${i} $${i}.o ${OBJECTS_DEPENDENCIES} ${F90FLAGS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LINKFLAGS} ; \
	done

clean:
	rm -f *.o *.mod
	rm -f ${OBJECTS}
	rm -f ${EXAMPLES}

# -----------------------------------------------------------------------------------------
