Use WRF better Jasper module for control of versioning
[WPS.git] / compile
blobb7814cb3a6847b0efb288eb95fafb523c9980dd1
1 #!/bin/csh -f
3 if ( ! -e configure.wps ) then
4 echo "Do 'configure' first"
5 exit ( 1 )
6 endif
8 if ( ( ! $?NETCDF ) && ( -d netcdf_links ) ) then
9 setenv NETCDF `pwd`/netcdf_links
10 setenv temp_netcdf 1
11 else
12 setenv temp_netcdf 0
13 endif
15 set DEV_TOP = `pwd`
16 set first_char = `grep ^WRF_DIR configure.wps | awk '{print $3}' | cut -c -1`
19 ## test for Cygwin on Windows
20 grep CYGWIN_NT configure.wps >& /dev/null
21 if ( $status == 0 ) then
22 ls -l */*/*cio.c | grep '^l'
23 if ( $status == 0 ) then
24 echo Symbolic links are not handled properly by pgcc on Windows. Run arch/fixlinks in this directory and try again.
25 exit
26 endif
27 else
28 if ( "$first_char" == "/" ) then
29 set WRF_DIR_PRE =
30 else
31 set WRF_DIR_PRE = ${DEV_TOP}/
32 endif
33 endif
35 if ( ${#argv} == 0 ) then
36 set names = ( geogrid ungrib metgrid g1print g2print rd_intermediate mod_levs avg_tsfc calc_ecmwf_p height_ukmo int2nc )
37 set NAMES = ( GEOGRID UNGRIB METGRID GRIBUTIL GRIBUTIL UTIL UTIL UTIL UTIL UTIL UTIL )
38 else if ( $1 == wps ) then
39 set names = ( geogrid ungrib metgrid )
40 set NAMES = ( GEOGRID UNGRIB METGRID )
41 else if ( $1 == util ) then
42 set names = ( g1print g2print plotfmt rd_intermediate plotgrids mod_levs avg_tsfc calc_ecmwf_p height_ukmo int2nc )
43 set NAMES = ( GRIBUTIL GRIBUTIL UTIL UTIL UTIL UTIL UTIL UTIL UTIL UTIL )
44 else if ( $1 == geogrid ) then
45 set names = ( geogrid )
46 set NAMES = ( GEOGRID )
47 else if ( $1 == ungrib ) then
48 set names = ( ungrib )
49 set NAMES = ( UNGRIB )
50 else if ( $1 == metgrid ) then
51 set names = ( metgrid )
52 set NAMES = ( METGRID )
53 else if ( $1 == g1print ) then
54 set names = ( g1print )
55 set NAMES = ( GRIBUTIL )
56 else if ( $1 == g2print ) then
57 set names = ( g2print )
58 set NAMES = ( GRIBUTIL )
59 else if ( $1 == plotfmt ) then
60 set names = ( plotfmt )
61 set NAMES = ( UTIL )
62 else if ( $1 == rd_intermediate ) then
63 set names = ( rd_intermediate )
64 set NAMES = ( UTIL )
65 else if ( $1 == plotgrids ) then
66 set names = ( plotgrids )
67 set NAMES = ( UTIL )
68 else if ( $1 == mod_levs ) then
69 set names = ( mod_levs )
70 set NAMES = ( UTIL )
71 else if ( $1 == avg_tsfc ) then
72 set names = ( avg_tsfc )
73 set NAMES = ( UTIL )
74 else if ( $1 == calc_ecmwf_p ) then
75 set names = ( calc_ecmwf_p )
76 set NAMES = ( UTIL )
77 else if ( $1 == height_ukmo ) then
78 set names = ( height_ukmo )
79 set NAMES = ( UTIL )
80 else if ( $1 == int2nc ) then
81 set names = ( int2nc )
82 set NAMES = ( UTIL )
83 else
84 echo "*****"
85 echo " "
86 echo "Unrecognized compile target $1."
87 echo " "
88 echo "Usage: compile [target]"
89 echo "where target is one of"
90 echo " wps"
91 echo " util"
92 echo " geogrid"
93 echo " ungrib"
94 echo " metgrid"
95 echo " g1print"
96 echo " g2print"
97 echo " plotfmt"
98 echo " rd_intermediate"
99 echo " plotgrids"
100 echo " mod_levs"
101 echo " avg_tsfc"
102 echo " calc_ecmwf_p"
103 echo " height_ukmo"
104 echo " int2nc"
105 echo " "
106 echo " or just run compile with no target to build everything."
107 echo " "
108 echo "*****"
109 exit(1)
110 endif
112 # Print out WPS version, system info, and compiler/version
113 echo "============================================================================================== "
114 echo " "
115 echo Version 4.4
116 echo " "
117 uname -a
118 echo " "
119 set comp = ( `grep "^SFC" configure.wps | cut -d"=" -f2-` )
120 if ( "$comp[1]" == "gfortran" ) then
121 gfortran --version
122 else if ( "$comp[1]" == "pgf90" ) then
123 pgf90 --version
124 else if ( "$comp[1]" == "ifort" ) then
125 ifort -V
126 else
127 echo "Not sure how to figure out the version of this compiler: $comp[1]"
128 endif
129 echo " "
130 echo "============================================================================================== "
131 echo " "
134 echo " "
135 if ( ${#argv} == 0 ) then
136 echo "**** Compiling WPS and all utilities ****"
137 else
138 echo "**** Compiling $1 ****"
139 endif
140 echo " "
142 set count = 1
143 foreach f ( $names )
144 if ("$NAMES[$count]" == "UTIL") then
145 ( cd util ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all )
146 else if ("$NAMES[$count]" == "GRIBUTIL") then
147 ( cd ungrib ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all )
148 if ( -e ungrib/src/${f}.exe ) then
149 ( cd util ; ln -sf ../ungrib/src/${f}.exe . )
150 endif
151 else
152 ( cd $f ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all )
153 if ( -e ${f}/src/${f}.exe ) then
154 ln -sf ${f}/src/${f}.exe .
155 endif
156 endif
157 @ count ++
160 if ( $temp_netcdf == 1 ) then
161 unsetenv NETCDF
162 endif
164 exit(0)