For PR automake/347:
authorTom Tromey <tromey@redhat.com>
Sun, 18 Aug 2002 22:26:37 +0000 (22:26 +0000)
committerTom Tromey <tromey@redhat.com>
Sun, 18 Aug 2002 22:26:37 +0000 (22:26 +0000)
* automake.in (rule_define): Given portability warning if "%" seen
in target name.
(TARGET_PATTERN): Added `%'.
* tests/Makefile.am (TESTS): Added percent.test.
* tests/percent.test: New file.

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

index 7e900c7..d46a541 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2002-08-17  Tom Tromey  <tromey@redhat.com>
+
+       For PR automake/347:
+       * automake.in (rule_define): Given portability warning if "%" seen
+       in target name.
+       (TARGET_PATTERN): Added `%'.
+       * tests/Makefile.am (TESTS): Added percent.test.
+       * tests/percent.test: New file.
+
 2002-08-15  Art Haas  <ahaas@neosoft.com>
 
        * lib/am/depend2.am: Use correct name for dependency file in
index cce7b51..def0500 100755 (executable)
@@ -145,7 +145,7 @@ my $libdir = "@datadir@/@PACKAGE@-@APIVERSION@";
 my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n';
 my $WHITE_PATTERN = '^\s*' . "\$";
 my $COMMENT_PATTERN = '^#';
-my $TARGET_PATTERN='[$a-zA-Z_.@][-.a-zA-Z0-9_(){}/$+@]*';
+my $TARGET_PATTERN='[$a-zA-Z_.@%][-.a-zA-Z0-9_(){}/$+@%]*';
 # A rule has three parts: a list of targets, a list of dependencies,
 # and optionally actions.
 my $RULE_PATTERN =
@@ -7257,6 +7257,11 @@ sub rule_define ($$$$)
        ? ! exists $target_conditional{$target}
        : exists $target_conditional{$target});
 
+  # A GNU make-style pattern rule has a single "%" in the target name.
+  msg ('portability', $where,
+       "`%'-style pattern rules are a GNU make extension")
+    if $target =~ /^[^%]*%[^%]*$/;
+
   # Value here doesn't matter; for targets we only note existence.
   $targets{$target} = $where;
   if ($cond)
index 4701322..addf303 100644 (file)
@@ -268,6 +268,7 @@ output4.test \
 output5.test \
 package.test \
 parse.test \
+percent.test \
 pluseq.test \
 pluseq2.test \
 pluseq3.test \
index 5aab2c7..ed91ebd 100644 (file)
@@ -52,7 +52,6 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LIBS = @LIBS@
 LN = @LN@
-LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -356,6 +355,7 @@ output4.test \
 output5.test \
 package.test \
 parse.test \
+percent.test \
 pluseq.test \
 pluseq2.test \
 pluseq3.test \
diff --git a/tests/percent.test b/tests/percent.test
new file mode 100755 (executable)
index 0000000..25b4b8b
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Test to make sure that -Wportability understands %-style pattern
+# rules.
+
+. $srcdir/defs
+
+set -e
+
+cat >>configure.in <<EOF
+AC_PROG_CC
+EOF
+
+cat >Makefile.am <<EOF
+bin_PROGRAMS = liver
+liver_SOURCES = foo.c
+
+%.o: %.c
+       echo "gnu make extension"
+EOF
+
+$ACLOCAL
+$AUTOMAKE -Wportability && exit 1
+exit 0