Subversion Repositories pvinversion.ecmwf

Rev

Rev 4 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
# ----- Load modules --------------------------
2
 
3
module load netcdf/4.2.1-pgf90
4
module list 
5
 
6
# ---- set some directories and other stuff ---
7
 
8
set bdir = ${PWD}
9
set mode = $1
10
 
11
# ----- Set libraries and includes ------------
12
 
13
set libs   = "-L ${bdir}/lib"
14
set libs   = "${libs} -lcdfio" 
15
set libs   = "${libs} -lcdfplus" 
16
set libs   = "${libs} -lipo"
17
set libs   = "${libs} -lgm2em"
18
 
19
set ncdf_incs  = `nc-config --fflags`
20
set ncdf_libs  = `nc-config --flibs`
21
 
22
# ----- Make clean ----------------------------
23
clean:
24
 
25
if ( "${mode}" != "clean" ) goto compile
26
 
27
cd ${bdir}/lib
28
foreach lib (  libcdfio libcdfplus libipo libgm2em ) 
29
 \rm -f ${lib}.o
30
end
31
 
32
cd ${bdir}/diag/
33
foreach tool (  calc_qgpv check_boundcon difference hydrostatic qvec_analysis ) 
34
 \rm -f ${tool}.o
35
 \rm -f ${tool}
36
end
37
 
38
cd ${bdir}/post/
39
foreach tool ( add2p rotate_lalo )  
40
 \rm -f ${tool}.o
41
 \rm -f ${tool}
42
end
43
 
44
cd ${bdir}/prep/
45
foreach tool ( coastline cutnetcdf def_anomaly p2z ref_profile rotate_grid z2s ) 
46
 \rm -f ${tool}.o
47
 \rm -f ${tool}
48
end
49
 
50
cd ${bdir}/pvin/
51
foreach tool ( inv_cart prep_iteration pv_to_qgpv z2s ) 
52
 \rm -f ${tool}.o
53
 \rm -f ${tool}
54
end
55
 
56
cd ${bdir}/spec/
57
foreach tool ( modify_anomaly ) 
58
  \rm -f ${tool}.o
59
  \rm -f ${tool}
60
end
61
 
62
# ----- Compile -------------------------------
63
compile:
64
 
65
if ( "${mode}" != "compile" ) goto done
66
 
67
cd ${bdir}/lib
68
 
69
foreach lib (  libcdfio libcdfplus libipo libgm2em ) 
70
 
71
\rm -f ${lib}.o
72
 
73
echo "pgf90 -c ${lib}.f ${ncdf_incs}"  
74
      pgf90 -c ${lib}.f ${ncdf_incs}   
75
 
76
end
77
 
78
cd ${bdir}/diag/
79
 
80
foreach tool (  calc_qgpv check_boundcon difference hydrostatic qvec_analysis ) 
81
 
82
\rm -f ${tool}.o
83
\rm -f ${tool}
84
 
85
echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
86
      pgf90 -c ${tool}.f ${ncdf_incs}   
87
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
88
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}
89
 
90
if ( ! -f ${tool} ) then
91
  echo "ERROR: compilation of <tool> failed... exit"
92
  exit 1
93
endif
94
 
95
end
96
 
97
cd ${bdir}/post/
98
 
99
foreach tool ( add2p rotate_lalo )  
100
 
101
\rm -f ${tool}.o
102
\rm -f ${tool}
103
 
104
echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
105
      pgf90 -c ${tool}.f ${ncdf_incs}   
106
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
107
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}
108
 
109
if ( ! -f ${tool} ) then
110
  echo "ERROR: compilation of <tool> failed... exit"
111
  exit 1
112
endif
113
 
114
end
115
 
116
cd ${bdir}/prep/
117
 
118
foreach tool ( coastline cutnetcdf def_anomaly p2z ref_profile rotate_grid z2s ) 
119
 
120
\rm -f ${tool}.o
121
\rm -f ${tool}
122
 
123
echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
124
      pgf90 -c ${tool}.f ${ncdf_incs}   
125
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
126
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}
127
 
128
if ( ! -f ${tool} ) then
129
  echo "ERROR: compilation of <tool> failed... exit"
130
  exit 1
131
endif
132
 
133
end
134
 
135
cd ${bdir}/pvin/
136
 
137
foreach tool ( inv_cart prep_iteration pv_to_qgpv z2s ) 
138
 
139
\rm -f ${tool}.o
140
\rm -f ${tool}
141
 
142
echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
143
      pgf90 -c ${tool}.f ${ncdf_incs}   
144
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
145
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}
146
 
147
if ( ! -f ${tool} ) then
148
  echo "ERROR: compilation of <tool> failed... exit"
149
  exit 1
150
endif
151
 
152
end
153
 
154
cd ${bdir}/spec/
155
 
156
foreach tool ( modify_anomaly ) 
157
 
158
\rm -f ${tool}.o
159
\rm -f ${tool}
160
 
161
echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
162
      pgf90 -c ${tool}.f ${ncdf_incs}   
163
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
164
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}
165
 
166
if ( ! -f ${tool} ) then
167
  echo "ERROR: compilation of <tool> failed... exit"
168
  exit 1
169
endif
170
 
171
end
172
 
173
# ----- Done ----------------------------------
174
done:
175
 
176
exit 0