source: codes/icosagcm/devel/make_icosa @ 606

Last change on this file since 606 was 574, checked in by dubos, 7 years ago

devel : get rid of CPP_DYSL

  • Property svn:executable set to *
File size: 5.2 KB
Line 
1#!/bin/bash
2export PATH=$PWD/tools/FCM/bin:$PATH
3
4echo ./make_icosa $* > rebuild
5chmod a+x rebuild
6
7compil_mode_defined="FALSE"
8compil_mode="prod"
9
10job=1
11full_defined="FALSE"
12with_xios_defined="FALSE"
13arch_defined="FALSE"
14parallel_defined="FALSE"
15arch_default_path="arch"
16arch_path="arch"
17parallel="none"
18physics="none"
19external_ioipsl="FALSE"
20external_physics="FALSE"
21no_io_defined="FALSE"
22
23CPP_KEY="CPP_NONE" 
24ICOSA_LIB=""
25
26while (($# > 0))
27  do
28  case $1 in
29      "-h") cat <<fin
30Usage :
31makegcm [options] -m arch exec
32[-h]                       : help
33[-prod / -dev / -debug]    : compilation en mode production (default) / developpement / debug .
34 -arch nom_arch            : target architecture, use paths and compilation options from arch files arch/arch-NAME.*
35 -arch_path PATH           : use arch files PATH/arch-ARCH.*
36 -parallel mpi|mpi_omp     : pure MPI or hybrid MPI/OpenMP parallelism
37 -job N                    : parallel compilation as with make -j N
38 -full                     : full compilation
39 -with_xios                : use XIOS for I/O (default is NetCDF-CF on native grid)
40 -no_io                    : disable I/O altogether
41 -external_ioipsl PATH     : use IOIPSL from PATH rather than tools/ioipsl
42 -physics lmdz_generic     : use LMDZ generic physics (planets)
43 -external_physics         : allows external physics
44fin
45          exit;;
46
47      "-prod")
48          compil_mode="prod" ; shift ;;
49
50      "-dev")
51          compil_mode="dev" ; shift ;;
52
53      "-debug")
54          compil_mode="debug" ; shift ;;
55
56      "-arch")
57          arch=$2 ; arch_defined="TRUE"; shift ; shift ;;
58 
59      "-arch_path")
60          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
61
62      "-parallel")
63          parallel=$2 ; parallel_defined="TRUE"; shift ; shift ;;
64
65      "-physics")
66          physics=$2 ; physics_defined="TRUE"; shift ; shift ;;
67
68      "-job")
69          job=$2 ; shift ; shift;;
70
71      "-full")
72          full_defined="TRUE" ; shift ;;
73
74      "-with_xios")
75          with_xios_defined="TRUE" ; shift ;;
76 
77      "-no_io")
78          no_io_defined="TRUE" ; shift ;;
79 
80      "-external_ioipsl")
81          external_ioipsl="TRUE" ; shift ;;
82
83      "-external_physics")
84          external_physics="TRUE" ; shift ;;
85
86      *)
87          code="$1" ; shift ;;
88  esac
89done
90
91rm -f .void_file
92echo > .void_file
93rm -rf .void_dir
94mkdir .void_dir
95
96if [[ "$arch_defined" == "TRUE" ]]
97then
98  rm -f arch.path
99  rm -f arch.fcm
100  rm -f arch.env
101
102  if test -f $arch_path/arch-${arch}.path
103  then
104    ln -s $arch_path/arch-${arch}.path arch.path
105  elif test -f $arch_default_path/arch-${arch}.path
106  then
107    ln -s $arch_default_path/arch-${arch}.path arch.path
108  fi
109       
110  if test -f $arch_path/arch-${arch}.fcm
111  then
112    ln -s $arch_path/arch-${arch}.fcm arch.fcm
113  elif test -f $arch_default_path/arch-${arch}.fcm
114  then
115    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
116  fi
117
118  if test -f $arch_path/arch-${arch}.env
119  then
120    ln -s $arch_path/arch-${arch}.env arch.env
121  elif test -f $arch_default_path/arch-${arch}.env
122  then
123    ln -s $arch_default_path/arch-${arch}.env arch.env
124  else
125    ln -s .void_file arch.env
126  fi
127  source arch.env
128  source arch.path
129else
130  echo "Veuillez definir une architecture cible"
131  exit 1
132fi
133
134LD_FLAGS="%BASE_LD"
135
136if [[ "$compil_mode" == "prod" ]]
137then
138  COMPIL_FFLAGS="%PROD_FFLAGS"
139elif [[ "$compil_mode" == "dev" ]]
140then
141  COMPIL_FFLAGS="%DEV_FFLAGS"
142elif [[ "$compil_mode" == "debug" ]]
143then
144  COMPIL_FFLAGS="%DEBUG_FFLAGS"
145fi
146
147if [[ "$parallel" == "mpi" ]]
148then
149  CPP_KEY="$CPP_KEY CPP_USING_MPI"
150elif [[ "$parallel" == "omp" ]]
151then
152  CPP_KEY="$CPP_KEY CPP_USING_OMP"
153  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
154  LD_FLAGS="$LD_FLAGS %OMP_LD"
155elif [[ "$parallel" == "mpi_omp" ]]
156then
157  CPP_KEY="$CPP_KEY CPP_USING_MPI CPP_USING_OMP"
158  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
159  LD_FLAGS="$LD_FLAGS %OMP_LD"
160elif [[ "$parallel" == "none" ]]
161then
162  parallel="none"
163else
164  echo "-parallel value $parallel is invalid, only permited <none>, <mpi>, <omp> or <mpi_omp>"
165  exit 1
166fi
167
168if [[ "$physics" == "lmdz_generic" ]]
169then
170  CPP_KEY="$CPP_KEY CPP_PHYSICS_LMDZ_GENERIC"
171  COMPIL_FFLAGS="$COMPIL_FFLAGS $PHYSICS_INCDIR"
172  ICOSA_LIB="$ICOSA_LIB $PHYSICS_LIBDIR $PHYSICS_LIB"
173fi
174
175if [[ "$no_io_defined" == "TRUE" ]]
176then
177  CPP_KEY="$CPP_KEY CPP_NO_IO"
178  with_xios_defined="FALSE"
179fi 
180
181if [[ "$with_xios_defined" == "TRUE" ]]
182then
183  CPP_KEY="$CPP_KEY CPP_USING_XIOS"
184  COMPIL_FFLAGS="$COMPIL_FFLAGS $XIOS_INCDIR"
185  ICOSA_LIB="$ICOSA_LIB $XIOS_LIBDIR $XIOS_LIB"
186fi 
187
188if [[ "$external_ioipsl" == "TRUE" ]]
189then
190  ioipsl_path=".void_dir"
191  use_ioipsl="use::ioipsl"
192  COMPIL_FFLAGS="$COMPIL_FFLAGS $IOIPSL_INCDIR"
193  ICOSA_LIB="$ICOSA_LIB $IOIPSL_LIBDIR $IOIPSL_LIB"
194else
195  ioipsl_path="tools/ioipsl"
196  use_ioipsl=""
197fi 
198
199if [[ "$external_physics" == "TRUE" ]]
200then
201  CPP_KEY="$CPP_KEY CPP_USING_EXTERNAL_PHYSICS"
202fi
203
204if [[ "$no_io_defined" == "FALSE" ]]
205then
206  ICOSA_LIB="$ICOSA_LIB $NETCDF_LIBDIR $NETCDF_LIB $HDF5_LIBDIR $HDF5_LIB"
207  COMPIL_FFLAGS="$COMPIL_FFLAGS $NETCDF_INCDIR"
208fi
209
210rm -f config.fcm
211
212echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
213echo "%LD_FLAGS $LD_FLAGS" >> config.fcm
214echo "%CPP_KEY $CPP_KEY" >> config.fcm
215echo "%LIB $ICOSA_LIB">> config.fcm
216echo "%IOIPSL_PATH $ioipsl_path">> config.fcm
217echo "%USE_IOIPSL $use_ioipsl">> config.fcm
218
219if [[ "$full_defined" == "TRUE" ]]
220then
221  ./build --job $job --full
222else
223  ./build --job $job
224fi
Note: See TracBrowser for help on using the repository browser.