summaryrefslogtreecommitdiff
path: root/lib/sbin/f_depend_modules.pl
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2006-06-23 03:46:38 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2006-06-23 03:46:38 +0000
commit4d5f9ed6fdc103aa509c79e14d1ec4680e643925 (patch)
tree75d549d6848b758bd357e40c0a14b6682c6fdcdf /lib/sbin/f_depend_modules.pl
parent2d6ee90c4f66b9a6920e966a1bc3ab23770bc843 (diff)
Generate dependencies for Fortran include statements only if the
included file is actually found. The previous code required that each included file be in the same directory as the including file. The new code treats using modules and including files in the same manner. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4328 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/f_depend_modules.pl')
-rwxr-xr-xlib/sbin/f_depend_modules.pl58
1 files changed, 56 insertions, 2 deletions
diff --git a/lib/sbin/f_depend_modules.pl b/lib/sbin/f_depend_modules.pl
index feb59e5e..fc4749d8 100755
--- a/lib/sbin/f_depend_modules.pl
+++ b/lib/sbin/f_depend_modules.pl
@@ -38,7 +38,61 @@ while (<STDIN>)
{
# include statement
my $name = $1;
- print " \\\n $srcdir/$name";
+ my $found = 0;
+ if (! $found)
+ {
+ # reference to an include file in this thorn?
+ my $dirhdl;
+ if( opendir( DIRHDL, "$srcdir" ) )
+ {
+ while( defined( my $filename = readdir( DIRHDL ) ) )
+ {
+ if( $filename eq "$name" )
+ {
+ $found = 1;
+ print " \\\n $filename";
+ last loop;
+ }
+ }
+ closedir DIRHDL;
+ }
+ }
+ if (! $found)
+ {
+ # reference to an include file in another thorn?
+ loop: foreach my $dir (@otherdirs)
+ {
+ # note: we could also use the SUBDIRS from the make.code.defn here
+ foreach my $subdir (".", "include")
+ {
+ if( opendir( DIRHDL, "$dir/$subdir" ) )
+ {
+ while( defined( my $filename = readdir( DIRHDL ) ) )
+ {
+ if( $filename eq "$name" )
+ {
+ $found = 1;
+ print " \\\n $dir/$subdir/$filename";
+ last loop;
+ }
+ }
+ closedir DIRHDL;
+ }
+ }
+ }
+ }
+ if (! $found)
+ {
+ print STDERR "$srcfile:$line: Warning: While tracing include depencencies: Include file \"$name\" not found\n";
+ if (@otherdirs)
+ {
+ print STDERR " Searched in thorn directory and in [" . join(', ', @otherdirs) . "]\n";
+ }
+ else
+ {
+ print STDERR " Searched in thorn directory only.\n";
+ }
+ }
}
elsif (/^\s*module\s+(\w+)/i)
{
@@ -83,7 +137,7 @@ while (<STDIN>)
if (! $found)
{
# reference to a module in another thorn?
- loop: foreach my $dir (@otherdirs)
+ loop: foreach my $dir (@otherdirs)
{
# note: we could also use the SUBDIRS from the make.code.defn here
foreach my $subdir (".", "include")