]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] suffix: don't reject old-fashioned suffix rules anymore
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 29 May 2012 11:45:46 +0000 (13:45 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 29 May 2012 12:55:47 +0000 (14:55 +0200)
Now that, after today's commit 'v1.12-331-g645bb21', Automake-NG does
not follow the chain of user-defined pattern rules anymore, there's no
need to treat such rules preferentially, nor to reject old-fashioned
suffix rules.  This will help interoperability with tools like Gnulib,
which generated Makefile.am fragments that still uses old-fashioned
suffix rules (since they are targeted to mainline Automake).

* automake.in (handle_footer): Do not reject the '.SUFFIXES:' rule
nor the 'SUFFIXES' variable.  Add a "FIXME" comment about why we
still support the 'SUFFIXES' variable.
* lib/Automake/Rule.pm: Do not error out if an old-fashioned suffix
rule is seen.
* lib/am/footer.am (.SUFFIXES): Depend on '$(SUFFIXES)', if that's
non-empty.
* t/suffix-rules-reject.sh: Remove.
* t/suffix-rules-old-fashioned.sh: New.
* NG-NEWS: Adjust.
* doc/automake-ng.texi (Suffixes): Do not state that Automake-NG
rejects attempts to define old-fashioned suffix rules.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NG-NEWS
automake.in
doc/automake-ng.texi
lib/Automake/Rule.pm
lib/am/footer.am
t/suffix-rules-old-fashioned.sh [new file with mode: 0755]
t/suffix-rules-reject.sh [deleted file]

diff --git a/NG-NEWS b/NG-NEWS
index c464ea305a9fa0cc9a7c37debb443a2176f8de0c..28c35788c975fac7798e6be5485ba0bdca5281d0 100644 (file)
--- a/NG-NEWS
+++ b/NG-NEWS
@@ -166,18 +166,6 @@ Parallel testsuite harness
   for suffix-less tests).
 
 
-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.
-
-
 Distribution
 ============
 
index 0bb68298f6728bc4fe91102f466acb06362bd0e8..473796b4b78533dbb7d9e1a60eb2e18eebbff8ec 100644 (file)
@@ -4222,12 +4222,9 @@ sub handle_gettext
 # Handle footer elements.
 sub handle_footer
 {
-  # 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";
+  # FIXME: maybe display a warning if the obsolescent $(SUFFIXES)
+  # FIXME: variable is used?  Currently, we don't do that, to preserve
+  # FIXME: better compatibility with mainline Automake.
   $output_trailer .= file_contents ('footer', new Automake::Location);
 }
 
index 80db240ad8d8b32f67495b2a9e09947a169e9633..6571eb8b3b75a7d3506738e2b64457309daa0390 100644 (file)
@@ -10334,12 +10334,6 @@ doit_SOURCES = doit.foo
 
 Note that the above only works with suffixes that start with a dot.
 
-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
 
index d6c73e7e4c4acdf69929efac87b4a0f44193ec7b..e49e3828a1868945c5e30afb53378991701ddd82 100644 (file)
@@ -625,16 +625,6 @@ sub define ($$$$$;$)
       $rule->set ($c, $def);
     }
 
-  my $chars_rx = '[a-zA-Z0-9_(){}$+@\-]+';
-  my $suffix_rule_rx = "^(\\.$chars_rx+)(\\.$chars_rx+)(?:\\s|\$)";
-
-  # We don't support old-fashioned  suffix rules anymore, but want to
-  # report them as errors.
-  if ($target =~ /$suffix_rule_rx/o)
-    {
-      error $where, "use pattern rules, not old-fashioned suffix rules";
-    }
-
   return @conds;
 }
 
index 691b0c4e842895b26522c96c27c4f259487772cc..3a758f5c1023accec9ad190a8f1a469f6f19f4cd 100644 (file)
@@ -14,8 +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/>.
 
-# Neutralize the default suffix rules.
-.SUFFIXES:
+# For better compatibility with mainline Automake.
+$(if $(SUFFIXES),$(eval .SUFFIXES: $$(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.
diff --git a/t/suffix-rules-old-fashioned.sh b/t/suffix-rules-old-fashioned.sh
new file mode 100755 (executable)
index 0000000..8de64ce
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 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 still accepts old-fashioned suffix rules.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+foobar: ; cp $< $@
+.mu.um:
+       cp $< $@
+.SUFFIXES: foo bar .mu .um
+data_DATA = xbar question.um
+END
+
+mkdir sub
+cat > sub/Makefile.am << 'END'
+SUFFIXES = .1 2 .3 4
+.1.3 24:
+       sed 's/@/O/' $< >$@
+all-local: bar.3 bar4
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+grep SUFFIXES Makefile.in sub/Makefile.in # For debugging.
+
+$AUTOCONF
+echo foofoofoo > xfoo
+echo 'What is the sound of one hand?' > question.mu
+echo '@NE' > sub/bar.1
+echo 'TW@' > sub/bar2
+
+mkdir build
+cd build
+../configure
+$MAKE
+diff ../xfoo xbar
+diff ../question.mu question.um
+test "$(cat sub/bar.3)" = ONE
+test "$(cat sub/bar4)" = TWO
+
+cd ..
+./configure
+$MAKE
+
+diff xfoo xbar
+diff question.mu question.um
+test "$(cat sub/bar.3)" = ONE
+test "$(cat sub/bar4)" = TWO
+
+:
diff --git a/t/suffix-rules-reject.sh b/t/suffix-rules-reject.sh
deleted file mode 100755 (executable)
index a4d6aef..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /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
-
-: