help-make
[Top][All Lists]
Advanced

[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 gnu.utils.help, 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 (http://www.r-project.org/) but
hopefully comprehensible even to someone who doesn't know anything about
R.

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
understanding.

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
`MAKEFLAGS',
as in

MAKEFLAGS="CFLAGS=-O3" R CMD SHLIB *.c

**********************************************************************

Now, something like

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

works fine, and something like

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

also works fine.

However,

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

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]