1 | #!/bin/bash |
---|
2 | |
---|
3 | #######This is a Luigi Nardi improved version of the YaoH script file. |
---|
4 | |
---|
5 | #°°°°°°°°°°°°°°°°°°°°°°Function for move all files generated and quit. |
---|
6 | findir() |
---|
7 | { |
---|
8 | mkdir -p $YWRKDIR; |
---|
9 | mv -f Yaoext* Y*.cpp Y*~ Y*.o .Y* $YWRKDIR |
---|
10 | |
---|
11 | # si la generation n'est pas demanded, on ne move pas Y1, Y2 |
---|
12 | # et donc, on ne les movent que si la generation est demanded. |
---|
13 | # if test $OGENER = "1" |
---|
14 | # then |
---|
15 | mv -f Y1* Y2* .Y* $YWRKDIR |
---|
16 | # fi |
---|
17 | exit |
---|
18 | } |
---|
19 | #°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° |
---|
20 | |
---|
21 | |
---|
22 | #BEGIN of the procédure |
---|
23 | VERS=9 |
---|
24 | YNAME=`basename $0` |
---|
25 | VERELDAT="01.11.2008 (release 01.11.2008)" |
---|
26 | |
---|
27 | #======================================================================= |
---|
28 | # Determination de l'architecture materielle pour savoir quelle |
---|
29 | # version de librairies compilees utiliser. |
---|
30 | #======================================================================= |
---|
31 | # Si $YAOARCHI est defini (cela ce fait normalement dans fichier |
---|
32 | # d'environnement .cshrc) ceci definit $MACHINE. Sinon, il faut |
---|
33 | # determiner le type de $MACHINE selon l'architecture materielle : |
---|
34 | # |
---|
35 | # - Par la commande `uname -s` et, |
---|
36 | # - si Linux (Mandriva ici au LOCEAN), par le contenu du fichier |
---|
37 | # /etc/mandriva-release. Il faut donc adapter cette procedure selon |
---|
38 | # l'environnement de systeme d'exploitation ... |
---|
39 | MACHINE="UNKNOWN" |
---|
40 | if [ -n "$YAOARCHI" ]; then |
---|
41 | echo " --> MACHINE TYPE ihnerited from YAOARCHI enviromental variable" |
---|
42 | MACHINE="$YAOARCHI" |
---|
43 | else |
---|
44 | echo -n " --> MACHINE TYPE determined now ... " |
---|
45 | case `uname -s` in |
---|
46 | Linux) MACHINE=linux ;; |
---|
47 | SunOS) MACHINE=solaris ;; |
---|
48 | Darwin) MACHINE=darwin ;; |
---|
49 | *) cat <<EOF |
---|
50 | EOF |
---|
51 | exit;; |
---|
52 | esac |
---|
53 | echo " <${MACHINE}>." |
---|
54 | fi |
---|
55 | echo |
---|
56 | #============= Traitement des options passées en paramètre ============= |
---|
57 | #valeur d'option par defaut |
---|
58 | OHELP="0" |
---|
59 | OGENER="1" |
---|
60 | OPTCPIL="" |
---|
61 | #DBGCPIL="" |
---|
62 | indexec="0" |
---|
63 | indydir="0" |
---|
64 | OCAPSUL="0" |
---|
65 | OECHO="0" |
---|
66 | OLIBFOR="-lgfortran" |
---|
67 | if test $MACHINE = "darwin" |
---|
68 | then |
---|
69 | OLIBFOR="-L/sw/lib/gcc4.4/lib -lgfortran" |
---|
70 | fi |
---|
71 | |
---|
72 | #verif au moins un parametre |
---|
73 | #nb: le nom du projet est toujours le dernier parametre |
---|
74 | if test -z $1 |
---|
75 | then |
---|
76 | #echo " > missing parameter, syntaxe: $YNAME {-h, [-g][{-O0, -O1, -O2, -O3}] prj}" |
---|
77 | cat <<EOF |
---|
78 | |
---|
79 | > Missing parameter, syntaxe: |
---|
80 | > $YNAME { -h, [+"optionType"] [-x execName] [-d directory] [-s] [-e] [-lg2c] prjName } |
---|
81 | > |
---|
82 | > Options: |
---|
83 | > -h show a YAO help. |
---|
84 | > +optionType option to be added directly at compilation time (it is translated in -optionType), i.e. +g add the option for DBG. |
---|
85 | > -d directory to define a different ROOT destination directory. The default ROOT is the current directory. |
---|
86 | > The generated files are always created in "ROOT/Yworkdir/". |
---|
87 | > -x execName to define a different executable name. The default is the name of the application. |
---|
88 | > -s encapsulation (performed with the creation of a namespace). |
---|
89 | > -e echo of the compilation and the link. |
---|
90 | > -lg2c the specification of the fortran library. |
---|
91 | > -p enable the parallelization (openMP must be installed on the machine). |
---|
92 | > prjName is the project name. |
---|
93 | EOF |
---|
94 | exit |
---|
95 | fi |
---|
96 | |
---|
97 | #boucle sur les parametres |
---|
98 | for i |
---|
99 | do |
---|
100 | #-----> Help required ? on demande juste de l'aide |
---|
101 | if test $i = "-h" |
---|
102 | then |
---|
103 | OHELP="1" |
---|
104 | fi |
---|
105 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
106 | |
---|
107 | # -g option for the GNU debuger (GDB). This option is copied directly in the compilation command g++. |
---|
108 | # It is not needed because if we want the GDB we write the "+g" option and this is copied at compilation time. |
---|
109 | #if test $i = "-g" |
---|
110 | # then |
---|
111 | # DBGCPIL="-g" |
---|
112 | # fi |
---|
113 | # echo "DBGCPIL = " $DBGCPIL |
---|
114 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
115 | |
---|
116 | # Options de compilation ??????????????? |
---|
117 | if test ${i:0:1} = "+" |
---|
118 | then |
---|
119 | OPTCPIL=$OPTCPIL$i |
---|
120 | fi |
---|
121 | #echo "OPTCPIL = " $OPTCPIL (cf ci apres, transformation des options de compil |
---|
122 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
123 | #-----> Avant l'Executable avait le meme nom que prj (=dernier parametre), |
---|
124 | #maintenant ce sera par default, et il peut etre changed avec l'option -x |
---|
125 | if test $indexec = "1" |
---|
126 | then |
---|
127 | EXECNAME=$i |
---|
128 | indexec="0" |
---|
129 | fi |
---|
130 | if test $i = "-x" |
---|
131 | then |
---|
132 | indexec="1" |
---|
133 | fi |
---|
134 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
135 | #-----> Changement du Repertoire YAO |
---|
136 | if test $indydir = "1" |
---|
137 | then |
---|
138 | YAODIR=$i |
---|
139 | indydir="0" |
---|
140 | fi |
---|
141 | if test $i = "-d" |
---|
142 | then |
---|
143 | indydir="1" |
---|
144 | fi |
---|
145 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
146 | #-----> Encapsulation (spacename) ou pas |
---|
147 | if test $i = "-s" |
---|
148 | then |
---|
149 | OCAPSUL="1" |
---|
150 | fi |
---|
151 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
152 | #-----> Echo de la Compil et du Link |
---|
153 | if test $i = "-e" |
---|
154 | then |
---|
155 | OECHO="1" |
---|
156 | fi |
---|
157 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
158 | #-----> Librairie Fortran |
---|
159 | if test $i = "-lg2c" |
---|
160 | then |
---|
161 | OLIBFOR="-lg2c" |
---|
162 | fi |
---|
163 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
164 | #-----> Parallelism openMP |
---|
165 | if test $i = "-p" |
---|
166 | then |
---|
167 | PARALLEL="-fopenmp" |
---|
168 | fi |
---|
169 | #=====> Fin Boucle de traitement des Parametres |
---|
170 | done |
---|
171 | |
---|
172 | prj=`basename $i .d` |
---|
173 | #======================================================================= |
---|
174 | #bibliothèque YAODIR (pour objets YAO) |
---|
175 | #desormais pour changer le repertoire yao, on peut utiliser l'option -d |
---|
176 | if test ${#YAODIR} -eq 0 |
---|
177 | then |
---|
178 | echo "YAO directory variable not declared...current dir used" |
---|
179 | YAODIR="." |
---|
180 | fi |
---|
181 | # |
---|
182 | if test ! -d ${YAODIR} |
---|
183 | then |
---|
184 | echo "$YAODIR : invalid or unavailable YAO directory" |
---|
185 | exit |
---|
186 | fi |
---|
187 | #----------------------------------------------------------------------- |
---|
188 | #BINDIR=${YAODIR}/yao${VERS}/product/bin/${MACHINE} |
---|
189 | |
---|
190 | #BINDIR=${YAODIR}/yao${VERS}/yao/bin/${MACHINE} |
---|
191 | #INCDIR=${YAODIR}/yao${VERS}/yao/include |
---|
192 | BINDIR=${YAODIR}/yao/bin |
---|
193 | INCDIR=${YAODIR}/yao/include |
---|
194 | |
---|
195 | |
---|
196 | |
---|
197 | #BINDIR=${YAODIR}/yao${VERS}/bin/${MACHINE} |
---|
198 | #INCDIR=${YAODIR}/yao${VERS}/include |
---|
199 | # |
---|
200 | #======================================================================= |
---|
201 | # On revient sur le traitement des paramètres |
---|
202 | #----> on demande juste de l'aide |
---|
203 | if test $OHELP = "1" |
---|
204 | then |
---|
205 | #${BINDIR}/Yao${VERS} -h |
---|
206 | ${BINDIR}/Yao${VERS}Generator -h |
---|
207 | #Yao9Generator -h |
---|
208 | exit |
---|
209 | fi |
---|
210 | |
---|
211 | #----> dernier parametre = prj (doit exister eventuellement avec .d) |
---|
212 | #echo "last parm: $i" |
---|
213 | #prj=$i |
---|
214 | #if !(test -e $prj) |
---|
215 | #then |
---|
216 | if !(test -e $prj.d) |
---|
217 | then |
---|
218 | echo " description file $prj(.d) not found" |
---|
219 | exit |
---|
220 | fi |
---|
221 | #fi |
---|
222 | |
---|
223 | #----> nom de l'exe : exename ; s'il n'est pas affected alors c'est prj |
---|
224 | if test -z $EXECNAME |
---|
225 | then |
---|
226 | EXECNAME=$prj |
---|
227 | fi |
---|
228 | |
---|
229 | #----> on transforme les options de compilation |
---|
230 | OPTCPIL=`echo $OPTCPIL | sed 's/+/ -/g'` |
---|
231 | |
---|
232 | #----> more verif on parameters |
---|
233 | #--> si sans generation, les fichiers Y1 et Y2 doivent etre dans le repertoire courant |
---|
234 | if test $OGENER = "0" |
---|
235 | then |
---|
236 | if !(test -e Y1$prj.h) || !(test -e Y2$prj.h) |
---|
237 | then |
---|
238 | echo "file Y1$prj.h or Y2$prj.h missing" |
---|
239 | exit |
---|
240 | fi |
---|
241 | fi |
---|
242 | |
---|
243 | #======================================================================= |
---|
244 | #----------------------------------------------------------------------- |
---|
245 | #bibliotheque YADFDIR pour la derivation automatique |
---|
246 | #YADFDIR=${YAODIR}/etc/bin/${MACHINE} |
---|
247 | YADFDIR=${YAODIR}/etc/bin |
---|
248 | |
---|
249 | #----------------------------------------------------------------------- |
---|
250 | #une bibliotheque de travail pour ne pas etre embarassed par les codes generes |
---|
251 | YWRKDIR="./Yworkdir" |
---|
252 | |
---|
253 | #----------------------------------------------------------------------- |
---|
254 | # Compiler Global Variables: |
---|
255 | #----------------------------------------------------------------------- |
---|
256 | CC= |
---|
257 | CFLAGS= |
---|
258 | CXX="g++" |
---|
259 | #CXXFLAGS=" ${OPTCPIL} ${DBGCPIL} -Wall -DLINUXPC -Wno-deprecated -Wno-write-strings -I${INCDIR}" |
---|
260 | CXXFLAGS=" ${OPTCPIL} ${DBGCPIL} -Wall -DLINUXPC -Wno-deprecated -Wno-write-strings -I${INCDIR}" |
---|
261 | if test $MACHINE = "darwin" |
---|
262 | then |
---|
263 | CXXFLAGS=${CXXFLAGS}" -I/sw/include" |
---|
264 | fi |
---|
265 | NETCDFINCDIR=/usr/include |
---|
266 | if [ -f ${NETCDFINCDIR}/netcdf.h ]; then |
---|
267 | CXXFLAGS=${CXXFLAGS}" -I${NETCDFINCDIR}" |
---|
268 | else |
---|
269 | NETCDFINC=`echo ${NETCDFINCDIR}/netcdf* | awk '{ print $1 }'` |
---|
270 | if [ -d ${NETCDFINC} ]; then |
---|
271 | NETCDFINCFIC="${NETCDFINC}/netcdf.h" |
---|
272 | if [ -f ${NETCDFINCFIC} ]; then |
---|
273 | CXXFLAGS=${CXXFLAGS}" -I${NETCDFINC}" |
---|
274 | fi |
---|
275 | fi |
---|
276 | fi |
---|
277 | |
---|
278 | #----------------------------------------------------------------------- |
---|
279 | # LDFLAGS: |
---|
280 | # Test d'existence de la bibliotheque NetCDF |
---|
281 | NETCDFLIBDIR=/usr/lib |
---|
282 | NETCDFLIB=`echo ${NETCDFLIBDIR}/libnetcdf* | awk '{ print $1 }'` |
---|
283 | if test -e ${NETCDFLIB} |
---|
284 | then |
---|
285 | LDFLAGS=" -lm ${OLIBFOR} -L${NETCDFLIBDIR} -lnetcdf" |
---|
286 | else |
---|
287 | NETCDFLIBDIR=/usr/lib/local |
---|
288 | NETCDFLIB=`echo ${NETCDFLIBDIR}/libnetcdf* | awk '{ print $1 }'` |
---|
289 | if test -e ${NETCDFLIB} |
---|
290 | then |
---|
291 | LDFLAGS=" -lm ${OLIBFOR} -L${NETCDFLIBDIR} -lnetcdf" |
---|
292 | else |
---|
293 | NETCDFLIBDIR=/sw/lib |
---|
294 | NETCDFLIB=`echo ${NETCDFLIBDIR}/libnetcdf* | awk '{ print $1 }'` |
---|
295 | if test -e ${NETCDFLIB} |
---|
296 | then |
---|
297 | LDFLAGS=" -lm ${OLIBFOR} -L${NETCDFLIBDIR} -lnetcdf" |
---|
298 | else |
---|
299 | NETCDFLIBDIR=/usr/lib64 |
---|
300 | NETCDFLIB=`echo ${NETCDFLIBDIR}/libnetcdf* | awk '{ print $1 }'` |
---|
301 | if test -e ${NETCDFLIB} |
---|
302 | then |
---|
303 | LDFLAGS=" -lm ${OLIBFOR} -L${NETCDFLIBDIR} -lnetcdf" |
---|
304 | else |
---|
305 | LDFLAGS=" -lm ${OLIBFOR}" |
---|
306 | fi |
---|
307 | fi |
---|
308 | fi |
---|
309 | fi |
---|
310 | |
---|
311 | #======================================================================= |
---|
312 | #bibliothèque MQNDIR (pour libreries M1QN3 et M2QN1) |
---|
313 | if test ${#MQNDIR} -eq 0 |
---|
314 | then |
---|
315 | echo "MQNDIR directory variable not declared...standard directory" |
---|
316 | MQNDIR="${YAODIR}/yao/share/inria/" |
---|
317 | fi |
---|
318 | if test $OLIBFOR = "-lg2c" |
---|
319 | then |
---|
320 | BINMQN="${MQNDIR}/bin/mdk" |
---|
321 | else |
---|
322 | BINMQN="${MQNDIR}/bin" |
---|
323 | fi |
---|
324 | LDMQN=" -L${BINMQN} -lmqn" |
---|
325 | |
---|
326 | #----------------------------------------------------------------------- |
---|
327 | FC="g77" |
---|
328 | #FFLAGS=" -Dkey_4dvar ${OPTCPIL} ${DBGCPIL} -Wall" |
---|
329 | FFLAGS=" -Dkey_4dvar ${OPTCPIL} -Wall" |
---|
330 | # |
---|
331 | #CPPFLAGS= |
---|
332 | #----------------------------------------------------------------------- |
---|
333 | |
---|
334 | cat <<EOF |
---|
335 | ==================================================================== |
---|
336 | $YNAME V.$VERS : PROJECT CREATION PROCEDURE |
---|
337 | $VERELDAT |
---|
338 | ==================================================================== |
---|
339 | `printf "LOCAL MACHINE BINARY TYPE FOUND ..... %-28s" "<$MACHINE>"` |
---|
340 | ==================================================================== |
---|
341 | |
---|
342 | EOF |
---|
343 | |
---|
344 | #----------------------------------------------------------------------- |
---|
345 | echo " > Run of $YNAME for project :" $prj |
---|
346 | #noms des sources |
---|
347 | Ympp=Ymain_$prj.cpp |
---|
348 | Y1h=Y1$prj.h |
---|
349 | Y2h=Y2$prj.h |
---|
350 | Y3l=Y3$prj.l |
---|
351 | Y3h=Y3$prj.h |
---|
352 | Ycpp=Y$prj.cpp |
---|
353 | |
---|
354 | #======================================================================= |
---|
355 | #Test: we regenerate or not? This test is automatic looking the dates of the files. |
---|
356 | #Default is OGENER = "1": regenerate. |
---|
357 | if test $YWRKDIR/${Y1h} -nt ${prj}.d |
---|
358 | then |
---|
359 | if test $YWRKDIR/${Y2h} -nt ${prj}.d |
---|
360 | then OGENER="0" |
---|
361 | echo " > HEADERS generation not required: " |
---|
362 | echo " > the description file has not changed from the last generation of $Y1h and $Y2h." |
---|
363 | echo " > Pay attention all the warning showed in the generation process are not been displayed this way because of the non regeneration." |
---|
364 | echo " > If you want to force the regeneration remove the Yworkdir/ directory." |
---|
365 | cp $YWRKDIR/$Y1h . |
---|
366 | cp $YWRKDIR/$Y2h . |
---|
367 | if test -e $YWRKDIR/Yaoext_$prj |
---|
368 | then |
---|
369 | cp $YWRKDIR/Yaoext_$prj . |
---|
370 | fi |
---|
371 | fi |
---|
372 | fi |
---|
373 | # Remark: maybe we should consider also Yaoext_projName for the regeneration option. |
---|
374 | |
---|
375 | #ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg |
---|
376 | if test $OGENER = "1"; |
---|
377 | then |
---|
378 | echo " > enter proc generation " |
---|
379 | |
---|
380 | # sauvegarde (mv~) des Y1prjname.h Y2prjname.h et Yprjname.cpp ... |
---|
381 | # (i.e de tout ce qui est genere, sauf Y3) s'ils existent |
---|
382 | if test -e $YWRKDIR/$Y1h; |
---|
383 | then |
---|
384 | mv -f $YWRKDIR/$Y1h $YWRKDIR/$Y1h~ |
---|
385 | echo " > $Y1h moved as \~" |
---|
386 | fi |
---|
387 | if test -e $YWRKDIR/$Y2h; |
---|
388 | then |
---|
389 | mv -f $YWRKDIR/$Y2h $YWRKDIR/$Y2h~ |
---|
390 | echo " > $Y2h moved as \~" |
---|
391 | fi |
---|
392 | ##Y3h: pour les derivees automatiques la gestion est differente |
---|
393 | if test -e $YWRKDIR/$Y3l; |
---|
394 | then |
---|
395 | mv -f $YWRKDIR/$Y3l $YWRKDIR/$Y3l~ |
---|
396 | echo " > $Y3l moved as \~" |
---|
397 | fi |
---|
398 | # |
---|
399 | #Ympp=Y$prj.cpp |
---|
400 | if test -e $YWRKDIR/$Ycpp; |
---|
401 | then |
---|
402 | mv -f $YWRKDIR/$Ycpp $YWRKDIR/$Ycpp~ |
---|
403 | echo " > $Ycpp moved as \~" |
---|
404 | fi |
---|
405 | if test -e $YWRKDIR/$Ympp; |
---|
406 | then |
---|
407 | mv -f $YWRKDIR/$Ympp $YWRKDIR/$Ympp~ |
---|
408 | echo " > $Ympp moved as \~" |
---|
409 | fi |
---|
410 | # idem pour les .o et l'executable |
---|
411 | if test -e $YWRKDIR/Y$prj.o; |
---|
412 | then |
---|
413 | mv -f $YWRKDIR/Y$prj.o $YWRKDIR/Y$prj.o~ |
---|
414 | echo " > Y$prj.o moved as \~" |
---|
415 | fi |
---|
416 | if test -e $YWRKDIR/Ymain_$prj.o; |
---|
417 | then |
---|
418 | mv -f $YWRKDIR/Ymain_$prj.o $YWRKDIR/Ymain_$prj.o~ |
---|
419 | echo " > Ymain_$prj.o moved as \~" |
---|
420 | fi |
---|
421 | if test -e $prj; |
---|
422 | then |
---|
423 | mv -f $prj $YWRKDIR/$prj~ |
---|
424 | echo " > $prj moved as \~" |
---|
425 | fi |
---|
426 | if test -e $EXECNAME; |
---|
427 | then |
---|
428 | mv -f $EXECNAME $YWRKDIR/$EXECNAME~ |
---|
429 | echo " > $EXECNAME moved as \~" |
---|
430 | fi |
---|
431 | if test -e $YWRKDIR/Yaoext_$prj |
---|
432 | then |
---|
433 | mv -f $YWRKDIR/Yaoext_$prj $YWRKDIR/Yaoext_$prj~ |
---|
434 | echo " > Yaoext_$prj moved as \~" |
---|
435 | fi |
---|
436 | |
---|
437 | #--------------------------------------------------------------------- |
---|
438 | # Lancement de la GENERATION : appel de Yao9Generator |
---|
439 | # creation des header (Y1prjname.h et Y2prjname.h, et autres ...) du projet |
---|
440 | # if Yao8 $Yd desormais, c'est Yao qui, si besoin, formatera un .d |
---|
441 | |
---|
442 | # if ${BINDIR}/Yao${VERS} $prj # old version |
---|
443 | # if ./Yao9Generator $prj |
---|
444 | # if ./Yao${VERS}Generator $prj |
---|
445 | |
---|
446 | BEGIN_TIME=`date +%s` |
---|
447 | if ${BINDIR}/Yao${VERS}Generator $prj |
---|
448 | then |
---|
449 | END_TIME=`date +%s` |
---|
450 | echo " > Execution time of the Yao code generator..."$(($END_TIME-$BEGIN_TIME)) second\(s\) |
---|
451 | echo " > headers are now created" |
---|
452 | else echo " > PROJECT HEADERS CREATION FAILED" |
---|
453 | findir |
---|
454 | fi |
---|
455 | |
---|
456 | #--------------------------------------------------------------------- |
---|
457 | # creation des derivees automatique (Y3prjname.h) pour les modules de la liste (Y3prjname.l) |
---|
458 | if test -e $Y3l |
---|
459 | then |
---|
460 | if ${YADFDIR}/ylmodf $Y3l $Y3h 1 |
---|
461 | then echo " > automatic differenciation done" |
---|
462 | else echo " > AUTOMATIC DIFFERENCIATION FAILED" |
---|
463 | findir |
---|
464 | fi |
---|
465 | fi |
---|
466 | |
---|
467 | #ggggggggggggggggggggggggggggg |
---|
468 | echo " > end proc generation " |
---|
469 | fi |
---|
470 | # fin de la génération |
---|
471 | #ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg |
---|
472 | |
---|
473 | #======================================================================= |
---|
474 | #ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
475 | echo " > enter proc construct " |
---|
476 | |
---|
477 | #------- inclusion d'eventuels objets (.o) externes dont la liste aura ete |
---|
478 | # produite par la directive option O_EXTOBJ |
---|
479 | #if test -e "YaoEXT" |
---|
480 | if test -e Yaoext_$prj |
---|
481 | then |
---|
482 | echo " Extern object : " |
---|
483 | #source Yaoext_$prj |
---|
484 | . Yaoext_$prj |
---|
485 | echo " ${LDYEXTOBJ}" |
---|
486 | fi |
---|
487 | |
---|
488 | #----------------------------------------------------------------------- |
---|
489 | # création (i.e construction) du source complet du projet |
---|
490 | # integration du 1er header (include define at autres ...) |
---|
491 | cat ${INCDIR}/Dynide.h > $Ycpp |
---|
492 | #----------- |
---|
493 | # on ajoute eventuellement un 1er additionnel utilisateur |
---|
494 | # avant l'encapsulation (namespace) de l'application |
---|
495 | Uadd=$prj"03.h" |
---|
496 | if test -e $Uadd; |
---|
497 | then |
---|
498 | cat $Uadd >> $Ycpp |
---|
499 | fi |
---|
500 | #----------- |
---|
501 | if test $OCAPSUL = "1" |
---|
502 | then |
---|
503 | # on encapsule l'appli dans un namespace |
---|
504 | echo "/////////////////////////////////////////////////////////////////" >> $Ycpp |
---|
505 | echo "namespace YAP__$prj { //debut du domaine " >> $Ycpp |
---|
506 | echo "/////////////////////////////////////////////////////////////////" >> $Ycpp |
---|
507 | fi |
---|
508 | #----------- |
---|
509 | # on complete la suite du header de |
---|
510 | cat ${INCDIR}/Dynamo.h >> $Ycpp |
---|
511 | #----------- |
---|
512 | # integration du projet (les 2 header créés par Yao8 (+adf) et de son nom et version |
---|
513 | echo "#include \"$Y1h\" " >> $Ycpp |
---|
514 | if test -e $Y3h; |
---|
515 | then |
---|
516 | echo "#include \"$Y3h\" " >> $Ycpp |
---|
517 | fi |
---|
518 | echo "#include \"$Y2h\" " >> $Ycpp |
---|
519 | echo "#define PRJNAME \"$prj\" " >> $Ycpp |
---|
520 | #echo "#define VERREF \"$YNAME V.$VERS $VERELDAT $OPTCPIL $DBGCPIL \" " >> $Ycpp |
---|
521 | echo "#define VERREF \"$YNAME V.$VERS $VERELDAT $OPTCPIL \" " >> $Ycpp |
---|
522 | # |
---|
523 | # integration du main |
---|
524 | cat ${INCDIR}/Dynamo.cpp >> $Ycpp |
---|
525 | # |
---|
526 | if test $OCAPSUL = "1" |
---|
527 | then |
---|
528 | # fin de l'encapsulage de l'appli |
---|
529 | echo "/////////////////////////////////////////////////////////////////" >> $Ycpp |
---|
530 | echo "} //fin du domaine " >> $Ycpp |
---|
531 | echo "/////////////////////////////////////////////////////////////////" >> $Ycpp |
---|
532 | # |
---|
533 | # maintenant, il faut cree et ajouter la fonction de lancement |
---|
534 | echo "int Ygo_$prj (int argc, char *argv[])" >> $Ycpp |
---|
535 | echo "{ YAP__$prj::Yentry0 (argc, argv); return(0);}" >> $Ycpp |
---|
536 | # |
---|
537 | fi |
---|
538 | # on ajoute eventuellement un 2eme additionnel utilisateur (apres l'encapsulation) |
---|
539 | Uadd=$prj"07.h" |
---|
540 | if test -e $Uadd; |
---|
541 | then |
---|
542 | cat $Uadd >> $Ycpp |
---|
543 | fi |
---|
544 | #----------------------------------------------------------------- |
---|
545 | # On cree de toute piece le 'vrai' main de l"application, dans un .cpp cette fois !!! |
---|
546 | if test $OCAPSUL = "1" |
---|
547 | then |
---|
548 | echo "extern int Ygo_$prj (int argc, char *argv[]);" > $Ympp |
---|
549 | echo "int main(int argc, char *argv[])" >> $Ympp |
---|
550 | echo "{ Ygo_$prj (argc, argv); return(0); }" >> $Ympp |
---|
551 | else |
---|
552 | echo "extern int Yentry0 (int argc, char *argv[]);" > $Ympp |
---|
553 | echo "int main(int argc, char *argv[])" >> $Ympp |
---|
554 | echo "{ Yentry0 (argc, argv); return(0); }" >> $Ympp |
---|
555 | fi |
---|
556 | |
---|
557 | #----------------------------------------------------------------------- |
---|
558 | echo " > end proc construction " |
---|
559 | #ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
560 | |
---|
561 | #======================================================================= |
---|
562 | #----------------------------------------------------------------------- |
---|
563 | # compilation et édition des liens |
---|
564 | echo " > start compilation " |
---|
565 | # //-------------------------------------------------------------------- |
---|
566 | # création de l'executable |
---|
567 | # |
---|
568 | #compilation du projet.c |
---|
569 | if test $OECHO = '1' |
---|
570 | then |
---|
571 | echo "${CXX} ${CXXFLAGS} ${PARALLEL} -c $Ympp $Ycpp" |
---|
572 | fi |
---|
573 | ${CXX} ${CXXFLAGS} ${PARALLEL} -c $Ympp $Ycpp |
---|
574 | echo " > end of compilation, start linking " |
---|
575 | |
---|
576 | # 2) link |
---|
577 | if test $OECHO = '1' |
---|
578 | then |
---|
579 | echo " ${CXX} ${CXXFLAGS} ${PARALLEL} -o $EXECNAME Ymain_$prj.o Y$prj.o ${LDMQN} ${LDYEXTOBJ} ${LDFLAGS}" |
---|
580 | fi |
---|
581 | if ${CXX} ${CXXFLAGS} ${PARALLEL} -o $EXECNAME Ymain_$prj.o Y$prj.o ${LDMQN} ${LDYEXTOBJ} ${LDFLAGS} |
---|
582 | then |
---|
583 | echo |
---|
584 | echo " ======================= PROJECT IS NOW READY =====================" |
---|
585 | else |
---|
586 | echo |
---|
587 | echo " > unpredictable mistakes : PROJECT BUILDING FAILED" |
---|
588 | echo |
---|
589 | findir |
---|
590 | fi |
---|
591 | |
---|
592 | cat<<EOF |
---|
593 | $YNAME V.$VERS : END OF PROCEDURE |
---|
594 | $VERELDAT |
---|
595 | ==================================================================== |
---|
596 | TOTAL COMPILATION TIME : $SECONDS second(s) |
---|
597 | ==================================================================== |
---|
598 | |
---|
599 | EOF |
---|
600 | findir |
---|
601 | #=============================================================================== |
---|