1 | #!/bin/sh |
---|
2 | #set -xv |
---|
3 | machine=`hostname` |
---|
4 | os=`uname` |
---|
5 | gcm=`pwd` |
---|
6 | libf=$gcm/libf |
---|
7 | libo=$gcm/libo |
---|
8 | CRAY=0 |
---|
9 | if [ "$machine" = "atlas" -o "$machine" = "etoile" -o "$machine" = "axis" ] ; then |
---|
10 | CRAY=1 |
---|
11 | fi |
---|
12 | # |
---|
13 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
14 | echo "# Definitions de Macros pour Make" |
---|
15 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
16 | echo |
---|
17 | echo "# Repertoires :" |
---|
18 | echo |
---|
19 | echo "GCM = "$gcm |
---|
20 | if [ "$CRAY" = '0' ] ; then |
---|
21 | echo "MACHINE = sun4" |
---|
22 | fi |
---|
23 | echo 'LIBF = $(GCM)/libf' |
---|
24 | if [ "$CRAY" = '0' ] ; then |
---|
25 | # echo 'LIBO = $(GCM)/libo/$(MACHINE)' |
---|
26 | echo 'LIBO = $(LIBOGCM)/$(MACHINE)' |
---|
27 | else |
---|
28 | echo 'LIBO = $(GCM)/libo' |
---|
29 | fi |
---|
30 | #echo 'LOCAL_DIR=$(GCM)' |
---|
31 | #echo $localdir |
---|
32 | echo "LOCAL_DIR=`echo $localdir`" |
---|
33 | echo 'BIBIO = $(LIBF)/bibio' |
---|
34 | echo "FILTRE = filtre" |
---|
35 | echo "PHYS = " |
---|
36 | echo "DYN = dyn " |
---|
37 | echo 'LIBPHY = $(LIBO)/libphy$(PHYS).a' |
---|
38 | echo 'DIRMAIN=dyn$(DIM)d' |
---|
39 | echo 'RM=rm' |
---|
40 | echo |
---|
41 | echo "OPLINK = " |
---|
42 | echo |
---|
43 | echo '# Les differentes librairies pour l"edition des liens:' |
---|
44 | echo |
---|
45 | echo 'dyn3d = $(LIBO)/libdyn3d.a $(LIBO)/lib$(FILTRE).a' |
---|
46 | echo 'dyn2d = $(LIBO)/libdyn2d.a' |
---|
47 | echo 'dyn1d = $(LIBO)/libdyn1d.a' |
---|
48 | echo 'L_DYN = -ldyn$(DIM)d' |
---|
49 | echo 'L_FILTRE = -l$(FILTRE)' |
---|
50 | echo 'L_PHY = -lphy$(PHYS) ' |
---|
51 | echo 'L_BIBIO = -lbibio' |
---|
52 | echo 'L_ADJNT =' |
---|
53 | echo |
---|
54 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
55 | echo "# Option de compilation FORTRAN" |
---|
56 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
57 | echo |
---|
58 | echo 'COMPILE = $(F77) $(OPTIM) $(INCLUDE) -c' |
---|
59 | echo 'COMPILE90 = $(F90) $(OPTIM90) $(INCLUDE) -c' |
---|
60 | echo 'LINK = f90' |
---|
61 | echo "AR = ar" |
---|
62 | echo |
---|
63 | echo |
---|
64 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
65 | echo "# Creation des differents executables" |
---|
66 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
67 | echo |
---|
68 | echo "# Executables:" |
---|
69 | echo "# ------------" |
---|
70 | echo |
---|
71 | echo "PROG = code" |
---|
72 | echo |
---|
73 | echo 'main : $(DYN) bibio phys $(OPTION_DEP) ' |
---|
74 | echo ' cd $(LIBO) ; $(RANLIB) lib*.a ; cd $(GCM) ;\' |
---|
75 | if [ "$CRAY" = '0' ] ; then |
---|
76 | echo ' cd $(LOCAL_DIR); \' |
---|
77 | #echo ' $(COMPILE90) $(LIBF)/$(DIRMAIN)/$(PROG).F -o $(PROG).o ; \' |
---|
78 | echo ' $(COMPILE) $(LIBF)/$(DIRMAIN)/$(PROG).F -o $(PROG).o ; \' |
---|
79 | else |
---|
80 | echo ' $(COMPILE90) $(LIBF)/$(DIRMAIN)/$(PROG).F ; \' |
---|
81 | fi |
---|
82 | if [ "$CRAY" = '0' ] ; then |
---|
83 | echo ' $(LINK) $(PROG).o -L$(LIBO) $(L_DYN) $(L_ADJNT) $(L_FILTRE) $(L_PHY) $(L_BIBIO) $(L_DYN) $(OPLINK) $(OPTION_LINK) -o $(LOCAL_DIR)/$(PROG).e ; $(RM) $(PROG).o ' |
---|
84 | else |
---|
85 | echo ' $(LINK) $(PROG).o -L$(LIBO) $(L_DYN) $(L_ADJNT) $(L_FILTRE) $(L_PHY) $(L_BIBIO) $(OPLINK) $(OPTION_LINK) -o $(LOCAL_DIR)/$(PROG).e ; $(RM) $(PROG).o ' |
---|
86 | fi |
---|
87 | echo |
---|
88 | echo 'dyn : $(LIBO)/libdyn$(DIM)d.a $(FILTRE)$(DIM)d' |
---|
89 | echo |
---|
90 | echo 'phys : $(LIBPHY)' |
---|
91 | echo |
---|
92 | echo 'bibio : $(LIBO)/libbibio.a' |
---|
93 | echo |
---|
94 | echo 'adjnt : $(LIBO)/libadjnt.a' |
---|
95 | echo |
---|
96 | echo '$(FILTRE)3d : $(LIBO)/lib$(FILTRE).a' |
---|
97 | echo |
---|
98 | echo '$(FILTRE)2d :' |
---|
99 | echo |
---|
100 | echo '$(FILTRE)1d :' |
---|
101 | echo |
---|
102 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
103 | echo "# Contenu des differentes bibliotheques" |
---|
104 | echo "#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" |
---|
105 | echo |
---|
106 | echo |
---|
107 | cd $libf >/dev/null 2>&1 |
---|
108 | for diri in ` ls ` |
---|
109 | do |
---|
110 | if [ -d $diri ] ; then |
---|
111 | if [ "`ls $diri/*.F`" != "" ] ; then |
---|
112 | cd $diri >/dev/null 2>&1 |
---|
113 | echo |
---|
114 | listlib="" |
---|
115 | for i in `ls *.F` |
---|
116 | do |
---|
117 | fili=`basename $i .F` |
---|
118 | test=` ( head $i | grep ' PROGRAM' ) ` |
---|
119 | if [ "$test" = "" ] ; then |
---|
120 | listlib=$listlib" "$fili |
---|
121 | fi |
---|
122 | done |
---|
123 | # |
---|
124 | echo |
---|
125 | echo |
---|
126 | echo "#=======================================================================" |
---|
127 | echo "# Contenu de la bibliotheque correspondant au Directory "$diri |
---|
128 | echo "#=======================================================================" |
---|
129 | echo |
---|
130 | for fili in $listlib |
---|
131 | do |
---|
132 | echo '$(LIBO)/lib'$diri".a : " '$(LIBO)/lib'$diri".a("$fili".o)" |
---|
133 | echo |
---|
134 | done |
---|
135 | echo '.PRECIOUS : $(LIBO)/lib'$diri'.a' |
---|
136 | echo |
---|
137 | echo |
---|
138 | echo "# Compilation des membres de la bibliotheque lib"$diri".a" |
---|
139 | echo |
---|
140 | for fili in $listlib |
---|
141 | do |
---|
142 | F90=0 ; egrep -i '^ *use ' $fili.F > /dev/null 2>&1 && F90=1 |
---|
143 | egrep -i '^ *module ' $fili.F > /dev/null 2>&1 && F90=1 |
---|
144 | str1='$(LIBO)/lib'$diri'.a('$fili'.o) : $(LIBF)/'$diri/$fili.F |
---|
145 | [ "$fili" = "chem.subs" ] && str1=$str1' $(LIBF)/'$diri/chem.mods.F |
---|
146 | for stri in ` ( sed -n "/\#include/s/\#include//p" $fili.F | sed 's/\"//g' ; egrep -i '^ *use ' $fili.F | awk ' { print $2 } ' ) ` |
---|
147 | do |
---|
148 | if [ -f $stri ] ; then |
---|
149 | echo $str1 \\ |
---|
150 | str1='$(LIBF)/'$diri'/'$stri |
---|
151 | else |
---|
152 | if [ -f $stri.F ] ; then |
---|
153 | str1='$(LIBO)/lib'$diri'.a('$stri'.o)' |
---|
154 | else |
---|
155 | for dirinc in dyn3d grid bibio |
---|
156 | do |
---|
157 | if [ -f ../$dirinc/$stri ] ; then |
---|
158 | echo $str1 \\ |
---|
159 | str1='$(LIBF)/'`cd .. ; ls */$stri | head -1` |
---|
160 | fi |
---|
161 | done |
---|
162 | fi |
---|
163 | fi |
---|
164 | done |
---|
165 | echo $str1 |
---|
166 | if [ "$F90" -eq '0' ] ; then |
---|
167 | echo ' cd $(LOCAL_DIR); \' |
---|
168 | echo ' $(COMPILE) $(LIBF)/'$diri'/'$fili'.F ; \' |
---|
169 | else |
---|
170 | echo ' cd $(LOCAL_DIR); \' |
---|
171 | echo ' $(COMPILE90) $(LIBF)/'$diri'/'$fili'.F ; \' |
---|
172 | MODU=0; egrep -i ' *module ' $fili.F> /dev/null 2>&1 && MODU=1 |
---|
173 | if [ "$MODU" -eq '1' -a "$CRAY" != '1' ] ; then |
---|
174 | if [ "$os" = 'UNIX_System_V' ] ; then |
---|
175 | echo ' cp $(MOD_LOC_DIR)/*.$(MOD_SUFFIX) $(LIBO)/ ; \' |
---|
176 | else |
---|
177 | echo ' mv $(MOD_LOC_DIR)/'$fili'.$(MOD_SUFFIX) $(LIBO)/'$fili'.$(MOD_SUFFIX) ; \' |
---|
178 | fi |
---|
179 | fi |
---|
180 | fi |
---|
181 | echo ' $(AR) r $(LIBO)/lib'$diri'.a '$fili'.o ; $(RM) '$fili'.o ; \' |
---|
182 | echo ' cd $(GCM)' |
---|
183 | echo |
---|
184 | done |
---|
185 | # |
---|
186 | echo |
---|
187 | cd $libf |
---|
188 | fi |
---|
189 | fi |
---|
190 | done |
---|