* automake.in (&am_target_error): New.
[platform/upstream/automake.git] / automake.in
index f4ebbb6..6e82b04 100755 (executable)
@@ -3991,7 +3991,7 @@ sub handle_footer
       if variable_value ('SOURCES');
 
 
-    &am_line_error ('.SUFFIXES',
+    am_target_error ('.SUFFIXES',
                    "use variable `SUFFIXES', not target `.SUFFIXES'")
       if target_defined ('.SUFFIXES');
 
@@ -4203,13 +4203,13 @@ sub handle_factored_dependencies
        {
            my $x = $utarg;
            $x =~ s/(data|exec)-//;
-           &am_line_error ($utarg, "use `$x', not `$utarg'");
+           am_target_error ($utarg, "use `$x', not `$utarg'");
        }
     }
 
     if (&target_defined ('install-local'))
     {
-       &am_line_error ('install-local',
+       am_target_error ('install-local',
                        "use `install-data-local' or `install-exec-local', "
                        . "not `install-local'");
     }
@@ -4217,7 +4217,7 @@ sub handle_factored_dependencies
     if (!defined $options{'no-installinfo'}
        && &target_defined ('install-info-local'))
     {
-       &am_line_error ('install-info-local',
+       am_target_error ('install-info-local',
                        "`install-info-local' target defined but "
                        . "`no-installinfo' option not in use");
     }
@@ -6645,7 +6645,7 @@ sub rule_define ($$$$)
          ? ! defined $target_conditional{$target}
          : defined $target_conditional{$target}))
   {
-      &am_line_error ($target,
+      am_target_error ($target,
                      "$target defined both conditionally and unconditionally");
   }
 
@@ -8077,7 +8077,7 @@ sub am_file_error
 
 # &am_macro_error ($MACRO, @ARGS)
 # -------------------------------
-# Report an error, @ARGS,  about $MACRO.
+# Report an error, @ARGS, about $MACRO.
 sub am_macro_error ($@)
 {
     my ($macro, @args) = @_;
@@ -8085,6 +8085,16 @@ sub am_macro_error ($@)
 }
 
 
+# &am_target_error ($TARGET, @ARGS)
+# ---------------------------------
+# Report an error, @ARGS, about the rule $TARGET.
+sub am_target_error ($@)
+{
+    my ($target, @args) = @_;
+    am_file_error ($targets{$target}, @args);
+}
+
+
 # &am_line_error ($SYMBOL or $LINE, @ARGS)
 # ----------------------------------------
 # Report an error about $SYMBOL.  The error message is composed of the
@@ -8095,22 +8105,25 @@ sub am_line_error ($@)
 
     if ($symbol && "$symbol" ne '-1')
     {
-        my $where;
        if ($symbol =~ /^\d+$/)
        {
            # SYMBOL is a line number, then it must be a Makefile.am.
-           $where = "${am_file}.am:$symbol";
+           am_file_error ("${am_file}.am:$symbol", @args);
        }
        elsif (defined $configure_vars{$symbol})
        {
            # SYMBOL is a variable defined in configure.ac, so add the
            # appropriate line number.
-           $where = $configure_vars{$symbol};
+           am_file_error ($configure_vars{$symbol}, @args);
        }
        elsif (defined $var_location{$symbol})
        {
            croak "use am_macro_error for macros: $symbol\n";
        }
+       elsif (defined $targets{$symbol})
+       {
+           croak "use am_target_error for targets: $symbol\n";
+       }
        else
        {
            # Couldn't find the line number.