]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* tests/exeext3.test: New file.
authorAlexandre Duret-Lutz <adl@gnu.org>
Sun, 29 Sep 2002 10:35:03 +0000 (10:35 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sun, 29 Sep 2002 10:35:03 +0000 (10:35 +0000)
* 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).

ChangeLog
automake.in
tests/Makefile.am
tests/Makefile.in
tests/exeext3.test [new file with mode: 0755]

index b53e8e9799157c4f3b06b7a3459e762558f886b9..19d4919943fb107d65390b96c9f8f5bc7e86e728 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2002-09-29  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
+       * 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).
+
 2002-09-28  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        For PR automake/360:
index 045b89a4e7f37e02f53c0169fa8e1bdb2c221341..29b9f69a6322cb27dc5c8570aa1dd4b740f32866 100755 (executable)
@@ -520,7 +520,8 @@ my %content_seen;
 
 # 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
@@ -528,6 +529,11 @@ my %targets;
 # 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.
@@ -732,6 +738,7 @@ sub initialize_per_input ()
 
     %targets = ();
     %target_source = ();
+    %target_name = ();
     %target_owner = ();
 
     @cond_stack = ();
@@ -7459,7 +7466,10 @@ sub rule_define ($$$$$)
   # 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'})
@@ -7472,6 +7482,9 @@ sub rule_define ($$$$$)
       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.
@@ -7489,6 +7502,9 @@ sub rule_define ($$$$$)
       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};
 
@@ -7622,6 +7638,7 @@ sub rule_define ($$$$$)
       $targets{$target}{$c} = $where->clone;
       $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 fecf3ec01db0cf18d39ca95ddd371a036601478e..4fea52461b6639b1e673065b007c985b83d19916 100644 (file)
@@ -155,6 +155,7 @@ exdir.test \
 exdir2.test \
 exeext.test \
 exeext2.test \
+exeext3.test \
 exsource.test \
 ext.test \
 ext2.test \
index 85ffc6753718d54e694633532f291fcb9ca0d1d5..6260c2f257c689b45a297c82a65144f47c2b67db 100644 (file)
@@ -247,6 +247,7 @@ exdir.test \
 exdir2.test \
 exeext.test \
 exeext2.test \
+exeext3.test \
 exsource.test \
 ext.test \
 ext2.test \
diff --git a/tests/exeext3.test b/tests/exeext3.test
new file mode 100755 (executable)
index 0000000..a867f00
--- /dev/null
@@ -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`