[Rd] Makefile vs Makevars vs configure

Whit Armstrong Whit.Armstrong at tudor.com
Wed Dec 29 20:06:17 CET 2004


Apologies in advance for the long post.

I'm currently using a Makefile to build my shared library. Pursuant to the
R-exts manual, I'd like to switch to a Makevars file or a configure file if
necessary.

Having never used these types of make utilities before, I'm a bit lost.

My package is quite simple.  It only has one source file and one header:
excelpoi.cpp
excelpoi.h

The reason I need help with Makevars is because it needs jni.h from the
user's JAVA_HOME/include and jni_md.h from the user's
JAVA_HOME/include/OS_TYPE directory.

In addition, it needs libjvm.so from the user's
JAVA_HOME/jre/lib/ARCH/client directory.

I've looked at the SJava package with the idea of using a similar configure
script, but I was hoping I could just get by with a Makevars file rather
than a configure script.

I would appreciate any pointers, as I'm not really sure exactly where to
begin.

I suppose if I can find the values of JAVA_HOME, ARCH, and OS_TYPE, then I
can fill in the values I need using PKG_LIBS and PKG_INCLUDE in the Makevars
file.

below is the makefile I'm currently using for your reference.

Thanks in advance,
Whit

<Makefile>
archExpr = case "`uname -m`" in  \
                i[3-6]86 | ia32) \
                    echo i386 \
                    ;; \
                sparc*)  \
                    echo sparc \
                    ;; \
                *) \
                    uname -m  \
                    ;; \
        esac

ARCH = $(shell $(archExpr) )

JAVA_HOME=/opt/blackdown-jdk-1.4.1/

INCLUDES=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
-I/usr/local/lib/R/include

LIBS=-L$(JAVA_HOME)/jre/lib/$(ARCH)/client -ljvm

# The recommended c compiler flags
CFLAGS=-D_REENTRANT -D_GNU_SOURCE

all: excelpoi.so

excelpoi.so: excelpoi.cpp excelpoi.h
  $(CXX) -O2 $(CFLAGS) $(INCLUDES) $(LIBS) -shared -fPIC -o $@ $<

</Makefile>


	[[alternative HTML version deleted]]



More information about the R-devel mailing list