1 |
cnh |
1.1 |
#!/bin/csh -f |
2 |
jahn |
1.3 |
# $Header$ |
3 |
|
|
# $Name$ |
4 |
cnh |
1.1 |
# |
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 |
jahn |
1.3 |
# The name of the source file should be all lower case (except for the extension). |
8 |
cnh |
1.1 |
# |
9 |
jahn |
1.3 |
cat /dev/null > f90mkdepend.log |
10 |
|
|
|
11 |
jahn |
1.2 |
set flist = ( `echo *.F90 *.F *.h` ) |
12 |
cnh |
1.1 |
foreach filename ( $flist ) |
13 |
jahn |
1.3 |
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 |
cnh |
1.1 |
|
19 |
jahn |
1.3 |
if ("x$modreflist" != x) then |
20 |
|
|
echo "$filename => $modreflist" >> f90mkdepend.log |
21 |
|
|
endif |
22 |
cnh |
1.1 |
|
23 |
jahn |
1.3 |
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 |
cnh |
1.1 |
end |