[1549] | 1 | #!/usr/bin/perl |
---|
| 2 | # |
---|
| 3 | # Usage: makemake {<program name> {<F90 compiler or fc or f77 or cc or c>}} |
---|
| 4 | # |
---|
| 5 | # Generate a Makefile from the sources in the current directory. The source |
---|
| 6 | # files may be in either C, FORTRAN 77, Fortran 90 or some combination of |
---|
| 7 | # these languages. If the F90 compiler specified is cray or parasoft, then |
---|
| 8 | # the Makefile generated will conform to the conventions of these compilers. |
---|
| 9 | # To run makemake, it will be necessary to modify the first line of this script |
---|
| 10 | # to point to the actual location of Perl on your system. |
---|
| 11 | # |
---|
| 12 | # Written by Michael Wester <wester@math.unm.edu> February 16, 1995 |
---|
| 13 | # Cotopaxi (Consulting), Albuquerque, New Mexico |
---|
| 14 | # |
---|
| 15 | open(MAKEFILE, "> AA_make"); |
---|
| 16 | # |
---|
| 17 | #print MAKEFILE "PROG =\t$ARGV[0]\n\n"; |
---|
| 18 | # |
---|
| 19 | # Misc |
---|
| 20 | |
---|
[1560] | 21 | print MAKEFILE "VPATH=../src/IOSERVER:../src/XMLIO\n"; |
---|
[1549] | 22 | print MAKEFILE "MAKE_NAM = \$(MAKE)\n"; |
---|
| 23 | print MAKEFILE "ifneq (\$(MAKE_NAM),\$(M_K))\n"; |
---|
| 24 | print MAKEFILE " \@\$(error You must invoke this Makefile with the \$(M_K) command)\n"; |
---|
| 25 | print MAKEFILE "endif\n"; |
---|
| 26 | print MAKEFILE "USER_DIR = \$(shell /bin/pwd)\n"; |
---|
| 27 | print MAKEFILE "MAKE_DIR = '??'\n"; |
---|
| 28 | print MAKEFILE "ifneq (\$(USER_DIR),\$(MAKE_DIR))\n"; |
---|
| 29 | print MAKEFILE " \@\$(error You must invoke this Makefile from its directory)\n"; |
---|
| 30 | print MAKEFILE "endif\n"; |
---|
| 31 | print MAKEFILE "#-\n"; |
---|
[1722] | 32 | print MAKEFILE "#-Q- sx6nec F_O := \$(F_O) -Wf,-ptr byte\n"; |
---|
| 33 | print MAKEFILE "#-Q- sx8brodie F_O := \$(F_O) -Wf,-ptr byte\n"; |
---|
| 34 | print MAKEFILE "#-Q- sx8mercure F_O := \$(F_O) -Wf,-ptr byte\n"; |
---|
| 35 | print MAKEFILE "#-Q- sx9mercure F_O := \$(F_O) -Wf,-ptr byte\n"; |
---|
| 36 | print MAKEFILE "#-Q- sxdkrz F_O := \$(F_O) -Wf,-ptr byte\n"; |
---|
[1791] | 37 | print MAKEFILE "#-Q- es2 F_O := \$(F_O) -Wf,-ptr byte\n"; |
---|
[1560] | 38 | print MAKEFILE "#-Q- aix6 F_O = \$(F_P) -O3 -qextname -qsuffix=cpp=F90 -qsuffix=f=f90 -qmoddir=\$(MODDIR) -I \$(MODDIR)\n"; |
---|
| 39 | print MAKEFILE "#-Q- aix F_O = \$(F_P) -O3 -qextname -qsuffix=cpp=F90 -qsuffix=f=f90 -qmoddir=\$(MODDIR) -I \$(MODDIR)\n"; |
---|
| 40 | print MAKEFILE "#-Q- osxxlf F_O = \$(F_P) -O3 -qextname -qsuffix=cpp=F90 -qsuffix=f=f90 -qmoddir=\$(MODDIR) -I \$(MODDIR)\n"; |
---|
[1549] | 41 | print MAKEFILE "F_O := \$(F_O) -I../../../lib\n"; |
---|
| 42 | print MAKEFILE "P_O := \$(P_O) -traditional\n"; |
---|
[1560] | 43 | print MAKEFILE "#-Q- aix6 L_O = \$(F_P) -q64 -O3\n"; |
---|
| 44 | print MAKEFILE "#-Q- aix L_O = \$(F_P) -q64 -O3\n"; |
---|
| 45 | print MAKEFILE "prefix=''\n"; |
---|
| 46 | print MAKEFILE "#-Q- aix6 prefix='-WF,'\n"; |
---|
| 47 | print MAKEFILE "#-Q- aix prefix='-WF,'\n"; |
---|
| 48 | print MAKEFILE "override P_P := \$(P_P:\%=\$(prefix)\%)\n\n"; |
---|
[1549] | 49 | print MAKEFILE "#---------------------------------------------------------------------\n"; |
---|
| 50 | print MAKEFILE "#- Create libioserver and libxmlio\n"; |
---|
| 51 | print MAKEFILE "#---------------------------------------------------------------------\n\n"; |
---|
| 52 | |
---|
| 53 | print MAKEFILE ".PRECIOUS : \$(MODEL_LIB1) \$(MODEL_LIB2)\n"; |
---|
| 54 | print MAKEFILE "SXMODEL_LIB1 = \$(MODEL_LIB1)\n"; |
---|
| 55 | print MAKEFILE "SXMODEL_LIB2 = \$(MODEL_LIB2)\n"; |
---|
| 56 | print MAKEFILE "ifeq (\$(L_X),1)\n"; |
---|
| 57 | print MAKEFILE "SXMODEL_LIB1 = \$(LIBDIR)/libsxioserver.a\n"; |
---|
| 58 | print MAKEFILE "SXMODEL_LIB2 = \$(LIBDIR)/libsxxmlio.a\n"; |
---|
| 59 | print MAKEFILE ".PRECIOUS : \$(SXMODEL_LIB1) \$(SXMODEL_LIB2)\n"; |
---|
| 60 | print MAKEFILE "endif\n\n"; |
---|
| 61 | |
---|
| 62 | # Source listing |
---|
| 63 | #IOSERVER |
---|
| 64 | print MAKEFILE "MODS1 =\t"; |
---|
| 65 | @srcs = < ../src/IOSERVER/*.F90 ../src/IOSERVER/*.f90>; |
---|
| 66 | &PrintWords(8, 0, @srcs); |
---|
| 67 | print MAKEFILE "\n\n"; |
---|
| 68 | # |
---|
| 69 | # Object listing |
---|
| 70 | # |
---|
| 71 | print MAKEFILE "OBJSMODS1 =\t"; |
---|
| 72 | @objs = @srcs; |
---|
| 73 | foreach (@objs) { s/\.[^.]+$/.o/ }; |
---|
| 74 | foreach $objs (@objs) { |
---|
| 75 | @tab = split('/', $objs); |
---|
| 76 | $objs = $tab[$#tab] ; |
---|
| 77 | if( "$objs" eq 'server.o' ){ |
---|
| 78 | $objs = ''}; |
---|
| 79 | }; |
---|
| 80 | |
---|
| 81 | &PrintWords(8, 0, @objs); |
---|
| 82 | print MAKEFILE "\n\n"; |
---|
| 83 | |
---|
| 84 | # Source listing |
---|
| 85 | #XMLIO |
---|
| 86 | print MAKEFILE "MODS2 =\t"; |
---|
| 87 | @srcs = < ../src/XMLIO/*.F90 ../src/XMLIO/*.f90>; |
---|
| 88 | &PrintWords(8, 0, @srcs); |
---|
| 89 | print MAKEFILE "\n\n"; |
---|
| 90 | # |
---|
| 91 | # Object listing |
---|
| 92 | # |
---|
| 93 | print MAKEFILE "OBJSMODS2 =\t"; |
---|
| 94 | @objs = @srcs; |
---|
| 95 | foreach (@objs) { s/\.[^.]+$/.o/ }; |
---|
| 96 | foreach $objs (@objs) { |
---|
| 97 | @tab = split('/', $objs); |
---|
| 98 | $objs = $tab[$#tab] ; |
---|
| 99 | if( "$objs" eq 'test_xmlio.o' ){ |
---|
| 100 | $objs = ''}; |
---|
| 101 | }; |
---|
| 102 | |
---|
| 103 | &PrintWords(8, 0, @objs); |
---|
| 104 | print MAKEFILE "\n\n"; |
---|
| 105 | |
---|
| 106 | # |
---|
| 107 | # make |
---|
| 108 | # |
---|
| 109 | print MAKEFILE ".SUFFIXES: .f90 .F90\n\n"; |
---|
| 110 | |
---|
[1560] | 111 | print MAKEFILE "all: libioipsl libxmlf90 dirxml \$(MODEL_LIB2)(\$(OBJSMODS2)) key \$(MODEL_LIB1)(\$(OBJSMODS1)) server.o EXEC_BIN\n"; |
---|
[1549] | 112 | print MAKEFILE "\t\@echo IOSERVER is OK\n\n"; |
---|
| 113 | |
---|
[1560] | 114 | # mpi or not |
---|
| 115 | print MAKEFILE "key :\n"; |
---|
| 116 | print MAKEFILE "\t\-\@if [ \"`cat KEY_CPP`\" \!= \"\$(P_P)\" ] \; then \\\n"; |
---|
| 117 | print MAKEFILE "\techo \"\$(P_P)\" > KEY_CPP \; fi\n\n"; |
---|
| 118 | |
---|
| 119 | |
---|
[1549] | 120 | # Main program |
---|
[1560] | 121 | print MAKEFILE "ifneq (,\$(findstring NO_MPI,\$(P_P)))\n"; |
---|
[1549] | 122 | print MAKEFILE "EXEC_BIN :\n"; |
---|
| 123 | print MAKEFILE "server.o :\n"; |
---|
| 124 | print MAKEFILE "else\n"; |
---|
| 125 | print MAKEFILE "EXEC_BIN : server.o\n"; |
---|
[1722] | 126 | print MAKEFILE "\t\$(F_L) \$(L_O) -o ../../../bin/ioserver server.o \$(MODEL_LIB1) \$(MODEL_LIB2) ../../../lib/libioipsl.a \$(NCDF_LIB) ../../../lib/libxmlio_server/libxmlf90.a\n"; |
---|
[1549] | 127 | print MAKEFILE "server.o : ../src/IOSERVER/server.f90\n"; |
---|
| 128 | print MAKEFILE "\t\@\$(F_C) \$(F_O) -c ../src/IOSERVER/server.f90\n"; |
---|
| 129 | print MAKEFILE "endif\n\n"; |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | # .f90 -> .o |
---|
| 133 | # |
---|
| 134 | |
---|
| 135 | print MAKEFILE "#Rules for ioserver\n"; |
---|
[1560] | 136 | print MAKEFILE "#---- Using VPATH instead \$(MODEL_LIB1)(%.o): ../src/IOSERVER/%.f90\n"; |
---|
| 137 | print MAKEFILE "\$(MODEL_LIB1)(%.o): %.f90\n"; |
---|
[1728] | 138 | print MAKEFILE "\t\$(F_C) \$(F_O) -I../src/XMLIO -I../src/IOSERVER -I\$(NCDF_INC) \$<\n"; |
---|
[1549] | 139 | print MAKEFILE "\t\$(A_C) \$(MODEL_LIB1) \$*.o\n"; |
---|
| 140 | print MAKEFILE "ifeq (\$(L_X),1)\n"; |
---|
| 141 | print MAKEFILE "\t\$(A_X) \$(SXMODEL_LIB1) \$*.o\n"; |
---|
| 142 | print MAKEFILE "endif\n"; |
---|
| 143 | print MAKEFILE "#-Q- sgi6 mv \$(shell echo \$* | tr '[:lower:]' '[:upper:]').mod \$(MODDIR)\n"; |
---|
| 144 | print MAKEFILE "ifeq (\$(M_M),1)\n"; |
---|
| 145 | print MAKEFILE "\t\@mv -f *.mod \$(MODDIR) 2> /dev/null || true\n"; |
---|
| 146 | print MAKEFILE "endif\n"; |
---|
| 147 | print MAKEFILE "\t\$(RM) \$*.o\n\n"; |
---|
| 148 | |
---|
[1560] | 149 | print MAKEFILE "#Rules for ioserver\n"; |
---|
[1549] | 150 | #print MAKEFILE "\$src/IOSERVER/%.f90: ../src/IOSERVER/%.F90\n"; |
---|
| 151 | #print MAKEFILE "\t@\$(P_C) \$(P_O) \$(P_P) src/IOSERVER/\$(*F).F90 > src/IOSERVER/\$(*F).f90\n\n"; |
---|
[1560] | 152 | print MAKEFILE "#---- Using VPATH instead \$(MODEL_LIB1)(%.o): ../src/IOSERVER/%.F90\n"; |
---|
| 153 | print MAKEFILE "\$(MODEL_LIB1)(%.o): %.F90 KEY_CPP\n"; |
---|
[1728] | 154 | print MAKEFILE "\t\$(F_C) \$(F_O) \$(P_P) -I\$(NCDF_INC) -I../src/XMLIO -I../src/IOSERVER \$<\n"; |
---|
[1549] | 155 | print MAKEFILE "\t\$(A_C) \$(MODEL_LIB1) \$*.o\n"; |
---|
| 156 | print MAKEFILE "ifeq (\$(L_X),1)\n"; |
---|
| 157 | print MAKEFILE "\t\$(A_X) \$(SXMODEL_LIB1) \$*.o\n"; |
---|
| 158 | print MAKEFILE "endif\n"; |
---|
| 159 | print MAKEFILE "#-Q- sgi6 mv \$(shell echo \$* | tr '[:lower:]' '[:upper:]').mod \$(MODDIR)\n"; |
---|
| 160 | print MAKEFILE "ifeq (\$(M_M),1)\n"; |
---|
| 161 | print MAKEFILE "\t\@mv -f *.mod \$(MODDIR) 2> /dev/null || true\n"; |
---|
| 162 | print MAKEFILE "endif\n"; |
---|
| 163 | print MAKEFILE "\t\$(RM) \$*.o\n\n"; |
---|
| 164 | |
---|
| 165 | print MAKEFILE "#Rules for xmlio\n"; |
---|
[1560] | 166 | print MAKEFILE "#---- Using VPATH instead \$(MODEL_LIB1)(%.o): ../src/XMLIO/%.F90\n"; |
---|
| 167 | print MAKEFILE "\$(MODEL_LIB2)(%.o): %.f90\n"; |
---|
[1549] | 168 | print MAKEFILE "\t\$(F_C) \$(F_O) -I\$(NCDF_INC) -I../src/XMLIO \$<\n"; |
---|
| 169 | print MAKEFILE "\t\$(A_C) \$(MODEL_LIB2) \$*.o\n"; |
---|
| 170 | print MAKEFILE "ifeq (\$(L_X),1)\n"; |
---|
| 171 | print MAKEFILE "\t\$(A_X) \$(SXMODEL_LIB2) \$*.o\n"; |
---|
| 172 | print MAKEFILE "endif\n"; |
---|
| 173 | print MAKEFILE "#-Q- sgi6 mv \$(shell echo \$* | tr '[:lower:]' '[:upper:]').mod \$(MODDIR)\n"; |
---|
| 174 | print MAKEFILE "ifeq (\$(M_M),1)\n"; |
---|
| 175 | print MAKEFILE "\t\@mv -f *.mod \$(MODDIR) 2> /dev/null || true\n"; |
---|
| 176 | print MAKEFILE "endif\n"; |
---|
| 177 | print MAKEFILE "\t\$(RM) \$*.o\n\n"; |
---|
| 178 | |
---|
| 179 | |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | print MAKEFILE "dirxml: \n"; |
---|
| 183 | print MAKEFILE "\t\@if [ ! -d ../../../lib/libxmlio_server ] ; then mkdir ../../../lib/libxmlio_server ; fi\n\n"; |
---|
| 184 | |
---|
| 185 | print MAKEFILE "# IOIPSL library\n"; |
---|
| 186 | print MAKEFILE "libioipsl :\n"; |
---|
| 187 | print MAKEFILE "\t(cd ../../IOIPSL/src ; \$(M_K) -f Makefile )\n\n"; |
---|
| 188 | |
---|
| 189 | print MAKEFILE "# XMLF90 library\n"; |
---|
| 190 | print MAKEFILE "libxmlf90 :\n"; |
---|
| 191 | print MAKEFILE "\t(cd ../../XMLF90/external ; \$(M_K) -f Makefile )\n\n"; |
---|
| 192 | |
---|
| 193 | # |
---|
| 194 | # make clean |
---|
| 195 | # |
---|
| 196 | print MAKEFILE "clean:\n"; |
---|
| 197 | print MAKEFILE "\t\$(RM) *.*~ Makefile~ core *.o *.mod i.*.L *.L\n"; |
---|
| 198 | print MAKEFILE "\t\$(RM) server.o \$(MODEL_LIB1) \$(MODEL_LIB2)\n\n"; |
---|
| 199 | # |
---|
| 200 | # |
---|
| 201 | # Dependency listings |
---|
| 202 | # |
---|
| 203 | &MakeDependsf90($ARGV[1],IOSERVER,MODEL_LIB1); |
---|
| 204 | &MakeDependsf90($ARGV[1],XMLIO,MODEL_LIB2); |
---|
| 205 | &MakeDepends("*.f *.F", '^\s*include\s+["\']([^"\']+)["\']'); |
---|
| 206 | &MakeDepends("*.c", '^\s*#\s*include\s+["\']([^"\']+)["\']'); |
---|
| 207 | |
---|
| 208 | # |
---|
| 209 | # &PrintWords(current output column, extra tab?, word list); --- print words |
---|
| 210 | # nicely |
---|
| 211 | # |
---|
| 212 | sub PrintWords { |
---|
| 213 | local($columns) = 78 - shift(@_); |
---|
| 214 | local($extratab) = shift(@_); |
---|
| 215 | local($wordlength); |
---|
| 216 | # |
---|
| 217 | print MAKEFILE @_[0]; |
---|
| 218 | $columns -= length(shift(@_)); |
---|
| 219 | foreach $word (@_) { |
---|
| 220 | $wordlength = length($word); |
---|
| 221 | if ($wordlength + 1 < $columns) { |
---|
| 222 | print MAKEFILE " $word"; |
---|
| 223 | $columns -= $wordlength + 1; |
---|
| 224 | } |
---|
| 225 | else { |
---|
| 226 | # |
---|
| 227 | # Continue onto a new line |
---|
| 228 | # |
---|
| 229 | if ($extratab) { |
---|
| 230 | print MAKEFILE " \\\n\t\t$word"; |
---|
| 231 | $columns = 62 - $wordlength; |
---|
| 232 | } |
---|
| 233 | else { |
---|
| 234 | print MAKEFILE " \\\n\t$word"; |
---|
| 235 | $columns = 70 - $wordlength; |
---|
| 236 | } |
---|
| 237 | } |
---|
| 238 | } |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | # |
---|
| 242 | # &LanguageCompiler(compiler, sources); --- determine the correct language |
---|
| 243 | # compiler |
---|
| 244 | # |
---|
| 245 | sub LanguageCompiler { |
---|
| 246 | local($compiler) = &toLower(shift(@_)); |
---|
| 247 | local(@srcs) = @_; |
---|
| 248 | # |
---|
| 249 | if (length($compiler) > 0) { |
---|
| 250 | CASE: { |
---|
| 251 | grep(/^$compiler$/, ("fc", "f77")) && |
---|
| 252 | do { $compiler = "FC"; last CASE; }; |
---|
| 253 | grep(/^$compiler$/, ("cc", "c")) && |
---|
| 254 | do { $compiler = "CC"; last CASE; }; |
---|
| 255 | $compiler = "F90"; |
---|
| 256 | } |
---|
| 257 | } |
---|
| 258 | else { |
---|
| 259 | CASE: { |
---|
| 260 | grep(/\.f90$/, @srcs) && do { $compiler = "F90"; last CASE; }; |
---|
| 261 | grep(/\.(f|F)$/, @srcs) && do { $compiler = "FC"; last CASE; }; |
---|
| 262 | grep(/\.c$/, @srcs) && do { $compiler = "CC"; last CASE; }; |
---|
| 263 | $compiler = "???"; |
---|
| 264 | } |
---|
| 265 | } |
---|
| 266 | $compiler; |
---|
| 267 | } |
---|
| 268 | |
---|
| 269 | # |
---|
| 270 | # &toLower(string); --- convert string into lower case |
---|
| 271 | # |
---|
| 272 | sub toLower { |
---|
| 273 | local($string) = @_[0]; |
---|
| 274 | $string =~ tr/A-Z/a-z/; |
---|
| 275 | $string; |
---|
| 276 | } |
---|
| 277 | |
---|
| 278 | # |
---|
| 279 | # &uniq(sorted word list); --- remove adjacent duplicate words |
---|
| 280 | # |
---|
| 281 | sub uniq { |
---|
| 282 | local(@words); |
---|
| 283 | foreach $word (@_) { |
---|
| 284 | if ($word ne $words[$#words]) { |
---|
| 285 | push(@words, $word); |
---|
| 286 | } |
---|
| 287 | } |
---|
| 288 | @words; |
---|
| 289 | } |
---|
| 290 | |
---|
| 291 | # |
---|
| 292 | # &MakeDepends(language pattern, include file sed pattern); --- dependency |
---|
| 293 | # maker |
---|
| 294 | # |
---|
| 295 | sub MakeDepends { |
---|
| 296 | local(@incs); |
---|
| 297 | local($lang) = @_[0]; |
---|
| 298 | local($pattern) = @_[1]; |
---|
| 299 | # |
---|
| 300 | foreach $file (<${lang}>) { |
---|
| 301 | open(FILE, $file) || warn "Cannot open $file: $!\n"; |
---|
| 302 | while (<FILE>) { |
---|
| 303 | /$pattern/i && push(@incs, $1); |
---|
| 304 | } |
---|
| 305 | if (defined @incs) { |
---|
| 306 | $file =~ s/\.[^.]+$/.o/; |
---|
| 307 | @tab = split('/', $file); |
---|
| 308 | $file = '$(MODEL_LIB)(' . $tab[$#tab] . ')' ; |
---|
| 309 | print MAKEFILE "$file: "; |
---|
| 310 | &PrintWords(length($file) + 2, 0, @incs); |
---|
| 311 | print MAKEFILE "\n"; |
---|
| 312 | undef @incs; |
---|
| 313 | } |
---|
| 314 | } |
---|
| 315 | } |
---|
| 316 | |
---|
| 317 | # |
---|
| 318 | # &MakeDependsf90(f90 compiler); --- FORTRAN 90 dependency maker |
---|
| 319 | # |
---|
| 320 | sub MakeDependsf90 { |
---|
| 321 | local($compiler) = &toLower(@_[0]); |
---|
| 322 | local(@dependencies); |
---|
| 323 | local(%filename); |
---|
| 324 | local(@incs); |
---|
| 325 | local(@modules); |
---|
| 326 | local($objfile); |
---|
| 327 | local($DIR) = @_[1]; |
---|
| 328 | local($MODEL_LIB) = @_[2]; |
---|
| 329 | # |
---|
| 330 | # Associate each module with the name of the file that contains it |
---|
| 331 | # |
---|
| 332 | foreach $file (<../*/*/*.f90>) { |
---|
| 333 | open(FILE, $file) || warn "Cannot open $file: $!\n"; |
---|
| 334 | while (<FILE>) { |
---|
| 335 | /^\s*module\s+([^\s!]+)/i && |
---|
| 336 | ($filename{&toLower($1)} = $file) =~ s/\.f90$/.o/; |
---|
| 337 | } |
---|
| 338 | } |
---|
| 339 | foreach $file (<../*/*/*.F90>) { |
---|
| 340 | open(FILE, $file) || warn "Cannot open $file: $!\n"; |
---|
| 341 | while (<FILE>) { |
---|
| 342 | /^\s*module\s+([^\s!]+)/i && |
---|
| 343 | ($filename{&toLower($1)} = $file) =~ s/\.F90$/.o/; |
---|
| 344 | } |
---|
| 345 | } |
---|
| 346 | |
---|
| 347 | # |
---|
| 348 | # Print the dependencies of each file that has one or more include's or |
---|
| 349 | # references one or more modules |
---|
| 350 | # |
---|
| 351 | foreach $file (<../src/$DIR/*.f90 ../src/$DIR/*.F90>) { |
---|
| 352 | open(FILE, $file); |
---|
| 353 | while (<FILE>) { |
---|
| 354 | /^\s*include\s+["\']([^"\']+)["\']/i && push(@incs, $1); |
---|
| 355 | /^\s*use\s+([^\s,!]+)/i && push(@modules, &toLower($1)); |
---|
| 356 | } |
---|
| 357 | if (defined @incs || defined @modules) { |
---|
| 358 | # ($objfile = $file) =~ s/\.F90$/.o/; |
---|
| 359 | ($objfile = $file) =~ s/\.[fF]90$/.o/; |
---|
| 360 | @tab = split('/', $objfile); |
---|
| 361 | $objfile = '$(' . $MODEL_LIB . ')(' . $tab[$#tab] . ')' ; |
---|
| 362 | |
---|
| 363 | print MAKEFILE "$objfile: "; |
---|
| 364 | undef @dependencies; |
---|
| 365 | foreach $module (@modules) { |
---|
| 366 | push(@dependencies, $filename{$module}); |
---|
| 367 | } |
---|
| 368 | @dependencies = &uniq(sort(@dependencies)); |
---|
| 369 | |
---|
| 370 | foreach $dependencies (@dependencies) { |
---|
| 371 | |
---|
| 372 | @tab = split('/', $dependencies); |
---|
| 373 | $dependencies = '$(' . $MODEL_LIB . ')(' . $tab[$#tab] . ')'; |
---|
| 374 | |
---|
| 375 | if( "$DIR" eq 'IOSERVER' && "$dependencies" eq '$(MODEL_LIB1)(xmlio.o)' ) { |
---|
| 376 | $dependencies = '$(MODEL_LIB2)' |
---|
| 377 | # $dependencies = '' |
---|
| 378 | |
---|
| 379 | } |
---|
| 380 | } |
---|
| 381 | |
---|
| 382 | foreach $incs (@incs) { |
---|
| 383 | @tab = split('/', $incs); |
---|
| 384 | @incs = '../src' . '/' . $DIR. '/' . $tab[$#tab] ; |
---|
| 385 | } |
---|
| 386 | foreach $incs (@incs) { |
---|
| 387 | if( "$incs" eq '../src/IOSERVER/mpif.h' || "$incs" eq '../src/IOSERVER/VT.inc' || "$incs" eq '../src/IOSERVER/ios_mpif.h' ) { |
---|
| 388 | $incs = ''; |
---|
| 389 | } |
---|
| 390 | } |
---|
| 391 | |
---|
| 392 | |
---|
| 393 | |
---|
| 394 | &PrintWords(length($objfile) + 2, 0, |
---|
| 395 | @dependencies, &uniq(sort(@incs))); |
---|
| 396 | print MAKEFILE "\n"; |
---|
| 397 | undef @incs; |
---|
| 398 | undef @modules; |
---|
| 399 | # |
---|
| 400 | # |
---|
| 401 | } |
---|
| 402 | } |
---|
| 403 | } |
---|