-
Notifications
You must be signed in to change notification settings - Fork 177
/
Copy pathbuild_all.sh
executable file
·185 lines (165 loc) · 4.53 KB
/
build_all.sh
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/sh
set +x
#------------------------------------
# Exception handling is now included.
#
# USER DEFINED STUFF:
#
# USE_PREINST_LIBS: set to "true" to use preinstalled libraries.
# Anything other than "true" will use libraries locally.
#------------------------------------
while getopts "c" option;
do
case $option in
c)
echo "Received -c flag, check out ufs-weather-model develop branch with CCPP physics"
RUN_CCPP="YES"
;;
esac
done
export USE_PREINST_LIBS="true"
#------------------------------------
# END USER DEFINED STUFF
#------------------------------------
build_dir=`pwd`
logs_dir=$build_dir/logs
if [ ! -d $logs_dir ]; then
echo "Creating logs folder"
mkdir $logs_dir
fi
# Check final exec folder exists
if [ ! -d "../exec" ]; then
echo "Creating ../exec folder"
mkdir ../exec
fi
#------------------------------------
# GET MACHINE
#------------------------------------
target=""
source ./machine-setup.sh > /dev/null 2>&1
#------------------------------------
# INCLUDE PARTIAL BUILD
#------------------------------------
. ./partial_build.sh
#------------------------------------
# Exception Handling Init
#------------------------------------
ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'}
err=0
#------------------------------------
# build fv3
#------------------------------------
$Build_fv3gfs && {
echo " .... Building fv3 .... "
export RUN_CCPP=${RUN_CCPP:-"NO"}
./build_fv3.sh > $logs_dir/build_fv3.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building fv3."
echo "The log file is in $logs_dir/build_fv3.log"
fi
((err+=$rc))
}
#------------------------------------
# build gsi
#------------------------------------
$Build_gsi && {
echo " .... Building gsi .... "
./build_gsi.sh > $logs_dir/build_gsi.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building gsi."
echo "The log file is in $logs_dir/build_gsi.log"
fi
((err+=$rc))
}
#------------------------------------
# build ncep_post
#------------------------------------
$Build_ncep_post && {
echo " .... Building ncep_post .... "
./build_ncep_post.sh > $logs_dir/build_ncep_post.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building ncep_post."
echo "The log file is in $logs_dir/build_ncep_post.log"
fi
((err+=$rc))
}
#------------------------------------
# build ufs_utils
#------------------------------------
$Build_ufs_utils && {
echo " .... Building ufs_utils .... "
./build_ufs_utils.sh > $logs_dir/build_ufs_utils.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building ufs_utils."
echo "The log file is in $logs_dir/build_ufs_utils.log"
fi
((err+=$rc))
}
#------------------------------------
# build gldas
#------------------------------------
$Build_gldas && {
echo " .... Building gldas .... "
./build_gldas.sh > $logs_dir/build_gldas.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building gldas."
echo "The log file is in $logs_dir/build_gldas.log"
fi
((err+=$rc))
}
#------------------------------------
# build gfs_wafs - optional checkout
#------------------------------------
if [ -d gfs_wafs.fd ]; then
$Build_gfs_wafs && {
echo " .... Building gfs_wafs .... "
./build_gfs_wafs.sh > $logs_dir/build_gfs_wafs.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building gfs_wafs."
echo "The log file is in $logs_dir/build_gfs_wafs.log"
fi
((err+=$rc))
}
fi
#------------------------------------
# build workflow_utils
#------------------------------------
$Build_workflow_utils && {
echo " .... Building workflow_utils .... "
target=$target ./build_workflow_utils.sh > $logs_dir/build_workflow_utils.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building workflow_utils."
echo "The log file is in $logs_dir/build_workflow_utils.log"
fi
((err+=$rc))
}
#------------------------------------
# build gfs_util
#------------------------------------
# Only build on WCOSS
if [ $target = wcoss -o $target = wcoss_cray -o $target = wcoss_dell_p3 ]; then
$Build_gfs_util && {
echo " .... Building gfs_util .... "
./build_gfs_util.sh > $logs_dir/build_gfs_util.log 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in building gfs_util."
echo "The log file is in $logs_dir/build_gfs_util.log"
fi
((err+=$rc))
}
fi
#------------------------------------
# Exception Handling
#------------------------------------
[[ $err -ne 0 ]] && echo "FATAL BUILD ERROR: Please check the log file for detail, ABORT!"
$ERRSCRIPT || exit $err
echo;echo " .... Build system finished .... "
exit 0