[64] | 1 | #!/bin/csh |
---|
| 2 | set verbose echo |
---|
| 3 | set is_parallel_opt = FALSE |
---|
| 4 | set is_driver_opt = FALSE |
---|
| 5 | set is_arch_opt = FALSE |
---|
| 6 | set is_compile_opt = FALSE |
---|
| 7 | set default_compile_flags = "%PROD_FFLAGS" |
---|
| 8 | set fcm_path=none |
---|
| 9 | |
---|
| 10 | top: |
---|
| 11 | if ($#argv > 0) then |
---|
| 12 | switch ($1) |
---|
| 13 | |
---|
| 14 | case -h |
---|
| 15 | |
---|
| 16 | ######################################################################## |
---|
| 17 | # Manuel en ligne |
---|
| 18 | ######################################################################## |
---|
| 19 | more <<eod |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | makeorchidee_fcm [Options] |
---|
| 23 | |
---|
| 24 | [ -parallel|-p PARALLEL_TYPE ] : activate parallelization with 3 options : |
---|
| 25 | PARALLEL_TYPE = |
---|
| 26 | ( mpi | MPI ) : use Message Passing Interface standard |
---|
| 27 | ( omp | OMP ) : use OpenMP standard |
---|
| 28 | ( mpi_omp | MPI_OMP ) : use both MPI and OpenMP |
---|
| 29 | |
---|
| 30 | [ -driver ] : compilation of ORCHIDEE driver if equal TRUE |
---|
| 31 | |
---|
| 32 | [ -a|-arch ARCHitecture ] : if TRUE, change architecture for ARCHitecture |
---|
| 33 | |
---|
| 34 | [ -prod ] : compilation for production (all optimization) |
---|
| 35 | |
---|
| 36 | [ -dev ] : compilation for development (low optimization and -g) |
---|
| 37 | |
---|
| 38 | [ -d|-debug ] : compilation for debugging (no optmization and all debug options) |
---|
| 39 | |
---|
| 40 | [-fcm_path path] : path for fcm (default: the default fcm path in environment) |
---|
| 41 | |
---|
| 42 | [ -doc ] : generate documentation with Doxygen |
---|
| 43 | |
---|
| 44 | eod |
---|
| 45 | exit |
---|
| 46 | |
---|
| 47 | ######################################################################## |
---|
| 48 | # Lecture des differentes options |
---|
| 49 | ######################################################################## |
---|
| 50 | |
---|
| 51 | case -parallel |
---|
| 52 | set is_parallel_opt = TRUE |
---|
| 53 | set parallel=$2 ; shift ; shift ; goto top |
---|
| 54 | |
---|
| 55 | case -p |
---|
| 56 | set is_parallel_opt = TRUE |
---|
| 57 | set parallel=$2 ; shift ; shift ; goto top |
---|
| 58 | |
---|
| 59 | case -driver |
---|
| 60 | set is_driver_opt = TRUE |
---|
| 61 | shift ; goto top |
---|
| 62 | |
---|
| 63 | case -a |
---|
| 64 | case -arch |
---|
| 65 | set is_arch_opt = TRUE |
---|
| 66 | set arch="$2" ; shift ; shift ; goto top |
---|
| 67 | |
---|
| 68 | case -prod |
---|
| 69 | set is_compile_opt = TRUE |
---|
| 70 | set compile_flags="%PROD_FFLAGS" |
---|
| 71 | shift ; goto top |
---|
| 72 | |
---|
| 73 | case -dev |
---|
| 74 | set is_compile_opt = TRUE |
---|
| 75 | set compile_flags="%DEV_FFLAGS" |
---|
| 76 | shift ; goto top |
---|
| 77 | |
---|
| 78 | case -d |
---|
| 79 | case -debug |
---|
| 80 | set is_compile_opt = TRUE |
---|
| 81 | set compile_flags="%DEBUG_FFLAGS" |
---|
| 82 | shift ; goto top |
---|
| 83 | |
---|
| 84 | case -fcm_path |
---|
| 85 | set fcm_path=$2 ; shift ; shift ; goto top |
---|
| 86 | |
---|
| 87 | case -doc |
---|
| 88 | doxygen Doxyfile_ORCHIDEE ; exit 0 |
---|
| 89 | |
---|
| 90 | default |
---|
| 91 | echo "unknown option "$1" , exiting..." |
---|
| 92 | exit |
---|
| 93 | endsw |
---|
| 94 | endif |
---|
| 95 | |
---|
| 96 | ############################################################### |
---|
| 97 | # mettre le chemin du fcm dans le path |
---|
| 98 | ############################################################### |
---|
| 99 | if ( "$fcm_path" != 'none' ) then |
---|
| 100 | setenv PATH ${fcm_path}:${PATH} |
---|
| 101 | endif |
---|
| 102 | |
---|
| 103 | echo "Chemin du fcm utlise :" |
---|
| 104 | which fcm |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | #define architecture files |
---|
| 108 | if ( $is_arch_opt == TRUE) then |
---|
| 109 | if ( -e arch/arch-${arch}.fcm ) then |
---|
| 110 | rm -f arch.fcm |
---|
| 111 | ln -s arch/arch-${arch}.fcm arch.fcm |
---|
| 112 | else |
---|
| 113 | echo "architecture file : << arch/arch-${arch}.fcm >> is missing, exiting...." |
---|
| 114 | exit |
---|
| 115 | endif |
---|
| 116 | |
---|
| 117 | if ( -e arch/arch-${arch}.path ) then |
---|
| 118 | rm -f arch.path |
---|
| 119 | ln -s arch/arch-${arch}.path arch.path |
---|
| 120 | else |
---|
| 121 | echo "architecture file : << arch/arch-${arch}.path >> is missing, exiting...." |
---|
| 122 | exit |
---|
| 123 | endif |
---|
| 124 | else |
---|
| 125 | echo "Warning : architecture not specified, taking default file <<arch.fcm>> and <<arch.path>>" |
---|
| 126 | if ( ! -e arch.fcm ) then |
---|
| 127 | echo "architecture file : << arch.fcm >> is missing, exiting...." |
---|
| 128 | exit |
---|
| 129 | endif |
---|
| 130 | |
---|
| 131 | if ( ! -e arch.fcm ) then |
---|
| 132 | echo "architecture file : << arch.path >> is missing, exiting...." |
---|
| 133 | exit |
---|
| 134 | endif |
---|
| 135 | endif |
---|
| 136 | |
---|
| 137 | # set compiler flags |
---|
| 138 | set FFLAGS="%BASE_FFLAGS" |
---|
| 139 | set LD_FFLAGS="%LD_BASE" |
---|
| 140 | set CPP_KEY="%FPP_DEF" |
---|
| 141 | |
---|
| 142 | # set compiler flags for optimisation |
---|
| 143 | if ( $is_compile_opt == FALSE ) then |
---|
| 144 | set compile_flags=$default_compile_flags |
---|
| 145 | endif |
---|
| 146 | set FFLAGS=${FFLAGS}" "$compile_flags |
---|
| 147 | |
---|
| 148 | # set compiler flags for parallelism |
---|
| 149 | if ( $is_parallel_opt == TRUE ) then |
---|
| 150 | echo $parallel |
---|
| 151 | switch ($parallel) |
---|
| 152 | case mpi |
---|
| 153 | case MPI |
---|
| 154 | set FFLAGS="${FFLAGS} %MPI_FFLAGS" |
---|
| 155 | set LD_FFLAGS="%MPI_LD ${LD_FFLAGS}" |
---|
| 156 | set CPP_KEY="CPP_PARA ${CPP_KEY}" |
---|
| 157 | breaksw |
---|
| 158 | case omp |
---|
| 159 | case OMP |
---|
| 160 | set FFLAGS="${FFLAGS} %OMP_FFLAGS" |
---|
| 161 | set LD_FFLAGS="%OMP_LD ${LD_FFLAGS}" |
---|
| 162 | set CPP_KEY="CPP_OMP CPP_PARA ${CPP_KEY}" |
---|
| 163 | breaksw |
---|
| 164 | case mpi_omp |
---|
| 165 | case MPI_OMP |
---|
| 166 | set FFLAGS="${FFLAGS} %MPI_FFLAGS %OMP_FFLAGS" |
---|
| 167 | set LD_FFLAGS="%MPI_LD %OMP_LD ${LD_FFLAGS}" |
---|
| 168 | set CPP_KEY="CPP_OMP CPP_PARA ${CPP_KEY}" |
---|
| 169 | breaksw |
---|
| 170 | |
---|
| 171 | default |
---|
| 172 | echo "unknown option for parallelism :$parallel , only <<mpi>>, <<MPI>> or <<omp>>, <<OMP>> or <<mpi_omp>> <<MPI_OMP>> allowed , exiting..." |
---|
| 173 | exit |
---|
| 174 | endsw |
---|
| 175 | endif |
---|
| 176 | |
---|
| 177 | # set target |
---|
| 178 | set TARGET = liborchidee.a |
---|
| 179 | if ( $is_driver_opt == TRUE) then |
---|
| 180 | set TARGET="liborchidee_ol.a dim2_driver.exe teststomate.exe forcesoil.exe" |
---|
| 181 | endif |
---|
| 182 | |
---|
| 183 | source ./arch.path |
---|
| 184 | |
---|
| 185 | # build config file |
---|
| 186 | set config_fcm="config.fcm" |
---|
| 187 | rm -f $config_fcm |
---|
| 188 | |
---|
| 189 | echo "%FFLAGS $FFLAGS" > $config_fcm |
---|
| 190 | echo "%CPP_KEY $CPP_KEY" >> $config_fcm |
---|
| 191 | echo "%EXEC $TARGET" >> $config_fcm |
---|
| 192 | echo "%LD_FFLAGS $LD_FFLAGS" >> $config_fcm |
---|
| 193 | echo "%INCDIR -I$NETCDF_INCDIR -I$IOIPSL_INCDIR" >> $config_fcm |
---|
| 194 | echo "%LIBDIR -L$NETCDF_LIBDIR -L$IOIPSL_LIBDIR" >> $config_fcm |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | fcm build |
---|