[Rcpp-commits] r2198 - pkg/Rcpp/inst/examples/ConvolveBenchmarks

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Sep 26 17:57:04 CEST 2010


Author: edd
Date: 2010-09-26 17:57:04 +0200 (Sun, 26 Sep 2010)
New Revision: 2198

Added:
   pkg/Rcpp/inst/examples/ConvolveBenchmarks/Makefile
Log:
simple Makefile added


Added: pkg/Rcpp/inst/examples/ConvolveBenchmarks/Makefile
===================================================================
--- pkg/Rcpp/inst/examples/ConvolveBenchmarks/Makefile	                        (rev 0)
+++ pkg/Rcpp/inst/examples/ConvolveBenchmarks/Makefile	2010-09-26 15:57:04 UTC (rev 2198)
@@ -0,0 +1,29 @@
+
+## comment this out if you need a different version of R, 
+## and set set R_HOME accordingly as an environment variable
+R_HOME := 		$(shell R RHOME)
+
+## include headers and libraries for R 
+RCPPFLAGS := 		$(shell $(R_HOME)/bin/R CMD config --cppflags)
+RLDFLAGS := 		$(shell $(R_HOME)/bin/R CMD config --ldflags)
+
+## include headers and libraries for Rcpp interface classes
+RCPPINCL := 		$(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
+RCPPLIBS := 		$(shell echo 'Rcpp:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)
+
+c_sources := 		$(wildcard *.c)
+c_sharedlibs := 	$(patsubst %.c,%.o,$(c_sources))
+
+cpp_sources := 		$(wildcard *.cpp)
+cpp_sharedlibs := 	$(patsubst %.cpp,%.o,$(cpp_sources))
+
+all :			$(c_sharedlibs) $(cpp_sharedlibs)
+
+%.o : 			%.c
+			R CMD SHLIB $<
+
+%.o : 			%.cpp
+			PKG_CPPFLAGS="$(RCPPFLAGS) $(RCPPINCL)" PKG_LIBS="$(RLDFLAGS) $(RCPPLIBS)" R CMD SHLIB $<
+
+run :			$(c_sharedlibs) $(cpp_sharedlibs)
+			Rscript exampleRCode.r
\ No newline at end of file



More information about the Rcpp-commits mailing list