New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
WorkingGroups/TAM/InstallationsMacInstosh/InstallMacGfortran – NEMO
wiki:WorkingGroups/TAM/InstallationsMacInstosh/InstallMacGfortran

Version 5 (modified by chauvin, 15 years ago) (diff)

--

Installing the gfortran compiler

gfortran 4.2.3 available on the site http://r.research.att.com/tools/

Generating NETCDF modules and library

The following script is executed in the directory netcdf-3.6.1. gcc-4.0 comes from the XCode (Mac OS X 10.5.8). Flags avoid conflicts between C and Fortran during the library compilation.

#!/bin/sh

export FC=gfortran
export F90=gfortran
export F77=gfortran

export FFLAGS='-O3 -ff2c'
export F90FLAGS='-O3 -ff2c'

export CC=gcc-4.0
export CPPFLAGS='-Df2cFortran'

./configure --prefix=/usr/local/netcdf-3.6.1/gfortran

-- Compiling NEMO -- Config file in NEMO/build/config : The debugging option has to be -dwarf-2 (and not -g). The optimizing option -O3 is ok too.

NETCDF_INCLUDE=/usr/local/netcdf-3.6.1/gfortran/include
NETCDF_LIB=-L/usr/local/netcdf-3.6.1/gfortran/lib -lnetcdf
CPP=cpp
CPPFLAGS=-traditional -P
AR=ar 
ARFLAGS=cvr
FC=gfortran
FCFLAGS=  -c -gdwarf-2 -fdefault-real-8 -ffree-line-length-none -I$(NETCDF_INCLUDE) -I$(NEMOLIB)
FCFLAGSF90=  -c -gdwarf-2  -fdefault-real-8 -ffree-line-length-none -I$(NETCDF_INCLUDE) -I$(NEMOLIB)
LDFLAGS=  -gdwarf-2  -free-line-length-none -o 
LDNOMPI=$(FC)
#-g -Wall -Wimplicit-none -Wuninitialized -fbounds-check -ftrace=frame -fpointer=invalid

CPPKEYS_ARCH=-DNC_DOUBLE \
-DNOIARGCPROTO \
-Dkey_tau_daily_monthly_files \
-Dkey_dtasst_monthly_files \
-Dkey_flx_forced_daily_monthly_files