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: Paul D. Smith
Subject: Re: using MAKEFLAGS in compiling C code as a shared library for R
Date: Thu, 13 Jun 2002 18:33:43 -0400

%% Faheem Mitha <address@hidden> 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).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist



reply via email to

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