1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/darwin_ia32_gfortran,v 1.10 2010/03/21 22:22:52 jmc Exp $ |
4 |
# $Name: $ |
5 |
|
6 |
# tested on MacBook Pro with Snow Leopard & Snow Lion |
7 |
# ==> need to update folowing comments: |
8 |
# on 20-Nov-2009 |
9 |
# gcc and gfortran obtained from |
10 |
# http://hpc.sourceforge.net/ |
11 |
# http://prdownloads.sourceforge.net/hpc/gcc-snwleo-intel-bin.tar.gz?download |
12 |
# http://prdownloads.sourceforge.net/hpc/gfortran-snwleo-intel-bin.tar.gz?download |
13 |
|
14 |
#------- |
15 |
# need to set NETCDF_ROOT to where the NetCDF is installed, e.g.: |
16 |
# export NETCDF_ROOT='/usr/NetCDF' |
17 |
# MPI : need to set environment variable MPI_INC_DIR to the include |
18 |
# directory of your MPI implementation |
19 |
|
20 |
#------- |
21 |
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
22 |
# and generally, needs to increase the thread stack-size: |
23 |
# - sh,bash: |
24 |
# > export OMP_NUM_THREADS=2 |
25 |
# > export GOMP_STACKSIZE=400m |
26 |
# - csh,tcsh: |
27 |
# > setenv OMP_NUM_THREADS 2 |
28 |
# > setenv GOMP_STACKSIZE 400m |
29 |
#------- |
30 |
|
31 |
if test "x$MPI" = xtrue ; then |
32 |
CC=mpicc |
33 |
FC=mpif77 |
34 |
F90C=mpif90 |
35 |
LINK=$F90C |
36 |
else |
37 |
CC=gcc |
38 |
FC=gfortran |
39 |
F90C=gfortran |
40 |
LINK=$F90C |
41 |
fi |
42 |
|
43 |
FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _" |
44 |
S64='$(TOOLSDIR)/set64bitConst.sh' |
45 |
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' |
46 |
CPP='/usr/bin/cpp -traditional -P' |
47 |
GET_FC_VERSION="--version" |
48 |
EXTENDED_SRC_FLAG='-ffixed-line-length-132' |
49 |
OMPFLAG='-fopenmp' |
50 |
|
51 |
#MAKEDEPEND=tools_xmakedepend |
52 |
|
53 |
#Following flag is needed when using 32-bit gfortran with 64-bit gcc, |
54 |
#as can be the case right after switching to Snow Leopard. |
55 |
#CFLAGS='-arch i386' |
56 |
|
57 |
NOOPTFLAGS='-O0' |
58 |
NOOPTFILES='' |
59 |
|
60 |
FFLAGS="$FFLAGS -fconvert=big-endian" |
61 |
# for big objects: |
62 |
#FFLAGS="$FFLAGS -fPIC" |
63 |
#- might want to use '-fdefault-real-8' for fizhi pkg: |
64 |
#FFLAGS="$FFLAGS -fdefault-real-8" |
65 |
|
66 |
# For IEEE, use the "-ffloat-store" option |
67 |
if test "x$IEEE" = x ; then |
68 |
FFLAGS="$FFLAGS -Wunused -Wuninitialized" |
69 |
FOPTIM='-O3 -ftree-vectorize -funroll-loops' |
70 |
NOOPTFLAGS='-O2 -funroll-loops' |
71 |
NOOPTFILES='gad_c4_adv_x.F gad_u3_adv_x.F' |
72 |
else |
73 |
FFLAGS="$FFLAGS -Wunused" |
74 |
FOPTIM='-O0' |
75 |
fi |
76 |
|
77 |
INCLUDEDIRS='' |
78 |
INCLUDES='' |
79 |
LIBS='' |
80 |
|
81 |
if [ "x$NETCDF_ROOT" != x ] ; then |
82 |
INCLUDEDIR="${NETCDF_ROOT}/include" |
83 |
INCLUDES="-I${NETCDF_ROOT}/include" |
84 |
LIBDIR="${NETCDF_ROOT}/lib" |
85 |
LIBS="-L${NETCDF_ROOT}/lib -lnetcdf -lcurl" |
86 |
fi |
87 |
|
88 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
89 |
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
90 |
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
91 |
MPIINCLUDEDIR="$MPI_INC_DIR" |
92 |
MPI_HEADER_FILES='mpif.h mpiof.h' |
93 |
MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h' |
94 |
fi |