# -*- mode: makefile -*-
# -----------------------------------------------------------------
# Programmer: Daniel R. Reynolds @ SMU
# -----------------------------------------------------------------
# LLNS/SMU Copyright Start
# Copyright (c) 2014, Southern Methodist University and 
# Lawrence Livermore National Security
#
# This work was performed under the auspices of the U.S. Department 
# of Energy by Southern Methodist University and Lawrence Livermore 
# National Laboratory under Contract DE-AC52-07NA27344.
# Produced at Southern Methodist University and the Lawrence 
# Livermore National Laboratory.
#
# All rights reserved.
# For details, see the LICENSE file.
# LLNS/SMU Copyright End
# -----------------------------------------------------------------
# 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.
# -----------------------------------------------------------------

SHELL = sh

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

CPP         = /usr/bin/cc
CPPFLAGS    = -O3 -DNDEBUG -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX -DLAM_BUILDING
CXX         = /usr/bin/c++
CXXFLAGS    = -O3 -DNDEBUG
LDFLAGS     = 
LIBS        =  -lm /usr/lib/x86_64-linux-gnu/librt.so

LINKFLAGS = -Wl,-rpath,/usr/lib

MPICXX      = /usr/bin/mpicxx
MPI_INC_DIR = .
MPI_LIB_DIR = .
MPI_LIBS    = 
MPI_FLAGS   = 

TMP_INCS = ${includedir} ${MPI_INC_DIR}
INCLUDES = $(addprefix -I, ${TMP_INCS})
LIBRARIES = -lsundials_arkode -lsundials_nvecparallel ${LIBS}

EXAMPLES =  ark_heat2D
OBJECTS  = ${EXAMPLES:=.o}

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

.SUFFIXES : .o .cpp

.cpp.o :
	${MPICXX} ${CPPFLAGS} ${CXXFLAGS} ${MPI_FLAGS} ${INCLUDES} -c $<

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

all: ${OBJECTS}
	@for i in ${EXAMPLES} ; do \
	  echo "${MPICXX} -o $${i} $${i}.o ${MPI_FLAGS} ${CXXFLAGS} ${LDFLAGS} ${INCLUDES} -L${libdir} ${LIBRARIES} -L${MPI_LIB_DIR} ${MPI_LIBS} ${LINKFLAGS}" ; \
	  ${MPICXX} -o $${i} $${i}.o ${MPI_FLAGS} ${CXXFLAGS} ${LDFLAGS} ${INCLUDES} -L${libdir} ${LIBRARIES} -L${MPI_LIB_DIR} ${MPI_LIBS} ${LINKFLAGS} ; \
	done

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

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