Guest User

Untitled

a guest
Dec 12th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. ## -*- mode: make; tab-width: 8; -*-
  2. ##
  3. ## Simple Makefile
  4. ##
  5. ## From RInside examples
  6. ## TODO:
  7. ## proper configure for non-Debian file locations, [ Done ]
  8. ## allow RHOME to be set for non-default R etc
  9.  
  10. ## comment this out if you need a different version of R,
  11. ## and set set R_HOME accordingly as an environment variable
  12. R_HOME := $(shell R RHOME)
  13.  
  14. sources := $(wildcard *.cpp)
  15. programs := $(sources:.cpp=)
  16.  
  17.  
  18. ## include headers and libraries for R
  19. RCPPFLAGS := $(shell $(R_HOME)/bin/R CMD config --cppflags)
  20. RLDFLAGS := $(shell $(R_HOME)/bin/R CMD config --ldflags)
  21. RBLAS := $(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
  22. RLAPACK := $(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)
  23.  
  24. ## if you need to set an rpath to R itself, also uncomment
  25. #RRPATH := -Wl,-rpath,$(R_HOME)/lib
  26.  
  27. ## include headers and libraries for Rcpp interface classes
  28. RCPPINCL := $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
  29. RCPPLIBS := $(shell echo 'Rcpp:::LdFlags()' | $(R_HOME)/bin/R --vanilla --slave)
  30.  
  31.  
  32. ## include headers and libraries for RInside embedding classes
  33. RINSIDEINCL := $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
  34. RINSIDELIBS := $(shell echo 'RInside:::LdFlags()' | $(R_HOME)/bin/R --vanilla --slave)
  35.  
  36. ## compiler etc settings used in default make rules
  37. CXX := $(shell $(R_HOME)/bin/R CMD config CXX)
  38. CPPFLAGS := -Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)
  39. CXXFLAGS := $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R CMD config CXXFLAGS)
  40. LDLIBS := $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)
  41.  
  42. all: $(programs)
  43. @test -x /usr/bin/strip && strip $^
  44.  
  45. run: $(programs)
  46. @for p in $(programs); do echo; echo "Running $$p:"; ./$$p; done
  47.  
  48. clean:
  49. rm -vf $(programs)
  50. rm -vrf *.dSYM
  51.  
  52. runAll:
  53. for p in $(programs); do echo "Running $$p"; ./$$p; done
Add Comment
Please, Sign In to add comment