-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (20 loc) · 1.12 KB
/
Makefile
File metadata and controls
30 lines (20 loc) · 1.12 KB
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
## 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) -I/usr/include/gsl -lgsl -lgslcblas -lm
RLDFLAGS := $(shell $(R_HOME)/bin/R CMD config --ldflags) -L/usr/lib -lgsl -lgslcblas -lm
## include headers and libraries for Rcpp interface classes
RCPPINCL := $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
ARMAINCL := $(shell echo 'RcppArmadillo:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RCPPLIBS := $(shell echo 'Rcpp:::LdFlags()' | $(R_HOME)/bin/R --vanilla --slave)
GSLLIB := $(shell gsl-config --libs)
GSLINC := $(shell gsl-config --cflags)
## OpenMP
OPENMPFLAGS := -fopenmp
c_sources := $(wildcard *.c)
cpp_sources := $(wildcard *.cpp)
model.so : $(c_sources) $(cpp_sources)
PKG_CPPFLAGS="$(RCPPFLAGS) $(GSLLIB) $(GSLINC) $(RCPPINCL) $(ARMAINCL) $(OPENMPFLAGS)" PKG_LIBS="$(RLDFLAGS) $(RCPPLIBS) $(OPENMPFLAGS)" R CMD SHLIB $^
clean :
/bin/rm *.o *.so