1 |
yunx |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
yunx |
1.2 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_gfortran_greenplanet,v 1.1 2010/04/05 20:58:31 yunx Exp $ |
4 |
yunx |
1.1 |
# $Name: $ |
5 |
|
|
# |
6 |
|
|
# tested on greenplanet.ps.uci.edu |
7 |
|
|
# Linux greenplanet.ps.uci.edu 2.6.18-128.el5 #1 SMP Wed Jan 21 10:41:14 EST 2009 x86_64 x86_64 x86_64 GNU/Linux |
8 |
|
|
# GNU Fortran (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44) |
9 |
|
|
# Copyright (C) 2007 Free Software Foundation, Inc. |
10 |
|
|
|
11 |
|
|
FC=gfortran |
12 |
|
|
F90C=gfortran |
13 |
|
|
CC=gcc |
14 |
|
|
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' |
15 |
|
|
CPP='cpp -traditional -P' |
16 |
|
|
NOOPTFLAGS='-O0' |
17 |
|
|
EXTENDED_SRC_FLAG='-ffixed-line-length-132' |
18 |
|
|
OMPFLAG='-fopenmp' |
19 |
|
|
|
20 |
|
|
if test "x$DEVEL" != x ; then |
21 |
|
|
FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check' |
22 |
|
|
else |
23 |
|
|
FFLAGS='' |
24 |
|
|
fi |
25 |
|
|
|
26 |
|
|
# Requires gfortran from 2006 onwards for -fconvert=big-endian |
27 |
|
|
FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none" |
28 |
|
|
|
29 |
|
|
if test "x$IEEE" = x ; then |
30 |
|
|
# No need for IEEE-754 |
31 |
|
|
FOPTIM='-O3 -funroll-loops' |
32 |
|
|
else |
33 |
|
|
# Try to follow IEEE-754 |
34 |
|
|
# these may also be useful, but require specific gfortran versions: |
35 |
|
|
# -Wnonstd-intrinsics for gfortran <= 4.3 |
36 |
|
|
# -Wintrinsics-std for gfortran >= 4.4 |
37 |
|
|
# -Wno-tabs for gfortran >= 4.3 |
38 |
|
|
FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation" |
39 |
|
|
# to get plenty of warnings : |
40 |
|
|
# FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels" |
41 |
|
|
FOPTIM='-O0' |
42 |
|
|
# for automatic testing with testreport (but no relation with IEEE arithmetic): |
43 |
|
|
FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check" |
44 |
|
|
fi |
45 |
|
|
F90FLAGS=$FFLAGS |
46 |
|
|
F90OPTIM=$FOPTIM |
47 |
|
|
CFLAGS=$FOPTIM |
48 |
|
|
|
49 |
|
|
if [ "x$NETCDF_ROOT" != x ] ; then |
50 |
|
|
INCLUDEDIR="${NETCDF_ROOT}/include" |
51 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
52 |
|
|
LIBDIR="${NETCDF_ROOT}/lib" |
53 |
|
|
LIBS="-L${NETCDF_ROOT}/lib" |
54 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
55 |
|
|
INCLUDEDIR="${NETCDF_HOME}/include" |
56 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
57 |
|
|
LIBDIR="${NETCDF_HOME}/lib" |
58 |
|
|
LIBS="-L${NETCDF_HOME}/lib" |
59 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
60 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
61 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
62 |
|
|
INCLUDEDIR="${NETCDF_INC}" |
63 |
|
|
INCLUDES="-I${NETCDF_INC}" |
64 |
|
|
LIBDIR="${NETCDF_LIB}" |
65 |
|
|
LIBS="-L${NETCDF_LIB}" |
66 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
67 |
|
|
INCLUDEDIR="${NETCDF_INCDIR}" |
68 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
69 |
|
|
LIBDIR="${NETCDF_LIBDIR}" |
70 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
71 |
|
|
elif test -d /sopt/netcdf/netcdf3-gcc-serial; then |
72 |
|
|
INCLUDES='-I/sopt/netcdf/netcdf3-gcc-serial/include' |
73 |
|
|
LIBS='-L/sopt/netcdf/netcdf3-gcc-serial/lib' |
74 |
|
|
elif test -d /usr/include/netcdf ; then |
75 |
|
|
INCLUDES='-I/usr/include/netcdf' |
76 |
|
|
elif test -d /usr/local/netcdf ; then |
77 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
78 |
|
|
LIBS='-L/usr/local/netcdf/lib' |
79 |
|
|
elif test -d /usr/local/include/netcdf.inc ; then |
80 |
|
|
INCLUDES='-I/usr/local/include' |
81 |
|
|
LIBS='-L/usr/local/lib64' |
82 |
|
|
fi |