SOURCES = command_line_support.f90 constant.f90 io.f90 mrf_ids.f90 \
	precision.f90 resolution.f90 ferror.f90 isnan.f90 rnor.f90 \
	Makefile constant.h lonsperlat.h resolution.h machine.h \
	fftpack.f ev

OBJECTS = command_line_support.o constant.o io.o mrf_ids.o precision.o \
	resolution.o ferror.o isnan.o rnor.o
#
#  SGI
#
#LIBS =
#DEBUG = -g -c -DEBUG:trap_uninitialized -DEBUG:conform_check=YES \
   #-DEBUG:verbose_runtime=YES -DEBUG:subscript_check=YES \
   #-ansi -fullwarn -woff 878,1438,1584 -Dsgi
#OPT = -O -c -OPT:swp=ON -g3 -Dsgi -ansi -fullwarn -woff 878,1438,1584
#F95 = f90

#
#  Sun
#
#LIBS = 
#DEBUG = -g -c -C -ansi -ftrap=invalid -stackvar -u -w4
#OPT = -O4 -c -ftrap=invalid -stackvar -u
#F95 = f95

#
# Lahey - add --trap for f.p. trapping (but not with these e.v. routines)
#
#  --f95 adds extra checking for nonstandard constructs.  There should be
#  none in this code, except for "call exit" statements (which are de facto
#  standard).
#  Use --info for more details on code optimizations
#  Use --lst for a listing (mostly useful with --lst)
#
LIBS = 
DEBUG = -g -c --trace --chk a,e,s --f95 
OPT = -O -c --trace --f95
DBLFLAGS = --dbl
F95 = lf95

FFLAGS = $(OPT) 
#FFLAGS = $(DEBUG) 

.SUFFIXES: .o .mod .f .f90 .f95 .F90 .F95
.F90.o:
	$(F95)  $(FFLAGS) $<
.f90.mod:
	$(F95)  $(FFLAGS) $<
.f95.mod:
	$(F95)  $(FFLAGS) $<
.f.o:
	$(F95)  $(FFLAGS) $<
.f90.o:
	$(F95)  $(FFLAGS) $<
.f95.o:
	$(F95)  $(FFLAGS) $<

all: libfft.a libsupport.a libev.a

libfft.a: fftpack.f
	$(F95) $(OPT) $(DBLFLAGS) fftpack.f
	ar cr libfft.a fftpack.o

libsupport.a: $(OBJECTS)
	ar r libsupport.a $(OBJECTS)

libev.a:
	cd ev; make -r

(%.o): %.f90
	
command_line_support.o: command_line_support.f90 
constant.o: constant.f90 precision.o 
isnan.o: precision.o
io.o: io.f90 
mrf_ids.o: mrf_ids.f90 
precision.o: precision.f90 
resolution.o: resolution.f90 resolution.h 
ferror.o: ferror.f90
clean:
	rm -f *.o *.mod *.a core
	@cd ev; make clean
backup:
	tar cf support.tar $(SOURCES)
