[Top][All Lists]

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

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

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

Dear Make People,

I first sent this to, then realised that a make mailing
list was at least as suitable, plus I would probably get a faster answer.

First, let me say that the version of make I am using is GNU Make
3.79.1-14 (in Debian Woody).

My question is somewhat R specific ( but
hopefully comprehensible even to someone who doesn't know anything about

The command "R CMD SHLIB" is used to make shared libraries to load
into R, which runs as an interpreted language. This essentially run
make on a dynamically generated makefile. At least, that is my

in the R FAQ (in the R Programming section) it says


How can I change compilation flags?

   Suppose you have C code file for dynloading into R, but you want to
use `R CMD SHLIB' with compilation flags other than the default ones
(which were determined when R was built).  You could change the file
``R_HOME'/etc/Makeconf' to reflect your preferences.  If you are a
Bourne shell user, you can also pass the desired flags to Make (which
is used for controlling compilation) via the Make variable
as in



Now, something like

MAKEFLAGS="CC=gcc-3.0" R CMD SHLIB rc.c -o

works fine, and something like

MAKEFLAGS="CC=gcc-3.0 PKG_CFLAGS= -Wall" R CMD SHLIB rc.c -o

also works fine.


MAKEFLAGS="CC=gcc-3.0 PKG_CFLAGS= -Wall -pedantic" R CMD SHLIB rc.c -o

does not work fine. Make throws a fit and spews forth gibberish.

My understanding of MAKEFLAGS is that it is for passing flags to some
submake process, in this case R CMD SHLIB. The documentation (make
manual) says that

"Words in the value of `MAKEFLAGS' that contain `=', `make' treats as
variable definitions just as if they appeared on the command line."

However, there seems to be a problem when the variable definition
contains blanks, as PKG_CFLAGS does above. Can anyone advise on what
is the correct syntax for this? I tried various possibilities and none
of them worked, and I cannot find any documentation that is helpful.

                                       Sincerely, Faheem Mitha.

reply via email to

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