2 # Copyright (C) 2009-2024 CEA, EDF
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Comm : Generateur de Makefile
26 # =============================================== al_aide
29 proc=`basename $commande`
32 $ $proc [ options ] <fichiers_source>
34 Genere un Makefile tenant compte des fichiers sources passes en argument
35 et des includes appeles par ces fichiers.
37 <fichiers_sources> liste des fichiers *.c *.cc *.cpp *.cxx et *.C
38 pris en compte pour constituer le Makefile.
39 Si des fichiers *.h sont presents, c'est pour generer des
40 fichiers qt (utilitaire moc)
42 Make=<fic> : Nom du makefile a generer
43 opt=val : Option passee
44 <autres> : options de compilation
45 (par exemple le repertoire des includes)
49 # =============================================== ana_arguments
57 for arg in $liste_args
67 make_file=`echo $arg | cut -f2 -d=`
70 arg_gcc="$arg_gcc $arg"
82 *.cpp | *.cc | *.cxx | *.C | *.c )
83 rad=`echo $arg | cut -f1 -d.`
84 liste_src="$liste_src $arg"
85 liste_rad="$liste_rad $rad"
92 # =============================================== put_includes
95 if ( [ -z "$3" ] ) then
115 # =============================================== init_par_defaut
119 if ( [ $os = Linux ] ) then
123 hdebut=`date '+%Hh %Mmn %Ss'`
125 make_file=makefile.ozz
143 cmd_cpil="g++ -c -g $opt_pic -Wall -DNO_CASCADE -Inokas --pedantic"
144 cmd_arch='ar rcvu $(BIBLI) *.o'
152 comm=`basename $commande`
153 reptools=`dirname $commande`
154 ### Definition des includes par $ozz_opt_cpp
156 if ( [ -n "$OZZ_FLAGS" -a -f "$OZZ_FLAGS" ] ) then
160 # =============================================== add_entete
163 today=`date "+%d/%m/%y a %Hh%M"`
165 echo "# Makefile OZZ genere le $today"
166 echo "# Par la commande : $comm "
167 echo "# Role de ce makefile : "
168 echo "# - Compiler les fichiers-source defraichis avec la commande \$CPIL"
169 echo "# - Les archiver sur le fichier archive \$REPLIB/\$BIBLI"
170 echo "# - Linker le programme principal (test unitaire) passe en argument"
172 echo ".SUFFIXES:" ## Pour ne pas etre emm....
173 echo "OPT = " ## Options de compilation de l'appelant
176 echo "REPEXE = ./work"
177 echo "BIBLI = $namof_lib"
178 echo "ARCH = $cmd_arch"
179 echo "CPIL = $cmd_cpil"
180 echo "LINK = $cmd_link"
181 echo "main = test_hexa"
184 precedente="OBJECTS ="
186 for module in $liste_rad
188 echo "$precedente \\"
189 precedente=" $repobj/$module.o"
198 @ echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo
200 link : $repexe/\$(main).exe
202 $repexe/\$(main).cpp :
205 $repexe/\$(main).exe : $repexe/\$(main).cpp \$(REPLIB)/\$(BIBLI)
206 \$(LINK) $repexe/\$(main).cpp \$(REPLIB)/\$(BIBLI) -o $repexe/\$(main).exe
208 \$(REPLIB)/\$(BIBLI) : \$(OBJECTS)
212 rm -rf *.exe \$(REPLIB)/\$(BIBLI) \$(REPOBJ)/*.o *.bak *~
215 rm -rf \$(REPLIB)/\$(BIBLI) \$(REPOBJ)/*.o *.bak *~
219 # =============================================== add_sources
223 echo " ### Compilations"
225 for arg in $liste_src
227 radical=`echo $arg | cut -f1 -d.`
228 echo "$repobj/$radical.o : $arg"
229 echo " $compile $opt_user $arg"
232 # =============================================== Begin
235 echo " ... Generation de $make_file qui met a jour $namof_lib ..."
241 add_entete >> $make_file
242 add_sources >> $make_file
244 makedepend -f $make_file -Y -I. $liste_src 2> /dev/null
246 hfin=`date '+%Hh %Mmn %Ss'`
247 echo " ... Fin de la generation : $hfin"
248 echo " ... Elle avait debute a : $hdebut"