source: XIOS/trunk/make_xios @ 440

Last change on this file since 440 was 440, checked in by aclsce, 11 years ago
  • Modified Oasis library path in order to use XIOS in IPSL coupled model
  • Added "-lnetcdff" (fortran netcdf interface) in --use_oasis case
  • Property svn:executable set to *
File size: 6.0 KB
Line 
1#!/bin/bash
2
3install_dir=$PWD
4compil_full="false"
5use_oasis="false"
6use_memtrack="false"
7job="1"
8netcdf_lib="netcdf4_par"
9compil_mode="prod"
10
11# Traitement de la ligne de commande
12while (($# > 0))
13   do
14      case $1 in
15         "-h"|"--help"|"-help")
16            echo "make_xios - installs XIOS on your architecture"
17            echo "make_xios [options]"
18            echo "options :"
19            echo "       [--prod] : compilation in production mode (default)"
20            echo "       [--dev] : compilation in development mode"
21            echo "       [--debug] : compilation in debug mode"
22            echo "       --arch arch : to choose target architecture"
23            echo "       [--avail] : to know available target architectures "
24            echo "       [--full] : to generate dependencies and recompile from scratch"
25            echo "       [--use_oasis] : to use Oasis coupler"
26            echo "       [--doc] : to generate Doxygen documentation (not available yet)"
27            echo "       [--job ntasks] : to use parallel compilation with ntasks"
28            echo "       [--netcdf_lib 'netcdf4_par'/'netcdf4_seq'/'netcdf4_internal' : default netcdf4_par] : choice of netcdf library"
29            echo "       [--memtrack] : tracking memory leak - developper only"
30            echo "Example : ./make_xios --prod --arch PW6_VARGAS"
31            echo "Example : ./make_xios --avail"
32            exit;;
33         "--prod")  compil_mode="prod"  ; shift ;;
34         "--dev")   compil_mode="dev"   ; shift ;;
35         "--debug") compil_mode="debug" ; shift ;;
36         "--arch")  arch=$2     ; shift ; shift ;;
37         "--avail") ls arch/*.fcm | cut -d"-" -f2 | cut -d"." -f1 ; exit ;;
38         "--full")  compil_full="true"  ; shift ;;
39         "--use_oasis")  use_oasis="true"  ; shift  ;;
40         "--doc")   doc="true"          ; shift ;;
41         "--job")   job=$2              ; shift ; shift ;;
42         "--netcdf_lib")   netcdf_lib=$2 ; shift ; shift ;;
43         "--memtrack")   use_memtrack="true" ; shift ;;
44         *)         code="$1"           ; shift ;;
45      esac
46   done
47
48# Installation des sources
49nb_files_gz=`ls $install_dir/tools/archive | grep tar.gz | wc -l`
50if [ ${nb_files_gz} -ne 0 ]               
51then
52    echo -e "- uncompress archives ..."         
53    for tarname in `ls $install_dir/tools/archive/*.tar.gz` ; do
54        gunzip -f "$tarname"
55        tar -xf ${tarname%.gz}
56    done
57fi
58
59# Vérification de la présence d'un identifiant d'architecture.
60
61###############################################################
62# lecture des chemins propres a l'architecture de la machine #
63#           et configuration de l'environnement              #
64###############################################################
65
66rm -f .void_file
67echo > .void_file
68rm -rf .void_dir
69mkdir .void_dir
70
71if [[ !(-z $arch) ]]
72   then
73      rm -f  $install_dir/arch.path
74      rm -f  $install_dir/arch.fcm
75      rm -f  $install_dir/arch.env
76      ln -s  $install_dir/arch/arch-${arch}.path $install_dir/arch.path
77      ln -s  $install_dir/arch/arch-${arch}.fcm  $install_dir/arch.fcm
78
79      if test -f $install_dir/arch/arch-${arch}.env
80      then
81        ln -s $install_dir/arch/arch-${arch}.env arch.env
82      else
83        ln -s $install_dir/.void_file arch.env
84      fi
85
86      source $install_dir/arch.env
87      source $install_dir/arch.path
88  else
89      echo "Please choose a target achitecture --> list all available architecture using make_xios --avail!"
90      exit 1
91fi
92
93# Vérification de la présence d'un mode de compilation.
94
95if [[ "$compil_mode" == "prod" ]]
96   then
97      COMPIL_CFLAGS="%PROD_CFLAGS"
98      COMPIL_FFLAGS="%PROD_FFLAGS"
99elif [[ "$compil_mode" == "dev" ]]
100   then
101      COMPIL_CFLAGS="%DEV_CFLAGS"
102      COMPIL_FFLAGS="%DEV_FFLAGS"
103elif [[ "$compil_mode" == "debug" ]]
104   then
105      COMPIL_CFLAGS="%DEBUG_CFLAGS"
106      COMPIL_FFLAGS="%DEBUG_FFLAGS"
107fi
108
109rm -r $PWD/extern/netcdf4
110
111if [[ "$netcdf_lib" == "netcdf4_par" ]]
112   then
113     ln -s $PWD/.void_dir $PWD/extern/netcdf4
114     XMLIO_CPPKEY="$XMLIO_CPPKEY USING_NETCDF_PAR"
115elif [[ "$netcdf_lib" == "netcdf4_seq" ]]
116  then
117    ln -s $PWD/.void_dir $PWD/extern/netcdf4
118elif [[ "$netcdf_lib" == "netcdf4_internal" ]]
119  then
120    ln -s $PWD/extern/src_netcdf4 $PWD/extern/netcdf4
121    XMLIO_CPPKEY="$XMLIO_CPPKEY USING_NETCDF_PAR USING_NETCDF_INTERNAL"
122    export NETCDF_INCDIR="-I${PWD}/extern/netcdf4"
123    export NETCDF_LIBDIR=""
124    export NETCDF_LIB=""
125else
126   echo "Bad choice for --netcdf_lib argument : choose between 'netcdf4_par','netcdf4_seq' or 'netcdf4_internal'"
127   exit
128fi
129
130if [[ "$use_oasis" == "true" ]]
131   then
132   NETCDF_LIB="-lnetcdff -lnetcdf"
133   XMLIO_FINCDIR="$OASIS_INCDIR $XMLIO_FINCDIR"
134   XMLIO_LIB="$OASIS_LIBDIR $OASIS_LIB $XMLIO_LIB"
135   XMLIO_CPPKEY="$XMLIO_CPPKEY USE_OASIS"
136fi
137
138if [[ "$use_memtrack" == "true" ]]
139   then
140   XMLIO_LIB="$ADDR2LINE_LIBDIR $ADDR2LINE_LIB $XMLIO_LIB"
141   XMLIO_CPPKEY="$XMLIO_CPPKEY XIOS_MEMTRACK"
142fi
143
144XMLIO_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR"
145XMLIO_FINCDIR="$XMLIO_FINCDIR $MPI_INCDIR"
146
147XMLIO_LIB="$XMLIO_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
148
149rm -f config.fcm
150echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm
151echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
152echo "%CPP_KEY       $XMLIO_CPPKEY"  >> config.fcm
153
154echo "%CBASE_INC     $XMLIO_CINCDIR" >> config.fcm     
155echo "%FBASE_INC     $XMLIO_FINCDIR" >> config.fcm
156echo "%ARCH_LD       $XMLIO_LIB" >> config.fcm
157
158echo "=> Using "$compil_mode" mode for compiling under architecture \""$arch"\" !"
159
160# Création de la documentation doxygen.
161if [[ !(-z $doc) ]]
162   then
163      echo -e "- Create Doxygen documentation (disabled)..."
164      #doxygen -s
165fi
166
167make_dir=$PWD
168
169export PATH=$PWD/tools/FCM/bin:$PATH
170
171#$make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp      $make_dir/src/xmlio/iface/interface.cpp.in
172#$make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in
173
174if [[ "$compil_full" == "true" ]]
175   then
176   fcm build --clean --ignore-lock
177   fcm build -f --ignore-lock -j $job
178else
179  fcm build --ignore-lock -j $job
180fi
181
182
183if [[ $? == 0 ]]
184  then
185  set nothing
186#    cd $WORKDIR/XMLIO_NEMO_COUPLE/modeles/NEMO/WORK
187#    cd $WORKDIR/XMLIO_NEMO/modeles/NEMO/WORK
188#    make
189fi
Note: See TracBrowser for help on using the repository browser.