-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcompile
executable file
·271 lines (244 loc) · 9.36 KB
/
compile
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
#!/bin/csh -f
cont1:
if ( ! -e configure.wrf ) then
./configure $1
set dontask
endif
#----------------------------------
if ( ! $?WRF_KPP ) setenv WRF_KPP 0
if ( $WRF_KPP == 1 ) then
chem/KPP/compile_wkc
endif
#---------------------------------
if ( ! $?dontask && $?prompt ) then
echo "This script assumes you have configured the code already."
echo "You only need to configure once."
echo "If you wish to reconfigure, type c at the prompt below"
echo " "
echo "Ready to compile? [ync]"
set resp=$<
if ( "$resp" == "c" ) then
./configure
goto cont1
endif
if ( "$resp" == "n" ) then
exit 2
endif
endif
set arglist=""
foreach a ( $argv )
if ( "$a" == "-h" ) then
goto hlp
else
if ( "$a" != "-d" ) then
set arglist = ( $arglist $a )
endif
endif
end
if ( $arglist == "" ) then
goto hlp
else
unsetenv A2DCASE
setenv A2DCASE `echo $arglist | grep 2d`
if ( ! ( $?WRF_EM_CORE || $?WRF_NMM_CORE \
|| $?WRF_COAMPS_CORE || $?WRF_EXP_CORE )) then
echo 'None of WRF_EM_CORE, WRF_NMM_CORE, '
# echo ' WRF_COAMPS_CORE, or WRF_EXP_CORE '
echo ' specified in shell environment.... '
setenv WRF_EM_CORE 1
setenv WRF_NMM_CORE 0
setenv WRF_COAMPS_CORE 0
setenv WRF_EXP_CORE 0
endif
# these settings get passed down through the environment in the
# calls to Make
if ( ! $?WRF_DA_CORE ) setenv WRF_DA_CORE 0
if ( ! $?WRF_EM_CORE ) setenv WRF_EM_CORE 0
if ( ! $?WRF_NMM_CORE ) setenv WRF_NMM_CORE 0
if ( ! $?WRF_NMM_NEST ) setenv WRF_NMM_NEST 0
if ( ! $?WRF_COAMPS_CORE ) setenv WRF_COAMPS_CORE 0
if ( ! $?WRF_EXP_CORE ) setenv WRF_EXP_CORE 0
if ( ! $?WRF_CHEM ) setenv WRF_CHEM 0
if ( ! $?WRF_CONVERT ) then
if ( "$arglist" == "convert_em" ) then
setenv WRF_CONVERT 1
setenv WRF_EM_CORE 0
else
setenv WRF_CONVERT 0
endif
endif
set overwrite=0
if ($WRF_NMM_CORE == 1 && $WRF_CHEM == 1 ) then
echo "Chemistry not yet supported in NMM core, set WRF_CHEM to 0 "
grep -q DM_PARALLEL configure.wrf
if ( $status == 1 ) then
echo NMM_CORE must be configured for DM parallel
echo Please rerun the configure script and chose a DM parallel option
exit 3
endif
if ( ! -f Registry/Registry ) then
echo Registry file does not exist
set overwrite=1
else
head -2 Registry/Registry | tail -1 | grep NMM_CHEM > /dev/null
if ( $status ) then
set overwrite=1
else
set nmm_time=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM_CHEM' | grep -v 'Registry.NMM_CHEM.' | awk '{print $1}'`
set rg_time=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
if ( $nmm_time > $rg_time ) set overwrite=1
endif
endif
if ( $overwrite ) then
echo copying Registry/Registry.NMM_CHEM to Registry/Registry
echo '## WARNING: this file is autogenerated from Registry/Registry.NMM_CHEM. Changes may be lost' > Registry/Registry
/bin/cat Registry/Registry.NMM_CHEM >> Registry/Registry
endif
# exit 2
endif
if ($WRF_EM_CORE == 1 && $WRF_NMM_CORE == 1 ) then
echo "Cannot compile both EM and NMM cores in same executable yet."
exit 2
endif
if ($WRF_EM_CORE == 0 && $WRF_NMM_CORE == 0 && ! $WRF_CONVERT == 1 ) then
echo "Cannot compile because both EM and NMM cores are set to 0."
exit 2
endif
if ($arglist == 'nmm_real' && $WRF_NMM_CORE == 0) then
echo WRF_NMM_CORE must be set to 1 in order to compile nmm_real
exit 2
endif
if (($WRF_EM_CORE == 1)&&($WRF_DA_CORE == 0 ) &&($WRF_CHEM == 0 )&&($WRF_CONVERT == 0)) then
if ( ! -f Registry/Registry ) then
set overwrite=1
else
head -2 Registry/Registry | tail -1 | grep EM > /dev/null
if ( $status ) then
set overwrite=1
else
set em_time=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM' | grep -v 'Registry.EM.' | awk '{print $1}'`
set rg_time=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
if ( $em_time > $rg_time ) set overwrite=1
endif
endif
if ( $overwrite ) then
echo copying Registry/Registry.EM to Registry/Registry
echo '## WARNING: this file is autogenerated from Registry/Registry.EM. Changes may be lost' > Registry/Registry
/bin/cat Registry/Registry.EM >> Registry/Registry
endif
else if (($WRF_EM_CORE == 1)&&($WRF_CHEM == 1 )) then
if ( ! -f Registry/Registry ) then
set overwrite=1
else
head -2 Registry/Registry | tail -1 | grep EM_CHEM > /dev/null
if ( $status ) then
set overwrite=1
else
set em_time=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM_CHEM' | grep -v 'Registry.EM_CHEM.' | awk '{print $1}'`
set rg_time=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
if ( $em_time > $rg_time ) set overwrite=1
endif
endif
if ( $overwrite ) then
echo copying Registry/Registry.EM_CHEM to Registry/Registry
echo '## WARNING: this file is autogenerated from Registry/Registry.EM_CHEM. Changes may be lost' > Registry/Registry
/bin/cat Registry/Registry.EM_CHEM >> Registry/Registry
endif
else if (($WRF_EM_CORE == 0)&&($WRF_CONVERT == 1 )) then
if ( ! -f Registry/Registry ) then
set overwrite=1
else
head -2 Registry/Registry | tail -1 | grep EM_CONVERT > /dev/null
if ( $status ) then
set overwrite=1
else
set em_time=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM_CONVERT' | grep -v 'Registry.EM_CONVERT.' | awk '{print $1}'`
set rg_time=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
if ( $em_time > $rg_time ) set overwrite=1
endif
endif
if ( $overwrite ) then
echo copying Registry/Registry.CONVERT to Registry/Registry
echo '## WARNING: this file is autogenerated from Registry/Registry.CONVERT. Changes may be lost' > Registry/Registry
/bin/cat Registry/Registry.CONVERT >> Registry/Registry
endif
else if ( $WRF_DA_CORE == 1 ) then
echo copying Registry/Registry.wrfvar to Registry/Registry
echo '## WARNING: this file is autogenerated from Registry/Registry.wrfvar. Changes may be lost' > Registry/Registry
/bin/cat Registry/Registry.wrfvar >> Registry/Registry
endif
endif
if (($WRF_NMM_CORE == 1)&&($WRF_CHEM == 0 )) then
grep -q DM_PARALLEL configure.wrf
if ( $status == 1 ) then
echo NMM_CORE must be configured for DM parallel
echo Please rerun the configure script and chose a DM parallel option
exit 3
endif
if ( ! -f Registry/Registry ) then
set overwrite=1
else
head -2 Registry/Registry | tail -1 | grep NMM > /dev/null
if ( $status ) then
set overwrite=1
else
set nmm_time=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM' | grep -v 'Registry.NMM.' | awk '{print $1}'`
set rg_time=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
if ( $nmm_time > $rg_time ) set overwrite=1
endif
endif
if ( $overwrite ) then
if (($WRF_NMM_CORE == 1)&&($WRF_NMM_NEST == 1)) then
echo copying Registry/Registry.NMM_NEST to Registry/Registry
echo '## WARNING: this file is autogenerated from Registry/Registry.NMM_NEST. Changes may be lost' > Registry/Registry
/bin/cat Registry/Registry.NMM_NEST >> Registry/Registry
else
echo copying Registry/Registry.NMM to Registry/Registry
echo '## WARNING: this file is autogenerated from Registry/Registry.NMM. Changes may be lost' > Registry/Registry
/bin/cat Registry/Registry.NMM >> Registry/Registry
endif
endif
# integrity check for a kludge where a hard coded value in the
# registry must match the same value in arch/preamble
set registryvalue=`grep 'dimspec.* q ' Registry/Registry.NMM | sed -e 's/..*constant=//' -e 's/ ..*$//'`
set preamblevalue=`grep 'DNMM_MAX_DIM=.*' arch/preamble | sed -e 's/..*-DNMM_MAX_DIM=//' -e 's/ ..*$//'`
if ( $registryvalue != $preamblevalue ) then
echo "Harded coded value of dimspec q in Registry ($registryvalue) does not"
echo "equal the hard coded value of NMM_MAX_DIM in arch/preamble ($preamblevalue)"
echo "Please fix and try again."
exit 2
endif
endif
echo " "
echo -n "**** Compiling: "
if ( $WRF_DA_CORE ) echo -n "WRF_DA_CORE "
if ( $WRF_EM_CORE ) echo -n "WRF_EM_CORE "
if ( $WRF_NMM_CORE ) echo -n "WRF_NMM_CORE "
if ( $WRF_COAMPS_CORE ) echo -n "WRF_COAMPS_CORE "
if ( $WRF_EXP_CORE ) echo -n "WRF_EXP_CORE "
echo "."
echo " "
# This incredible hackery due to OSF1 $(PWD) not changing during
# build via regtest.csh ...
# Note that $WRF_SRC_ROOT_DIR is only used by the OSF1 build.
if ( $?WRF_SRC_ROOT_DIR ) then
make $arglist A2DCASE="$A2DCASE" WRF_SRC_ROOT_DIR="$WRF_SRC_ROOT_DIR"
else
make $arglist A2DCASE="$A2DCASE" WRF_SRC_ROOT_DIR="$PWD"
endif
endif
exit 0
hlp:
echo ' '
echo 'Usage:'
echo ' '
echo ' compile wrf compile wrf in run dir (NOTE: no real.exe, ndown.exe, or ideal.exe generated)'
echo ' '
echo ' or choose a test case (see README_test_cases for details) :'
foreach d ( `/bin/ls test` )
if ( "$d" != "CVS" ) then
echo " compile $d"
endif
end
echo ' '
echo ' compile -h help message'