[248] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | install_dir=$PWD |
---|
[287] | 4 | compil_full="false" |
---|
| 5 | use_oasis="false" |
---|
[248] | 6 | |
---|
| 7 | # Traitement de la ligne de commande |
---|
| 8 | while (($# > 0)) |
---|
| 9 | do |
---|
| 10 | case $1 in |
---|
| 11 | "-h") |
---|
| 12 | # A modifier |
---|
| 13 | exit;; |
---|
| 14 | |
---|
| 15 | "--prod") compil_mode="prod" ; shift ;; |
---|
| 16 | "--dev") compil_mode="dev" ; shift ;; |
---|
| 17 | "--debug") compil_mode="debug" ; shift ;; |
---|
| 18 | "--arch") arch=$2 ; shift ; shift ;; |
---|
[287] | 19 | "--full") compil_full="true" ; shift ; shift ;; |
---|
[301] | 20 | "--use_oasis") use_oasis="true" ; shift ;; |
---|
[248] | 21 | "--doc") doc="true" ; shift ;; |
---|
| 22 | *) code="$1" ; shift ;; |
---|
| 23 | esac |
---|
| 24 | done |
---|
| 25 | |
---|
| 26 | # Vérification de la présence d'un identifiant d'architecture. |
---|
| 27 | |
---|
[281] | 28 | ############################################################### |
---|
| 29 | # lecture des chemins propres à l'architecture de la machine # |
---|
| 30 | # et configuration de l'environnement # |
---|
| 31 | ############################################################### |
---|
| 32 | |
---|
| 33 | rm -f .void_file |
---|
| 34 | echo > .void_file |
---|
| 35 | rm -rf .void_dir |
---|
| 36 | mkdir .void_dir |
---|
| 37 | |
---|
[248] | 38 | if [[ !(-z $arch) ]] |
---|
| 39 | then |
---|
| 40 | rm -f $install_dir/arch.path |
---|
| 41 | rm -f $install_dir/arch.fcm |
---|
[281] | 42 | rm -f $install_dir/arch.env |
---|
[248] | 43 | ln -s $install_dir/arch/arch-${arch}.path $install_dir/arch.path |
---|
| 44 | ln -s $install_dir/arch/arch-${arch}.fcm $install_dir/arch.fcm |
---|
[281] | 45 | |
---|
| 46 | if test -f $install_dir/arch/arch-${arch}.env |
---|
| 47 | then |
---|
| 48 | ln -s $install_dir/arch/arch-${arch}.env arch.env |
---|
| 49 | else |
---|
| 50 | ln -s $install_dir/.void_file arch.env |
---|
| 51 | fi |
---|
| 52 | |
---|
| 53 | source $install_dir/arch.env |
---|
[248] | 54 | source $install_dir/arch.path |
---|
[281] | 55 | else |
---|
[248] | 56 | echo "Veuillez definir une architecture cible !" |
---|
| 57 | exit 1 |
---|
| 58 | fi |
---|
| 59 | |
---|
| 60 | # Vérification de la présence d'un mode de compilation. |
---|
| 61 | |
---|
| 62 | if [[ "$compil_mode" == "prod" ]] |
---|
| 63 | then |
---|
| 64 | COMPIL_CFLAGS="%PROD_CFLAGS" |
---|
| 65 | COMPIL_FFLAGS="%PROD_FFLAGS" |
---|
| 66 | elif [[ "$compil_mode" == "dev" ]] |
---|
| 67 | then |
---|
| 68 | COMPIL_CFLAGS="%DEV_CFLAGS" |
---|
| 69 | COMPIL_FFLAGS="%DEV_FFLAGS" |
---|
| 70 | elif [[ "$compil_mode" == "debug" ]] |
---|
| 71 | then |
---|
| 72 | COMPIL_CFLAGS="%DEBUG_CFLAGS" |
---|
| 73 | COMPIL_FFLAGS="%DEBUG_FFLAGS" |
---|
| 74 | else |
---|
| 75 | echo "Veuillez definir un mode de compilation [debug|dev|prod] !" |
---|
| 76 | exit 1 |
---|
| 77 | fi |
---|
| 78 | |
---|
[287] | 79 | if [[ "$use_oasis" == "true" ]] |
---|
| 80 | then |
---|
| 81 | XMLIO_FINCDIR="$OASIS_INCDIR $XMLIO_FINCDIR" |
---|
| 82 | XMLIO_LIB="$OASIS_LIBDIR $OASIS_LIB $XMLIO_LIB" |
---|
| 83 | XMLIO_CPPKEY="$XMLIO_CPPKEY USE_OASIS" |
---|
| 84 | else |
---|
| 85 | fcm build |
---|
| 86 | fi |
---|
[248] | 87 | XMLIO_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR" |
---|
[287] | 88 | XMLIO_FINCDIR="$XMLIO_FINCDIR $MPI_INCDIR" |
---|
[248] | 89 | |
---|
[287] | 90 | XMLIO_LIB="$XMLIO_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB" |
---|
[248] | 91 | |
---|
| 92 | rm -f config.fcm |
---|
| 93 | echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm |
---|
| 94 | echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm |
---|
[287] | 95 | echo "%CPP_KEY $XMLIO_CPPKEY" >> config.fcm |
---|
[248] | 96 | |
---|
| 97 | echo "%CBASE_INC $XMLIO_CINCDIR" >> config.fcm |
---|
| 98 | echo "%FBASE_INC $XMLIO_FINCDIR" >> config.fcm |
---|
| 99 | echo "%ARCH_LD $XMLIO_LIB" >> config.fcm |
---|
| 100 | |
---|
| 101 | echo "=> Activation du mode "$compil_mode" pour la distribution sous l'architecture \""$arch"\" !" |
---|
| 102 | |
---|
| 103 | # Création de la documentation doxygen. |
---|
| 104 | if [[ !(-z $doc) ]] |
---|
| 105 | then |
---|
| 106 | echo -e "- Création de la documentation de code doxygen (désactivée)..." |
---|
| 107 | #doxygen -s |
---|
| 108 | fi |
---|
| 109 | |
---|
| 110 | make_dir=$PWD |
---|
| 111 | |
---|
| 112 | export PATH=$PWD/tools/FCM/bin:$PATH |
---|
| 113 | |
---|
[274] | 114 | #$make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp $make_dir/src/xmlio/iface/interface.cpp.in |
---|
| 115 | #$make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in |
---|
[248] | 116 | |
---|
[287] | 117 | if [[ "$compil_full" == "true" ]] |
---|
| 118 | then |
---|
| 119 | fcm build -f |
---|
| 120 | else |
---|
| 121 | fcm build |
---|
| 122 | fi |
---|
[248] | 123 | |
---|
[287] | 124 | |
---|
| 125 | if [[ $? == 0 ]] |
---|
| 126 | then |
---|
| 127 | # cd $WORKDIR/XMLIO_NEMO_COUPLE/modeles/NEMO/WORK |
---|
| 128 | cd $WORKDIR/XMLIO_NEMO/modeles/NEMO/WORK |
---|
[301] | 129 | # make |
---|
[287] | 130 | fi |
---|