[Rd] C macros and Makevars/package building
Kurt Hornik
Kurt.Hornik at wu-wien.ac.at
Fri Sep 9 09:34:15 CEST 2005
>>>>> Kasper Daniel Hansen writes:
> Hi
> We are currently embedding a rather large C++ library in R (BioC),
> and we want some comments on the portability of how we have approach
> this.
> First of, we are not really able to do much about the portability of
> the basic library, which of course is the main question :) We have an
> approach which seems to work, I just want a bit of feedback on it....
> The way we integrate it into R is simply by having a subdirectory /
> src/sdk together with a Makevars file. This file basically looks like
> PKG_CPPFLAGS+=\
> -imacros R_affx_constants.h\
> -Isdk/files\
> (... + a lot of other -I statements telling CPP to include
> subdirectories of src/sdk)
> Then we have a
> SOURCES.SDK = \
> sdk/files/FileIO.cpp \
> (... + a lot of other .cpp files)
> SOURCES.OURS = \
> R_affx_cdf.cpp
> and then finally a
> OBJS=$(SOURCES.SDK:.cpp=.o) $(SOURCES.OURS:cpp:.o)
> We seem to need the last statement since it seems that .cpp is not
> automatically a C++ suffix (but is it done the "right" way for
> portability?). We need the -imacro statement in order to include some
> macros from Rconfig.h (big endian checks) which are then translated
> from the WORDS_BIGENDIAN used in R to the IS_BIG_ENDIAN used in the
> library.
> Comments on the portability?
THings like
OBJS=$(SOURCES.SDK:.cpp=.o)
are portable. Not sure about the .cpp not being a C++ suffix part; the
generated Makeconf files should contain a rule for
.cpp.o:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
and the appropriate .SUFFIXES settings. (Maybe you manipulate
.SUFFIXES?)
Using FOO += something in Make files is not portable.
best
-k
More information about the R-devel
mailing list