Subversion Repositories pvinversion.ecmwf

Rev

Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 michaesp 1
#!/bin/csh
2
 
3 michaesp 3
# ----- Load modules --------------------------
4
 
5
module load netcdf/4.2.1-pgf90
6
module list 
7
 
8
# ---- set some directories and other stuff ---
9
 
4 michaesp 10
set mode = $1
11
set svnpath=https://svn.iac.ethz.ch/pub/pvinversion.ecmwf/
3 michaesp 12
set bdir = ${PWD}
13
 
14
# ----- Set libraries and includes ------------
15
 
16
set libs   = "-L ${bdir}/lib"
17
set libs   = "${libs} -lcdfio" 
18
set libs   = "${libs} -lcdfplus" 
19
set libs   = "${libs} -lipo"
20
set libs   = "${libs} -lgm2em"
21
 
22
set ncdf_incs  = `nc-config --fflags`
23
set ncdf_libs  = `nc-config --flibs`
24
 
4 michaesp 25
# ----- Create a new SVN tag ------------------
26
tag:
27
 
28
if ( "${mode}" == "tag" ) then
29
   svn info
30
   if ( "${#argv}" != 2 ) then
31
     echo "Usage: install.csh tag id <id=tag number>"
32
   else
33
     set tagnr = $2
34
   endif
35
   svn copy ${svnpath}/trunk ${svnpath}/tags/${tagnr} -m "Release ${tagnr}"
36
   exit 0
37
endif
38
 
39
 
40
if ( "${mode}" != "clean" ) goto compile
3 michaesp 41
# ----- Make clean ----------------------------
42
clean:
43
 
44
if ( "${mode}" != "clean" ) goto compile
45
 
46
cd ${bdir}/lib
47
foreach lib (  libcdfio libcdfplus libipo libgm2em ) 
48
 \rm -f ${lib}.o
49
end
50
 
51
cd ${bdir}/diag/
52
foreach tool (  calc_qgpv check_boundcon difference hydrostatic qvec_analysis ) 
53
 \rm -f ${tool}.o
54
 \rm -f ${tool}
55
end
56
 
57
cd ${bdir}/post/
58
foreach tool ( add2p rotate_lalo )  
59
 \rm -f ${tool}.o
60
 \rm -f ${tool}
61
end
62
 
63
cd ${bdir}/prep/
64
foreach tool ( coastline cutnetcdf def_anomaly p2z ref_profile rotate_grid z2s ) 
65
 \rm -f ${tool}.o
66
 \rm -f ${tool}
67
end
68
 
69
cd ${bdir}/pvin/
70
foreach tool ( inv_cart prep_iteration pv_to_qgpv z2s ) 
71
 \rm -f ${tool}.o
72
 \rm -f ${tool}
73
end
74
 
75
cd ${bdir}/spec/
76
foreach tool ( modify_anomaly ) 
77
  \rm -f ${tool}.o
78
  \rm -f ${tool}
79
end
80
 
81
# ----- Compile -------------------------------
82
compile:
83
 
84
if ( "${mode}" != "compile" ) goto done
85
 
86
cd ${bdir}/lib
87
 
88
foreach lib (  libcdfio libcdfplus libipo libgm2em ) 
89
 
90
\rm -f ${lib}.o
91
 
92
echo "pgf90 -c ${lib}.f ${ncdf_incs}"  
93
      pgf90 -c ${lib}.f ${ncdf_incs}   
94
 
95
end
96
 
97
cd ${bdir}/diag/
98
 
99
foreach tool (  calc_qgpv check_boundcon difference hydrostatic qvec_analysis ) 
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}/post/
117
 
118
foreach tool ( add2p rotate_lalo )  
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}/prep/
136
 
137
foreach tool ( coastline cutnetcdf def_anomaly p2z ref_profile rotate_grid 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}/pvin/
155
 
156
foreach tool ( inv_cart prep_iteration pv_to_qgpv z2s ) 
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
cd ${bdir}/spec/
174
 
175
foreach tool ( modify_anomaly ) 
176
 
177
\rm -f ${tool}.o
178
\rm -f ${tool}
179
 
180
echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
181
      pgf90 -c ${tool}.f ${ncdf_incs}   
182
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
183
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}
184
 
185
if ( ! -f ${tool} ) then
186
  echo "ERROR: compilation of <tool> failed... exit"
187
  exit 1
188
endif
189
 
190
end
191
 
192
# ----- Done ----------------------------------
193
done:
194
 
195
exit 0