Subversion Repositories pvinversion.ecmwf

Rev

Rev 3 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

# ----- Load modules --------------------------

module load netcdf/4.2.1-pgf90
module list 

# ---- set some directories and other stuff ---

set mode = $1
set svnpath=https://svn.iac.ethz.ch/pub/pvinversion.ecmwf/
set bdir = ${PWD}

# ----- Set libraries and includes ------------

set libs   = "-L ${bdir}/lib"
set libs   = "${libs} -lcdfio" 
set libs   = "${libs} -lcdfplus" 
set libs   = "${libs} -lipo"
set libs   = "${libs} -lgm2em"

set ncdf_incs  = `nc-config --fflags`
set ncdf_libs  = `nc-config --flibs`

# ----- Create a new SVN tag ------------------
tag:

if ( "${mode}" == "tag" ) then
   svn info
   if ( "${#argv}" != 2 ) then
     echo "Usage: install.csh tag id <id=tag number>"
   else
     set tagnr = $2
   endif
   svn copy ${svnpath}/trunk ${svnpath}/tags/${tagnr} -m "Release ${tagnr}"
   exit 0
endif


if ( "${mode}" != "clean" ) goto compile
# ----- Make clean ----------------------------
clean:

if ( "${mode}" != "clean" ) goto compile

cd ${bdir}/lib
foreach lib (  libcdfio libcdfplus libipo libgm2em ) 
 \rm -f ${lib}.o
end

cd ${bdir}/diag/
foreach tool (  calc_qgpv check_boundcon difference hydrostatic qvec_analysis ) 
 \rm -f ${tool}.o
 \rm -f ${tool}
end

cd ${bdir}/post/
foreach tool ( add2p rotate_lalo )  
 \rm -f ${tool}.o
 \rm -f ${tool}
end

cd ${bdir}/prep/
foreach tool ( coastline cutnetcdf def_anomaly p2z ref_profile rotate_grid z2s ) 
 \rm -f ${tool}.o
 \rm -f ${tool}
end

cd ${bdir}/pvin/
foreach tool ( inv_cart prep_iteration pv_to_qgpv z2s ) 
 \rm -f ${tool}.o
 \rm -f ${tool}
end

cd ${bdir}/spec/
foreach tool ( modify_anomaly ) 
  \rm -f ${tool}.o
  \rm -f ${tool}
end

# ----- Compile -------------------------------
compile:

if ( "${mode}" != "compile" ) goto done

cd ${bdir}/lib

foreach lib (  libcdfio libcdfplus libipo libgm2em ) 

\rm -f ${lib}.o

echo "pgf90 -c ${lib}.f ${ncdf_incs}"  
      pgf90 -c ${lib}.f ${ncdf_incs}   

end

cd ${bdir}/diag/

foreach tool (  calc_qgpv check_boundcon difference hydrostatic qvec_analysis ) 

\rm -f ${tool}.o
\rm -f ${tool}

echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
      pgf90 -c ${tool}.f ${ncdf_incs}   
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}

if ( ! -f ${tool} ) then
  echo "ERROR: compilation of <tool> failed... exit"
  exit 1
endif

end

cd ${bdir}/post/

foreach tool ( add2p rotate_lalo )  

\rm -f ${tool}.o
\rm -f ${tool}

echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
      pgf90 -c ${tool}.f ${ncdf_incs}   
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}

if ( ! -f ${tool} ) then
  echo "ERROR: compilation of <tool> failed... exit"
  exit 1
endif

end

cd ${bdir}/prep/

foreach tool ( coastline cutnetcdf def_anomaly p2z ref_profile rotate_grid z2s ) 

\rm -f ${tool}.o
\rm -f ${tool}

echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
      pgf90 -c ${tool}.f ${ncdf_incs}   
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}

if ( ! -f ${tool} ) then
  echo "ERROR: compilation of <tool> failed... exit"
  exit 1
endif

end

cd ${bdir}/pvin/

foreach tool ( inv_cart prep_iteration pv_to_qgpv z2s ) 

\rm -f ${tool}.o
\rm -f ${tool}

echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
      pgf90 -c ${tool}.f ${ncdf_incs}   
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}

if ( ! -f ${tool} ) then
  echo "ERROR: compilation of <tool> failed... exit"
  exit 1
endif

end

cd ${bdir}/spec/

foreach tool ( modify_anomaly ) 

\rm -f ${tool}.o
\rm -f ${tool}

echo "pgf90 -c ${tool}.f ${ncdf_incs}"  
      pgf90 -c ${tool}.f ${ncdf_incs}   
echo "pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}"        
      pgf90 -o ${tool} ${tool}.o ${libs} ${ncdf_libs}

if ( ! -f ${tool} ) then
  echo "ERROR: compilation of <tool> failed... exit"
  exit 1
endif

end

# ----- Done ----------------------------------
done:

exit 0