From: Alexandre Duret-Lutz Date: Sun, 29 Sep 2002 10:35:03 +0000 (+0000) Subject: * tests/exeext3.test: New file. X-Git-Tag: Release-1-7-2b~156 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27855504a657553ca62680b0211ddcc71c21b6c1;p=thirdparty%2Fautomake.git * 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). --- diff --git a/ChangeLog b/ChangeLog index b53e8e979..19d491994 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-09-29 Alexandre Duret-Lutz + + * 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 For PR automake/360: diff --git a/automake.in b/automake.in index 045b89a4e..29b9f69a6 100755 --- a/automake.in +++ b/automake.in @@ -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. diff --git a/tests/Makefile.am b/tests/Makefile.am index fecf3ec01..4fea52461 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -155,6 +155,7 @@ exdir.test \ exdir2.test \ exeext.test \ exeext2.test \ +exeext3.test \ exsource.test \ ext.test \ ext2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 85ffc6753..6260c2f25 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..a867f0077 --- /dev/null +++ b/tests/exeext3.test @@ -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`