Skip to content

Commit

Permalink
rm Makevars and Makevars.win from skeleton package
Browse files Browse the repository at this point in the history
  • Loading branch information
romainfrancois committed Nov 13, 2013
1 parent e90318f commit 4f0c8ad
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 163 deletions.
13 changes: 1 addition & 12 deletions R/Rcpp.package.skeleton.R
Expand Up @@ -134,18 +134,7 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
dir.create( src )
}
skeleton <- system.file( "skeleton", package = "Rcpp" )
Makevars <- file.path( src, "Makevars" )
if( !file.exists( Makevars ) ){
file.copy( file.path( skeleton, "Makevars" ), Makevars )
message( " >> added Makevars file with Rcpp settings" )
}

Makevars.win <- file.path( src, "Makevars.win" )
if( !file.exists( Makevars.win ) ){
file.copy( file.path( skeleton, "Makevars.win" ), Makevars.win )
message( " >> added Makevars.win file with Rcpp settings" )
}


if ( length(cpp_files) > 0L ) {
for (file in cpp_files) {
file.copy(file, src)
Expand Down
45 changes: 7 additions & 38 deletions R/RcppLdpath.R
@@ -1,4 +1,4 @@
# Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
# Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois
#
# This file is part of Rcpp.
#
Expand All @@ -20,22 +20,10 @@ Rcpp.system.file <- function(...){
tools::file_path_as_absolute( base::system.file( ..., package = "Rcpp" ) )
}

## identifies if the default linking on the platform should be static
## or dynamic. Currently only linux uses dynamic linking by default
## although it works fine on mac osx as well
staticLinking <- function() {
! grepl( "^linux", R.version$os )
}

## Use R's internal knowledge of path settings to find the lib/ directory
## plus optinally an arch-specific directory on system building multi-arch
RcppLdPath <- function() {
if (nzchar(.Platform$r_arch)) { ## eg amd64, ia64, mips
path <- Rcpp.system.file("lib",.Platform$r_arch)
} else {
path <- Rcpp.system.file("lib")
}
path
""
}

## Provide linker flags -- i.e. -L/path/to/libRcpp -- as well as an
Expand All @@ -45,34 +33,15 @@ RcppLdPath <- function() {
## Updated Jan 2010: We now default to static linking but allow the use
## of rpath on Linux if static==FALSE has been chosen
## Note that this is probably being called from LdFlags()
RcppLdFlags <- function(static=staticLinking()) {
rcppdir <- RcppLdPath()
if (static) { # static is default on Windows and OS X
flags <- paste(rcppdir, "/libRcpp.a", sep="")
if (.Platform$OS.type=="windows") {
flags <- asBuildPath(flags)
}
} else { # else for dynamic linking
flags <- paste("-L", rcppdir, " -lRcpp", sep="") # baseline setting
if ((.Platform$OS.type == "unix") && # on Linux, we can use rpath to encode path
(length(grep("^linux",R.version$os)))) {
flags <- paste(flags, " -Wl,-rpath,", rcppdir, sep="")
}
}
invisible(flags)
}
## Updated Nov 2013: We no longer build a library. This should be deprecated.
RcppLdFlags <- function() { "" }

# indicates if Rcpp was compiled with GCC >= 4.3
canUseCXX0X <- function() .Call( "canUseCXX0X", PACKAGE = "Rcpp" )

## Provide compiler flags -- i.e. -I/path/to/Rcpp.h
RcppCxxFlags <- function(cxx0x=FALSE) {
# path <- RcppLdPath()
path <- Rcpp.system.file( "include" )
if (.Platform$OS.type=="windows") {
path <- asBuildPath(path)
}
paste("-I", path, if( cxx0x && canUseCXX0X() ) " -std=c++0x" else "", sep="")
""
}

## Shorter names, and call cat() directly
Expand All @@ -81,8 +50,8 @@ CxxFlags <- function(cxx0x=FALSE) {
cat(RcppCxxFlags(cxx0x=cxx0x))
}
## LdFlags defaults to static linking on the non-Linux platforms Windows and OS X
LdFlags <- function(static=staticLinking()) {
cat(RcppLdFlags(static=static))
LdFlags <- function() {
cat(RcppLdFlags())
}

# capabilities
Expand Down
27 changes: 0 additions & 27 deletions inst/skeleton/Makevars

This file was deleted.

3 changes: 0 additions & 3 deletions inst/skeleton/Makevars.win

This file was deleted.

44 changes: 1 addition & 43 deletions src/Makevars
@@ -1,44 +1,2 @@
# -*- mode: Makefile; tab-width: 8 -*-
#
# Makevars for Rcpp
#
# Copyright (C) 2008 - 2009 Dirk Eddelbuettel <edd@debian.org>
# Copyright (C) 2008, 2013 Simon Urbanek <simon.urbanek@r-project.org>
# Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois

## $(SHLIB) is the usual default target that is built automatically from all source
## files in this directory. userLibrary is an additional target for the second library
## that will be installed in ../inst/lib$(R_ARCH) and which users can link against.

## uncomment this to enable c++0x features (experimental)
## CLINK_CPPFLAGS=-std=c++0x

all: $(SHLIB) userLibrary

## we place it inside the inst/ directory so that it gets installed by the package
USERDIR = ../inst/lib

USERLIB = libRcpp$(DYLIB_EXT)
USERLIBST = libRcpp.a

PKG_CPPFLAGS += -I../inst/include/

userLibrary: $(USERLIB) $(USERLIBST)
-@if test ! -e $(USERDIR)$(R_ARCH); then mkdir -p $(USERDIR)$(R_ARCH); fi
cp $(USERLIB) $(USERDIR)$(R_ARCH)
cp $(USERLIBST) $(USERDIR)$(R_ARCH)
rm $(USERLIB) $(USERLIBST)

$(USERLIB): $(OBJECTS)
$(SHLIB_CXXLD) -o $(USERLIB) $(OBJECTS) $(SHLIB_CXXLDFLAGS) $(ALL_LIBS)
@: $${INSTALL_NAME_TOOL=/usr/bin/install_name_tool}; if test -e "$$INSTALL_NAME_TOOL"; then "$$INSTALL_NAME_TOOL" -id '$(R_PACKAGE_DIR)/lib$(R_ARCH)/$(USERLIB)' '$(USERLIB)'; fi

$(USERLIBST): $(OBJECTS)
$(AR) qc $(USERLIBST) $(OBJECTS)
@if test -n "$(RANLIB)"; then $(RANLIB) $(USERLIBST); fi

.PHONY: all clean userLibrary

clean:
rm -f $(OBJECTS) $(SHLIB) $(USERLIB) $(USERLIBST)
PKG_CPPFLAGS = -I../inst/include/

40 changes: 0 additions & 40 deletions src/Makevars.win
@@ -1,42 +1,2 @@
# Emacs please make this -*- mode: makefile; tab-width: 8 -*-
#
# Makefile.win for Rcpp
#
# Copyright (C) 2008 - 2009 Dirk Eddelbuettel <edd@debian.org>
# Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
#
# Contributions from an older Makefile.win are
# (C) Dominick Samperi and Uwe Ligges and gratefully acknowledged
#
# Contributions from Brian D Ripley are also gratefully acknowledged

PKG_CPPFLAGS = -I../inst/include/

## we place it inside the inst/ directory so that it gets installed by the package
USERDIR = ../inst/lib$(R_ARCH)
STATICLIB = libRcpp.a
USERLIB = $(USERDIR)/$(STATICLIB)

## uncomment this to enable c++0x features (experimental)
## CLINK_CPPFLAGS=-std=c++0x

## 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

RM = rm -f

.PHONY: all clean

all: userlib $(SHLIB)

clean:
${RM} $(OBJECTS) $(SHLIB)

$(USERLIB): $(OBJECTS)

userlib: $(STATICLIB)
-mkdir -p $(USERDIR)
-mv $(STATICLIB) $(USERLIB)

$(STATICLIB): $(OBJECTS)

0 comments on commit 4f0c8ad

Please sign in to comment.