Salome HOME
Hexa6 : Mise ajour des sources
[modules/hexablock.git] / src / HEXABLOCK / umake
1 #!/bin/sh
2 # Comm : Makefile associe aux tests unitaires
3
4 commande=$0
5 liste_args="$*"
6
7 # =============================================== al_aide
8 al_aide()
9 {
10 comm=`basename $appel`
11
12 cat << ENDOF_BLABLA
13  
14              ----  Recompilation locale de HexaBlock
15  Syntaxe : 
16  $ $comm <Options de $comm> 
17  
18  Options de $comm : 
19     -h     : Rappel des options
20     -make  : Regenerer le Makefile
21     -lib   : Regenerer la librairie partagee au moyen de swig
22     -clean : Detruire codes objets, executables et fichiers generes
23     -trace : Detail des sous-commandes
24     -setx  : Observer le deroulement de la procedure
25     -jN    : Compiler sur N process
26     test_* : Linker le test unitaire test_X.exe
27
28  Par defaut 1) le programme test_hexa.exe est genere
29             2) la librairie _hexablock_swig.so (ou *.dll) est generee
30
31 ENDOF_BLABLA
32 exit 
33 }
34 # =============================================== Begin
35
36 test_u=
37 opt=
38 make_lib=
39 for arg in $*
40    do
41    case $arg in
42       -setx ) set -x 
43            ;;
44       -h ) al_aide
45            ;;
46       -lib ) make_lib=OK
47            ;;
48       -make  ) 
49            chmod +x *make*
50            ./make.make
51            exit
52            ;;
53       -clean  ) 
54          rm -rf *.exe *.a *.o *.bak *.brep *~ *.vtk *.cpp *.xml *.exe.stackdump
55          rm -rf work/*.exe work/*.brep work/*~ work/*.vtk work/*.cpp work/*.xml
56          rm -rf work/*.exe.stackdump
57          rm -rf *.so *.dll 
58            exit
59            ;;
60       -j  ) opt="$opt -j4"
61            ;;
62       -j* ) opt="$opt $arg"
63            ;;
64       -k  ) echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo
65             echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo
66            ;;
67       *) if ( [ -z "$test_u" ] ) then
68             test_u=`echo $arg | cut -d. -f1`
69             ishere=`grep -w $test_u test_*.cxx | grep -c tabargs`
70             if ( [ "$ishere" = "0" ] ) then
71                echo "****"
72                echo "**** Programme non trouve : $test_u"
73                echo "****"
74                exit 1
75                fi
76             fi
77    esac
78    done
79
80 if ( [ -z "$test_u" ] ) then
81    test_u=test_hexa
82    make_lib=OK
83    fi
84
85 if ( [ ! -f makefile.ozz ] ) then
86    ./make.make
87    fi
88
89 uf=`pwd`
90 uf=`basename "$uf"`
91 os=`uname`
92
93 if ( [ $os = Linux ] ) then
94    opt_cpp=-fPIC
95    lib_ext=so
96 else             ## CYGWIN 
97    opt_cpp=
98    lib_ext=dll
99    fi
100
101 echo "  -- Maj $uf.a et $test_u.exe"
102 make -f makefile.ozz $opt main=$test_u
103 ier=$?
104
105                  ###### Verrue Saclay
106 vpy=
107 mach=`hostname`
108 mach=`echo $mach | cut -c1-2`
109 if ( [ $mach = is ] ) then
110    vpy='pyvers=2.5'
111    fi
112
113
114 if ( [ $ier = 0 -a -n "$make_lib" ] ) then
115    make -f makefile.swig $vpy lib_ext=$lib_ext opt_cpp=$opt_cpp uf=$uf
116    fi