[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch: PR 347
From: |
Tom Tromey |
Subject: |
Patch: PR 347 |
Date: |
17 Aug 2002 19:27:32 -0600 |
This patch implements part of PR automake/347.
Basically now we recognize "%" in a target name, and then give a
warning/error if -Wportability is enabled.
Alexandre, is it better to use `msg', as I have done, or to move the
code down a bit and use `msg_target'?
Tom
Index: ChangeLog
from Tom Tromey <address@hidden>
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.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1336
diff -u -r1.1336 automake.in
--- automake.in 30 Jul 2002 20:15:31 -0000 1.1336
+++ automake.in 18 Aug 2002 01:23:12 -0000
@@ -145,7 +145,7 @@
my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n';
my $WHITE_PATTERN = '^\s*' . "\$";
my $COMMENT_PATTERN = '^#';
-my $TARGET_PATTERN='address@hidden(){}/address@hidden';
+my $TARGET_PATTERN='address@hidden(){}/address@hidden';
# A rule has three parts: a list of targets, a list of dependencies,
# and optionally actions.
my $RULE_PATTERN =
@@ -7256,6 +7256,11 @@
if ($cond
? ! 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;
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.427
diff -u -r1.427 Makefile.am
--- tests/Makefile.am 2 Aug 2002 16:10:28 -0000 1.427
+++ tests/Makefile.am 18 Aug 2002 01:23:12 -0000
@@ -268,6 +268,7 @@
output5.test \
package.test \
parse.test \
+percent.test \
pluseq.test \
pluseq2.test \
pluseq3.test \
Index: tests/percent.test
===================================================================
RCS file: tests/percent.test
diff -N tests/percent.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/percent.test 18 Aug 2002 01:23:13 -0000
@@ -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
- Patch: PR 347,
Tom Tromey <=