[Rcpp-commits] r166 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 9 16:38:28 CET 2009


Author: edd
Date: 2009-11-09 16:38:28 +0100 (Mon, 09 Nov 2009)
New Revision: 166

Modified:
   pkg/src/Makevars.win
Log:
updated for Windows builds

Modified: pkg/src/Makevars.win
===================================================================
--- pkg/src/Makevars.win	2009-11-09 01:36:46 UTC (rev 165)
+++ pkg/src/Makevars.win	2009-11-09 15:38:28 UTC (rev 166)
@@ -7,25 +7,42 @@
 # Contributions from an older Makefile.win are
 # (C) Dominick Samperi and Uwe Ligges and gratefully acknowledged
 
-#RCPPFLAGS	= `${R_HOME}/bin/R CMD config --cppflags`
-#RLDFLAGS	= `${R_HOME}/bin/R CMD config --ldflags`
-#CXXFLAGS 	= -I. $(RCPPFLAGS) -Wall -O2
+## ask R about compiler flags and libraries
+#RCPPFLAGS = 	`${R_HOME}/bin/R CMD config --cppflags`
+#RLDFLAGS := 	`${R_HOME}/bin/R CMD config --ldflags`
 
-## the 'user' library contains only Rcpp.{cpp,h} and is what users need for their projects
-## we place it inside the inst/ directory so that it gets installed 
-## use 'Rscript -e 'cat(system.file("lib", "Rcpp.a", package="Rcpp", "\n")'  to get location
+# or just set it directly
+#RCPPFLAGS =	-I$(R_HOME)/include -I.
+RLDFLAGS =	-L$(R_HOME)/bin -lR
+
+# or just copy defaults (cf $R_HOME/etc/Makeconf)
+#RCPPFLAGS = $(ALL_CXXFLAGS)
+#RLDFLAGS = $(LIBR) $(LIBM)
+
+## and pass this on to the implicit build rules
+PKG_CPPFLAGS +=	-I.
+PKG_LIBS +=	-s $(RLDFLAGS)
+
+## all sources and objects
+SOURCES =	$(wildcard *.cpp)
+OBJECTS =	$(SOURCES:.cpp=.o)
+
+## the 'user' library contains all source apart from RcppExample.o and is what
+## users need for their projects -- RcppExample is used by the package library
+## we place it inside the inst/ directory so that it gets installed by the package
+USEROBJ	=	$(filter-out RcppExample.o,$(OBJECTS))
 USERDIR	= 	../inst/lib
 USERLIB	= 	$(USERDIR)/libRcpp.a
-USEROBJ	= 	Rcpp.o RcppList.o
 
+## to filter out -Wall which generated a ton with older compilers
+newCXXFLAGS := 	$(filter-out -Wall,$(CXXFLAGS))
+CXXFLAGS := 	$(newCXXFLAGS)
+
 ## the 'package' library contains both Rcpp.{cpp,h} and the RcppExample used to demonstrate the package
 ## it is loaded via library(Rcpp) but is not used for compiling / linking against
 PKGLIB = 	Rcpp.dll
-PKGOBJ = 	RcppExample.o $(USEROBJ)
-PKGLDFLAGS = 	-s 
+PKGOBJ = 	$(OBJECTS)
 
-PKG_CPPFLAGS += -I. -Wall -O2
-
 RM = 		rm -f
 
 .PHONY: 	all clean
@@ -36,7 +53,7 @@
 		${RM} $(PKGOBJ) $(PKGLIB)
 
 $(PKGLIB): 	$(PKGOBJ)
-		$(CXX) -shared -o $(PKGLIB) $(PKGOBJ) $(PKGLDFLAGS)
+		$(CXX) -shared -o $(PKGLIB) $(PKGOBJ) $(PKG_LIBS)
 
 $(USERLIB):	$(USEROBJ)
 		-mkdir -p $(USERDIR) 2>/dev/null



More information about the Rcpp-commits mailing list