-
Notifications
You must be signed in to change notification settings - Fork 1
/
r-makefile-common.mk
32 lines (24 loc) · 1.33 KB
/
r-makefile-common.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
R_HOME := $(shell $(LOCAL_PATH)/R/R.framework/Resources/bin/R RHOME)
else
R_HOME := $(shell $(LOCAL_PATH)/R/bin/R RHOME)
endif
## include headers and libraries for R
RCPPINCFLAGS := $(shell $(R_HOME)/bin/R CMD config --cppflags)
RLDFLAGS := $(shell $(R_HOME)/bin/R CMD config --ldflags)
RBLAS := $(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
RLAPACK := $(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)
## if you need to set an rpath to R itself, also uncomment
RRPATH := -Wl,-rpath,$(R_HOME)/lib
## include headers and libraries for Rcpp interface classes
## note that RCPPLIBS will be empty with Rcpp (>= 0.11.0) and can be omitted
RCPPINCL := $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RCPPLIBS := $(shell echo 'Rcpp:::LdFlags()' | $(R_HOME)/bin/R --vanilla --slave)
## include headers and libraries for RInside embedding classes
RINSIDEINCL := $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RINSIDELIBS := $(shell echo 'RInside:::LdFlags()' | $(R_HOME)/bin/R --vanilla --slave)
## compiler etc settings used in default make rules
COMLIBS += -DSTRICT_R_HEADERS $(RCPPINCFLAGS) $(RCPPINCL) $(RINSIDEINCL)
#COMLIBS += $(RFLAGS)
LD_FLAGS += $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)