/[MITgcm]/MITgcm/tools/f90mkdepend
ViewVC logotype

Contents of /MITgcm/tools/f90mkdepend

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.7 - (show annotations) (download)
Wed Dec 11 21:53:02 2013 UTC (5 years, 9 months ago) by jahn
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64s, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.6: +5 -0 lines
allow module source files to not have the trailing "_mod" and issue warning
if no source file found.

1 #!/bin/bash
2 # $Header$
3 # $Name$
4 #
5 # Generate some make file dependency entries for a Fortran 90 file that employs "use".
6 #
7 # For every "use" statement, generate a dependency on lowercase(modulename).o
8 #
9 # Note: We assume that the name of a module and the same of source are the same.
10 # The name of the source file should be all lower case (except for the extension).
11
12 # don't complain if *.F90 doesn't match any files
13 shopt -s nullglob
14
15 cat /dev/null > f90mkdepend.log
16
17 for filename in *.F90 *.F *.h; do
18 # quick check for "use" to speed up processing
19 if grep -i '^ *use ' $filename > /dev/null; then
20 # extract module name in lower case
21 modreflist=$(grep -i '^ *use ' $filename | awk '{print tolower($2)}' | sed 's/,.*$//')
22
23 echo "$filename => $modreflist" >> f90mkdepend.log
24
25 # change .F90 into .f90, .F into .f for target
26 preprocessed=$(echo $filename | sed -e 's/\.F$/.f/' -e 's/\.F90$/.f90/')
27
28 depline="$preprocessed:"
29 for m in $modreflist; do
30 # ignore modules that don't have an appropriately named source file
31 if [ -f $m.F90 ] || [ -f $m.F ]; then
32 depline="$depline $m.o"
33 elif [ -f ${m%_mod}.F90 ] || [ -f ${m%_mod}.F ]; then
34 # source file name is module name without "_mod"
35 depline="$depline ${m%_mod}.o"
36 else
37 echo "WARNING: f90mkdepend: no source file found for module $m" 1>&2
38 fi
39 done
40 echo $depline
41 fi
42 done

  ViewVC Help
Powered by ViewVC 1.1.22