source: XIOS/trunk/make_xios @ 410

Last change on this file since 410 was 410, checked in by ymipsl, 8 years ago

management of internal netcdf library

YM

  • 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   XMLIO_FINCDIR="$OASIS_INCDIR $XMLIO_FINCDIR"
133   XMLIO_LIB="$OASIS_LIBDIR $OASIS_LIB $XMLIO_LIB"
134   XMLIO_CPPKEY="$XMLIO_CPPKEY USE_OASIS"
135fi
136
137if [[ "$use_memtrack" == "true" ]]
138   then
139   XMLIO_LIB="$ADDR2LINE_LIBDIR $ADDR2LINE_LIB $XMLIO_LIB"
140   XMLIO_CPPKEY="$XMLIO_CPPKEY XIOS_MEMTRACK"
141fi
142
143XMLIO_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR"
144XMLIO_FINCDIR="$XMLIO_FINCDIR $MPI_INCDIR"
145
146XMLIO_LIB="$XMLIO_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
147
148rm -f config.fcm
149echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm
150echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
151echo "%CPP_KEY       $XMLIO_CPPKEY"  >> config.fcm
152
153echo "%CBASE_INC     $XMLIO_CINCDIR" >> config.fcm     
154echo "%FBASE_INC     $XMLIO_FINCDIR" >> config.fcm
155echo "%ARCH_LD       $XMLIO_LIB" >> config.fcm
156
157echo "=> Using "$compil_mode" mode for compiling under architecture \""$arch"\" !"
158
159# Création de la documentation doxygen.
160if [[ !(-z $doc) ]]
161   then
162      echo -e "- Create Doxygen documentation (disabled)..."
163      #doxygen -s
164fi
165
166make_dir=$PWD
167
168export PATH=$PWD/tools/FCM/bin:$PATH
169
170#$make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp      $make_dir/src/xmlio/iface/interface.cpp.in
171#$make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in
172
173if [[ "$compil_full" == "true" ]]
174   then
175   fcm build --clean --ignore-lock
176   fcm build -f --ignore-lock -j $job
177else
178  fcm build --ignore-lock -j $job
179fi
180
181
182if [[ $? == 0 ]]
183  then
184  set nothing
185#    cd $WORKDIR/XMLIO_NEMO_COUPLE/modeles/NEMO/WORK
186#    cd $WORKDIR/XMLIO_NEMO/modeles/NEMO/WORK
187#    make
188fi
Note: See TracBrowser for help on using the repository browser.