source: XIOS/trunk/make_xios @ 377

Last change on this file since 377 was 377, checked in by aclsce, 11 years ago
  • Modified to make it work on Curie and Vargas
  • Property svn:executable set to *
File size: 4.8 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"." -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
42nb_files_gz=`ls $install_dir/tools/archive | grep tar.gz | wc -l`
43if [ ${nb_files_gz} -ne 0 ]               
44then
45    echo -e "- uncompress archives ..."         
46    for tarname in `ls $install_dir/tools/archive/*.tar.gz` ; do
47        gunzip -f "$tarname"
48        tar -xf ${tarname%.gz}
49    done
50fi
51
52# Vérification de la présence d'un identifiant d'architecture.
53
54###############################################################
55# lecture des chemins propres a l'architecture de la machine #
56#           et configuration de l'environnement              #
57###############################################################
58
59rm -f .void_file
60echo > .void_file
61rm -rf .void_dir
62mkdir .void_dir
63
64if [[ !(-z $arch) ]]
65   then
66      rm -f  $install_dir/arch.path
67      rm -f  $install_dir/arch.fcm
68      rm -f  $install_dir/arch.env
69      ln -s  $install_dir/arch/arch-${arch}.path $install_dir/arch.path
70      ln -s  $install_dir/arch/arch-${arch}.fcm  $install_dir/arch.fcm
71
72      if test -f $install_dir/arch/arch-${arch}.env
73      then
74        ln -s $install_dir/arch/arch-${arch}.env arch.env
75      else
76        ln -s $install_dir/.void_file arch.env
77      fi
78
79      source $install_dir/arch.env
80      source $install_dir/arch.path
81  else
82      echo "Veuillez definir une architecture cible !"
83      exit 1
84fi
85
86# Vérification de la présence d'un mode de compilation.
87
88if [[ "$compil_mode" == "prod" ]]
89   then
90      COMPIL_CFLAGS="%PROD_CFLAGS"
91      COMPIL_FFLAGS="%PROD_FFLAGS"
92elif [[ "$compil_mode" == "dev" ]]
93   then
94      COMPIL_CFLAGS="%DEV_CFLAGS"
95      COMPIL_FFLAGS="%DEV_FFLAGS"
96elif [[ "$compil_mode" == "debug" ]]
97   then
98      COMPIL_CFLAGS="%DEBUG_CFLAGS"
99      COMPIL_FFLAGS="%DEBUG_FFLAGS"
100else
101   echo "Veuillez definir un mode de compilation [debug|dev|prod] !"
102   exit 1
103fi
104
105if [[ "$use_oasis" == "true" ]]
106   then
107   XMLIO_FINCDIR="$OASIS_INCDIR $XMLIO_FINCDIR"
108   XMLIO_LIB="$OASIS_LIBDIR $OASIS_LIB $XMLIO_LIB"
109   XMLIO_CPPKEY="$XMLIO_CPPKEY USE_OASIS"
110fi
111
112XMLIO_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR"
113XMLIO_FINCDIR="$XMLIO_FINCDIR $MPI_INCDIR"
114
115XMLIO_LIB="$XMLIO_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
116
117rm -f config.fcm
118echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm
119echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
120echo "%CPP_KEY       $XMLIO_CPPKEY"  >> config.fcm
121
122echo "%CBASE_INC     $XMLIO_CINCDIR" >> config.fcm     
123echo "%FBASE_INC     $XMLIO_FINCDIR" >> config.fcm
124echo "%ARCH_LD       $XMLIO_LIB" >> config.fcm
125
126echo "=> Activation du mode "$compil_mode" pour la distribution sous l'architecture \""$arch"\" !"
127
128# Création de la documentation doxygen.
129if [[ !(-z $doc) ]]
130   then
131      echo -e "- Création de la documentation de code doxygen (désactivée)..."
132      #doxygen -s
133fi
134
135make_dir=$PWD
136
137export PATH=$PWD/tools/FCM/bin:$PATH
138
139#$make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp      $make_dir/src/xmlio/iface/interface.cpp.in
140#$make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in
141
142if [[ "$compil_full" == "true" ]]
143   then
144   fcm build -f -j $job
145else
146  fcm build -j $job
147fi
148
149
150if [[ $? == 0 ]]
151  then
152  set nothing
153#    cd $WORKDIR/XMLIO_NEMO_COUPLE/modeles/NEMO/WORK
154#    cd $WORKDIR/XMLIO_NEMO/modeles/NEMO/WORK
155#    make
156fi
Note: See TracBrowser for help on using the repository browser.