#-------------------------------------------------------------------------------
#  MAKEFILE
#-------------------------------------------------------------------------------  
#
#  CVS: $Revision: 1.13 $ $Date: 2009/02/04 11:17:49 $
#
#  (C) James Wookey
#  Department of Earth Sciences, University of Bristol
#  Wills Memorial Building, Queen's Road, Bristol, BR8 1RJ, UK
#  j.wookey@bristol.ac.uk
#
#-------------------------------------------------------------------------------
#
#   Makefile for building f90sac
#
#-------------------------------------------------------------------------------
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
#
#-------------------------------------------------------------------------------

F90SAC = f90sac.o f90sac_csubs.o

#-------------------------------------------------------------------------------
# Uncomment to use Intel Compilers (v8+) 
#FC = ifort
#CC = icc
#CFLAGS = -O2
#FFLAGS = -O2 -assume byterecl
#-------------------------------------------------------------------------------
# Uncomment to use Gnu Compilers 
FC = gfortran
CC = gcc
CFLAGS = -O2
FFLAGS = -O2
#-------------------------------------------------------------------------------
# Uncomment to use g95
#FC = /opt/local/bin/g95
#CC = gcc
#CFLAGS = -O2
#FFLAGS = -O2 -fno-second-underscore
#-------------------------------------------------------------------------------
## Uncomment for sac/sac2000 (binaries sac files are native endian)
#F90SAC_FLAGS = 
#-------------------------------------------------------------------------------
## Uncomment for MacSAC (binary sac files are always big-endian)
F90SAC_FLAGS = -DFORCE_BIGENDIAN_SACFILES
#-------------------------------------------------------------------------------
## Uncomment to use pure Fortran IO (significantly slower)
#F90SAC_FLAGS += -DDISABLE_C_IO

## Uncomment to suppress warnings
F90SAC_FLAGS += -DSUPPRESS_WARNINGS
#-------------------------------------------------------------------------------

all:test_f90sac

test_f90sac: ${F90SAC} test_f90sac.o 
	$(FC) -o test_f90sac ${F90SAC} test_f90sac.o 

f90sac.o: f90sac.F90
	$(FC) $(FFLAGS) $(F90SAC_FLAGS) -c f90sac.F90
	
clean:
	rm -f *.o *.mod

# COMPILE INSTRUCTIONS
%.o: %.F90
	$(FC) $(FFLAGS) -c $*.F90 
%.o: %.f90
	$(FC) $(FFLAGS) -c $*.f90 
%.o: %.c
	$(CC) $(CFLAGS) -c $*.c
