# Makefile for Fortran programs to manipulate SIR files
# written by R. Chen Feb. 2002  JPL PO.DAAC
#

#*****************************************************************************
# Uncomment next 2 lines if using SUN solaris machine.  Also edit lib/SIR.inc
#*****************************************************************************
#FF		=	f90
#FFLAGS		=	-e -Ilib -libmil -native -O'	# (compiler issues)

#*****************************************************************************
# Uncomment next 2 lines if using SGI machine.  Also edit lib/SIR.inc
#*****************************************************************************
FF		=	f90
FFLAGS		=	-static -Ilib

#*****************************************************************************
# Uncomment next 2 lines if using HP machine.  Also edit lib/SIR.inc
#*****************************************************************************
#FF		=	f90
#FFLAGS		=	-Ilib -K +gformat77 +es +DAportable

#*****************************************************************************
# Uncomment next 2 lines if using Lahey f95 for linux. Also edit lib/SIR.inc
#*****************************************************************************
#FF		=	f95
#FFLAGS		=	-Ilib --wide --mldefault cdecl --sav


EXES = libfsirf_f90.a f90sirexample fsir_locmap
LDFLAGS = -L. -lfsirf_f90

all : $(EXES)

f90sirexample : f90sirexample.f90 libfsirf_f90.a
	$(FF) $(FFLAGS) -of90sirexample f90sirexample.f90 $(LDFLAGS)

fsir_locmap : fsir_locmap.f90 libfsirf_f90.a
	$(FF) $(FFLAGS) -ofsir_locmap fsir_locmap.f90 $(LDFLAGS)

LIBSRC = lib/arctand.f lib/easegrid.f lib/f2ipix.f lib/ieasegrid.f \
	lib/ilambert1.f lib/ipolster.f lib/lambert1.f lib/latlon2pix.f \
	lib/pix2latlon.f lib/polster.f lib/length.f lib/printhead.f \
	lib/printhead3.f lib/readsirf.f lib/readsirhead.f lib/readsirhead3.f \
	lib/swapbuf.f lib/writesir.f lib/writesir3.f lib/SIREZ_f90.f90

libfsirf_f90.a : $(LIBSRC)
	rm -f *.o libfsirf.a
	$(FF) $(FFLAGS) -c $(LIBSRC)
	ar cr libfsirf_f90.a *.o
	rm -f *.o *.B *.s

clean :
	rm -f $(EXES) *.o *.B *.s

