[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [PATCH 3/4] [ng] rules: forbid old-fashioned suffix rules,
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [PATCH 3/4] [ng] rules: forbid old-fashioned suffix rules, prefer pattern rules |
Date: |
Thu, 10 May 2012 14:29:49 +0200 |
Pattern rules are cleaner, safer, and vouched for in the GNU make manual
itself. Supporting them instead of suffix rules will also allow us to
simplify a little the automake script, auxiliary perl modules, and
documentation.
This change introduces a slight backward-incompatibility now, in that
user provided definitions of the SUFFIXES variable or of the .SUFFIXES
target, as well as old-fashioned suffix rules, are now rejected.
Automake-NG still tries to parse and understand suffix-based pattern
rules though, to retain support for user-added file extensions in the
_SOURCES variables (see "Handling new file extensions" in the Automake
manual).
So, an usage like:
SUFFIXES = .baz .c
.baz.c:
cp $< $@
foo_SOURCES = foo.c bar.baz
DISTCLEANFILES = bar.c
which was valid with mainline Automake, should be translated for
Automake-NG as:
%.c: %.baz
cp $< $@
bin_PROGRAMS = foo
foo_SOURCES = foo.c sub/bar.baz
DISTCLEANFILES = bar.c
Note that suffix-based pattern rules with dot-less suffix are *not*
supported.
* NG-NEWS: Update.
* doc/automake.texi: Likewise.
* lib/am/footer.am: Declare '.SUFFIXES:' with empty dependencies, to
neutralize the default suffix rules.
* automake.in (&handle_footer): Reject the 'SUFFIXES' variable. Don't
process its content anymore. Don't generate the .SUFFIXES special target
anymore.
(&var_SUFFIXES_trigger): Remove. And don't install it as an hook for the
now-deprecated 'SUFFIXES' variable.
* lib/Automake/Rule.pm (&define): Don't process old-fashioned suffix
rules specially, but just reject them. Instead, process pattern rules
specially.
($_SUFFIX_RULE_PATTERN): Made local to the '&define' function, renaming
it as '$suffix_rule_rx'.
(&suffixes, @_suffixes): Delete, they are no more used.
(@EXPORT): Adjust.
(register_suffix_rule): Don't extend '@_suffixes' anymore.
(reset): Don't reset '@_suffixes' anymore.
* t/ext3.sh: Remove as obsolete.
* t/suffix4.sh: Likewise.
* t/suffix6.sh: Likewise.
* t/suffix6b.sh: Likewise.
* t/suffix7.sh: Likewise.
* t/suffix11.tap: Likewise.
* t/suffix6c.sh: Rename ...
* t/suffix-obj.sh: .. like this, and adjust.
* t/suffix-chain.tap: Rewrite a as "simple" test (rather than as
a TAP test), adjust, and rename ...
* t/suffix-chain.sh: ... like this.
* t/suffix3.tap: Likewise rewrite and rename ...
* t/suffix3.sh: ... like this.
* t/suffix8.tap: Likewise rewrite and rename ...
* t/suffix8.sh: ... like this.
* t/suffix10.tap: Likewise rewrite and rename ...
* t/suffix10.sh: ... like this.
* t/suffix5.sh: Adjust.
* t/suffix9.sh: Likewise.
* t/suffix13.sh: Likewise.
* t/parallel-tests8.sh: Likewise.
* t/warnings-strictness-interactions.sh: Likewise.
* t/warnings-win-over-strictness.sh: Likewise.
* t/warnings-precedence.sh: Likewise.
* t/warnings-override.sh: Likewise.
* t/warning-groups-win-over-strictness.sh: Likewise.
* t/amopts-variable-expansion.sh: Likewise.
* t/specflg10.sh: Likewise.
* t/suffix-rules-reject.sh: New test.
Signed-off-by: Stefano Lattarini <address@hidden>
---
NG-NEWS | 31 +++++++++++++
automake.in | 54 +++-------------------
doc/automake.texi | 50 +++++++--------------
lib/Automake/Rule.pm | 70 +++++++++--------------------
lib/am/footer.am | 3 ++
t/amopts-variable-expansion.sh | 11 +++--
t/ext3.sh | 39 ----------------
t/parallel-tests8.sh | 2 +-
t/specflg10.sh | 5 +--
t/{suffix-chain.tap => suffix-chain.sh} | 26 +++++------
t/{suffix6c.sh => suffix-obj.sh} | 11 ++---
t/suffix-rules-reject.sh | 55 +++++++++++++++++++++++
t/{suffix10.tap => suffix10.sh} | 25 ++++++-----
t/suffix11.tap | 75 -------------------------------
t/suffix12.sh | 9 ++--
t/suffix13.sh | 12 +++--
t/{suffix3.tap => suffix3.sh} | 29 +++++-------
t/suffix4.sh | 39 ----------------
t/suffix5.sh | 2 +-
t/suffix6.sh | 63 --------------------------
t/suffix6b.sh | 74 ------------------------------
t/suffix7.sh | 37 ---------------
t/{suffix8.tap => suffix8.sh} | 32 ++++++-------
t/suffix9.sh | 8 ++--
t/warning-groups-win-over-strictness.sh | 9 ++--
t/warnings-override.sh | 20 +++++----
t/warnings-precedence.sh | 20 +++++----
t/warnings-strictness-interactions.sh | 15 ++++---
t/warnings-win-over-strictness.sh | 16 ++++---
29 files changed, 260 insertions(+), 582 deletions(-)
delete mode 100755 t/ext3.sh
rename t/{suffix-chain.tap => suffix-chain.sh} (73%)
rename t/{suffix6c.sh => suffix-obj.sh} (93%)
create mode 100755 t/suffix-rules-reject.sh
rename t/{suffix10.tap => suffix10.sh} (80%)
delete mode 100755 t/suffix11.tap
rename t/{suffix3.tap => suffix3.sh} (73%)
delete mode 100755 t/suffix4.sh
delete mode 100755 t/suffix6.sh
delete mode 100755 t/suffix6b.sh
delete mode 100755 t/suffix7.sh
rename t/{suffix8.tap => suffix8.sh} (77%)
diff --git a/NG-NEWS b/NG-NEWS
index 11d66d9..e31defc 100644
--- a/NG-NEWS
+++ b/NG-NEWS
@@ -99,6 +99,37 @@ Parallel testsuite harness
work as expected:
TESTS = $(wildcard $(srcdir)/t[0-9][0-9]*.sh)
+Pattern rules and suffix rules
+==============================
+
+* Old-fashioned suffix rules are not supported anymore; Automake-NG will
+ error out if you try to use them. Use pattern rules instead, as
+ advised in the GNU make manual itself.
+
+* The .SUFFIXES: special target and the SUFFIXES special variable are
+ not supported anymore either; Automake-NG will error out if you try
+ to define them.
+
+* To retain support for user-defined file extensions in the '_SOURCES'
+ variables (see "Handling new file extensions" in the Automake manual),
+ Automake-NG still tries to parse and understand suffix-based pattern
+ rules. So, an usage like:
+
+ SUFFIXES = .baz .c
+ .baz.c:
+ cp $< $@
+ foo_SOURCES = foo.c bar.baz
+ DISTCLEANFILES = bar.c
+
+ which was valid with mainline Automake, should be translated for
+ Automake-NG as:
+
+ %.c: %.baz
+ cp $< $@
+ bin_PROGRAMS = foo
+ foo_SOURCES = foo.c sub/bar.baz
+ DISTCLEANFILES = bar.c
+
Miscellaneous
=============
diff --git a/automake.in b/automake.in
index 69925c8..737825b 100644
--- a/automake.in
+++ b/automake.in
@@ -604,23 +604,6 @@ my %am_file_cache;
################################################################
-# var_SUFFIXES_trigger ($TYPE, $VALUE)
-# ------------------------------------
-# This is called by Automake::Variable::define() when SUFFIXES
-# is defined ($TYPE eq '') or appended ($TYPE eq '+').
-# The work here needs to be performed as a side-effect of the
-# macro_define() call because SUFFIXES definitions impact
-# on $KNOWN_EXTENSIONS_PATTERN which is used used when parsing
-# the input am file.
-sub var_SUFFIXES_trigger ($$)
-{
- my ($type, $value) = @_;
- accept_extensions (split (' ', $value));
-}
-Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger);
-
-################################################################
-
## --------------------------------- ##
## Forward subroutine declarations. ##
## --------------------------------- ##
@@ -4378,36 +4361,13 @@ sub handle_gettext
# Handle footer elements.
sub handle_footer
{
- reject_rule ('.SUFFIXES',
- "use variable 'SUFFIXES', not target '.SUFFIXES'");
-
- # Note: AIX 4.1 /bin/make will fail if any suffix rule appears
- # before .SUFFIXES. So we make sure that .SUFFIXES appears before
- # anything else, by sticking it right after the default: target.
- $output_header .= ".SUFFIXES:\n";
- my $suffixes = var 'SUFFIXES';
- my @suffixes = Automake::Rule::suffixes;
- if (@suffixes || $suffixes)
- {
- # Make sure SUFFIXES has unique elements. Sort them to ensure
- # the output remains consistent. However, $(SUFFIXES) is
- # always at the start of the list, unsorted. This is done
- # because make will choose rules depending on the ordering of
- # suffixes, and this lets the user have some control. Push
- # actual suffixes, and not $(SUFFIXES). Some versions of make
- # do not like variable substitutions on the .SUFFIXES line.
- my @user_suffixes = ($suffixes
- ? $suffixes->value_as_list_recursive : ());
-
- my %suffixes = map { $_ => 1 } @suffixes;
- delete @address@hidden;
-
- $output_header .= (".SUFFIXES: "
- . join (' ', @user_suffixes, sort keys %suffixes)
- . "\n");
- }
-
- $output_trailer .= file_contents ('footer', new Automake::Location);
+ # Automake used to have special support for old-fashioned suffix
+ # rules, but Automake-NG favors the use of GNU make pattern rules.
+ reject_rule '.SUFFIXES',
+ "use pattern rules, not old-fashioned suffix rules";
+ reject_var 'SUFFIXES',
+ "use pattern rules, not old-fashioned suffix rules";
+ $output_trailer .= file_contents ('footer', new Automake::Location);
}
diff --git a/doc/automake.texi b/doc/automake.texi
index 2890a8c..c5ac92d 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -5546,10 +5546,10 @@ each source file to be compiled to a single @file{.o}
file (or
@file{.lo} when using libtool). Normally these object files are named
after the source file, but other factors can change this. If a file in
the @code{_SOURCES} variable has an unrecognized extension, Automake
-will do one of two things with it. If a suffix rule exists for turning
-files with the unrecognized extension into @file{.o} files, then
address@hidden will treat this file as it will any other source file
-(@pxref{Support for Other Languages}). Otherwise, the file will be
+will do one of two things with it. If a suffix-based pattern rule exists
+for turning files with the unrecognized extension into @file{.o} files,
+then @command{automake} will treat this file as it will any other source
+file (@pxref{Support for Other Languages}). Otherwise, the file will be
ignored as though it were a header file.
The prefixes @code{dist_} and @code{nodist_} can be used to control
@@ -6826,7 +6826,7 @@ support for other languages, support for which will be
improved based
on user demand.
Some limited support for adding your own languages is available via the
-suffix rule handling (@pxref{Suffixes}).
+suffix-based pattern rules handling (@pxref{Suffixes}).
@node Dependencies
@section Automatic dependency tracking
@@ -7340,8 +7340,8 @@ not careful enough. This is due to the way Automake
tries not to
overwrite your rules (it assumes you know better than it).
@samp{foo.$(OBJEXT): bindir.h} supersedes any rule Automake may want to
output to build @samp{foo.$(OBJEXT)}. It happens to work in this case
-because Automake doesn't have to output any @samp{foo.$(OBJEXT):}
-target: it relies on a suffix rule instead (i.e., @samp{.c.$(OBJEXT):}).
+because Automake doesn't have to output any @samp{foo.$(OBJEXT):} target:
+it relies on a pattern rule instead (i.e., @samp{%.$(OBJEXT): %.c}).
Always check the generated @file{Makefile.in} if you do this.
@subsubheading Build @file{bindir.h} from @file{configure}
@@ -10348,14 +10348,15 @@ holds arguments that are passed to @command{gtags}.
@vindex SUFFIXES
It is sometimes useful to introduce a new implicit rule to handle a file
-type that Automake does not know about.
+type that Automake-NG does not know about. Automake-NG offers a limited
+support to do so, through the use of suffix-based pattern rules.
For instance, suppose you had a compiler that could compile @file{.foo}
-files to @file{.o} files. You would simply define a suffix rule for
+files to @file{.o} files. You would simply define a pattern rule for
your language:
@example
-.foo.o:
+%.o: %.foo
foocc -c -o $@@ $<
@end example
@@ -10367,30 +10368,13 @@ bin_PROGRAMS = doit
doit_SOURCES = doit.foo
@end example
-This was the simpler and more common case. In other cases, you will
-have to help Automake to figure out which extensions you are defining your
-suffix rule for. This usually happens when your extension does not
-start with a dot. Then, all you have to do is to put a list of new
-suffixes in the @code{SUFFIXES} variable @strong{before} you define your
-implicit rule.
+Note that the above only works with suffixes that start with a dot.
-For instance, the following definition prevents Automake from misinterpreting
-the @samp{.idlC.cpp:} rule as an attempt to transform @file{.idlC} files into
address@hidden files.
-
address@hidden Keep in sync with suffix7.sh
address@hidden
-SUFFIXES = .idl C.cpp
-.idlC.cpp:
- # whatever
address@hidden example
-
-As you may have noted, the @code{SUFFIXES} variable behaves like the
address@hidden special target of @command{make}. You should not touch
address@hidden yourself, but use @code{SUFFIXES} instead and let
-Automake generate the suffix list for @code{.SUFFIXES}. Any given
address@hidden go at the start of the generated suffixes list, followed
-by Automake generated suffixes not already in the list.
+Also note that Automake-NG does not support old-fashioned suffix rules
+(@pxref{Suffix Rules, ,Old-fashioned Suffix Rules, make, The GNU make
+Manual}), since they are obsoleted by the GNU make pattern rules. In
+fact, Automake-NG will error out an any attempt to use old-fashioned
+suffix rules.
@node Include
@chapter Include
diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm
index ed44a65..c8b8111 100644
--- a/lib/Automake/Rule.pm
+++ b/lib/Automake/Rule.pm
@@ -30,7 +30,7 @@ require Exporter;
use vars '@ISA', '@EXPORT', '@EXPORT_OK';
@ISA = qw/Automake::Item Exporter/;
@EXPORT = qw (reset register_suffix_rule suffix_rules_count
- suffixes rules $suffix_rules $KNOWN_EXTENSIONS_PATTERN
+ rules $suffix_rules $KNOWN_EXTENSIONS_PATTERN
depend %dependencies %actions register_action
accept_extensions
reject_rule msg_rule msg_cond_rule err_rule err_cond_rule
@@ -95,12 +95,6 @@ non-object).
=cut
-my $_SUFFIX_RULE_PATTERN =
- '^(\.[a-zA-Z0-9_()address@hidden)(\.[a-zA-Z0-9_()address@hidden)' . "\$";
-
-# Suffixes found during a run.
-use vars '@_suffixes';
-
# Same as $suffix_rules (declared below), but records only the
# default rules supplied by the languages Automake supports.
use vars '$_suffix_rules_default';
@@ -316,7 +310,6 @@ other internal data.
sub reset()
{
%_rule_dict = ();
- @_suffixes = ();
# The first time we initialize the variables,
# we save the value of $suffix_rules.
if (defined $_suffix_rules_default)
@@ -384,8 +377,8 @@ sub reset()
=item C<register_suffix_rule ($where, $src, $dest)>
-Register a suffix rule defined on C<$where> that transforms
-files ending in C<$src> into files ending in C<$dest>.
+Register a suffix-based pattern rule defined on C<$where> that
+transforms files ending in C<$src> into files ending in C<$dest>.
This upgrades the C<$suffix_rules> variables.
@@ -396,7 +389,6 @@ sub register_suffix_rule ($$$)
my ($where, $src, $dest) = @_;
verb "Sources ending in $src become $dest";
- push @_suffixes, $src, $dest;
# When transforming sources to objects, Automake uses the
# %suffix_rules to move from each source extension to
@@ -474,17 +466,6 @@ sub suffix_rules_count ()
return (scalar keys %$suffix_rules) - (scalar keys %$_suffix_rules_default);
}
-=item C<@list = suffixes>
-
-Return the list of known suffixes.
-
-=cut
-
-sub suffixes ()
-{
- return @_suffixes;
-}
-
=item C<rule ($rulename)>
Return the C<Automake::Rule> object for the rule
@@ -810,36 +791,27 @@ sub define ($$$$$;$)
$rule->set ($c, $def);
}
- # We honor inference rules with multiple targets because many
- # makes support this and people use it. However this is disallowed
- # by POSIX. We'll print a warning later.
- my $target_count = 0;
- my $inference_rule_count = 0;
+ my $chars_rx = '[a-zA-Z0-9_()address@hidden';
+ my $suffix_rule_rx = "^(\\.$chars_rx+)(\\.$chars_rx+)(?:\\s|\$)";
+ my $pattern_rx ="^%(\\.$chars_rx+)";
- for my $t (split (' ', $target))
+ # Let's see if the rule is a suffix-based pattern rule we can handle.
+ if ($target =~ /^%(\.$chars_rx)$/o)
{
- ++$target_count;
- # Check if the rule is a suffix rule: either it's a rule for
- # two known extensions...
- if ($t =~ /^($KNOWN_EXTENSIONS_PATTERN)($KNOWN_EXTENSIONS_PATTERN)$/
- # ...or it's a rule with unknown extensions (i.e., the rule
- # looks like '.foo.bar:' but '.foo' or '.bar' are not
- # declared in SUFFIXES and are not known language
- # extensions). Automake will complete SUFFIXES from
- # @suffixes automatically (see handle_footer).
- || ($t =~ /$_SUFFIX_RULE_PATTERN/o && accept_extensions($1)))
- {
- ++$inference_rule_count;
- register_suffix_rule ($where, $1, $2);
- }
+ my $objsuf = $1;
+ if ($deps =~ /^\s*%(\.$chars_rx)(\s|$)/o)
+ {
+ my $srcsuf = $1;
+ accept_extensions ($srcsuf);
+ register_suffix_rule ($where, $srcsuf, $objsuf);
+ }
+ }
+ # We don't support old-fashioned suffix rules anymore, but want to
+ # report them as errors.
+ elsif ($target =~ /$suffix_rule_rx/o)
+ {
+ error $where, "use pattern rules, not old-fashioned suffix rules";
}
-
- # POSIX allows multiple targets before the colon, but disallows
- # definitions of multiple inference rules. It's also
- # disallowed to mix plain targets with inference rules.
- msg ('portability', $where,
- "inference rules can have only one target before the colon (POSIX)")
- if $inference_rule_count > 0 && $target_count > 1;
return @conds;
}
diff --git a/lib/am/footer.am b/lib/am/footer.am
index 71ac76b..691b0c4 100644
--- a/lib/am/footer.am
+++ b/lib/am/footer.am
@@ -14,6 +14,9 @@
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Neutralize the default suffix rules.
+.SUFFIXES:
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/t/amopts-variable-expansion.sh b/t/amopts-variable-expansion.sh
index 7a04e47..2c39df8 100755
--- a/t/amopts-variable-expansion.sh
+++ b/t/amopts-variable-expansion.sh
@@ -25,27 +25,30 @@ cat > configure.ac <<END
AC_INIT([$me], [1.0])
AM_INIT_AUTOMAKE([-Wall -Werror gnu])
AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
END
cat > Makefile.am <<'END'
-# The following should expand to '-Wnone -Wno-error foreign -Wportability'.
+# The following should expand to:
+# subdir-objects -Wnone -Wno-error foreign -Wportability
AUTOMAKE_OPTIONS = $(foo) foreign
AUTOMAKE_OPTIONS += ${bar}
foo = $(foo1)
foo1 = ${foo2}
-foo2 = -Wnone
+foo2 = subdir-objects -Wnone
foo2 += $(foo3)
foo3 = -Wno-error
bar = -Wportability
+noinst_PROGRAMS = foo
# This will give a warning with '-Wportability'.
-.aaa.bbb .ccc.ddd:
+foo_SOURCES = sub/foo.c
# This would give a warning with '-Woverride'.
install:
END
$ACLOCAL
AUTOMAKE_run
-grep '^Makefile\.am:.*inference rules can have only one target' stderr
+grep '^Makefile\.am:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
grep README stderr && Exit 1
$EGREP '(install|override)' stderr && Exit 1
diff --git a/t/ext3.sh b/t/ext3.sh
deleted file mode 100755
index bd5ed6d..0000000
--- a/t/ext3.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2009-2012 Free Software Foundation, Inc.
-#
-# This program 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 3 of the License, or
-# (at your option) any later version.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Cover corner cases of derive_suffix wrt. file extensions:
-# - extension declared with SUFFIXES but with no suffix rule for it
-# - extension with a suffix rule but none that leads us to $(OBJEXT)
-# In both cases, we don't try to create a rule; but we shouldn't
-# fail either, because magic might be happening behind our back.
-
-. ./defs || Exit 1
-
-cat >> configure.ac << 'END'
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = foo bar
-foo_SOURCES = foo.goo
-SUFFIXES = .goo
-bar_SOURCES = bar.woo
-.woo.zoo: ; making a zoo $@ from a woo $<
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-Exit 0
diff --git a/t/parallel-tests8.sh b/t/parallel-tests8.sh
index a36cea7..46e4120 100755
--- a/t/parallel-tests8.sh
+++ b/t/parallel-tests8.sh
@@ -25,7 +25,7 @@ END
cat > Makefile.am << 'END'
TESTS = foo.test
-.in.test:
+%.test: %.in
cp $< $@ && chmod +x $@
check_SCRIPTS = $(TESTS)
EXTRA_DIST = foo.in foo.test
diff --git a/t/specflg10.sh b/t/specflg10.sh
index 3b8fc5b..6af4d28 100755
--- a/t/specflg10.sh
+++ b/t/specflg10.sh
@@ -44,15 +44,14 @@ bin_PROGRAMS = bla
if COND
AM_DEFAULT_SOURCE_EXT = .foo .quux
endif
-SUFFIXES = .foo .c
-.foo.c:
+%.c: %.foo
cat $< >$@
BUILT_SOURCES = bla.c
CLEANFILES = bla.c
END
cat > foo.c << 'END'
-int main () { return 0; }
+int main (void) { return 0; }
END
cp foo.c sub/bar.cpp
diff --git a/t/suffix-chain.tap b/t/suffix-chain.sh
similarity index 73%
rename from t/suffix-chain.tap
rename to t/suffix-chain.sh
index 9b3191e..2ff72f9 100755
--- a/t/suffix-chain.tap
+++ b/t/suffix-chain.sh
@@ -15,14 +15,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check that Automake can take advantage of GNU make ability to
-# automatically chain suffix rules.
+# automatically chain suffix-based pattern rules.
# See automake bug#7824 and bug#7670.
required=cc
. ./defs || Exit 1
-plan_ 8
-
cat >> configure.ac <<'END'
AC_PROG_CC
AC_OUTPUT
@@ -31,28 +29,28 @@ END
cat > Makefile.am <<'END'
bin_PROGRAMS = foo
foo_SOURCES = foo.c1
-.c1.c0:
+%.c0: %.c1
(echo 'int main (void)' && echo '{' && cat $<) > $@
-.c0.c:
+%.c: %.c0
(cat $< && echo '}') > $@
CLEANFILES = foo.c0 foo.c
END
echo 'return 0;' > foo.c1
-command_ok_ "aclocal" $ACLOCAL
-command_ok_ "automake" $AUTOMAKE
-command_ok_ "autoconf" $AUTOCONF
-command_ok_ "configure" ./configure
-command_ok_ "make all" $MAKE all
-command_ok_ "make distcheck" $MAKE distcheck
-command_ok_ "clean" $MAKE clean
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+./configure
+$MAKE all
+$MAKE distcheck
-# Sanity check.
+# Try with explicit dependencies as well.
+$MAKE clean
cat >> Makefile <<'END'
foo.c: foo.c0
foo.c0: foo.c1
END
-command_ok_ "make with explicit dependencies" $MAKE
+$MAKE all
:
diff --git a/t/suffix6c.sh b/t/suffix-obj.sh
similarity index 93%
rename from t/suffix6c.sh
rename to t/suffix-obj.sh
index 549f807..925b6ac 100755
--- a/t/suffix6c.sh
+++ b/t/suffix-obj.sh
@@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test to make sure that '.o' and '.obj' are handled like '.$(OBJEXT)'.
-# See also related "grepping" test suffix6.test.
. ./defs || Exit 1
@@ -31,19 +30,15 @@ AC_SUBST([OBJEXT])
AC_OUTPUT
END
-unset OBJEXT || :
-
cat > Makefile.am << 'END'
-SUFFIXES = .zoo .o .obj address@hidden@
-
bin_PROGRAMS = foo
foo_SOURCES = foo.zoo
-.zoo.o:
+%.o: %.zoo
{ echo '=.zoo.o=' && cat $<; } >$@
-.zoo.obj:
+%.obj: %.zoo
{ echo '=.zoo.obj=' && cat $<; } >$@
address@hidden@:
address@hidden@: %.zoo
{ echo 'address@hidden@=' && cat $<; } >$@
END
diff --git a/t/suffix-rules-reject.sh b/t/suffix-rules-reject.sh
new file mode 100755
index 0000000..a4d6aef
--- /dev/null
+++ b/t/suffix-rules-reject.sh
@@ -0,0 +1,55 @@
+#! /bin/sh
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+#
+# This program 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.
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Automake-NG should reject suffix rules in favor of pattern rules.
+
+. ./defs || Exit 1
+
+$ACLOCAL
+
+cat > Makefile.am << 'END'
+.SUFFIXES: .w
+END
+
+cat > Makefile2.am <<'END'
+## Dummy comments ...
+## ... whose only purpose is ...
+## ... to alter ...
+## ... the line count.
+SUFFIXES = .w
+END
+
+cat > Makefile3.am << 'END'
+.foo.bar: ; cp $< $@
+.mu.um:
+ cp $< $@
+.1.2 .3.4:
+ who cares
+END
+
+msg='use pattern rules, not old-fashioned suffix rules'
+
+AUTOMAKE_fails -Wno-error -Wnone Makefile
+grep "^Makefile\\.am:1:.*$msg" stderr
+AUTOMAKE_fails -Wno-error -Wnone Makefile2
+grep "^Makefile2\\.am:5:.*$msg" stderr
+AUTOMAKE_fails -Wno-error -Wnone Makefile3
+grep "^Makefile3\\.am:1:.*$msg" stderr
+grep "^Makefile3\\.am:2:.*$msg" stderr
+grep "^Makefile3\\.am:4:.*$msg" stderr
+test `grep -c "$msg" stderr` -eq 3
+
+:
diff --git a/t/suffix10.tap b/t/suffix10.sh
similarity index 80%
rename from t/suffix10.tap
rename to t/suffix10.sh
index 0ef7615..cd34fc7 100755
--- a/t/suffix10.tap
+++ b/t/suffix10.sh
@@ -15,13 +15,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Make sure that derivations work with .lo too.
+# Also check suffixes containing the'-' character.
# (related to PR/37)
required='cc libtoolize yacc'
. ./defs || Exit 1
-plan_ 7
-
cat >>configure.ac <<EOF
AC_PROG_CC
AC_PROG_YACC
@@ -32,8 +31,8 @@ EOF
cat >Makefile.am << 'END'
lib_LTLIBRARIES = libfoo.la
-libfoo_la_SOURCES = foo.x_
-.x_.y:
+libfoo_la_SOURCES = foo.x-x
+%.y: %.x-x
rm -f $@ address@hidden
## The leading ':;' works around a bug in bash <= 3.2.
:; { echo '/* autogenerated */' \
@@ -52,16 +51,18 @@ test:
echo $(libfoo_la_OBJECTS) | grep '^foo\.lo$$'
END
-cat > foo.x_ << 'END'
+cat > foo.x-x << 'END'
int foo (void) { return yyparse(); }
END
-command_ok_ "libtoolize" libtoolize --force
-command_ok_ "aclocal" $ACLOCAL
-command_ok_ "autoconf" $AUTOCONF
-command_ok_ "automake" $AUTOMAKE --add-missing
-command_ok_ "configure" ./configure
-command_ok_ "make test" $MAKE test
-command_ok_ "make all" $MAKE all
+libtoolize --force
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE test
+$MAKE all
:
diff --git a/t/suffix11.tap b/t/suffix11.tap
deleted file mode 100755
index 113e4b3..0000000
--- a/t/suffix11.tap
+++ /dev/null
@@ -1,75 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002-2012 Free Software Foundation, Inc.
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Tests that Automake understands multiple suffix rules on the same line.
-# PR/371 and PR/372: Reported by Duncan Gibson.
-# We also check for suffixes containing '-'.
-
-required=cc
-. ./defs || Exit 1
-
-plan_ 10
-
-cat >>configure.ac <<EOF
-AC_PROG_CC
-AC_OUTPUT
-EOF
-
-cat >Makefile.am << 'END'
-bin_PROGRAMS = foo bar baz
-foo_SOURCES = foo.x_
-bar_SOURCES = bar.y-z
-baz_SOURCES = baz1.x_ baz2.y-z
-
-.y-z.c .x_.c:
- sed 's/INTEGER/int/g' $< >$@
-
-CLEANFILES = foo.c bar.c baz1.c baz2.c
-
-.PHONY: test-real test-fake
-test-fake:
- echo $(foo_OBJECTS) | grep '^foo\.foo$$'
- echo $(bar_OBJECTS) | grep '^bar\.foo$$'
- echo $(baz_OBJECTS) | grep '^baz1\.foo baz2\.foo$$'
-test-real:
- echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT)$$'
- echo $(bar_OBJECTS) | grep '^bar\.$(OBJEXT)$$'
- echo $(baz_OBJECTS) | grep '^baz1\.$(OBJEXT) baz2\.$(OBJEXT)$$'
-check-local: test-real
-END
-
-echo 'INTEGER main(void) { return 0; }' > foo.x_
-echo 'INTEGER main(void) { return 0; }' > bar.y-z
-echo 'INTEGER main(void) { INTEGER baz(void); return baz(); }' > baz1.x_
-echo 'INTEGER baz(void) { return 0; }' > baz2.y-z
-
-command_ok_ "aclocal" $ACLOCAL
-command_ok_ "autoconf" $AUTOCONF
-
-# What we do is not portable. Automake should warn.
-AUTOMAKE_fails -a
-command_ok_ "warn about unportable make usage" \
- grep '[iI]nference rules can have only one target before the colon' stderr
-# But this should work anyway.
-command_ok_ "automake" $AUTOMAKE -a -Wno-portability
-
-command_ok_ "configure" ./configure
-command_ok_ "make test-fake" $MAKE test-fake OBJEXT=foo
-command_ok_ "make test-real" $MAKE test-real
-command_ok_ "make" $MAKE
-command_ok_ "make distcheck" $MAKE distcheck
-
-:
diff --git a/t/suffix12.sh b/t/suffix12.sh
index 2910527..ecdba67 100755
--- a/t/suffix12.sh
+++ b/t/suffix12.sh
@@ -14,8 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Tests that Automake understands suffix rules with subdir objects.
-# Reported by John Ratliff.
+# Tests that pattern rules with subdir objects are understood.
+# Originally reported by John Ratliff against suffix rules.
+# This test currently fails, because Automake-NG don't scan nor
+# process pattern rules.
required=cc
. ./defs || Exit 1
@@ -27,9 +29,8 @@ EOF
cat >Makefile.am << 'END'
AUTOMAKE_OPTIONS = subdir-objects
-SUFFIXES = .baz .o
# We fake here:
-.baz.o:
+%.o: %.baz
cp $< $@
bin_PROGRAMS = foo
diff --git a/t/suffix13.sh b/t/suffix13.sh
index d797ae5..86c5975 100755
--- a/t/suffix13.sh
+++ b/t/suffix13.sh
@@ -14,9 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Tests that Automake understands suffix rules with renamed objects
-# and subdir objects.
-# Reported by Florian Briegel.
+# Tests that Automake understands suffix-based pattern rules with
+# renamed objects and subdir objects. Reported by Florian Briegel.
required=cc
. ./defs || Exit 1
@@ -29,8 +28,7 @@ EOF
cat >Makefile.am << 'END'
AUTOMAKE_OPTIONS = subdir-objects
-SUFFIXES = .baz .c
-.baz.c:
+%.c: %.baz
case $@ in sub/*) $(MKDIR_P) sub;; *) :;; esac
cp $< $@
@@ -38,7 +36,7 @@ DISTCLEANFILES = sub/bar.c
bin_PROGRAMS = foo
foo_SOURCES = foo.c sub/bar.baz
-foo_CFLAGS =
+foo_CFLAGS = -DRETVAL=0
END
mkdir sub
@@ -47,7 +45,7 @@ extern int foo ();
int main () { return foo (); }
END
cat > foo.c <<'END'
-int foo () { return 0; }
+int foo () { return RETVAL; }
END
$ACLOCAL
diff --git a/t/suffix3.tap b/t/suffix3.sh
similarity index 73%
rename from t/suffix3.tap
rename to t/suffix3.sh
index 95a0ebe..1ef8a2b 100755
--- a/t/suffix3.tap
+++ b/t/suffix3.sh
@@ -19,16 +19,13 @@
required=c++
. ./defs || Exit 1
-plan_ 10
-
cat >> configure.ac << 'END'
AC_PROG_CXX
AC_OUTPUT
END
cat > Makefile.am << 'END'
-SUFFIXES = .zoo
-.zoo.cc:
+%.cc: %.zoo
sed 's/INTEGER/int/g' $< >$@
bin_PROGRAMS = foo
foo_SOURCES = foo.zoo
@@ -38,21 +35,19 @@ FOO = foo
CLEANFILES = $(FOO).cc
END
-command_ok_ "aclocal" $ACLOCAL
-command_ok_ "automake" $AUTOMAKE
+$ACLOCAL
+$AUTOMAKE
# The foo.cc intermediate step is implicit, it's a mistake if
# Automake requires this file somewhere. Also, Automake should
# not require the file 'foo.c' anywhere.
-command_ok_ "intermediate files not mentioned" \
- not $FGREP foo.c Makefile.in
+$FGREP foo.c Makefile.in && Exit 1
# However Automake must figure that foo.zoo is eventually
# transformed into foo.o, and use this latter file (to link foo).
-command_ok_ "final object file figured out" \
- $FGREP 'foo.$(OBJEXT)' Makefile.in
+$FGREP 'foo.$(OBJEXT)' Makefile.in
-command_ok_ "autoconf" $AUTOCONF
-command_ok_ "configure" ./configure
+$AUTOCONF
+./configure
# This is deliberately valid C++, but invalid C.
cat > foo.zoo <<'END'
@@ -63,15 +58,15 @@ INTEGER main (void)
}
END
-command_ok_ "make all" $MAKE all
-command_ok_ "make distcheck" $MAKE distcheck
+$MAKE all
+$MAKE distcheck
-# FIXME: should we check that intermediate file 'foo.cc' has
+# TODO: should we check that intermediate file 'foo.cc' has
# been removed? Or is this requiring too much from the make
# implementation?
# Intermediate files should not be distributed.
-command_ok_ "make distdir" $MAKE distdir
-command_ok_ "intermediate file not distributed" test ! -r $me-1.0/foo.cc
+$MAKE distdir
+test ! -r $me-1.0/foo.cc
:
diff --git a/t/suffix4.sh b/t/suffix4.sh
deleted file mode 100755
index 4523096..0000000
--- a/t/suffix4.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Test to make sure Automake doesn't abort on user-defined extensions.
-# Based on a report from Dmitry Mikhin <address@hidden>.
-
-# Also make sure that .SUFFIXES is automatically adjusted with
-# extensions from implicit rules.
-
-. ./defs || Exit 1
-
-cat > Makefile.am << 'END'
-.k.o:
- echo $< > $@
-
-bin_PROGRAMS = foo
-foo_SOURCES = foo.k
-END
-
-$ACLOCAL
-$AUTOMAKE
-grep '^\.SUFFIXES:' Makefile.in | sed -e 's/$/ /' > suffixes
-cat suffixes
-$FGREP ' .k ' suffixes
-
-:
diff --git a/t/suffix5.sh b/t/suffix5.sh
index 85a4c06..4963a58 100755
--- a/t/suffix5.sh
+++ b/t/suffix5.sh
@@ -29,7 +29,7 @@ AC_OUTPUT
END
cat > Makefile.am << 'END'
-.k.lo:
+%.lo: %.k
(echo $< && cat $<) > $@
noinst_LTLIBRARIES = libfoo.la
diff --git a/t/suffix6.sh b/t/suffix6.sh
deleted file mode 100755
index 29ffc4d..0000000
--- a/t/suffix6.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Test to make sure Automake supports implicit rules with dot-less
-# extensions. Also make sure that '.o' and '.obj' are handled like
-# '.$(OBJEXT)'. See also related "semantic" tests suffix6b.test
-# and suffix6c.test.
-
-. ./defs || Exit 1
-
-cat > Makefile.am << 'END'
-SUFFIXES = a b .$(OBJEXT) c .o .obj
-bin_PROGRAMS = foo
-foo_SOURCES = fooa barc bazc
-ab:
- dummy action 1
-b.$(OBJEXT):
- dummy action 2
-c.o:
- dummy action C
-c.obj:
- dummy action C
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-sed -n -e '/foo_OBJECTS *=.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
-}' -e 's/$/ /' -e 's/^.*foo_OBJECTS *= */ /p' Makefile.in > foo-objects
-cat foo-objects
-
-# Automake must figure that fooa translates to foo.$(OBJEXT) and
-# foo.$(OBJEXT) using the following rules:
-# fooa --[ab]--> foob --[b.$(OBJEXT)]--> foo.$(OBJEXT)
-$FGREP ' foo.$(OBJEXT) ' foo-objects
-# barc --[c.o]--> bar.$(OBJEXT) ## This is really meant!
-$FGREP ' bar.$(OBJEXT) ' foo-objects
-# bazc --[c.obj]--> baz.$(OBJEXT) ## This is really meant!
-$FGREP ' baz.$(OBJEXT) ' foo-objects
-
-:
diff --git a/t/suffix6b.sh b/t/suffix6b.sh
deleted file mode 100755
index 67ef877..0000000
--- a/t/suffix6b.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Test to make sure Automake supports implicit rules with dot-less
-# extensions. Se also related "grepping" test suffix6.test.
-
-. ./defs || Exit 1
-
-cat >> configure.ac << 'END'
-# $(LINK) is not defined automatically by Automake, since the *_SOURCES
-# variables don't contain any known extension (.c, .cc, .f, ...).
-# So we need this hack -- but since such an hack can also serve as a
-# mild stress test, that's ok.
-AC_SUBST([LINK], ['cat >$@'])
-AC_SUBST([OBJEXT], [oOo])
-AC_SUBST([EXEEXT], [.XxX])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-SUFFIXES = a b c .$(OBJEXT)
-bin_PROGRAMS = foo
-foo_SOURCES = fooa
-ab:
- { echo '=ab=' && cat $<; } >$@
-bc:
- { echo '=bc=' && cat $<; } >$@
-c.$(OBJEXT):
- { echo '=b.obj=' && cat $<; } >$@
-test:
- : For debugging.
- ls -l
- : Implicit intermediate files should be removed by GNU make ...
- test ! -r foob
- test ! -r fooc
- : ... but object files should not.
- cat foo.$(OBJEXT)
- : For debugging.
- cat foo.XxX
- : Now check that the chain of implicit rules has been executed
- : completely and in the correct order.
- (echo =b.obj= && echo =bc= && echo =ab= && echo =src=) > exp
- diff exp foo.XxX
- rm -f exp
-.PHONY: test
-check-local: test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
-echo =src= > fooa
-
-$MAKE
-$MAKE test
-$MAKE distcheck
-
-:
diff --git a/t/suffix7.sh b/t/suffix7.sh
deleted file mode 100755
index bef1031..0000000
--- a/t/suffix7.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Test to make sure Automake supports implicit rules "confusing"
-# extensions. Inspired by a mail from Alex Hornby.
-
-. ./defs || Exit 1
-
-cat > Makefile.am << 'END'
-SUFFIXES = .idl S.cpp C.h
-SUFFIXES += C.cpp S.h
-.idlC.cpp:
- cp $< $@
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-# Make sure Automake has NOT recognized .cpp and .idlC as two new
-# extensions.
-grep 'SUFFIXES.* \.cpp' Makefile.in && Exit 1
-grep 'SUFFIXES.* \.idlC' Makefile.in && Exit 1
-
-:
diff --git a/t/suffix8.tap b/t/suffix8.sh
similarity index 77%
rename from t/suffix8.tap
rename to t/suffix8.sh
index fd549cf..c1f254e 100755
--- a/t/suffix8.tap
+++ b/t/suffix8.sh
@@ -21,8 +21,6 @@
required='cc libtoolize'
. ./defs || Exit 1
-plan_ 10
-
cat >>configure.ac <<'END'
AM_PROG_AR
AM_PROG_LIBTOOL
@@ -41,22 +39,17 @@ lib_LTLIBRARIES = libfoo.la
foo_SOURCES = foo.x_
libfoo_la_SOURCES = bar.x_
-.x_.y_:
+%.y_: %.x_
cp $< $@
-.y_.o:
+%.o: %.y_
cp $< $@
-.y_.obj:
+%.obj: %.y_
cp $< $@
-.y_.z_:
+%.z_: %.y_
cp $< $@
-.z_.lo:
+%.lo: %.z_
cp $< $@
-# Some make implementations don't remove intermediate files
-# automatically, thus causing "make distcheck" to fail if
-# this is not added.
-MOSTLYCLEANFILES = *.y_ *.z_
-
.PHONY: test0 test1 test2
test0:
echo $(foo_OBJECTS) | grep '^foo\.foo$$'
@@ -73,15 +66,16 @@ END
echo 'int main (void) { return 0; }' > foo.x_
echo 'int bar (void) { return 0; }' > bar.x_
-command_ok_ "libtoolize" libtoolize
-command_ok_ "aclocal" $ACLOCAL
-command_ok_ "autoconf" $AUTOCONF
-command_ok_ "automake" $AUTOMAKE -a
-command_ok_ "configure" ./configure
-command_ok_ "make test0" $MAKE test0 OBJEXT=foo
+libtoolize
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE test0 OBJEXT=foo
for target in test1 test2 all distcheck; do
- command_ok_ "make $target" $MAKE $target
+ $MAKE $target
done
:
diff --git a/t/suffix9.sh b/t/suffix9.sh
index 2c1d73d..f6cdae9 100755
--- a/t/suffix9.sh
+++ b/t/suffix9.sh
@@ -39,9 +39,9 @@ cat >Makefile.am << 'END'
bin_PROGRAMS = foo
foo_SOURCES = foo.x_
-.x_.y:
+%.y: %.x_
cp $< $@
-.x_.c:
+%.c: %.x_
cp $< $@
END
@@ -53,9 +53,9 @@ cat >Makefile.am << 'END'
bin_PROGRAMS = foo
foo_SOURCES = foo.x_
-.x_.c:
+%.c: %.x_
cp $< $@
-.x_.y:
+%.y: %.x_
cp $< $@
END
diff --git a/t/warning-groups-win-over-strictness.sh
b/t/warning-groups-win-over-strictness.sh
index 192e409..70b8b7a 100755
--- a/t/warning-groups-win-over-strictness.sh
+++ b/t/warning-groups-win-over-strictness.sh
@@ -38,9 +38,10 @@ AC_OUTPUT
END
cat > Makefile.am <<END
+AUTOMAKE_OPTIONS = subdir-objects
include automake-options.am
-.c.o .c.obj:
- @echo bad
+noinst_PROGRAMS = foo
+foo_SOURCES = sub/foo.c
END
rm -rf autom4te*.cache
@@ -48,7 +49,7 @@ rm -rf autom4te*.cache
echo 'AM_INIT_AUTOMAKE' > am-init-automake.m4
$ACLOCAL
AUTOMAKE_fails -Werror -Wall --foreign
-grep '^Makefile\.am:.*inference rules can have only one target' stderr
+grep '^Makefile\.am:4:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
rm -rf autom4te*.cache
: > automake-options.am
@@ -57,7 +58,7 @@ $ACLOCAL
$AUTOMAKE
rm -rf autom4te*.cache
-echo 'AUTOMAKE_OPTIONS = -Werror -Wnone gnits' > automake-options.am
+echo 'AUTOMAKE_OPTIONS += -Werror -Wnone gnits' > automake-options.am
echo 'AM_INIT_AUTOMAKE' > am-init-automake.m4
$ACLOCAL
$AUTOMAKE
diff --git a/t/warnings-override.sh b/t/warnings-override.sh
index 81903f8..956bf81 100755
--- a/t/warnings-override.sh
+++ b/t/warnings-override.sh
@@ -26,16 +26,10 @@
# We want (almost) complete control over automake options.
AUTOMAKE="$am_original_AUTOMAKE -Werror"
-cat > Makefile.am <<'END'
-.c.o .c.obj:
- @echo bad
-AUTOMAKE_OPTIONS =
-END
-
set_warnings ()
{
set +x
- sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+ sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *+=.*|\\1 += $1|" \
-e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
mv -f $2-t $2
set -x
@@ -50,9 +44,19 @@ ok ()
ko ()
{
AUTOMAKE_fails $*
- grep '^Makefile\.am:1:.*inference rules can have only one target' stderr
+ grep '^Makefile\.am:5:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
}
+echo AC_PROG_CC >> configure.ac
+
+cat > Makefile.am <<END
+AUTOMAKE_OPTIONS = subdir-objects
+## For later editing by 'set_am_opts'.
+AUTOMAKE_OPTIONS +=
+noinst_PROGRAMS = foo
+foo_SOURCES = sub/foo.c
+END
+
$ACLOCAL
# Files required in gnu strictness.
diff --git a/t/warnings-precedence.sh b/t/warnings-precedence.sh
index 9dc6a35..715e294 100755
--- a/t/warnings-precedence.sh
+++ b/t/warnings-precedence.sh
@@ -23,16 +23,10 @@
# We want (almost) complete control over automake options.
AUTOMAKE="$am_original_AUTOMAKE -Werror"
-cat > Makefile.am <<'END'
-.c.o .c.obj:
- @echo bad
-AUTOMAKE_OPTIONS =
-END
-
set_warnings ()
{
set +x
- sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+ sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *+=.*|\\1 += $1|" \
-e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
mv -f $2-t $2
set -x
@@ -47,12 +41,22 @@ ok ()
ko ()
{
AUTOMAKE_fails $*
- grep '^Makefile\.am:1:.*inference rules can have only one target' stderr
+ grep '^Makefile\.am:5:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
}
# Files required in gnu strictness.
touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+echo AC_PROG_CC >> configure.ac
+
+cat > Makefile.am <<END
+AUTOMAKE_OPTIONS = subdir-objects
+## For later editing by 'set_warnings'.
+AUTOMAKE_OPTIONS +=
+noinst_PROGRAMS = foo
+foo_SOURCES = sub/foo.c
+END
+
$ACLOCAL
ok -Wportability -Wno-portability
ko -Wno-portability -Wportability
diff --git a/t/warnings-strictness-interactions.sh
b/t/warnings-strictness-interactions.sh
index d281475..c5e70e6 100755
--- a/t/warnings-strictness-interactions.sh
+++ b/t/warnings-strictness-interactions.sh
@@ -23,16 +23,20 @@
# We want (almost) complete control over automake options.
AUTOMAKE="$am_original_AUTOMAKE -Werror"
+echo AC_PROG_CC >> configure.ac
+
cat > Makefile.am <<END
-AUTOMAKE_OPTIONS =
-.c.o .c.obj:
- @echo bad
+AUTOMAKE_OPTIONS = subdir-objects
+## For later editing by 'set_am_opts'.
+AUTOMAKE_OPTIONS +=
+noinst_PROGRAMS = foo
+foo_SOURCES = sub/foo.c
END
set_am_opts ()
{
set +x
- sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+ sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *+=.*|\\1 += $1|" \
-e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
mv -f $2-t $2
set -x
@@ -54,7 +58,6 @@ set_am_opts '-Wno-portability' configure.ac
set_am_opts 'gnu' Makefile.am
AUTOMAKE_fails
-$ACLOCAL
-grep '^Makefile\.am:2:.*inference rules can have only one target' stderr
+grep '^Makefile\.am:5:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
:
diff --git a/t/warnings-win-over-strictness.sh
b/t/warnings-win-over-strictness.sh
index c537ac7..4deb27d 100755
--- a/t/warnings-win-over-strictness.sh
+++ b/t/warnings-win-over-strictness.sh
@@ -31,14 +31,14 @@ ok ()
ko ()
{
AUTOMAKE_run $*
- grep '^Makefile\.am:.*inference rules can have only one target' stderr
+ grep '^Makefile\.am:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
test `wc -l <stderr` -eq 1
}
-set_am_opts()
+set_am_opts ()
{
set +x
- sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+ sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *+=.*|\\1 += $1|" \
-e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
mv -f $2-t $2
set -x
@@ -48,10 +48,14 @@ set_am_opts()
# Files required in gnu strictness.
touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+echo AC_PROG_CC >> configure.ac
+
cat > Makefile.am <<END
-AUTOMAKE_OPTIONS =
-.c.o .c.obj:
- @echo bad
+AUTOMAKE_OPTIONS = subdir-objects
+## For later editing by 'set_am_opts'.
+AUTOMAKE_OPTIONS +=
+noinst_PROGRAMS = foo
+foo_SOURCES = sub/foo.c
END
$ACLOCAL
--
1.7.9.5
- [Automake-NG] [PATCH 0/4] Prefer pattern rules over suffix rules, Stefano Lattarini, 2012/05/10
- [Automake-NG] [PATCH 1/4] [ng] am: prefer pattern rules over old-fashioned suffix rules, Stefano Lattarini, 2012/05/10
- [Automake-NG] [PATCH 2/4] [ng] rules: can pass deps to &Automake::Rule::define, Stefano Lattarini, 2012/05/10
- [Automake-NG] [PATCH 4/4] [ng] cleanup: &Automake::Variable::hook is unused, remove it, Stefano Lattarini, 2012/05/10
- [Automake-NG] [PATCH 3/4] [ng] rules: forbid old-fashioned suffix rules, prefer pattern rules,
Stefano Lattarini <=
- Re: [Automake-NG] [PATCH 0/4] Prefer pattern rules over suffix rules, Akim Demaille, 2012/05/10