1 |
cnh |
1.1 |
#!/bin/csh -f |
2 |
|
|
# |
3 |
|
|
# Generate some make file dependency entries for a Fortran 90 file that employs "use". |
4 |
|
|
# Note: We assume that the name of a module and the same of source are the same. |
5 |
|
|
# |
6 |
jahn |
1.2 |
set flist = ( `echo *.F90 *.F *.h` ) |
7 |
cnh |
1.1 |
foreach filename ( $flist ) |
8 |
|
|
set dirlist = ( . ) |
9 |
|
|
|
10 |
|
|
# Try and find some use statements |
11 |
|
|
set modreflist = `cat $filename | grep '[ *] use ' | awk '{print $2}' | sed s'/,//'` |
12 |
|
|
|
13 |
|
|
set depfiles = ( ) |
14 |
|
|
foreach m ( $modreflist ) |
15 |
|
|
set depfile = ( ) |
16 |
|
|
foreach d ( $dirlist ) |
17 |
jahn |
1.2 |
if ( -f $m.F90 || -f $m.F ) then |
18 |
cnh |
1.1 |
if ( $depfile == "" ) then |
19 |
|
|
set depfile = ( $m.o ) |
20 |
|
|
endif |
21 |
|
|
endif |
22 |
|
|
end |
23 |
|
|
set depfiles = ( $depfiles $depfile ) |
24 |
|
|
end |
25 |
jahn |
1.2 |
set ext=`echo ${filename:e} | sed -e 's/F/f/'` |
26 |
|
|
echo ${filename:r}.${ext}: $depfiles |
27 |
cnh |
1.1 |
end |