3 setenv START_OF_COMPILE
"`date`"
7 if ( ! -e configure.wrf
) then
8 if ( $1 == "all_wrfvar" ) then
18 #----------------------------------
19 if ( ! $?WRF_KPP
) setenv WRF_KPP
0
20 if ( $WRF_KPP == 1 ) then
24 #---------------------------------
26 if ( ! $?dontask
&& $?prompt
) then
27 echo "This script assumes you have configured the code already."
28 echo "You only need to configure once."
29 echo "If you wish to reconfigure, type c at the prompt below"
31 echo "Ready to compile? [ync]"
34 if ( "$resp" == "c" ) then
39 if ( "$resp" == "n" ) then
46 if ( "$a" == "-h" ) then
49 if ( "$a" != "-d" ) then
50 set arglist
= ( $arglist $a )
52 if ( "$a" == "all_wrfvar" ) then
53 grep "DA_CORE=1" configure.wrf
> /dev
/null
55 # If configuration file has DA_CORE=1 hardwired, ok to set WRF_DA_CORE to 1
59 if ( "$a" == "nmm_real" ) then
60 grep "NMM_CORE=1" configure.wrf
> /dev
/null
62 # If configuration file has NMM_CORE=1 hardwired, ok to set WRF_NMM_CORE to 1
63 if ( ! $?WRF_NMM_CORE
) setenv WRF_NMM_CORE
1
66 if ( "$a" == "-j" ) then
68 setenv J
"-j $argv[1]"
73 if ( "$arglist" == "" ) then
77 setenv A2DCASE
`echo $arglist | grep 2d`
79 if ( ! ( $?WRF_EM_CORE || $?WRF_NMM_CORE \
80 || $?WRF_COAMPS_CORE || $?WRF_EXP_CORE
)) then
81 echo 'None of WRF_EM_CORE, WRF_NMM_CORE, '
82 # echo ' WRF_COAMPS_CORE, or WRF_EXP_CORE '
83 echo ' specified in shell environment.... '
86 setenv WRF_COAMPS_CORE
0
90 # these settings get passed down through the environment in the
92 if ( ! $?WRF_DA_CORE
) setenv WRF_DA_CORE
0
93 if ( ! $?WRF_EM_CORE
) setenv WRF_EM_CORE
0
94 if ( ! $?WRF_NMM_CORE
) setenv WRF_NMM_CORE
0
95 if ( ! $?WRF_NMM_NEST
) setenv WRF_NMM_NEST
0
96 if ( ! $?WRF_COAMPS_CORE
) setenv WRF_COAMPS_CORE
0
97 if ( ! $?WRF_EXP_CORE
) setenv WRF_EXP_CORE
0
98 if ( ! $?WRF_CHEM
) setenv WRF_CHEM
0
99 if ( ! $?WRF_DFI_RADAR
) setenv WRF_DFI_RADAR
0
100 if ( ! $?HWRF
) setenv HWRF
0
101 if ( ! $?WRF_CONVERT
) then
102 if ( "$arglist" == "convert_em" ) then
110 if ( ! $?DA_ARCHFLAGS
) setenv DA_ARCHFLAGS
""
112 if ( ( $WRF_DA_CORE == 1 ) && ( ! -d var
) ) then
114 echo "You need to download and untar the Var code, or"
115 echo "unset the WRF_DA_CORE env variable."
120 if ( ( $WRF_CHEM == 1 ) && ( ! -d chem
) ) then
122 echo "You need to download and untar the chem code, or"
123 echo "unset the WRF_CHEM env variable."
129 if ($WRF_NMM_CORE == 1 && $WRF_DFI_RADAR == 1 ) then
130 echo "radar dfi not yet supported in NMM core, set WRF_DFI_RADAR to 0 "
133 if ($WRF_NMM_CORE == 1 && $WRF_CHEM == 1 ) then
134 echo "Chemistry not yet supported in NMM core, set WRF_CHEM to 0 "
135 if ( ! -f Registry
/Registry
) then
136 echo Registry
file does not exist
139 head -2 Registry
/Registry |
tail -1 |
grep NMM_CHEM
> /dev
/null
143 set nmm_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM_CHEM' | grep -v 'Registry.NMM_CHEM.' | awk '{print $1}'`
144 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
145 if ( $nmm_time > $rg_time ) set overwrite
=1
148 if ( $overwrite ) then
149 echo copying Registry
/Registry.NMM_CHEM to Registry
/Registry
150 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM_CHEM. Changes may be lost' > Registry
/Registry
151 /bin
/cat Registry
/Registry.NMM_CHEM
>> Registry
/Registry
157 if ($WRF_EM_CORE == 1 && $WRF_NMM_CORE == 1 ) then
158 echo "Cannot compile both EM and NMM cores in same executable yet."
161 if ($WRF_EM_CORE == 0 && $WRF_NMM_CORE == 0 && ! $WRF_CONVERT == 1 ) then
162 echo "Cannot compile because both EM and NMM cores are set to 0."
165 if ("$arglist" == 'nmm_real' && $WRF_NMM_CORE == 0) then
166 echo WRF_NMM_CORE must be
set to
1 in order to compile nmm_real
169 if (($WRF_EM_CORE == 1)&&($WRF_DA_CORE == 0 ) &&($WRF_CHEM == 0 )&&($WRF_CONVERT == 0)) then
170 if ( ! -f Registry
/Registry
) then
173 head -2 Registry
/Registry |
tail -1 |
grep EM
> /dev
/null
177 set em_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM' | grep -v 'Registry.EM.' | awk '{print $1}'`
178 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
179 if ( $em_time > $rg_time ) set overwrite
=1
182 if ( $overwrite ) then
183 echo copying Registry
/Registry.EM to Registry
/Registry
184 echo '## WARNING: this file is autogenerated from Registry/Registry.EM. Changes may be lost' > Registry
/Registry
185 /bin
/cat Registry
/Registry.EM
>> Registry
/Registry
187 else if (($WRF_EM_CORE == 1)&&($WRF_CHEM == 1 )) then
188 if ( ! -f Registry
/Registry
) then
191 head -2 Registry
/Registry |
tail -1 |
grep EM_CHEM
> /dev
/null
195 set em_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM_CHEM' | grep -v 'Registry.EM_CHEM.' | awk '{print $1}'`
196 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
197 if ( $em_time > $rg_time ) set overwrite
=1
200 if ( $overwrite ) then
201 echo copying Registry
/Registry.EM_CHEM to Registry
/Registry
202 echo '## WARNING: this file is autogenerated from Registry/Registry.EM_CHEM. Changes may be lost' > Registry
/Registry
203 /bin
/cat Registry
/Registry.EM_CHEM
>> Registry
/Registry
205 else if (($WRF_EM_CORE == 1)&&($WRF_DFI_RADAR == 1 )) then
206 if ( ! -f Registry
/Registry
) then
209 if ( $overwrite ) then
210 echo copying Registry
/Registry.EM to Registry
/Registry
211 echo '## WARNING: this file is autogenerated from Registry/Registry.EM. Changes may be lost' > Registry
/Registry
212 /bin
/cat Registry
/Registry.EM
>> Registry
/Registry
214 else if (($WRF_EM_CORE == 0)&&($WRF_CONVERT == 1 )) then
215 if ( ! -f Registry
/Registry
) then
218 head -2 Registry
/Registry |
tail -1 |
grep EM_CONVERT
> /dev
/null
222 set em_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM_CONVERT' | grep -v 'Registry.EM_CONVERT.' | awk '{print $1}'`
223 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
224 if ( $em_time > $rg_time ) set overwrite
=1
227 if ( $overwrite ) then
228 echo copying Registry
/Registry.CONVERT to Registry
/Registry
229 echo '## WARNING: this file is autogenerated from Registry/Registry.CONVERT. Changes may be lost' > Registry
/Registry
230 /bin
/cat Registry
/Registry.CONVERT
>> Registry
/Registry
232 else if ( $WRF_DA_CORE == 1 ) then
233 if ( ! -f Registry
/Registry
) then
236 head -2 Registry
/Registry |
tail -1 |
grep WRFVAR
> /dev
/null
240 set nmm_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM' | grep -v 'Registry.NMM.' | awk '{print $1}'`
241 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
242 if ( $nmm_time > $rg_time ) set overwrite
=1
245 if ( $overwrite ) then
246 echo copying Registry
/Registry.wrfvar to Registry
/Registry
247 echo '## WARNING: this file is autogenerated from Registry/Registry.wrfvar. Changes may be lost' > Registry
/Registry
248 /bin
/cat Registry
/Registry.wrfvar
>> Registry
/Registry
253 echo "BUFR library will be compiled for radiance data ingest."
257 setenv CRTM_CPP
"-DCRTM"
258 setenv CRTM_LIB
"-L../external/crtm/libsrc -lCRTM"
259 setenv CRTM_SRC
"-I../external/crtm/libsrc"
260 setenv SFC_CRTM
`grep '^SFC' configure.wrf | awk '{print $3}' | sed -e 's/\// /g' | awk '{print $NF}'`
261 setenv ABI_CRTM
`grep '^SFC' configure.wrf | sed -n 's/.*\(\-m[0-9]\{2\}\).*/\1/p'`
270 echo "BUFR library is needed for radiance data ingest."
274 setenv RTTOV_CPP
"-DRTTOV"
275 setenv RTTOV_LIB
"-L${RTTOV}/lib -lrttov10.1.0_coef_io -lrttov10.1.0_emis_atlas -lrttov10.1.0_main"
276 setenv RTTOV_SRC
"-I${RTTOV}/include -I${RTTOV}/mod"
283 setenv BUFR_CPP
"-DBUFR"
284 setenv BUFR_LIB
"-L../external/bufr -lbufr"
289 if ( $?WAVELET
) then
290 setenv WAVELET_LIB
"../external/wavelet/libWavelet.a ../external/wavelet/lib_wavelet.a"
292 setenv WAVELET_LIB
" "
295 setenv MADIS_CPP
"-DMADIS"
296 setenv MADIS_STATIC
${MADIS}/static
297 setenv MADIS_LIB
"-L${MADIS} -lmadis"
302 setenv DA_ARCHFLAGS
"${BUFR_CPP} ${MADIS_CPP} -DFFTPACK -DNORESHAPE"
304 if (($WRF_NMM_CORE == 1)&&($WRF_CHEM == 0 )) then
305 if ( ! -f Registry
/Registry
) then
308 head -2 Registry
/Registry |
tail -1 |
grep NMM
> /dev
/null
312 set nmm_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM' | grep -v 'Registry.NMM.' | awk '{print $1}'`
313 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
314 if ( $nmm_time > $rg_time ) set overwrite
=1
317 if ( $overwrite ) then
318 if (($WRF_NMM_CORE == 1)&&($WRF_NMM_NEST == 1)) then
320 echo copying Registry
/Registry.NMM_HWRF to Registry
/Registry
321 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM_HWRF. Changes may be lost' > Registry
/Registry
322 /bin
/cat Registry
/Registry.NMM_HWRF
>> Registry
/Registry
324 echo copying Registry
/Registry.NMM_NEST to Registry
/Registry
325 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM_NEST. Changes may be lost' > Registry
/Registry
326 /bin
/cat Registry
/Registry.NMM_NEST
>> Registry
/Registry
329 echo copying Registry
/Registry.NMM to Registry
/Registry
330 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM. Changes may be lost' > Registry
/Registry
331 /bin
/cat Registry
/Registry.NMM
>> Registry
/Registry
334 # integrity check for a kludge where a hard coded value in the
335 # registry must match the same value in arch/preamble_new
336 set registryvalue
=`grep 'dimspec.* q ' Registry/registry.dimspec | sed -e 's/..*constant=//' -e 's/ ..*$//'`
337 set preamblevalue
=`grep 'DNMM_MAX_DIM=.*' arch/preamble_new | sed -e 's/..*-DNMM_MAX_DIM=//' -e 's/ ..*$//'`
338 if ( $registryvalue != $preamblevalue ) then
339 echo "Harded coded value of dimspec q in Registry ($registryvalue) does not"
340 echo "equal the hard coded value of NMM_MAX_DIM in arch/preamble_new ($preamblevalue)"
341 echo "Please fix and try again."
347 echo -n "Compiling: "
348 if ( $WRF_DA_CORE ) echo -n "WRF_DA_CORE "
349 if ( $WRF_EM_CORE ) echo -n "WRF_EM_CORE "
350 if ( $WRF_NMM_CORE ) echo -n "WRF_NMM_CORE "
351 if ( $WRF_COAMPS_CORE ) echo -n "WRF_COAMPS_CORE "
352 if ( $WRF_EXP_CORE ) echo -n "WRF_EXP_CORE "
356 if ( ! $?WRF_SRC_ROOT_DIR
) setenv WRF_SRC_ROOT_DIR
`pwd`
358 # new dec 2009. check to see if make supports parallel -j option
359 make -j 2 >& /dev
/null
360 if ( $status == 0 ) then # Parallel make ok
361 if ( ! $?J
) then # J not defined
362 echo setting parallel
make -j 1 # Set default to 2
365 # J is defined, check that it is a correctly formed variable
366 set first2chars
= `echo $J | cut -c 1-2` # Are 1st two chars are -j?
367 set second_word
= `echo $J | cut -d" " -f2` # Is second word a number?
368 if ( "$first2chars" == "-j" ) then
369 if ( ( "$second_word" >= "2" ) && \
370 ( "$second_word" <= "20" ) ) then
371 echo setting parallel
make $J
372 else if ( "$second_word" == "1" ) then
373 echo setting serial
make $J
375 echo "badly formed -j option for parallel make: $J"
376 echo "or you set the number of processors above 20 "
377 echo setting parallel
make -j 2 # Set default to 2
381 if ( "$J" == "" ) then # J blank is OK
382 echo setting serial
make $J
384 echo "parallel option for make is -j, you entered: $first2chars"
385 echo setting parallel
make -j 2 # Set default to 2
391 echo not setting parallel
make
394 make $arglist A2DCASE
="$A2DCASE" WRF_SRC_ROOT_DIR
="$WRF_SRC_ROOT_DIR"
405 echo ' compile [-d] [-j n] wrf compile wrf in run dir (NOTE: no real.exe, ndown.exe, or ideal.exe generated)'
407 echo ' or choose a test case (see README_test_cases for details) :'
408 foreach d
( `/bin/ls test` )
409 if ( "$d" != "CVS" ) then
414 echo ' compile -d compile without optimization and with debugging'
415 echo ' compile -j n parallel make using n tasks if supported (default 2)'
416 echo ' compile -h help message'