source: XIOS/trunk/make_xios @ 385

Last change on this file since 385 was 383, checked in by aclsce, 12 years ago
  • Fixed small bug
  • Added possibility to use -h, --help, -help command
  • Property svn:executable set to *
File size: 5.2 KB
RevLine 
[248]1#!/bin/bash
2
3install_dir=$PWD
[287]4compil_full="false"
5use_oasis="false"
[313]6job="1"
[381]7netcdf_lib="netcdf4_par"
8compil_mode="prod"
[248]9
10# Traitement de la ligne de commande
11while (($# > 0))
12   do
13      case $1 in
[383]14         "-h"|"--help"|"-help")
[374]15            echo "make_xios - installs XIOS on your architecture"
16            echo "make_xios [options]"
17            echo "options :"
[381]18            echo "       [--prod] : compilation in production mode (default)"
[374]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"
[381]27            echo "       [--netcdf_lib 'netcdf4_par'/'netcdf4_seq' : default netcdf4_par] : choice of netcdf library"
[374]28            echo "Example : ./make_xios --prod --arch PW6_VARGAS"
29            echo "Example : ./make_xios --avail"
[248]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 ;;
[383]35         "--avail") ls arch/*.fcm | cut -d"-" -f2 | cut -d"." -f1 ; exit ;;
[313]36         "--full")  compil_full="true"  ; shift ;;
[301]37         "--use_oasis")  use_oasis="true"  ; shift  ;;
[248]38         "--doc")   doc="true"          ; shift ;;
[313]39         "--job")   job=$2              ; shift ; shift ;;
[381]40         "--netcdf_lib")   netcdf_lib=$2 ; shift ; shift ;;
[248]41         *)         code="$1"           ; shift ;;
42      esac
43   done
44
[374]45# Installation des sources
[377]46nb_files_gz=`ls $install_dir/tools/archive | grep tar.gz | wc -l`
47if [ ${nb_files_gz} -ne 0 ]               
[376]48then
[377]49    echo -e "- uncompress archives ..."         
[376]50    for tarname in `ls $install_dir/tools/archive/*.tar.gz` ; do
51        gunzip -f "$tarname"
52        tar -xf ${tarname%.gz}
53    done
54fi
[374]55
[248]56# Vérification de la présence d'un identifiant d'architecture.
57
[281]58###############################################################
[374]59# lecture des chemins propres a l'architecture de la machine #
[281]60#           et configuration de l'environnement              #
61###############################################################
62
63rm -f .void_file
64echo > .void_file
65rm -rf .void_dir
66mkdir .void_dir
67
[248]68if [[ !(-z $arch) ]]
69   then
70      rm -f  $install_dir/arch.path
71      rm -f  $install_dir/arch.fcm
[281]72      rm -f  $install_dir/arch.env
[248]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
[281]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
[248]84      source $install_dir/arch.path
[281]85  else
[381]86      echo "Please choose a target achitecture --> list all available architecture using make_xios --avail!"
[248]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
[381]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
[287]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
[362]123
[248]124XMLIO_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR"
[287]125XMLIO_FINCDIR="$XMLIO_FINCDIR $MPI_INCDIR"
[248]126
[287]127XMLIO_LIB="$XMLIO_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
[248]128
129rm -f config.fcm
130echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm
131echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
[287]132echo "%CPP_KEY       $XMLIO_CPPKEY"  >> config.fcm
[248]133
134echo "%CBASE_INC     $XMLIO_CINCDIR" >> config.fcm     
135echo "%FBASE_INC     $XMLIO_FINCDIR" >> config.fcm
136echo "%ARCH_LD       $XMLIO_LIB" >> config.fcm
137
[381]138echo "=> Using "$compil_mode" mode for compiling under architecture \""$arch"\" !"
[248]139
140# Création de la documentation doxygen.
141if [[ !(-z $doc) ]]
142   then
[381]143      echo -e "- Create Doxygen documentation (disabled)..."
[248]144      #doxygen -s
145fi
146
147make_dir=$PWD
148
149export PATH=$PWD/tools/FCM/bin:$PATH
150
[274]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
[248]153
[287]154if [[ "$compil_full" == "true" ]]
155   then
[313]156   fcm build -f -j $job
[287]157else
[313]158  fcm build -j $job
[287]159fi
[248]160
[287]161
162if [[ $? == 0 ]]
163  then
[366]164  set nothing
[287]165#    cd $WORKDIR/XMLIO_NEMO_COUPLE/modeles/NEMO/WORK
[362]166#    cd $WORKDIR/XMLIO_NEMO/modeles/NEMO/WORK
[301]167#    make
[287]168fi
Note: See TracBrowser for help on using the repository browser.