1 |
#!/bin/csh -f |
2 |
# $Header$ |
3 |
# $Name$ |
4 |
# |
5 |
# Generate some make file dependency entries for a Fortran 90 file that employs "use". |
6 |
# Note: We assume that the name of a module and the same of source are the same. |
7 |
# The name of the source file should be all lower case (except for the extension). |
8 |
# |
9 |
cat /dev/null > f90mkdepend.log |
10 |
|
11 |
set flist = ( `echo *.F90 *.F *.h` ) |
12 |
foreach filename ( $flist ) |
13 |
set dirlist = ( . ) |
14 |
|
15 |
# Try and find some use statements |
16 |
cat $filename | grep -i '^ *use ' >> f90mkdepend.log |
17 |
set modreflist = `cat $filename | grep -i '^ *use ' | awk '{print tolower($2)}' | sed s'/,.*$//'` |
18 |
|
19 |
if ("x$modreflist" != x) then |
20 |
echo "$filename => $modreflist" >> f90mkdepend.log |
21 |
endif |
22 |
|
23 |
set depfiles = ( ) |
24 |
foreach m ( $modreflist ) |
25 |
set depfile = ( ) |
26 |
foreach d ( $dirlist ) |
27 |
if ( -f $m.F90 || -f $m.F ) then |
28 |
if ( $depfile == "" ) then |
29 |
set depfile = ( $m.o ) |
30 |
endif |
31 |
endif |
32 |
end |
33 |
set depfiles = ( $depfiles $depfile ) |
34 |
end |
35 |
set ext=`echo ${filename:e} | sed -e 's/F/f/'` |
36 |
echo ${filename:r}.${ext}: $depfiles |
37 |
end |