# -----------------------------------------------------------------
# $Revision: 4958 $
# $Date: 2016-09-23 14:02:13 -0700 (Fri, 23 Sep 2016) $
# -----------------------------------------------------------------
# Programmer: Radu Serban @ LLNL
# -----------------------------------------------------------------
# Copyright (c) 2007, The Regents of the University of California.
# Produced at the Lawrence Livermore National Laboratory.
# All rights reserved.
# For details, see the LICENSE file.
# -----------------------------------------------------------------
# Makefile for ARKODE parallel examples
#
# This file is generated from a template using various variables
# set at configuration time. It can be used as a template for
# other user Makefiles.
#
# Note: if the solver was successfully configured with Blas/Lapack
# support, the Blas/Lapack libraries are specified through the 
# variable LIBRARIES_BL. Otherwise, this variable should contain
# an empty string. We include LIBRARIES_BL in the link line for
# all examples, even the parallel ones which obviously cannot 
# use the Lapack linear solver modules simply to address the case 
# in which the SUNDIALS libraries are shared objects. In that case, 
# the solver library references Lapack  symbols which must be 
# always resolved by linking against the Blas/Lapack libraries. 
# If only static SUNDIALS libraries have been built, it is not 
# required to link the Blas/Lapack libraries for the parallel 
# examples...
# -----------------------------------------------------------------

SHELL = sh

prefix       = /usr
exec_prefix  = /usr
includedir   = /usr/include
libdir       = lib

CPP         = /usr/bin/cc
CPPFLAGS    = -O3 -DNDEBUG
CC          = /usr/bin/cc
CFLAGS      = -O3 -DNDEBUG
LDFLAGS     = 
LIBS        =  -lm /usr/lib/librt.so
LINKFLAGS = -Wl,-rpath,lib
MPICC       = /usr/bin/mpicc
MPI_INC_DIR = .
MPI_LIB_DIR = .
MPI_LIBS    = 
MPI_FLAGS   = 

INCLUDES = -I${includedir} -I${MPI_INC_DIR}
LIBRARIES = -lsundials_arkode -lsundials_nvecparallel ${LIBS}
LIBRARIES_BL =  /usr/lib/liblapack.so /usr/lib/libblas.so
LIBRARIES_SLUMT = 
LIBRARIES_KLU =   /usr/lib/libklu.so /usr/lib/libamd.so /usr/lib/libcolamd.so /usr/lib/libbtf.so /usr/lib/libsuitesparseconfig.so
LIBRARIES_PETSC = 

EXAMPLES =  ark_diurnal_kry_p ark_diurnal_kry_bbd_p
EXAMPLES_DEPENDENCIES = 

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

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

.SUFFIXES : .o .c

.c.o :
	${MPICC} ${CPPFLAGS} ${CFLAGS} ${MPI_FLAGS} ${INCLUDES} -c $<

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

all: ${OBJECTS}
	@for i in ${EXAMPLES} ; do \
	  echo "${MPICC} -o $${i} $${i}.o ${OBJECTS_DEPENDENCIES} ${MPI_FLAGS} ${CFLAGS} ${LDFLAGS} ${INCLUDES} -L${libdir} ${LIBRARIES} -L${MPI_LIB_DIR} ${MPI_LIBS} ${LIBRARIES_BL} ${LIBRARIES_SLUMT} ${LIBRARIES_KLU} ${LIBRARIES_PETSC} ${LINKFLAGS}" ; \
	  ${MPICC} -o $${i} $${i}.o ${OBJECTS_DEPENDENCIES} ${MPI_FLAGS} ${CFLAGS} ${LDFLAGS} ${INCLUDES} -L${libdir} ${LIBRARIES} -L${MPI_LIB_DIR} ${MPI_LIBS} ${LIBRARIES_BL} ${LIBRARIES_SLUMT} ${LIBRARIES_KLU} ${LIBRARIES_PETSC} ${LINKFLAGS} ; \
	done

${OBJECTS}: ${OBJECTS_DEPENDENCIES}

clean:
	rm -f ${OBJECTS_DEPENDENCIES}
	rm -f ${OBJECTS}
	rm -f ${EXAMPLES}

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