From: Stefano Lattarini Date: Thu, 1 Sep 2011 17:17:39 +0000 (+0200) Subject: docs: report few more automake parsing limitations X-Git-Tag: v1.11.1b~20^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1dcba7b847b137330ed91ef8269d403163387e7e;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 7c11ab304..5d0eda1f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-09-01 Stefano Lattarini + + 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 tests: list "forgotten" test script in TESTS diff --git a/doc/automake.texi b/doc/automake.texi index 49a6cd154..3be857851 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -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 diff --git a/tests/Makefile.am b/tests/Makefile.am index a1c67ffc3..61014608a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 4b2d8457d..108672d3f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..685d2b65d --- /dev/null +++ b/tests/doc-parsing-buglets-colneq-subst.test @@ -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 . + +# 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: +# or: + +. ./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 index 000000000..acff3634a --- /dev/null +++ b/tests/doc-parsing-buglets-tabs.test @@ -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 . + +# 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 <> 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 + +: