[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
whitespace and macros from the command line
From: |
Ralf Wildenhues |
Subject: |
whitespace and macros from the command line |
Date: |
Sun, 23 Jan 2011 11:33:42 +0100 |
User-agent: |
Mutt/1.5.20 (2010-08-04) |
Another patch set to document make limitations in autoconf.texi, and fix
the respective test failures in Automake. I have a separate patch for
Automake maint I'd like to apply, since this is such a long-standing
failure.
I'm not actually sure if Posix mandates the stripping of leading
whitespace from variables set on the make command line. I think
it does (which is why I chose that particular formulation), given
that leading whitespace is stripped after the equals sign in a
Makefile as well.
Any issues with this?
Thanks,
Ralf
Autoconf:
docs: new section about whitespace trimmmed from make command-lines.
* doc/autoconf.texi (Command-line Macros and whitespace): New
section, document trimming of whitespace from macros set on the
command line and from the environment.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 8a92ffd..8475ca8 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -535,6 +535,7 @@ Top
* Newlines in Make Rules:: Using literal newlines in rules
* Comments in Make Macros:: Other problems with Make comments in macros
* Trailing whitespace in Make Macros:: Macro substitution problems
+* Command-line Macros and whitespace:: Whitespace trimming of values
* obj/ and Make:: Don't name a subdirectory @file{obj}
* make -k Status:: Exit status of @samp{make -k}
* VPATH and Make:: @code{VPATH} woes
@@ -19141,6 +19142,7 @@ Portable Make
* Newlines in Make Rules:: Using literal newlines in rules
* Comments in Make Macros:: Other problems with Make comments in macros
* Trailing whitespace in Make Macros:: Macro substitution problems
+* Command-line Macros and whitespace:: Whitespace trimming of values
* obj/ and Make:: Don't name a subdirectory @file{obj}
* make -k Status:: Exit status of @samp{make -k}
* VPATH and Make:: @code{VPATH} woes
@@ -19646,6 +19648,26 @@ Trailing whitespace in Make Macros
@noindent
prints @samp{bar.test .test}.
address@hidden Command-line Macros and whitespace
address@hidden Command-line Macros and whitespace
address@hidden whitespace in command-line macros
address@hidden command-line, macros set on
address@hidden environment, macros set from
+
+Some @command{make} implementations may strip trailing whitespace off of
+macros set on the @command{make} command line in addition to leading
+whitespace. Further, some may strip leading whitespace off of macros
+set from environment variables:
+
address@hidden
+$ @kbd{echo 'print: ; @@echo "x$(foo)x$(bar)x"' |
+ foo=' f f ' make -f - bar=' b b '}
+x f f xb b x # AIX, BSD, GNU make
+xf f xb b x # HP-UX, IRIX, Tru64/OSF make
+x f f xb bx # Solaris make
address@hidden example
+
+
@node obj/ and Make
@section The @file{obj/} Subdirectory and Make
@cindex @file{obj/}, subdirectory
master:
tests: avoid instspc* failures due to make's whitespace trimming
* tests/instspc-tests.sh: Prepend './' when passing the test
characters, to avoid leading whitespace characters to be trimmed
from macros set from environment variables. Fixes testsuite
failures with HP-UX, IRIX, and Tru64/OSF make.
diff --git a/tests/instspc-tests.sh b/tests/instspc-tests.sh
index 38a63a4..1be8d0e 100755
--- a/tests/instspc-tests.sh
+++ b/tests/instspc-tests.sh
@@ -296,8 +296,12 @@ cd "./$build"
../configure --prefix "/$instspc_test_string-prefix"
$MAKE
+# Some make implementations eliminate leading and trailing whitespace
+# from macros passed on the command line, and some eliminate leading
+# whitespace from macros set from environment variables, so prepend
+# './' and use the latter here.
# Tru64 sh -e needs '|| Exit' in order to work correctly.
-DESTDIR="$dest" file="$instspc_test_string" $MAKE -e test-install-sep \
+DESTDIR="$dest" file="./$instspc_test_string" $MAKE -e test-install-sep \
|| Exit 1
:
maint:
tests: avoid instspc.test failures due to make's whitespace trimming
* tests/instspc.test: Prepend './' when passing the test
characters, to avoid leading whitespace characters to be trimmed
from macros set from environment variables. Fixes testsuite
failures with HP-UX, IRIX, and Tru64/OSF make.
diff --git a/tests/instspc.test b/tests/instspc.test
index 414b3e5..7d00788 100755
--- a/tests/instspc.test
+++ b/tests/instspc.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 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
@@ -135,9 +135,13 @@ do
cd "$build"
+ # Some make implementations eliminate leading and trailing whitespace
+ # from macros passed on the command line, and some eliminate leading
+ # whitespace from macros set from environment variables, so prepend
+ # './' and use the latter here.
../configure --prefix "/$file-prefix" &&
$MAKE &&
- DESTDIR=$dest file=$file $MAKE -e test-install-sep ||
+ DESTDIR=$dest file=./$file $MAKE -e test-install-sep ||
eval "${test}_failures=\"\$${test}_failures$lf\$file\""
cd ..
- whitespace and macros from the command line,
Ralf Wildenhues <=