1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/darwin_ia32_gfortran,v 1.15 2012/06/22 17:06:05 jmc Exp $ |
4 |
# $Name: $ |
5 |
|
6 |
# Tested on MacBook Pro with Snow Leopard |
7 |
#- on 20-Nov-2009, without MPI: |
8 |
# gcc and gfortran obtained from |
9 |
# http://hpc.sourceforge.net/ |
10 |
# http://prdownloads.sourceforge.net/hpc/gcc-snwleo-intel-bin.tar.gz?download |
11 |
# http://prdownloads.sourceforge.net/hpc/gfortran-snwleo-intel-bin.tar.gz?download |
12 |
# |
13 |
# gfortran (version 4.6.0) |
14 |
# OpenMPI (version 1.4.3) |
15 |
|
16 |
#-- Note: default location of NetCDF & MPI setting provided in this optfile |
17 |
# are not standard. For this reason, you might need: |
18 |
# 1) to set NETCDF_ROOT to where the NetCDF is installed, e.g.: |
19 |
# export NETCDF_ROOT='/usr/NetCDF' |
20 |
# 2) for MPI, to set environment variable MPI_INC_DIR to the include |
21 |
# directory of your MPI implementation |
22 |
|
23 |
if test "x$MPI" = xtrue ; then |
24 |
# CC=mpicc |
25 |
FC=mpif90 |
26 |
LINK=$FC |
27 |
else |
28 |
# CC=gcc |
29 |
FC=gfortran |
30 |
LINK=$FC |
31 |
fi |
32 |
|
33 |
#FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) _ ## X ## _" |
34 |
#FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X" |
35 |
#FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _" |
36 |
# for adjoint runs we might need this |
37 |
#MAKEDEPEND=tools_xmakedepend |
38 |
|
39 |
S64='$(TOOLSDIR)/set64bitConst.sh' |
40 |
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' |
41 |
CPP='/usr/bin/cpp -traditional -P' |
42 |
EXTENDED_SRC_FLAG='-ffixed-line-length-132' |
43 |
|
44 |
#Following flag is needed when using 32-bit gfortran with 64-bit gcc, |
45 |
#as can be the case right after switching to Snow Leopard. |
46 |
#CFLAGS='-arch i386' |
47 |
|
48 |
NOOPTFLAGS='-O0' |
49 |
NOOPTFILES='' |
50 |
|
51 |
FFLAGS="$FFLAGS -fsecond-underscore -fconvert=big-endian" |
52 |
#- might want to use '-fdefault-real-8' for fizhi pkg: |
53 |
#FFLAGS="$FFLAGS -fdefault-real-8 -fdefault-double-8" |
54 |
|
55 |
if test "x$IEEE" = x ; then #- with optimisation: |
56 |
FFLAGS="$FFLAGS -Wunused -Wuninitialized" |
57 |
FOPTIM='-O3 -funroll-loops' |
58 |
NOOPTFLAGS='-O2 -funroll-loops' |
59 |
# do we still need these? |
60 |
# NOOPTFILES="$NOOPTFILES gad_c4_adv_x.F gad_u3_adv_x.F" |
61 |
# add more optimization if you are bold enough |
62 |
# FOPTIM="$FOPTIM -ftree-vectorize" |
63 |
# with gcc version 4.6.0 20101106 (experimental) (GCC) I needed this |
64 |
# for better optimization (with bugs), more recent versions of gfortran |
65 |
# might not need this any longer |
66 |
# FOPTIM='-O3 -funroll-loops -ftree-vectorize' |
67 |
# NOOPTFLAGS='-O1 -funroll-loops -ftree-vectorize' |
68 |
# NOOPTFILES='exch2_uv_agrid_3d_r4.F exch2_uv_agrid_3d_r8.F exch2_uv_agrid_3d_rl.F exch2_uv_agrid_3d_rs.F exch2_uv_bgrid_3d_r4.F exch2_uv_cgrid_3d_r4.F exch2_uv_cgrid_3d_r8.F exch2_uv_cgrid_3d_rl.F exch2_uv_cgrid_3d_rs.F exch_uv_agrid_3d_r8.F exch_uv_agrid_3d_rl.F exch_uv_agrid_3d_rs.F' |
69 |
else #- no optimisation + IEEE : |
70 |
FFLAGS="$FFLAGS -Wunused -ffloat-store" |
71 |
FOPTIM='-O0' |
72 |
fi |
73 |
|
74 |
INCLUDEDIRS='' |
75 |
INCLUDES='' |
76 |
LIBS='' |
77 |
|
78 |
NETCDF_ROOT=/usr/local |
79 |
if [ "x$NETCDF_ROOT" != x ] ; then |
80 |
INCLUDES="-I${NETCDF_ROOT}/include" |
81 |
LIBS="-L${NETCDF_ROOT}/lib" |
82 |
else |
83 |
#-- default NetCDF location: from former darwin_ia32_gfortran optfile: |
84 |
# If you optain netcdf libraries from fink, this is where they will |
85 |
# be. I found that it is easier to get everything from |
86 |
# sourceforge.net, then the libraries will be in /usr/local |
87 |
INCLUDES='-I/sw/include' |
88 |
LIBS='-L/sw/lib' |
89 |
fi |
90 |
|
91 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
92 |
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
93 |
#- used for parallel (MPI) DIVA |
94 |
MPIINCLUDEDIR="$MPI_INC_DIR" |
95 |
#MPI_HEADER_FILES='mpif.h mpiof.h' |
96 |
elif [ "x$MPI" = xtrue ] ; then |
97 |
#-- default MPI header location: from former darwin_ia32_gfortran+mpi optfile: |
98 |
INCLUDES="$INCLUDES -I/usr/local/include -I/opt/openmpi/include" |
99 |
LIBS="$LIBS -L/usr/local/lib" |
100 |
fi |