[Rcpp-devel] Embedding RInside in C++ project

Dirk Eddelbuettel edd at debian.org
Fri Jul 24 13:13:08 CEST 2015

On 24 July 2015 at 10:18, Ulf Mertens wrote:
| Hi,
| I just looked into the GNUMakefile. I think I just have to only change those
| two lines, right?
| sources :=         $(wildcard *.cpp)
| programs :=       $(sources:.cpp=)

The idea here is that each .cpp leads to one executable, and its build is
triggered by a change in it.  (
| If I understand it correctly, it only works for .cpp files. So it has be
| changed to something like this?
| sources :=        $(wildcard *.cpp)
| header :=          $(wildcard *.h)
| programs :=      $(sources:.cpp= header:.h=)

The header files are implicit.  You could just enumerate the files by hand.:
Or, as eg in examples/threads/GNUmakefile, just write the rule:

all:			boostEx

boostEx:		boostEx.cpp
			$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(LDLIBS) 
			strip $@

where strip of course optional too.  'boostEx' could depend on more than one
.cpp; just list additonal ones.


http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the Rcpp-devel mailing list