Salome HOME
3aab4b8248e6abbe7830fc66a621aba990235900
[modules/hexablock.git] / src / HEXABLOCK / umake
1 #!/bin/sh
2 # Copyright (C) 2009-2023  CEA, EDF
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 # Comm : Makefile associe aux tests unitaires
22
23 commande=$0
24 liste_args="$*"
25
26 # =============================================== al_aide
27 al_aide()
28 {
29 comm=`basename $appel`
30
31 cat << ENDOF_BLABLA
32  
33              ----  Recompilation locale de HexaBlock
34  Syntaxe : 
35  $ $comm <Options de $comm> 
36  
37  Options de $comm : 
38     -h     : Rappel des options
39     -make  : Regenerer le Makefile
40     -lib   : Regenerer la librairie partagee au moyen de swig
41     -clean : Detruire codes objets, executables et fichiers generes
42     -trace : Detail des sous-commandes
43     -setx  : Observer le deroulement de la procedure
44     -jN    : Compiler sur N process
45     test_* : Linker le test unitaire test_X.exe
46
47  Par defaut 1) le programme test_hexa.exe est genere
48             2) la librairie _hexablock_swig.so (ou *.dll) est generee
49
50 ENDOF_BLABLA
51 exit 
52 }
53 # =============================================== Begin
54
55 test_u=
56 opt=
57 make_lib=
58 for arg in $*
59    do
60    case $arg in
61       -setx ) set -x 
62            ;;
63       -h ) al_aide
64            ;;
65       -lib ) make_lib=OK
66            ;;
67       -make  ) 
68            chmod +x *make*
69            ./make.make
70            exit
71            ;;
72       -clean  ) 
73          rm -rf *.exe *.a *.o *.bak *.brep *~ *.vtk *.cpp *.xml *.exe.stackdump
74          rm -rf work/*.exe work/*.brep work/*~ work/*.vtk work/*.cpp work/*.xml
75          rm -rf work/*.exe.stackdump
76          rm -rf *.so *.dll 
77            exit
78            ;;
79       -j  ) opt="$opt -j4"
80            ;;
81       -j* ) opt="$opt $arg"
82            ;;
83       -k  ) echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo
84             echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo
85            ;;
86       *) if ( [ -z "$test_u" ] ) then
87             test_u=`echo $arg | cut -d. -f1`
88             ishere=`grep -w $test_u test_*.cxx | grep -c tabargs`
89             if ( [ "$ishere" = "0" ] ) then
90                echo "****"
91                echo "**** Programme non trouve : $test_u"
92                echo "****"
93                exit 1
94                fi
95             fi
96    esac
97    done
98
99 if ( [ -z "$test_u" ] ) then
100    test_u=test_hexa
101    make_lib=OK
102    fi
103
104 if ( [ ! -f makefile.ozz ] ) then
105    ./make.make
106    fi
107
108 uf=`pwd`
109 uf=`basename "$uf"`
110 os=`uname`
111
112 if ( [ $os = Linux ] ) then
113    opt_cpp=-fPIC
114    lib_ext=so
115 else             ## CYGWIN 
116    opt_cpp=
117    lib_ext=dll
118    fi
119
120 echo "  -- Maj $uf.a et $test_u.exe"
121 make -f makefile.ozz $opt main=$test_u
122 ier=$?
123
124                  ###### Verrue Saclay
125 vpy=
126 mach=`hostname`
127 mach=`echo $mach | cut -c1-2`
128 if ( [ $mach = is ] ) then
129    vpy='pyvers=2.5'
130    fi
131
132
133 if ( [ $ier = 0 -a -n "$make_lib" ] ) then
134    make -f makefile.swig $vpy lib_ext=$lib_ext opt_cpp=$opt_cpp uf=$uf
135    fi