Allow changes to the windowing option in plotfmt to be made via the nameslist.
[WPS.git] / compile
blobec15418b78a3e4c70608a218a2e97cf74db9b7db
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 plotfmt rd_intermediate plotgrids mod_levs avg_tsfc calc_ecmwf_p height_ukmo )
37 set NAMES = ( GEOGRID UNGRIB METGRID GRIBUTIL GRIBUTIL UTIL 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 )
43 set NAMES = ( GRIBUTIL GRIBUTIL 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
81 echo "*****"
82 echo " "
83 echo "Unrecognized compile target $1."
84 echo " "
85 echo "Usage: compile [target]"
86 echo "where target is one of"
87 echo " wps"
88 echo " util"
89 echo " geogrid"
90 echo " ungrib"
91 echo " metgrid"
92 echo " g1print"
93 echo " g2print"
94 echo " plotfmt"
95 echo " rd_intermediate"
96 echo " plotgrids"
97 echo " mod_levs"
98 echo " avg_tsfc"
99 echo " calc_ecmwf_p"
100 echo " height_ukmo"
101 echo " "
102 echo " or just run compile with no target to build everything."
103 echo " "
104 echo "*****"
105 exit(1)
106 endif
108 echo " "
109 if ( ${#argv} == 0 ) then
110 echo "**** Compiling WPS and all utilities ****"
111 else
112 echo "**** Compiling $1 ****"
113 endif
114 echo " "
116 set count = 1
117 foreach f ( $names )
118 if ("$NAMES[$count]" == "UTIL") then
119 ( cd util ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all )
120 else if ("$NAMES[$count]" == "GRIBUTIL") then
121 ( cd ungrib ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all )
122 if ( -e ungrib/src/${f}.exe ) then
123 ( cd util ; ln -sf ../ungrib/src/${f}.exe . )
124 endif
125 else
126 ( cd $f ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all )
127 if ( -e ${f}/src/${f}.exe ) then
128 ln -sf ${f}/src/${f}.exe .
129 endif
130 endif
131 @ count ++
134 if ( $temp_netcdf == 1 ) then
135 unsetenv NETCDF
136 endif
138 exit(0)