-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile
executable file
·164 lines (152 loc) · 4.68 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
#!/bin/csh -f
if ( ! -e configure.wps ) then
echo "Do 'configure' first"
exit ( 1 )
endif
if ( ( ! $?NETCDF ) && ( -d netcdf_links ) ) then
setenv NETCDF `pwd`/netcdf_links
setenv temp_netcdf 1
else
setenv temp_netcdf 0
endif
set DEV_TOP = `pwd`
set first_char = `grep ^WRF_DIR configure.wps | awk '{print $3}' | cut -c -1`
## test for Cygwin on Windows
grep CYGWIN_NT configure.wps >& /dev/null
if ( $status == 0 ) then
ls -l */*/*cio.c | grep '^l'
if ( $status == 0 ) then
echo Symbolic links are not handled properly by pgcc on Windows. Run arch/fixlinks in this directory and try again.
exit
endif
else
if ( "$first_char" == "/" ) then
set WRF_DIR_PRE =
else
set WRF_DIR_PRE = ${DEV_TOP}/
endif
endif
if ( ${#argv} == 0 ) then
set names = ( geogrid ungrib metgrid g1print g2print rd_intermediate mod_levs avg_tsfc calc_ecmwf_p height_ukmo int2nc )
set NAMES = ( GEOGRID UNGRIB METGRID GRIBUTIL GRIBUTIL UTIL UTIL UTIL UTIL UTIL UTIL )
else if ( $1 == wps ) then
set names = ( geogrid ungrib metgrid )
set NAMES = ( GEOGRID UNGRIB METGRID )
else if ( $1 == util ) then
set names = ( g1print g2print plotfmt rd_intermediate plotgrids mod_levs avg_tsfc calc_ecmwf_p height_ukmo int2nc )
set NAMES = ( GRIBUTIL GRIBUTIL UTIL UTIL UTIL UTIL UTIL UTIL UTIL UTIL )
else if ( $1 == geogrid ) then
set names = ( geogrid )
set NAMES = ( GEOGRID )
else if ( $1 == ungrib ) then
set names = ( ungrib )
set NAMES = ( UNGRIB )
else if ( $1 == metgrid ) then
set names = ( metgrid )
set NAMES = ( METGRID )
else if ( $1 == g1print ) then
set names = ( g1print )
set NAMES = ( GRIBUTIL )
else if ( $1 == g2print ) then
set names = ( g2print )
set NAMES = ( GRIBUTIL )
else if ( $1 == plotfmt ) then
set names = ( plotfmt )
set NAMES = ( UTIL )
else if ( $1 == rd_intermediate ) then
set names = ( rd_intermediate )
set NAMES = ( UTIL )
else if ( $1 == plotgrids ) then
set names = ( plotgrids )
set NAMES = ( UTIL )
else if ( $1 == mod_levs ) then
set names = ( mod_levs )
set NAMES = ( UTIL )
else if ( $1 == avg_tsfc ) then
set names = ( avg_tsfc )
set NAMES = ( UTIL )
else if ( $1 == calc_ecmwf_p ) then
set names = ( calc_ecmwf_p )
set NAMES = ( UTIL )
else if ( $1 == height_ukmo ) then
set names = ( height_ukmo )
set NAMES = ( UTIL )
else if ( $1 == int2nc ) then
set names = ( int2nc )
set NAMES = ( UTIL )
else
echo "*****"
echo " "
echo "Unrecognized compile target $1."
echo " "
echo "Usage: compile [target]"
echo "where target is one of"
echo " wps"
echo " util"
echo " geogrid"
echo " ungrib"
echo " metgrid"
echo " g1print"
echo " g2print"
echo " plotfmt"
echo " rd_intermediate"
echo " plotgrids"
echo " mod_levs"
echo " avg_tsfc"
echo " calc_ecmwf_p"
echo " height_ukmo"
echo " int2nc"
echo " "
echo " or just run compile with no target to build everything."
echo " "
echo "*****"
exit(1)
endif
# Print out WPS version, system info, and compiler/version
echo "============================================================================================== "
echo " "
echo Version 3.9
echo " "
uname -a
echo " "
set comp = ( `grep "^SFC" configure.wps | cut -d"=" -f2-` )
if ( "$comp[1]" == "gfortran" ) then
gfortran --version
else if ( "$comp[1]" == "pgf90" ) then
pgf90 --version
else if ( "$comp[1]" == "ifort" ) then
ifort -V
else
echo "Not sure how to figure out the version of this compiler: $comp[1]"
endif
echo " "
echo "============================================================================================== "
echo " "
echo " "
if ( ${#argv} == 0 ) then
echo "**** Compiling WPS and all utilities ****"
else
echo "**** Compiling $1 ****"
endif
echo " "
set count = 1
foreach f ( $names )
if ("$NAMES[$count]" == "UTIL") then
( cd util ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all )
else if ("$NAMES[$count]" == "GRIBUTIL") then
( cd ungrib ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all )
if ( -e ungrib/src/${f}.exe ) then
( cd util ; ln -sf ../ungrib/src/${f}.exe . )
endif
else
( cd $f ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all )
if ( -e ${f}/src/${f}.exe ) then
ln -sf ${f}/src/${f}.exe .
endif
endif
@ count ++
end
if ( $temp_netcdf == 1 ) then
unsetenv NETCDF
endif
exit(0)