[R] SOLVED (was Re: using MAKEFLAGS in compiling C code as a shared library using R CMD SHLIB)
Faheem Mitha
faheem at email.unc.edu
Fri Jun 14 05:50:33 CEST 2002
Dear R People,
I'm replying to my own question here. The maintainer of GNU
Make, Paul Smith, kindly replied to a message I posted to the GNU Make
help list, help-make at gnu.org.
I suggest that an example be added to the appropriate section of the FAQ
to reflect this issue, or perhaps the current example could be expanded.
Granted, this is just a shell quoting issue, but it might save someone,
sometime, from some head scratching.
Sincerely, Faheem Mitha.
*******************************************************************
%% Faheem Mitha <faheem at email.unc.edu> writes:
fm> MAKEFLAGS="CC=gcc-3.0 PKG_CFLAGS= -Wall -pedantic" R CMD SHLIB rc.c
-o rc.so
fm> does not work fine. Make throws a fit and spews forth gibberish.
Make is interpreting the -Wall and -pedantic as lists of make options,
rather than as the value of PKG_CFLAGS, which is entirely correct given
that command string.
fm> My understanding of MAKEFLAGS is that it is for passing flags to
some
fm> submake process, in this case R CMD SHLIB. The documentation (make
fm> manual) says that
fm> "Words in the value of `MAKEFLAGS' that contain `=', `make' treats
as
fm> variable definitions just as if they appeared on the command line."
fm> However, there seems to be a problem when the variable definition
fm> contains blanks, as PKG_CFLAGS does above.
That's because the ''PKG_CFLAGS= -Wall -pedantic'' above is not _one_
word containing an =, it's three words, only the first of which contains
an =. So only the first word is considered to be a variable definition.
fm> Can anyone advise on what is the correct syntax for this?
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).
************************************************************************
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list