-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathBUILDmom6
executable file
·117 lines (107 loc) · 4.17 KB
/
BUILDmom6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
#***********************************************************************
#* GNU Lesser General Public License
#*
#* This file is part of the SHiELD Build System.
#*
#* The SHiELD Build System free software: you can redistribute it
#* and/or modify it under the terms of the
#* GNU Lesser General Public License as published by the
#* Free Software Foundation, either version 3 of the License, or
#* (at your option) any later version.
#*
#* The SHiELD Build System distributed in the hope that it will be
#* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
#* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#* See the GNU General Public License for more details.
#*
#* You should have received a copy of the GNU Lesser General Public
#* License along with theSHiELD Build System
#* If not, see <http://www.gnu.org/licenses/>.
#***********************************************************************
#
# DISCLAIMER: This script is provided as-is and as such is unsupported.
#
set -x
#
# set default values
# configure your build parameters
COMPILER="intel"
BIT="64bit"
COMP="" # implies PROD=Y
#
# parse arguments
for arg in "$@"
do
case $arg in
prod|repro|debug)
if [ ${arg#} = 'repro' ] ; then
COMP="REPRO=Y"
elif [ ${arg#} = 'debug' ] ; then
COMP="DEBUG=Y"
fi
shift # Remove COMP from processing
;;
intel|gnu)
COMPILER="${arg#*=}"
shift # Remove "compiler" from processing
;;
*)
if [ ${arg#} != '--help' ] && [ ${arg#} != '-h' ] ; then
echo "option "${arg#}" not found"
fi
echo -e ' '
echo -e "valid options are:"
echo -e "\t[intel(D) | gnu] \t\t\t compiler"
echo -e "\t[prod(D) | repro | debug] \t\t compiler option settings"
echo -e "\n"
exit
;;
esac
done
#
# set up some default variables if not called from COMPILE
# BUILD_ROOT is set if this script is called from the COMPILE script
if [ -z ${BUILD_ROOT} ] ; then
export BUILD_ROOT=${PWD%/*}
export SHiELD_SRC=${PWD%/*/*}/SHiELD_SRC/
export PATH="${BUILD_ROOT}/mkmf/bin:${BUILD_ROOT}/Build/mk_scripts:${PATH}"
export NCEP_DIR=${BUILD_ROOT}/Build
if [ ! -z ${EXTERNAL_LIBS} ] ; then
export NCEP_DIR=${EXTERNAL_LIBS}
fi
# load the proper environment for your machine
. ${BUILD_ROOT}/site/environment.${COMPILER}.sh
fi
mkdir -p ${BUILD_ROOT}/Build/mom6
list_paths -l -o ${BUILD_ROOT}/Build/mom6/pathnames_mom6 \
${SHiELD_SRC}/MOM6/config_src/memory/dynamic_nonsymmetric \
${SHiELD_SRC}/MOM6/config_src/drivers/FMS_cap \
${SHiELD_SRC}/MOM6/src/*/ \
${SHiELD_SRC}/MOM6/src/*/*/ \
${SHiELD_SRC}/MOM6/config_src/external/ODA_hooks \
${SHiELD_SRC}/MOM6/config_src/external/database_comms \
${SHiELD_SRC}/MOM6/config_src/external/drifters \
${SHiELD_SRC}/MOM6/config_src/external/stochastic_physics \
${SHiELD_SRC}/MOM6/config_src/external/GFDL_ocean_BGC \
${SHiELD_SRC}/MOM6/pkg/GSW-Fortran/*/ \
${SHiELD_SRC}/MOM6/config_src/infra/FMS2
cd ${BUILD_ROOT}/Build
pushd mom6
mkmf -m Makefile -a ${SHiELD_SRC} -p libmom6.a -t "${BUILD_ROOT}/${TEMPLATE}" \
-c "-DINTERNAL_FILE_NML -g -DMAX_FIELDS_=100 -DNOT_SET_AFFINITY -D_USE_MOM6_DIAG -D_USE_GENERIC_TRACER -DUSE_PRECISION=2 -I${NCEP_DIR}/libFMS/${COMPILER}/${BIT}" \
-I${SHiELD_SRC}/FMS/axis_utils/include -I${SHiELD_SRC}/FMS/diag_manager/include -I${SHiELD_SRC}/FMS/fms/include -I${SHiELD_SRC}/FMS/fms2_io/include \
-I${SHiELD_SRC}/FMS/horiz_interp/include -I${SHiELD_SRC}/FMS/include -I${SHiELD_SRC}/FMS/mpp/include -I${SHiELD_SRC}/FMS/sat_vapor_pres/include \
-I${SHiELD_SRC}/FMS/string_utils/include -I${SHiELD_SRC}/FMS/test_fms/fms/include \
-I${SHiELD_SRC}/MOM6/src/framework ${BUILD_ROOT}/Build/mom6/pathnames_mom6
make -j8 ${COMP} AVX=Y NETCDF=3 Makefile libmom6.a >& Build_mom6.out
################
#will get noise with openmp in debugmode
################
# test and report on libFMS build success
if [ $? -ne 0 ] ; then
echo ">>> ${BUILD_ROOT}/Build/mom6 build failed"
exit 1
fi
echo " libmom6 build successful"
popd