]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
docs: report few more automake parsing limitations
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 1 Sep 2011 17:17:39 +0000 (19:17 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 1 Sep 2011 19:36:28 +0000 (21:36 +0200)
Partly motivated by automake bug#8360.

* doc/automake.texi (General Operation): Report few more automake
limitations w.r.t. parsing of unusual makefile constructs.  Related
minor reorderings.
* tests/doc-parsing-buglets-colneq-subst.test: New test.
* tests/doc-parsing-buglets-tabs.test: Likewise.
* tests/Makefile.am (TESTS): Update.

ChangeLog
doc/automake.texi
tests/Makefile.am
tests/Makefile.in
tests/doc-parsing-buglets-colneq-subst.test [new file with mode: 0755]
tests/doc-parsing-buglets-tabs.test [new file with mode: 0755]

index 7c11ab304f2750fbbb890d973c28e78a12a6b1d1..5d0eda1f26d5aa3a45616f1ab980e1a760adef36 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-09-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs: report few more automake parsing limitations
+       Partly motivated by automake bug#8360.
+       * doc/automake.texi (General Operation): Report few more automake
+       limitations w.r.t. parsing of unusual makefile constructs.  Related
+       minor reorderings.
+       * tests/doc-parsing-buglets-colneq-subst.test: New test.
+       * tests/doc-parsing-buglets-tabs.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-08-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: list "forgotten" test script in TESTS
index 49a6cd1547d428cc6e9f038dcbdb0409537b03b6..3be857851bde28f0c5b780e02cfdad9d97cb68c6 100644 (file)
@@ -1813,14 +1813,30 @@ supported.  This operator appends its right hand argument to the variable
 specified on the left.  Automake will translate the operator into
 an ordinary @samp{=} operator; @samp{+=} will thus work with any make program.
 
-@cindex indentation
-Further note that variable assignments should not be indented with
-@key{TAB} characters, use spaces if necessary.  On the other hand,
-rule commands should be indented with a leading @key{TAB} character.
-
 Automake tries to keep comments grouped with any adjoining rules or
 variable definitions.
 
+@cindex Limitations of automake parser
+@cindex Automake parser, limitations of
+@cindex indentation in Makefile.am
+Generally, Automake is not particularly smart in the parsing of unusual
+Makefile constructs, so you're advised to avoid fancy constructs or
+``creative'' use of whitespaces.
+@c Keep this in sync with doc-parsing-buglets-tabs.test.
+For example, @key{TAB} characters cannot be used between a target name
+and the following ``@code{:}'' character, and variable assignments
+shouldn't be indented with @key{TAB} characters.
+@c Keep this in sync with doc-parsing-buglets-colneq-subst.test.
+Also, using more complex macro in target names can cause trouble:
+
+@example
+% @kbd{cat Makefile.am}
+$(FOO:=x): bar
+% @kbd{automake}
+Makefile.am:1: bad characters in variable name `$(FOO'
+Makefile.am:1: `:='-style assignments are not portable
+@end example
+
 @cindex Make targets, overriding
 @cindex Make rules, overriding
 @cindex Overriding make rules
index a1c67ffc3a3fa6fc9e33f7a3b5238f29ec989ded..61014608af7256c27efc36a7f6c0c581b0737c28 100644 (file)
@@ -325,6 +325,8 @@ distcheck-configure-flags-subpkg.test \
 distcheck-hook.test \
 distcheck-hook2.test \
 dmalloc.test \
+doc-parsing-buglets-colneq-subst.test \
+doc-parsing-buglets-tabs.test \
 dollar.test \
 dollarvar.test \
 dollarvar2.test \
index 4b2d8457d4e62addf93de6f86c8ffdcc0e9581aa..108672d3f23ea818f2f45c024daa3718d2f48461 100644 (file)
@@ -603,6 +603,8 @@ distcheck-configure-flags-subpkg.test \
 distcheck-hook.test \
 distcheck-hook2.test \
 dmalloc.test \
+doc-parsing-buglets-colneq-subst.test \
+doc-parsing-buglets-tabs.test \
 dollar.test \
 dollarvar.test \
 dollarvar2.test \
diff --git a/tests/doc-parsing-buglets-colneq-subst.test b/tests/doc-parsing-buglets-colneq-subst.test
new file mode 100755 (executable)
index 0000000..685d2b6
--- /dev/null
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check a documented limitation of the Automake's Makefile parser
+# w.r.t. POSIX variable substitutions used in the name of targets.
+# See Section "General Operation" in the Automake manual.
+# If you cause some parts of this test to fail, chances are that you've
+# improved the Automake parser ;-)
+# See: <http://lists.gnu.org/archive/html/automake/2010-08/msg00074.html>
+# or: <http://thread.gmane.org/gmane.comp.sysutils.automake.general/11943/focus=11962>
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am <<'END'
+$(FOO:=x): bar
+END
+
+$ACLOCAL
+AUTOMAKE_fails
+
+grep 'bad characters.*variable name.*\$(FOO' stderr
+grep ':=.*assignments.*not portable' stderr
+
+:
diff --git a/tests/doc-parsing-buglets-tabs.test b/tests/doc-parsing-buglets-tabs.test
new file mode 100755 (executable)
index 0000000..acff363
--- /dev/null
@@ -0,0 +1,61 @@
+#! /bin/sh
+# Copyright (C) 2011 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/>.
+
+# Check the documented limitation of the Automake's Makefile parser w.r.t.
+# use of TAB characters; see Section "General Operation" in the Automake
+# manual, and automake bug#8360.
+# If you cause some parts of this test to fail, chances are that you've
+# improved the Automake parser ;-)
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am <<END
+.PHONY: test
+test: all check
+
+fail:
+${tab}@echo "'\$@ recipe executed'"; exit 1
+
+## This won't be recognized as a target+recipe by Automake.
+all-local${tab}:
+${tab}@exit 1
+
+## This won't be recognized as a target+rdependency by Automake.
+all-local${tab}: fail
+
+just_to_separate: dummy deps
+
+## This won't be recognized as a variable assignment by Automake.
+${tab}bin_PROGRAMS = foo
+END
+
+echo AC_OUTPUT >> configure.in
+
+$ACLOCAL
+$AUTOMAKE
+
+$FGREP '$(EXEEEXT)' Makefile.in && Exit 1
+grep 'all:.*all-local' Makefile.in && Exit 1
+grep "^${tab}bin_PROGRAMS = foo" Makefile.in
+
+$AUTOCONF
+./configure
+
+$MAKE test
+
+: