1 | #!/bin/bash |
---|
2 | |
---|
3 | install_dir=$PWD |
---|
4 | compil_full="false" |
---|
5 | use_oasis="false" |
---|
6 | job="1" |
---|
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 ;; |
---|
20 | "--full") compil_full="true" ; shift ;; |
---|
21 | "--use_oasis") use_oasis="true" ; shift ;; |
---|
22 | "--doc") doc="true" ; shift ;; |
---|
23 | "--job") job=$2 ; shift ; shift ;; |
---|
24 | *) code="$1" ; shift ;; |
---|
25 | esac |
---|
26 | done |
---|
27 | |
---|
28 | # Vérification de la présence d'un identifiant d'architecture. |
---|
29 | |
---|
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 | |
---|
40 | if [[ !(-z $arch) ]] |
---|
41 | then |
---|
42 | rm -f $install_dir/arch.path |
---|
43 | rm -f $install_dir/arch.fcm |
---|
44 | rm -f $install_dir/arch.env |
---|
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 |
---|
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 |
---|
56 | source $install_dir/arch.path |
---|
57 | else |
---|
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 | |
---|
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 | fi |
---|
87 | |
---|
88 | XMLIO_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR" |
---|
89 | XMLIO_FINCDIR="$XMLIO_FINCDIR $MPI_INCDIR" |
---|
90 | |
---|
91 | XMLIO_LIB="$XMLIO_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB" |
---|
92 | |
---|
93 | rm -f config.fcm |
---|
94 | echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm |
---|
95 | echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm |
---|
96 | echo "%CPP_KEY $XMLIO_CPPKEY" >> config.fcm |
---|
97 | |
---|
98 | echo "%CBASE_INC $XMLIO_CINCDIR" >> config.fcm |
---|
99 | echo "%FBASE_INC $XMLIO_FINCDIR" >> config.fcm |
---|
100 | echo "%ARCH_LD $XMLIO_LIB" >> config.fcm |
---|
101 | |
---|
102 | echo "=> Activation du mode "$compil_mode" pour la distribution sous l'architecture \""$arch"\" !" |
---|
103 | |
---|
104 | # Création de la documentation doxygen. |
---|
105 | if [[ !(-z $doc) ]] |
---|
106 | then |
---|
107 | echo -e "- Création de la documentation de code doxygen (désactivée)..." |
---|
108 | #doxygen -s |
---|
109 | fi |
---|
110 | |
---|
111 | make_dir=$PWD |
---|
112 | |
---|
113 | export PATH=$PWD/tools/FCM/bin:$PATH |
---|
114 | |
---|
115 | #$make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp $make_dir/src/xmlio/iface/interface.cpp.in |
---|
116 | #$make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in |
---|
117 | |
---|
118 | if [[ "$compil_full" == "true" ]] |
---|
119 | then |
---|
120 | fcm build -f -j $job |
---|
121 | else |
---|
122 | fcm build -j $job |
---|
123 | fi |
---|
124 | |
---|
125 | |
---|
126 | if [[ $? == 0 ]] |
---|
127 | then |
---|
128 | set nothing |
---|
129 | # cd $WORKDIR/XMLIO_NEMO_COUPLE/modeles/NEMO/WORK |
---|
130 | # cd $WORKDIR/XMLIO_NEMO/modeles/NEMO/WORK |
---|
131 | # make |
---|
132 | fi |
---|