File: GNUmakefile

package info (click to toggle)
rcpp 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,480 kB
  • sloc: cpp: 27,436; ansic: 7,778; sh: 53; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 969 bytes parent folder | download | duplicates (8)
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

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