4 |
# |
# |
5 |
# Generate some make file dependency entries for a Fortran 90 file that employs "use". |
# Generate some make file dependency entries for a Fortran 90 file that employs "use". |
6 |
# |
# |
7 |
# For every "use" statement, generate a dependency on tolower(modulename).o |
# 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. |
# 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). |
# The name of the source file should be all lower case (except for the extension). |
18 |
# quick check for "use" to speed up processing |
# quick check for "use" to speed up processing |
19 |
if grep -i '^ *use ' $filename > /dev/null; then |
if grep -i '^ *use ' $filename > /dev/null; then |
20 |
# extract module name in lower case |
# extract module name in lower case |
21 |
modreflist=$(grep -i '^ *use ' $filename | awk '{sub(/,.*/,"",$2); print tolower($2)}') |
modreflist=$(grep -i '^ *use ' $filename | awk '{print tolower($2)}' | sed 's/,.*$//') |
22 |
|
|
23 |
echo "$filename => $modreflist" >> f90mkdepend.log |
echo "$filename => $modreflist" >> f90mkdepend.log |
24 |
|
|
30 |
# ignore modules that don't have an appropriately named source file |
# ignore modules that don't have an appropriately named source file |
31 |
if [ -f $m.F90 ] || [ -f $m.F ]; then |
if [ -f $m.F90 ] || [ -f $m.F ]; then |
32 |
depline="$depline $m.o" |
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 |
fi |
39 |
done |
done |
40 |
echo $depline |
echo $depline |