source: codes/icosagcm/devel/make_icosa @ 637

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

devel : fix PATH in make_icosa / build

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