[11] | 1 | #!/bin/csh -f |
---|
| 2 | |
---|
| 3 | if ( ! -e configure.wps ) then |
---|
| 4 | echo "Do 'configure' first" |
---|
| 5 | exit ( 1 ) |
---|
| 6 | endif |
---|
| 7 | |
---|
| 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 |
---|
| 14 | |
---|
| 15 | set DEV_TOP = `pwd` |
---|
| 16 | set first_char = `grep ^WRF_DIR configure.wps | awk '{print $3}' | cut -c -1` |
---|
| 17 | |
---|
| 18 | if ( "$first_char" == "/" ) then |
---|
| 19 | set WRF_DIR_PRE = |
---|
| 20 | else |
---|
| 21 | set WRF_DIR_PRE = ${DEV_TOP}/ |
---|
| 22 | endif |
---|
| 23 | |
---|
| 24 | if ( ${#argv} == 0 ) then |
---|
| 25 | set names = ( geogrid ungrib metgrid g1print g2print plotfmt rd_intermediate plotgrids mod_levs avg_tsfc ) |
---|
| 26 | set NAMES = ( GEOGRID UNGRIB METGRID GRIBUTIL GRIBUTIL UTIL UTIL UTIL UTIL UTIL ) |
---|
| 27 | else if ( $1 == wps ) then |
---|
| 28 | set names = ( geogrid ungrib metgrid ) |
---|
| 29 | set NAMES = ( GEOGRID UNGRIB METGRID ) |
---|
| 30 | else if ( $1 == util ) then |
---|
| 31 | set names = ( g1print g2print plotfmt rd_intermediate plotgrids mod_levs avg_tsfc ) |
---|
| 32 | set NAMES = ( GRIBUTIL GRIBUTIL UTIL UTIL UTIL UTIL UTIL ) |
---|
| 33 | else if ( $1 == geogrid ) then |
---|
| 34 | set names = ( geogrid ) |
---|
| 35 | set NAMES = ( GEOGRID ) |
---|
| 36 | else if ( $1 == ungrib ) then |
---|
| 37 | set names = ( ungrib ) |
---|
| 38 | set NAMES = ( UNGRIB ) |
---|
| 39 | else if ( $1 == metgrid ) then |
---|
| 40 | set names = ( metgrid ) |
---|
| 41 | set NAMES = ( METGRID ) |
---|
| 42 | else if ( $1 == g1print ) then |
---|
| 43 | set names = ( g1print ) |
---|
| 44 | set NAMES = ( GRIBUTIL ) |
---|
| 45 | else if ( $1 == g2print ) then |
---|
| 46 | set names = ( g2print ) |
---|
| 47 | set NAMES = ( GRIBUTIL ) |
---|
| 48 | else if ( $1 == plotfmt ) then |
---|
| 49 | set names = ( plotfmt ) |
---|
| 50 | set NAMES = ( UTIL ) |
---|
| 51 | else if ( $1 == rd_intermediate ) then |
---|
| 52 | set names = ( rd_intermediate ) |
---|
| 53 | set NAMES = ( UTIL ) |
---|
| 54 | else if ( $1 == plotgrids ) then |
---|
| 55 | set names = ( plotgrids ) |
---|
| 56 | set NAMES = ( UTIL ) |
---|
| 57 | else if ( $1 == mod_levs ) then |
---|
| 58 | set names = ( mod_levs ) |
---|
| 59 | set NAMES = ( UTIL ) |
---|
| 60 | else if ( $1 == avg_tsfc ) then |
---|
| 61 | set names = ( avg_tsfc ) |
---|
| 62 | set NAMES = ( UTIL ) |
---|
| 63 | else |
---|
| 64 | echo "*****" |
---|
| 65 | echo " " |
---|
| 66 | echo "Unrecognized compile target $1." |
---|
| 67 | echo " " |
---|
| 68 | echo "Usage: compile [target]" |
---|
| 69 | echo "where target is one of" |
---|
| 70 | echo " wps" |
---|
| 71 | echo " util" |
---|
| 72 | echo " geogrid" |
---|
| 73 | echo " ungrib" |
---|
| 74 | echo " metgrid" |
---|
| 75 | echo " g1print" |
---|
| 76 | echo " g2print" |
---|
| 77 | echo " plotfmt" |
---|
| 78 | echo " rd_intermediate" |
---|
| 79 | echo " plotgrids" |
---|
| 80 | echo " mod_levs" |
---|
| 81 | echo " avg_tsfc" |
---|
| 82 | echo " " |
---|
| 83 | echo " or just run compile with no target to build everything." |
---|
| 84 | echo " " |
---|
| 85 | echo "*****" |
---|
| 86 | exit(1) |
---|
| 87 | endif |
---|
| 88 | |
---|
| 89 | echo " " |
---|
| 90 | if ( ${#argv} == 0 ) then |
---|
| 91 | echo "**** Compiling WPS and all utilities ****" |
---|
| 92 | else |
---|
| 93 | echo "**** Compiling $1 ****" |
---|
| 94 | endif |
---|
| 95 | echo " " |
---|
| 96 | |
---|
| 97 | set count = 1 |
---|
| 98 | foreach f ( $names ) |
---|
| 99 | if ("$NAMES[$count]" == "UTIL") then |
---|
| 100 | ( cd util ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all ) |
---|
| 101 | else if ("$NAMES[$count]" == "GRIBUTIL") then |
---|
| 102 | ( cd ungrib ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all ) |
---|
| 103 | if ( -e ungrib/src/${f}.exe ) then |
---|
| 104 | ( cd util ; ln -sf ../ungrib/src/${f}.exe . ) |
---|
| 105 | endif |
---|
| 106 | else |
---|
| 107 | ( cd $f ; make -i -r WRF_DIR_PRE="${WRF_DIR_PRE}" DEV_TOP="${DEV_TOP}" TARGET="${f}.exe" CPP_TARGET="$NAMES[$count]" all ) |
---|
| 108 | if ( -e ${f}/src/${f}.exe ) then |
---|
| 109 | ln -sf ${f}/src/${f}.exe . |
---|
| 110 | endif |
---|
| 111 | endif |
---|
| 112 | @ count ++ |
---|
| 113 | end |
---|
| 114 | |
---|
| 115 | if ( $temp_netcdf == 1 ) then |
---|
| 116 | unsetenv NETCDF |
---|
| 117 | endif |
---|
| 118 | |
---|
| 119 | exit(0) |
---|