source: XIOS/trunk/make_xios @ 375

Last change on this file since 375 was 374, checked in by aclsce, 12 years ago
  • Created test_client (from test_cs) to have test_client and xios_server instead of test_cs
  • Modifed make_xios to allow the installation through make_xios
  • Modified bld.cfg to add the creation of new executable file test_client.exe
  • Property svn:executable set to *
File size: 4.7 KB
Line 
1#!/bin/bash
2
3install_dir=$PWD
4compil_full="false"
5use_oasis="false"
6job="1"
7
8# Traitement de la ligne de commande
9while (($# > 0))
10   do
11      case $1 in
12         "-h")
13            echo "make_xios - installs XIOS on your architecture"
14            echo "make_xios [options]"
15            echo "options :"
16            echo "       [--prod] : compilation in production mode"
17            echo "       [--dev] : compilation in development mode"
18            echo "       [--debug] : compilation in debug mode"
19            echo "       --arch arch : to choose target architecture"
20            echo "       [--avail] : to know available target architectures "
21            echo "       [--full] : to generate dependencies and recompile from scratch"
22            echo "       [--use_oasis] : to use Oasis coupler"
23            echo "       [--doc] : to generate Doxygen documentation (not available yet)"
24            echo "       [--job ntasks] : to use parallel compilation with ntasks"
25            echo "Example : ./make_xios --prod --arch PW6_VARGAS"
26            echo "Example : ./make_xios --avail"
27            exit;;
28         "--prod")  compil_mode="prod"  ; shift ;;
29         "--dev")   compil_mode="dev"   ; shift ;;
30         "--debug") compil_mode="debug" ; shift ;;
31         "--arch")  arch=$2     ; shift ; shift ;;
32         "--avail") ls arch/*.fcm | cut -d"-" -f2 | cut -d".fcm" -f1 ; exit ;;
33         "--full")  compil_full="true"  ; shift ;;
34         "--use_oasis")  use_oasis="true"  ; shift  ;;
35         "--doc")   doc="true"          ; shift ;;
36         "--job")   job=$2              ; shift ; shift ;;
37         *)         code="$1"           ; shift ;;
38      esac
39   done
40
41# Installation des sources
42for tarname in `ls $install_dir/tools/archive | grep tar.gz` ; do
43    echo -e "- uncompress archives ..."
44    gunzip -f "$tarname"
45    tar -xf ${tarname%.gz}
46done
47
48# Vérification de la présence d'un identifiant d'architecture.
49
50###############################################################
51# lecture des chemins propres a l'architecture de la machine #
52#           et configuration de l'environnement              #
53###############################################################
54
55rm -f .void_file
56echo > .void_file
57rm -rf .void_dir
58mkdir .void_dir
59
60if [[ !(-z $arch) ]]
61   then
62      rm -f  $install_dir/arch.path
63      rm -f  $install_dir/arch.fcm
64      rm -f  $install_dir/arch.env
65      ln -s  $install_dir/arch/arch-${arch}.path $install_dir/arch.path
66      ln -s  $install_dir/arch/arch-${arch}.fcm  $install_dir/arch.fcm
67
68      if test -f $install_dir/arch/arch-${arch}.env
69      then
70        ln -s $install_dir/arch/arch-${arch}.env arch.env
71      else
72        ln -s $install_dir/.void_file arch.env
73      fi
74
75      source $install_dir/arch.env
76      source $install_dir/arch.path
77  else
78      echo "Veuillez definir une architecture cible !"
79      exit 1
80fi
81
82# Vérification de la présence d'un mode de compilation.
83
84if [[ "$compil_mode" == "prod" ]]
85   then
86      COMPIL_CFLAGS="%PROD_CFLAGS"
87      COMPIL_FFLAGS="%PROD_FFLAGS"
88elif [[ "$compil_mode" == "dev" ]]
89   then
90      COMPIL_CFLAGS="%DEV_CFLAGS"
91      COMPIL_FFLAGS="%DEV_FFLAGS"
92elif [[ "$compil_mode" == "debug" ]]
93   then
94      COMPIL_CFLAGS="%DEBUG_CFLAGS"
95      COMPIL_FFLAGS="%DEBUG_FFLAGS"
96else
97   echo "Veuillez definir un mode de compilation [debug|dev|prod] !"
98   exit 1
99fi
100
101if [[ "$use_oasis" == "true" ]]
102   then
103   XMLIO_FINCDIR="$OASIS_INCDIR $XMLIO_FINCDIR"
104   XMLIO_LIB="$OASIS_LIBDIR $OASIS_LIB $XMLIO_LIB"
105   XMLIO_CPPKEY="$XMLIO_CPPKEY USE_OASIS"
106fi
107
108XMLIO_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR"
109XMLIO_FINCDIR="$XMLIO_FINCDIR $MPI_INCDIR"
110
111XMLIO_LIB="$XMLIO_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
112
113rm -f config.fcm
114echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm
115echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
116echo "%CPP_KEY       $XMLIO_CPPKEY"  >> config.fcm
117
118echo "%CBASE_INC     $XMLIO_CINCDIR" >> config.fcm     
119echo "%FBASE_INC     $XMLIO_FINCDIR" >> config.fcm
120echo "%ARCH_LD       $XMLIO_LIB" >> config.fcm
121
122echo "=> Activation du mode "$compil_mode" pour la distribution sous l'architecture \""$arch"\" !"
123
124# Création de la documentation doxygen.
125if [[ !(-z $doc) ]]
126   then
127      echo -e "- Création de la documentation de code doxygen (désactivée)..."
128      #doxygen -s
129fi
130
131make_dir=$PWD
132
133export PATH=$PWD/tools/FCM/bin:$PATH
134
135#$make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp      $make_dir/src/xmlio/iface/interface.cpp.in
136#$make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in
137
138if [[ "$compil_full" == "true" ]]
139   then
140   fcm build -f -j $job
141else
142  fcm build -j $job
143fi
144
145
146if [[ $? == 0 ]]
147  then
148  set nothing
149#    cd $WORKDIR/XMLIO_NEMO_COUPLE/modeles/NEMO/WORK
150#    cd $WORKDIR/XMLIO_NEMO/modeles/NEMO/WORK
151#    make
152fi
Note: See TracBrowser for help on using the repository browser.