source: tags/ORCHIDEE_1_9_5_2/ORCHIDEE/makeorchidee_fcm

Last change on this file was 8, checked in by orchidee, 14 years ago

import first tag equivalent to CVS orchidee_1_9_5 + OOL_1_9_5

File size: 5.2 KB
Line 
1#!/bin/csh
2set verbose echo
3set is_parallel_opt       = FALSE
4set is_driver_opt         = FALSE
5set is_arch_opt           = FALSE
6set is_compile_opt        = FALSE
7set default_compile_flags = "%PROD_FFLAGS"
8set fcm_path=none
9
10top:
11if ($#argv > 0) then
12    switch ($1)
13
14    case -h
15
16########################################################################
17# Manuel en ligne
18########################################################################
19more <<eod
20
21
22makeorchidee_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
44eod
45exit
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
94endif
95
96###############################################################
97# mettre le chemin du fcm dans le path
98###############################################################
99if  ( "$fcm_path" != 'none' ) then
100    setenv PATH ${fcm_path}:${PATH}
101endif
102
103echo "Chemin du fcm utlise :" 
104which fcm
105
106
107#define architecture files
108if ( $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
124else
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
135endif
136 
137# set compiler flags
138set FFLAGS="%BASE_FFLAGS"
139set LD_FFLAGS="%LD_BASE"
140set CPP_KEY="%FPP_DEF"
141
142# set compiler flags for optimisation
143if ( $is_compile_opt == FALSE ) then
144  set compile_flags=$default_compile_flags
145endif
146set FFLAGS=${FFLAGS}" "$compile_flags
147
148# set compiler flags for parallelism
149if ( $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
175endif
176       
177# set target
178set TARGET = liborchidee.a
179if ( $is_driver_opt == TRUE) then
180  set TARGET="liborchidee_ol.a dim2_driver.exe teststomate.exe forcesoil.exe"
181endif
182
183source ./arch.path
184
185# build config file
186set config_fcm="config.fcm"
187rm -f $config_fcm
188
189echo "%FFLAGS        $FFLAGS"                           >  $config_fcm 
190echo "%CPP_KEY       $CPP_KEY"                          >> $config_fcm
191echo "%EXEC          $TARGET"                           >> $config_fcm
192echo "%LD_FFLAGS     $LD_FFLAGS"                        >> $config_fcm
193echo "%INCDIR        -I$NETCDF_INCDIR -I$IOIPSL_INCDIR" >> $config_fcm
194echo "%LIBDIR        -L$NETCDF_LIBDIR -L$IOIPSL_LIBDIR" >> $config_fcm
195
196
197fcm build
Note: See TracBrowser for help on using the repository browser.