1 |
ce107 |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
jmc |
1.4 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_ia32_sunf90,v 1.3 2011/09/12 15:10:14 jmc Exp $ |
4 |
jmc |
1.2 |
# $Name: $ |
5 |
ce107 |
1.1 |
|
6 |
jmc |
1.3 |
# Build options for the Sun fortran compiler (with and without MPI) |
7 |
|
|
# on Linux IA32 platform |
8 |
|
|
# MPI : need to set environment variable MPI_INC_DIR to the include |
9 |
|
|
# directory of your MPI implementation |
10 |
|
|
|
11 |
|
|
if test "x$MPI" = xtrue ; then |
12 |
|
|
CC=${CC:=mpicc} |
13 |
|
|
FC=${FC:=mpif77} |
14 |
|
|
F90C=${F90C:=mpif90} |
15 |
|
|
LINK=${F90C} |
16 |
|
|
else |
17 |
|
|
CC='cc' |
18 |
|
|
FC='f77' |
19 |
|
|
F90C='f90' |
20 |
|
|
LINK=${F90C} |
21 |
|
|
fi |
22 |
|
|
|
23 |
ce107 |
1.1 |
FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _" |
24 |
|
|
DEFINES='-DWORDLENGTH=4' |
25 |
|
|
CPP='cpp -traditional -P' |
26 |
|
|
EXTENDED_SRC_FLAG='-e' |
27 |
|
|
OMPFLAG='-xopenmp' |
28 |
|
|
|
29 |
jmc |
1.3 |
NOOPTFLAGS='-O0 -g' |
30 |
|
|
NOOPTFILES='' |
31 |
|
|
|
32 |
|
|
FFLAGS="$FFLAGS -m32 -xfilebyteorder=big16:%all -u" |
33 |
|
|
#FFLAGS="$FFLAGS -r8const" |
34 |
|
|
|
35 |
ce107 |
1.1 |
if test "x$DEVEL" != x ; then |
36 |
jmc |
1.3 |
FFLAGS="$FFLAGS -g -xs -C -xcommonchk -xcheck=init_local -fpover" |
37 |
|
|
OMPFLAG='-xopenmp=noopt' |
38 |
ce107 |
1.1 |
fi |
39 |
|
|
|
40 |
jmc |
1.3 |
if test "x$IEEE" = x ; then #- with optimisation: |
41 |
|
|
FOPTIM='-fast -xvector=simd -xpad=local' |
42 |
|
|
LIBS="$LIBS -lmopt" #- but get overwritten during NETCDF libs setting below |
43 |
|
|
else #- no optimisation + IEEE : |
44 |
|
|
# FOPTIM='-O0' |
45 |
|
|
FOPTIM='-fast -xpad=local -fsimple=1' |
46 |
ce107 |
1.1 |
fi |
47 |
jmc |
1.3 |
|
48 |
ce107 |
1.1 |
F90FLAGS=$FFLAGS |
49 |
|
|
F90OPTIM=$FOPTIM |
50 |
jmc |
1.3 |
CFLAGS='-O0 -m32' |
51 |
|
|
|
52 |
|
|
INCLUDEDIRS='' |
53 |
|
|
INCLUDES='' |
54 |
|
|
#LIBS='' |
55 |
ce107 |
1.1 |
|
56 |
|
|
if [ "x$NETCDF_ROOT" != x ] ; then |
57 |
|
|
INCLUDEDIR="${NETCDF_ROOT}/include" |
58 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
59 |
|
|
LIBDIR="${NETCDF_ROOT}/lib" |
60 |
|
|
LIBS="-L${NETCDF_ROOT}/lib" |
61 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
62 |
|
|
INCLUDEDIR="${NETCDF_HOME}/include" |
63 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
64 |
|
|
LIBDIR="${NETCDF_HOME}/lib" |
65 |
|
|
LIBS="-L${NETCDF_HOME}/lib" |
66 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
67 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
68 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
69 |
|
|
INCLUDEDIR="${NETCDF_INC}" |
70 |
|
|
INCLUDES="-I${NETCDF_INC}" |
71 |
|
|
LIBDIR="${NETCDF_LIB}" |
72 |
|
|
LIBS="-L${NETCDF_LIB}" |
73 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
74 |
|
|
INCLUDEDIR="${NETCDF_INCDIR}" |
75 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
76 |
|
|
LIBDIR="${NETCDF_LIBDIR}" |
77 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
78 |
|
|
elif test -d /usr/include/netcdf-3 ; then |
79 |
|
|
INCLUDES='-I/usr/include/netcdf-3' |
80 |
|
|
LIBS='-L/usr/lib/netcdf-3' |
81 |
|
|
elif test -d /usr/include/netcdf ; then |
82 |
|
|
INCLUDES='-I/usr/include/netcdf' |
83 |
|
|
elif test -d /usr/local/netcdf ; then |
84 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
85 |
|
|
LIBS='-L/usr/local/netcdf/lib' |
86 |
|
|
elif test -d /usr/local/include/netcdf.inc ; then |
87 |
|
|
INCLUDES='-I/usr/local/include' |
88 |
|
|
LIBS='-L/usr/local/lib' |
89 |
|
|
fi |
90 |
|
|
|
91 |
jmc |
1.3 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
92 |
|
|
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
93 |
|
|
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
94 |
jmc |
1.4 |
#- used for parallel (MPI) DIVA |
95 |
jmc |
1.3 |
MPIINCLUDEDIR="$MPI_INC_DIR" |
96 |
jmc |
1.4 |
#MPI_HEADER_FILES=${MPI_HEADER_FILES:='mpif.h mpiof.h'} |
97 |
jmc |
1.3 |
fi |
98 |
|
|
|