source: codes/icosagcm/trunk/make_icosa @ 352

Last change on this file since 352 was 347, checked in by dubos, 9 years ago

Synced with aquaplanet branch HEAT@45 - tested with DCMIP4

  • Property svn:executable set to *
File size: 3.9 KB
RevLine 
[12]1#!/bin/bash
[14]2export PATH=$PWD/tools/FCM/bin:$PATH
[12]3
[279]4echo ./make_icosa $* > rebuild
5chmod a+x rebuild
6
[12]7compil_mode_defined="FALSE"
8compil_mode="prod"
9
[89]10job=1
11full_defined="FALSE"
[171]12with_xios_defined="FALSE"
[12]13arch_defined="FALSE"
[28]14parallel_defined="FALSE"
[332]15arch_path="arch"
[28]16parallel="none"
[327]17physics="none"
[347]18external_ioipsl="FALSE"
19external_physics="FALSE"
20
[28]21CPP_KEY="CPP_NONE" 
[171]22ICOSA_LIB=""
[12]23
24while (($# > 0))
25  do
26  case $1 in
27      "-h") cat <<fin
28Usage :
29makegcm [options] -m arch exec
30[-h]                       : help
31[-prod / -dev / -debug]    : compilation en mode production (default) / developpement / debug .
32 -arch nom_arch            : nom de l\'architecture cible
33fin
34          exit;;
35
36      "-prod")
37          compil_mode="prod" ; shift ;;
38
39      "-dev")
40          compil_mode="dev" ; shift ;;
41
42      "-debug")
43          compil_mode="debug" ; shift ;;
44
45      "-arch")
46          arch=$2 ; arch_defined="TRUE"; shift ; shift ;;
[332]47 
48      "-arch_path")
49          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
[12]50
[28]51      "-parallel")
52          parallel=$2 ; parallel_defined="TRUE"; shift ; shift ;;
53
[327]54      "-physics")
55          physics=$2 ; physics_defined="TRUE"; shift ; shift ;;
56
[89]57      "-job")
[103]58          job=$2 ; shift ; shift;;
[89]59
60      "-full")
[103]61          full_defined="TRUE" ; shift ;;
[89]62
[171]63      "-with_xios")
64          with_xios_defined="TRUE" ; shift ;;
65
[347]66      "-external_ioipsl")
67          external_ioipsl="TRUE" ; shift ;;
68
69      "-external_physics")
70          external_physics="TRUE" ; shift ;;
71
[12]72      *)
73          code="$1" ; shift ;;
74  esac
75done
76
[28]77rm -f .void_file
78echo > .void_file
79rm -rf .void_dir
80mkdir .void_dir
81
[12]82if [[ "$arch_defined" == "TRUE" ]]
83then
84  rm -f arch.path
85  rm -f arch.fcm
[28]86  rm -f arch.env
[332]87  ln -s $arch_path/arch-${arch}.path ./arch.path
88  ln -s $arch_path/arch-${arch}.fcm  ./arch.fcm
89  if test -f $arch_path/arch-${arch}.env
[28]90    then
[332]91      ln -s $arch_path/arch-${arch}.env arch.env
[28]92    else
93      ln -s .void_file arch.env
94    fi
95  source arch.env
[12]96  source arch.path
97else
98  echo "Veuillez definir une architecture cible"
99  exit 1
100fi
101
[152]102LD_FLAGS="%BASE_LD"
103
[12]104if [[ "$compil_mode" == "prod" ]]
105then
106  COMPIL_FFLAGS="%PROD_FFLAGS"
107elif [[ "$compil_mode" == "dev" ]]
108then
109  COMPIL_FFLAGS="%DEV_FFLAGS"
110elif [[ "$compil_mode" == "debug" ]]
111then
112  COMPIL_FFLAGS="%DEBUG_FFLAGS"
113fi
114
[28]115if [[ "$parallel" == "mpi" ]]
116then
117  CPP_KEY="$CPP_KEY CPP_USING_MPI"
[152]118elif [[ "$parallel" == "omp" ]]
119then
120  CPP_KEY="$CPP_KEY CPP_USING_OMP"
121  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
122  LD_FLAGS="$LD_FLAGS %OMP_LD"
123elif [[ "$parallel" == "mpi_omp" ]]
124then
125  CPP_KEY="$CPP_KEY CPP_USING_MPI CPP_USING_OMP"
[189]126  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
[152]127  LD_FLAGS="$LD_FLAGS %OMP_LD"
[28]128elif [[ "$parallel" == "none" ]]
129then
130  parallel="none"
131else
[152]132  echo "-parallel value $parallel is invalid, only permited <none>, <mpi>, <omp> or <mpi_omp>"
[28]133  exit 1
134fi
135
[327]136if [[ "$physics" == "lmdz_generic" ]]
137then
138  CPP_KEY="$CPP_KEY CPP_PHYSICS_LMDZ_GENERIC"
139  COMPIL_FFLAGS="$COMPIL_FFLAGS $PHYSICS_INCDIR"
140  ICOSA_LIB="$ICOSA_LIB $PHYSICS_LIBDIR $PHYSICS_LIB"
141fi
142
[171]143if [[ "$with_xios_defined" == "TRUE" ]]
144then
145  CPP_KEY="$CPP_KEY CPP_USING_XIOS"
146  COMPIL_FFLAGS="$COMPIL_FFLAGS $XIOS_INCDIR"
147  ICOSA_LIB="$ICOSA_LIB $XIOS_LIBDIR $XIOS_LIB"
148fi 
[28]149
[347]150if [[ "$external_ioipsl" == "TRUE" ]]
151then
152  ioipsl_path=".void_dir"
153  use_ioipsl="use::ioipsl"
154  COMPIL_FFLAGS="$COMPIL_FFLAGS $IOIPSL_INCDIR"
155  ICOSA_LIB="$ICOSA_LIB $IOIPSL_LIBDIR $IOIPSL_LIB"
156else
157  ioipsl_path="tools/ioipsl"
158  use_ioipsl=""
159fi 
160
161if [[ "$external_physics" == "TRUE" ]]
162then
163  CPP_KEY="$CPP_KEY CPP_USING_EXTERNAL_PHYSICS"
164fi
165
[171]166ICOSA_LIB="$ICOSA_LIB $NETCDF_LIBDIR $NETCDF_LIB $HDF5_LIBDIR $HDF5_LIB"
167
[327]168
[12]169rm -f config.fcm
170
[28]171echo "%COMPIL_FFLAGS $COMPIL_FFLAGS $NETCDF_INCDIR" >> config.fcm
[152]172echo "%LD_FLAGS $LD_FLAGS" >> config.fcm
[28]173echo "%CPP_KEY $CPP_KEY" >> config.fcm
174echo "%LIB $ICOSA_LIB">> config.fcm
[347]175echo "%IOIPSL_PATH $ioipsl_path">> config.fcm
176echo "%USE_IOIPSL $use_ioipsl">> config.fcm
[12]177
[89]178if [[ "$full_defined" == "TRUE" ]]
179then
180  ./build --job $job --full
181else
182  ./build --job $job
183fi
Note: See TracBrowser for help on using the repository browser.