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