#----------------------------------------------------------------------------
#                                CVODE                                      
#----------------------------------------------------------------------------
# This file will compile all the CVODE modules in order to make the Unix
# library cvodelib.a. All object (.o) files are removed after the library
# has been created. The library cvodelib.a is placed in CVODE/lib.
#
# The following variables are used:
#
# COMPILER - set to use the gcc compiler
# OPTS     - list of compiler options
# OBJS     - list of object files in cvodelib.a
#
# Modify the COMPILER and OPTS variables as needed.
#
# If the ranlib utility is not available on your system, then remove the call
# to ranlib from the commands to create lib/libcvode.a.

   
COMPILER = gcc

OPTS = -I../include

OBJS = source/cvode.o source/cvdense.o source/dense.o source/cvband.o \
       source/band.o source/cvdiag.o source/cvspgmr.o source/spgmr.o  \
       source/iterativ.o source/cvbandpre.o source/nvector.o source/llnlmath.o


lib lib/libcvode.a: $(OBJS)
	(ar rcv lib/libcvode.a $(OBJS); ranlib lib/libcvode.a; rm source/*.o)

source/cvode.o: source/cvode.c include/cvode.h include/llnltyps.h \
                include/nvector.h include/llnlmath.h
	(cd source; $(COMPILER) $(OPTS) -c cvode.c)

source/cvdense.o: source/cvdense.c include/cvdense.h include/cvode.h \
                  include/dense.h include/llnltyps.h include/nvector.h \
                  include/llnlmath.h
	(cd source; $(COMPILER) $(OPTS) -c cvdense.c)
 
source/dense.o: source/dense.c include/dense.h include/llnltyps.h \
                include/nvector.h include/llnlmath.h
	(cd source; $(COMPILER) $(OPTS) -c dense.c)
 
source/cvband.o: source/cvband.c include/cvband.h include/cvode.h \
                 include/band.h include/llnltyps.h include/nvector.h \
                 include/llnlmath.h
	(cd source; $(COMPILER) $(OPTS) -c cvband.c)
 
source/band.o: source/band.c include/band.h include/llnltyps.h \
               include/nvector.h include/llnlmath.h
	(cd source; $(COMPILER) $(OPTS) -c band.c)
 
source/cvdiag.o: source/cvdiag.c include/cvdiag.h  include/cvode.h \
                 include/llnltyps.h include/nvector.h
	(cd source; $(COMPILER) $(OPTS) -c cvdiag.c)
 
source/cvspgmr.o: source/cvspgmr.c include/cvspgmr.h include/cvode.h \
                  include/llnltyps.h include/nvector.h include/llnlmath.h \
                  include/iterativ.h include/spgmr.h
	(cd source; $(COMPILER) $(OPTS) -c cvspgmr.c)
 
source/spgmr.o: source/spgmr.c include/spgmr.h include/iterativ.h \
                include/llnltyps.h include/nvector.h include/llnlmath.h 
	(cd source; $(COMPILER) $(OPTS) -c spgmr.c)
 
source/iterativ.o: source/iterativ.c include/iterativ.h include/llnltyps.h \
                   include/nvector.h include/llnlmath.h
	(cd source; $(COMPILER) $(OPTS) -c iterativ.c)
 
source/cvbandpre.o: source/cvbandpre.c include/cvbandpre.h include/cvode.h \
                    include/nvector.h include/llnltyps.h include/llnlmath.h \
                    include/band.h 
	(cd source; $(COMPILER) $(OPTS) -c cvbandpre.c)
 
source/nvector.o: source/nvector.c include/nvector.h include/llnltyps.h \
                 include/llnlmath.h
	(cd source; $(COMPILER) $(OPTS) -c nvector.c)
 
source/llnlmath.o: source/llnlmath.c include/llnlmath.h include/llnltyps.h
	(cd source; $(COMPILER) $(OPTS) -c llnlmath.c)
