Browse code

Better error output

Lorenz Hüdepohl authored on22/05/2015 15:50:48
Showing2 changed files
... ...
@@ -69,7 +69,7 @@ ifneq ($(call is_clean),1)
69 69
 include $(_f90_depfile)
70 70
 endif
71 71
 $(_f90_depfile): $(top_srcdir)/fdep/fortran_dependencies.pl $(foreach p,$(_f90_targets),$(_$p_use_mods) $(_$p_def_mods)) | $(foreach p,$(_f90_targets),$(_f90_depdir)/$p)
72
-	$(call _f90_verbose,F90 DEPS $@)echo > $@; $(foreach p,$(_f90_targets),$(top_srcdir)/fdep/fortran_dependencies.pl $(_$p_use_mods) $(_$p_def_mods) >> $@; )
72
+	$(call _f90_verbose,F90 DEPS $@)echo > $@; $(foreach p,$(_f90_targets),$(top_srcdir)/fdep/fortran_dependencies.pl $p $(_$p_use_mods) $(_$p_def_mods) >> $@; )
73 73
 
74 74
 $(_f90_depdir):
75 75
 	@mkdir $@
... ...
@@ -39,10 +39,15 @@ sub add_def {
39 39
 	}
40 40
 }
41 41
 
42
+my $target = shift;
43
+
42 44
 foreach my $file (@ARGV) {
43 45
 	my $re;
44 46
 	my $add;
45 47
 	my $object;
48
+	if (defined($ENV{V}) && $ENV{V} ge "2") {
49
+		print STDERR "fdep: Considering file $file for target $target\n";
50
+	}
46 51
 	if ($file =~ /^(.*)\.def_mods(\..*)$/) {
47 52
 		$re = $def_re;
48 53
 		$add = \&add_def;
... ...
@@ -61,7 +66,7 @@ foreach my $file (@ARGV) {
61 66
 		if ($_ =~ $re) {
62 67
 			&$add($object, $1);
63 68
 		} else {
64
-			die "Cannot parse module statement '$_', was expecting $re";
69
+			die "At $file:$.\nCannot parse module statement '$_', was expecting $re";
65 70
 		}
66 71
 	}
67 72
 	close(FILE)
... ...
@@ -71,8 +76,8 @@ foreach my $object (sort keys %uses) {
71 76
 	for my $m (keys %{$uses{$object}}) {
72 77
 		if (defined $defs{$m}) {
73 78
 			print "$object: ", $defs{$m}, "\n";
74
-		} elsif (defined($ENV{V}) && $ENV{V} eq "1") {
75
-			print STDERR "Warning: Cannot find definition of module $m in files for current program, might be external\n";
79
+		} elsif (defined($ENV{V}) && $ENV{V} ge "1") {
80
+			print STDERR "Warning: Cannot find definition of module $m in files for current target $target, might be external\n";
76 81
 		}
77 82
 	}
78 83
 }