source: codes/icosagcm/trunk/make_icosa @ 332

Last change on this file since 332 was 332, checked in by ymipsl, 9 years ago

Add possibility to give file path for arch file with -arch_path option in make_icosa.

YM

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