automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: fix bug related to missing-EXEEXT diagnostic


From: Alexandre Duret-Lutz
Subject: FYI: fix bug related to missing-EXEEXT diagnostic
Date: 29 Sep 2002 12:34:07 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

On

   bin_PROGRAMS = maude
   maude$(EXEEXT):
        bar

automake-1.7 tells 

maude: deprecated feature: `maude' overrides `maude$(EXEEXT)'
maude: change your target to read `maude$(EXEEXT)'

Which of course in nonsensical, since the target already reads
`maude$(EXEEXT)'...

Fortunately, this is only a -Wobsolete warning: 
  - the resulting Makefile.in works fine,
  - the -Wobsolete warnings are not shown by default.

This seems to come from my patch of 2002-09-13, which has changed
rule_define to store `ctags$(EXEEXT)' using key `ctags', to detect
clashes with other targets using the same name more easily.

I'm installing the following fix on HEAD and branch-1-7.

2002-09-29  Alexandre Duret-Lutz  <address@hidden>

        * tests/exeext3.test: New file.
        * tests/Makefile.am (TESTS): Add exeext3.test.
        * automake.in (%target_name): New hash.
        (initialize_per_input): Reset %target_name.
        (rule_define): Fill %target_name, and use it to detect targets
        which have been registered with key X but really are X$(EXEEXT).

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1365
diff -u -r1.1365 automake.in
--- automake.in 24 Sep 2002 22:30:36 -0000      1.1365
+++ automake.in 29 Sep 2002 10:25:35 -0000
@@ -516,7 +516,8 @@
 
 # This holds the names which are targets.  These also appear in
 # %contents.  $targets{TARGET}{COND} is the location of the definition
-# of TARGET for condition COND.
+# of TARGET for condition COND.  TARGETs should not include
+# a trailing $(EXEEXT), we record this in %target_name.
 my %targets;
 
 # $target_source{TARGET}{COND} is the filename where TARGET
@@ -524,6 +525,11 @@
 # filename, *without* any line number.
 my %target_source;
 
+# $target_name{TARGET}{COND} is the real name of TARGET (in condition COND).
+# The real name is often TARGET or TARGET$(EXEEXT), and TARGET never
+# contain $(EXEEXT)
+my %target_name;
+
 # $target_owner{TARGET}{COND} the owner of TARGET in condition COND.
 my %target_owner;
 use constant TARGET_AUTOMAKE => 0; # Target defined by Automake.
@@ -728,6 +734,7 @@
 
     %targets = ();
     %target_source = ();
+    %target_name = ();
     %target_owner = ();
 
     @cond_stack = ();
@@ -7426,7 +7433,10 @@
   # For now `foo:' will override `foo$(EXEEXT):'.  This is temporary,
   # though, so we emit a warning.
   (my $noexe = $target) =~ s,\$\(EXEEXT\)$,,;
-  if ($noexe ne $target && exists $targets{$noexe}{$cond})
+  if ($noexe ne $target
+      && exists $targets{$noexe}
+      && exists $targets{$noexe}{$cond}
+      && $target_name{$noexe}{$cond} ne $target)
     {
       # The no-exeext option enables this feature.
       if (! defined $options{'no-exeext'})
@@ -7439,6 +7449,9 @@
       return ();
     }
 
+  # For now on, strip off $(EXEEXT) from $target, so we can diagnose
+  # a clash if `ctags$(EXEEXT):' is redefined after `ctags:'.
+  my $realtarget = $target;
   $target = $noexe;
 
   # A GNU make-style pattern rule has a single "%" in the target name.
@@ -7456,6 +7469,9 @@
       prog_error ("\$target_source{$target}{$cond} exists, but \$targets"
                  . " doesn't.")
        unless exists $targets{$target}{$cond};
+      prog_error ("\$target_source{$target}{$cond} exists, but \$target_name"
+                 . " doesn't.")
+       unless exists $target_name{$target}{$cond};
 
       my $oldowner  = $target_owner{$target}{$cond};
 
@@ -7589,6 +7605,7 @@
       $targets{$target}{$c} = $where;
       $target_source{$target}{$c} = $source;
       $target_owner{$target}{$c} = $owner;
+      $target_name{$target}{$c} = $realtarget;
     }
 
   # Check the rule for being a suffix rule. If so, store in a hash.
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.443
diff -u -r1.443 Makefile.am
--- tests/Makefile.am   23 Sep 2002 22:08:31 -0000      1.443
+++ tests/Makefile.am   29 Sep 2002 10:25:46 -0000
@@ -155,6 +155,7 @@
 exdir2.test \
 exeext.test \
 exeext2.test \
+exeext3.test \
 exsource.test \
 ext.test \
 ext2.test \
Index: tests/exeext3.test
===================================================================
RCS file: tests/exeext3.test
diff -N tests/exeext3.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/exeext3.test  29 Sep 2002 10:25:46 -0000
@@ -0,0 +1,42 @@
+#! /bin/sh
+# Copyright (C) 2002  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with autoconf; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure we can override a program rule.
+
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = maude
+
+maude$(EXEEXT):
+       yeah
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+$FGREP 'maude$(EXEEXT):' Makefile.in
+test 1 = `grep 'maude.*:' Makefile.in | wc -l`

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]