help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using MAKEFLAGS in compiling C code as a shared library for R


From: Faheem Mitha
Subject: Re: using MAKEFLAGS in compiling C code as a shared library for R
Date: Thu, 13 Jun 2002 23:17:55 -0400 (EDT)

On Thu, 13 Jun 2002, Paul D. Smith wrote:

> The simplest solution is to use backslashes to quote the spaces:
>
>  MAKEFLAGS='CC=gcc-3.0 PKG_CFLAGS=\ -Wall\ -pedantic' R CMD SHLIB rc.c -o 
> rc.so
>
> will work (note the change to single quotes: if you must use double
> quotes you'll have to type two backslashes to get one--see the
> documentation for your shell).

Thanks. This works. Am I correct in thinking this a shell issue?  I am
using bash, of course.

I am not completely clear on why it works, though. The Bash manual says:

Single Quotes
.............

   Enclosing characters in single quotes (`'') preserves the literal
value of each character within the quotes.  A single quote may not occur
between single quotes, even when preceded by a backslash.

Also

Escape Character
................

   A non-quoted backslash `\' is the Bash escape character.  It
preserves the literal value of the next character that follows, with
the exception of `newline'.  If a `\newline' pair appears, and the
backslash itself is not quoted, the `\newline' is treated as a line
continuation (that is, it is removed from the input stream and
effectively ignored).

So, if single quotes are preserving the literal value of each character
within the quotes, why is it necessary to include a backslash before each
space within single quotes, when a backslash also "preserves the literal
value of the next character that follows"? I take it that the "literal
value" means that the space is not interpreted specially as breaking up
the string into units to be interpreted as different variable definitions.

Perhaps this has to do with the fact that the single quotes and the
backslash are to do with quoting at different "levels"? In the former case
the string enclosed by single quotes is being passed to MAKEFLAGS, and in
the latter case the backslash has to do with values being passed as part
of the variable definitions. (Just uninformed speculation).

Forgive my cluelessness. I am quite ignorant about shells beyond the
basics, but life is too short to become an expert on everything. I could
spend years just learning about the GNU utilities.

Thanks again for the quick and helpful reply. It is quite cool to get a
question about GNU Make answered by the maintainer of GNU Make. :-)

                                              Sincerely, Faheem Mitha.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]