#
#  $Author: pkubota $
#  $Date: 2007/10/10 20:24:23 $
#  $Revision: 1.1 $
#
# $Id: Makefile.linux64,v 1.1 2007/10/10 20:24:23 pkubota Exp $
#
#
#  PC Cluster, mpi scali
#
FTRACE=  
OPENMP= 
F90=gfortran   -ffree-line-length-none -fconvert=big-endian
AR=ar
F90_32FLAGS = 
F90_32BITS = 
F77=gfortran   -ffree-line-length-none -fconvert=big-endian
FFLAGS = 
CC     =gcc   
flagOpt="-O2"
flag64bit= 
MPIF90=mpif90   -ffree-line-length-none -fconvert=big-endian

TRACE= 
OPENMP=
F90_32FLAGS = 
F90_32BITS = $(FTRACE) $(OPENMP) 
LOADFLAG= 


# OPTIONS FOR POS
CPPFLAGS = -D_UNDERSCORE -DLINUX
FFLAGS	= 
CFLAGS	= -w
ARFLAGS	= 
CC      =gcc   
# If there is a version difference between your gcc and the gcc
# used to compile the ifort binary, you may have to add a flag
# like -gcc-version=400 do CFLAG
LOADFLAG= 
# Bibliotecas necessarias
LIBS = -leccodes_f90 -leccodes
#

#
###include Makefile.common
#
EXEC=AOI_SSTNOAA.x

#ECCODES_SAMPLES_PATH = /mnt/beegfs/paulo.kubota/lib/eccodes/share/eccodes/samples
#ECCODES_INCLUDE = -I/mnt/beegfs/paulo.kubota/lib/eccodes/include
#ECCODES_LIB = -L/mnt/beegfs/paulo.kubota/lib/eccodes/lib $(LIBS)/mnt/beegfs/paulo.kubota/lib/lib_gnu/hdf5/hdf5-1.12.1//hdf5 

OUTPUTINC = -I/mnt/beegfs/paulo.kubota/lib/lib_gnu/netcdf/include -I/mnt/beegfs/paulo.kubota/lib/lib_gnu/hdf5/hdf5-1.12.1/hdf5/include
OUTPUTLIB = -L/mnt/beegfs/paulo.kubota/lib/lib_gnu/netcdf/lib -lnetcdff  -L/mnt/beegfs/paulo.kubota/lib/lib_gnu/netcdf/lib -lnetcdf  -L/mnt/beegfs/paulo.kubota/lib/lib_gnu/hdf5/hdf5-1.12.1/hdf5/lib -lhdf5_hl -lhdf5 

LINKOPTS  =  -lnetcdff -lnetcdf
LIB_NETCDF= $(OUTPUTLIB)  $(OUTPUTINC)

.SUFFIXES: .o .f90 .F90 .c 
#
# *****************************************************************
#
OBJS_CC = cio.o

OBJS = 	met_data_module.o met_utils_module.o read_met_module.o write_met_module.o \
	SSTtoMONAN.o InputParameters.o Netcdf_Parameter_SST.o Netcdf_Parameter_XICE.o main.o

SRC	= $(OBJ_MOD:.o=.f90) $(OBJS:.o=.f90) $(OBJS_CC:.o=.c)

$(EXEC):	$(OBJS) $(OBJS_CC)
	$(F90) -o $(EXEC) $(F90FLAG) $(LOADFLAG) $(OBJS) $(OBJS_CC)   $(LIB_NETCDF)

cio.o: 	cio.c
	$(CC)  $(LIB_NETCDF) $(CPPFLAGS) $(CFLAGS) -c  cio.c

met_data_module.o: 	met_data_module.f90
	$(F90)  $(LIB_NETCDF) $(F90FLAG) -c  met_data_module.f90

met_utils_module.o: 	met_utils_module.f90 met_utils_module.o   cio.o
	$(F90)  $(LIB_NETCDF) $(F90FLAG) -c  met_utils_module.f90

read_met_module.o: 	read_met_module.f90  met_utils_module.o  met_data_module.o cio.o
	$(F90)  $(LIB_NETCDF) $(F90FLAG) -c  read_met_module.f90

write_met_module.o: 	write_met_module.f90  met_utils_module.o met_data_module.o cio.o
	$(F90)  $(LIB_NETCDF) $(F90FLAG) -c  write_met_module.f90

SSTtoMONAN.o: 	SSTtoMONAN.f90 read_met_module.o write_met_module.o 
	$(F90)  $(LIB_NETCDF) $(F90FLAG) -c  SSTtoMONAN.f90

InputParameters.o: 	InputParameters.f90
	$(F90)  $(LIB_NETCDF) $(F90FLAG) -c  InputParameters.f90

Netcdf_Parameter_SST.o: 	Netcdf_Parameter_SST.f90
	$(F90)  $(LIB_NETCDF) $(F90FLAG) -c  Netcdf_Parameter_SST.f90

Netcdf_Parameter_XICE.o: 	Netcdf_Parameter_XICE.f90
	$(F90)  $(LIB_NETCDF) $(F90FLAG) -c  Netcdf_Parameter_XICE.f90

main.o: 	main.f90  SSTtoMONAN.o InputParameters.o Netcdf_Parameter_SST.o Netcdf_Parameter_XICE.o
	$(F90)   $(LIB_NETCDF) $(F90FLAG) -c  main.f90

clean:
	-rm -f $(OBJS)
	-rm -f $(OBJS_CC)
	-rm -f $(EXEC)
	-rm -f *.mod

.F90.o :
	$(F90) $(F90FLAG) -c  $<

.f90.o:
	$(F90) $(F90FLAG) -c $< 
.c.o:
	$(CC) $(CFLAGS) $(DEFS) -c $< 
 
