source: codes/icosagcm/trunk/make_icosa @ 286

Last change on this file since 286 was 279, checked in by dubos, 10 years ago

Let make_icosa write a ./rebuild script

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