[Rcpp-devel] Rcpp: Sort Rcpp:::ldFlags() to LDFLAGS and LDADD

Dirk Eddelbuettel edd at debian.org
Thu Apr 26 14:56:14 CEST 2012


On 26 April 2012 at 06:23, Dirk Eddelbuettel wrote:
| | +------------------+
| | | /src/Makefile.am |
| | +------------------+
| | 
| | EXTRA_PROGRAMS = Rmyproject.so
| | 
| | Rmyproject_so_SOURCES = Rmyproject.cpp coding2.cpp coding3.cpp
| | 
| | Rmyproject_so_CXXFLAGS = -fPIC @RCPPCXXFLAGS@ -I$(R_INCLUDE_DIR) -I./myproject/src
| | 
| | Rmyproject_so_LDFLAGS = -shared @RCPPLDFLAGS@ -Wl,-rpath,$(R_PACKAGE_DIR)/libs  
| | 
| | Rmyproject_so_LDADD = @RCPPLDADD@ $(LIBR) -L./ -lmyproject
| | 
| | all: Rmyproject.so

Also, I see no reason why you need to split things over LDFLAGS and LDADD in
the first place.  Why not just 

  Rmyproject_so_LDFLAGS = -shared $(LIBR) $(RCPPLDFLAGS) -L./ -lmyproject 

just how eg the Makefile for the RInside examples --- which is even more
complicated as it needs R, Rcpp and RInside -- combines everything in

   LDLIBS :=    $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)

But as I said before, inside of a normal R package you do not need a Makefile
and you should really try to get by with just Makevars as suggested by 'Writing R
Extensions': 

     The default rules can be tweaked by setting macros(9) in a file
  `src/Makevars' (*note Using Makevars::).  Note that this mechanism
  should be general enough to eliminate the need for a package-specific
  `src/Makefile'.  


Dirk

-- 
R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com


More information about the Rcpp-devel mailing list