source: codes/icosagcm/trunk/make_icosa @ 497

Last change on this file since 497 was 497, checked in by ymipsl, 8 years ago

Add arch_path in make_icosa

YM

  • Property svn:executable set to *
File size: 4.6 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            : nom de l\'architecture cible
35fin
36          exit;;
37
38      "-prod")
39          compil_mode="prod" ; shift ;;
40
41      "-dev")
42          compil_mode="dev" ; shift ;;
43
44      "-debug")
45          compil_mode="debug" ; shift ;;
46
47      "-arch")
48          arch=$2 ; arch_defined="TRUE"; shift ; shift ;;
49 
50      "-arch_path")
51          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
52
53      "-parallel")
54          parallel=$2 ; parallel_defined="TRUE"; shift ; shift ;;
55
56      "-physics")
57          physics=$2 ; physics_defined="TRUE"; shift ; shift ;;
58
59      "-job")
60          job=$2 ; shift ; shift;;
61
62      "-full")
63          full_defined="TRUE" ; shift ;;
64
65      "-with_xios")
66          with_xios_defined="TRUE" ; shift ;;
67 
68        "-no_io")
69          no_io_defined="TRUE" ; shift ;;
70 
71      "-external_ioipsl")
72          external_ioipsl="TRUE" ; shift ;;
73
74      "-external_physics")
75          external_physics="TRUE" ; shift ;;
76
77      *)
78          code="$1" ; shift ;;
79  esac
80done
81
82rm -f .void_file
83echo > .void_file
84rm -rf .void_dir
85mkdir .void_dir
86
87if [[ "$arch_defined" == "TRUE" ]]
88then
89  rm -f arch.path
90  rm -f arch.fcm
91  rm -f arch.env
92
93  if test -f $arch_path/arch-${arch}.path
94  then
95    ln -s $arch_path/arch-${arch}.path arch.path
96  elif test -f $arch_default_path/arch-${arch}.path
97  then
98    ln -s $arch_default_path/arch-${arch}.path arch.path
99  fi
100       
101  if test -f $arch_path/arch-${arch}.fcm
102  then
103    ln -s $arch_path/arch-${arch}.fcm arch.fcm
104  elif test -f $arch_default_path/arch-${arch}.fcm
105  then
106    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
107  fi
108
109  if test -f $arch_path/arch-${arch}.env
110  then
111    ln -s $arch_path/arch-${arch}.env arch.env
112  elif test -f $arch_default_path/arch-${arch}.env
113  then
114    ln -s $arch_default_path/arch-${arch}.env arch.env
115  else
116    ln -s .void_file arch.env
117  fi
118  source arch.env
119  source arch.path
120else
121  echo "Veuillez definir une architecture cible"
122  exit 1
123fi
124
125LD_FLAGS="%BASE_LD"
126
127if [[ "$compil_mode" == "prod" ]]
128then
129  COMPIL_FFLAGS="%PROD_FFLAGS"
130elif [[ "$compil_mode" == "dev" ]]
131then
132  COMPIL_FFLAGS="%DEV_FFLAGS"
133elif [[ "$compil_mode" == "debug" ]]
134then
135  COMPIL_FFLAGS="%DEBUG_FFLAGS"
136fi
137
138if [[ "$parallel" == "mpi" ]]
139then
140  CPP_KEY="$CPP_KEY CPP_USING_MPI"
141elif [[ "$parallel" == "omp" ]]
142then
143  CPP_KEY="$CPP_KEY CPP_USING_OMP"
144  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
145  LD_FLAGS="$LD_FLAGS %OMP_LD"
146elif [[ "$parallel" == "mpi_omp" ]]
147then
148  CPP_KEY="$CPP_KEY CPP_USING_MPI CPP_USING_OMP"
149  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
150  LD_FLAGS="$LD_FLAGS %OMP_LD"
151elif [[ "$parallel" == "none" ]]
152then
153  parallel="none"
154else
155  echo "-parallel value $parallel is invalid, only permited <none>, <mpi>, <omp> or <mpi_omp>"
156  exit 1
157fi
158
159if [[ "$physics" == "lmdz_generic" ]]
160then
161  CPP_KEY="$CPP_KEY CPP_PHYSICS_LMDZ_GENERIC"
162  COMPIL_FFLAGS="$COMPIL_FFLAGS $PHYSICS_INCDIR"
163  ICOSA_LIB="$ICOSA_LIB $PHYSICS_LIBDIR $PHYSICS_LIB"
164fi
165
166if [[ "$no_io_defined" == "TRUE" ]]
167then
168  CPP_KEY="$CPP_KEY CPP_NO_IO"
169  with_xios_defined="FALSE"
170fi 
171
172if [[ "$with_xios_defined" == "TRUE" ]]
173then
174  CPP_KEY="$CPP_KEY CPP_USING_XIOS"
175  COMPIL_FFLAGS="$COMPIL_FFLAGS $XIOS_INCDIR"
176  ICOSA_LIB="$ICOSA_LIB $XIOS_LIBDIR $XIOS_LIB"
177fi 
178
179if [[ "$external_ioipsl" == "TRUE" ]]
180then
181  ioipsl_path=".void_dir"
182  use_ioipsl="use::ioipsl"
183  COMPIL_FFLAGS="$COMPIL_FFLAGS $IOIPSL_INCDIR"
184  ICOSA_LIB="$ICOSA_LIB $IOIPSL_LIBDIR $IOIPSL_LIB"
185else
186  ioipsl_path="tools/ioipsl"
187  use_ioipsl=""
188fi 
189
190if [[ "$external_physics" == "TRUE" ]]
191then
192  CPP_KEY="$CPP_KEY CPP_USING_EXTERNAL_PHYSICS"
193fi
194
195if [[ "$no_io_defined" == "FALSE" ]]
196then
197  ICOSA_LIB="$ICOSA_LIB $NETCDF_LIBDIR $NETCDF_LIB $HDF5_LIBDIR $HDF5_LIB"
198  COMPIL_FFLAGS="$COMPIL_FFLAGS $NETCDF_INCDIR"
199fi
200
201rm -f config.fcm
202
203echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
204echo "%LD_FLAGS $LD_FLAGS" >> config.fcm
205echo "%CPP_KEY $CPP_KEY" >> config.fcm
206echo "%LIB $ICOSA_LIB">> config.fcm
207echo "%IOIPSL_PATH $ioipsl_path">> config.fcm
208echo "%USE_IOIPSL $use_ioipsl">> config.fcm
209
210if [[ "$full_defined" == "TRUE" ]]
211then
212  ./build --job $job --full
213else
214  ./build --job $job
215fi
Note: See TracBrowser for help on using the repository browser.