1 | #!/bin/bash |
---|
2 | |
---|
3 | install_dir=$PWD |
---|
4 | |
---|
5 | # Traitement de la ligne de commande |
---|
6 | while (($# > 0)) |
---|
7 | do |
---|
8 | case $1 in |
---|
9 | "-h") |
---|
10 | # A modifier |
---|
11 | exit;; |
---|
12 | |
---|
13 | "--prod") compil_mode="prod" ; shift ;; |
---|
14 | "--dev") compil_mode="dev" ; shift ;; |
---|
15 | "--debug") compil_mode="debug" ; shift ;; |
---|
16 | "--arch") arch=$2 ; shift ; shift ;; |
---|
17 | "--doc") doc="true" ; shift ;; |
---|
18 | *) code="$1" ; shift ;; |
---|
19 | esac |
---|
20 | done |
---|
21 | |
---|
22 | # Vérification de la présence d'un identifiant d'architecture. |
---|
23 | |
---|
24 | if [[ !(-z $arch) ]] |
---|
25 | then |
---|
26 | rm -f $install_dir/arch.path |
---|
27 | rm -f $install_dir/arch.fcm |
---|
28 | ln -s $install_dir/arch/arch-${arch}.path $install_dir/arch.path |
---|
29 | ln -s $install_dir/arch/arch-${arch}.fcm $install_dir/arch.fcm |
---|
30 | source $install_dir/arch.path |
---|
31 | else |
---|
32 | echo "Veuillez definir une architecture cible !" |
---|
33 | exit 1 |
---|
34 | fi |
---|
35 | |
---|
36 | # Vérification de la présence d'un mode de compilation. |
---|
37 | |
---|
38 | if [[ "$compil_mode" == "prod" ]] |
---|
39 | then |
---|
40 | COMPIL_CFLAGS="%PROD_CFLAGS" |
---|
41 | COMPIL_FFLAGS="%PROD_FFLAGS" |
---|
42 | elif [[ "$compil_mode" == "dev" ]] |
---|
43 | then |
---|
44 | COMPIL_CFLAGS="%DEV_CFLAGS" |
---|
45 | COMPIL_FFLAGS="%DEV_FFLAGS" |
---|
46 | elif [[ "$compil_mode" == "debug" ]] |
---|
47 | then |
---|
48 | COMPIL_CFLAGS="%DEBUG_CFLAGS" |
---|
49 | COMPIL_FFLAGS="%DEBUG_FFLAGS" |
---|
50 | else |
---|
51 | echo "Veuillez definir un mode de compilation [debug|dev|prod] !" |
---|
52 | exit 1 |
---|
53 | fi |
---|
54 | |
---|
55 | XMLIO_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR" |
---|
56 | XMLIO_FINCDIR="$MPI_INCDIR" |
---|
57 | |
---|
58 | XMLIO_LIB="$NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB" |
---|
59 | |
---|
60 | rm -f config.fcm |
---|
61 | echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm |
---|
62 | echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm |
---|
63 | |
---|
64 | echo "%CBASE_INC $XMLIO_CINCDIR" >> config.fcm |
---|
65 | echo "%FBASE_INC $XMLIO_FINCDIR" >> config.fcm |
---|
66 | echo "%ARCH_LD $XMLIO_LIB" >> config.fcm |
---|
67 | |
---|
68 | echo "=> Activation du mode "$compil_mode" pour la distribution sous l'architecture \""$arch"\" !" |
---|
69 | |
---|
70 | # Création de la documentation doxygen. |
---|
71 | if [[ !(-z $doc) ]] |
---|
72 | then |
---|
73 | echo -e "- Création de la documentation de code doxygen (désactivée)..." |
---|
74 | #doxygen -s |
---|
75 | fi |
---|
76 | |
---|
77 | make_dir=$PWD |
---|
78 | |
---|
79 | export PATH=$PWD/tools/FCM/bin:$PATH |
---|
80 | |
---|
81 | $make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp $make_dir/src/xmlio/iface/interface.cpp.in |
---|
82 | $make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in |
---|
83 | |
---|
84 | fcm build |
---|
85 | |
---|