source: XIOS/trunk/make_xios @ 395

Last change on this file since 395 was 395, checked in by ymipsl, 9 years ago

some cleaning and update in arch files.

YM

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