]> git.ipfire.org Git - thirdparty/automake.git/commit
general: assume GNU make semantic in line continuation
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 24 May 2012 20:10:14 +0000 (22:10 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 24 May 2012 23:04:21 +0000 (01:04 +0200)
commitd9ca69945949d464e49cb6097d72a92ca017bf79
tree881daeae3cbb00f842c97409f882a28052a2dd9b
parente1a53f2a4ae379b2a5c79d986ba37b853a57aaa4
general: assume GNU make semantic in line continuation

The line continuation with a backslash is yet another source of
portability problems for Makefiles.

For example, according to the Autoconf manual, some versions of
make (e.g., HP-UX) read multiple newlines following a backslash,
continuing to the next non-empty line.

Also, according to Posix, make comments start with # and continue
until an unescaped newline is reached; but some BSD make versions
do not follow this requirement.

Finally, some make implementations (like Solaris 10 CCS make)
handle a '\#' sequence at the end of a line like it was a line
continuation:

    $ cat Makefile
    x = \#
    all:; : $(x)

    $ /usr/local/bin/gmake
    : #

    $ /usr/ccs/bin/make -f foo.mk
    mksh: Error in reader: Loop detected when expanding macro value `\#
    all:; : $(x)'
    Current working directory /tmp

Luckily, GNU make is more rational and consistent in its handling
of line continuation, which allows us to drop some Automake time
checks.  Not a great simplification, but better than nothing.

* automake.in (read_am_file, file_contents_internal): Don't error
on blank line following trailing backslash, on comment following
trailing backslash, nor on trailing backslash on the last line.
* t/spy-trailing-backslash.sh: New, check that the expected GNU
make semantics actually hold.
* t/backslash-tricks.sh: New test, check that automake truly
supports the uses of backslash it doesn't warn about anymore.
* t/backsl3.sh: Remove as obsolete.
* t/comment5.sh: Likewise.
* t/commen10.sh: Likewise.
* t/commen11.sh: Likewise.
* t/syntax.sh: Likewise.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
automake.in
t/backsl3.sh [deleted file]
t/backslash-tricks.sh [new file with mode: 0755]
t/commen10.sh [deleted file]
t/commen11.sh [deleted file]
t/comment5.sh [deleted file]
t/spy-trailing-backlash.sh [new file with mode: 0755]
t/syntax.sh [deleted file]