RMDs := $(wildcard *.Rmd)
RNWs := $(wildcard *.Rnw)
PDFs := $(RMDs:.Rmd=.pdf) $(RNWs:.Rnw=.pdf)
HTMLs := $(RMDs:.Rmd=.html) 

all : $(PDFs) $(HTMLs)

%.pdf : %.Rmd
      # R --vanilla -e 'library(INLA);INLA:::inla.my.update(b=T); inla.setOption(inla.call="inla.mkl.work"); library(rmarkdown); render("'$<'", c("pdf_document"))'
	R --vanilla -e 'library(INLA); inla.setOption(inla.call="inla.mkl.work"); library(rmarkdown); render("'$<'", c("pdf_document"))'

%.html : %.Rmd
       # R --vanilla -e 'library(INLA);INLA:::inla.my.update(b=T); inla.setOption(inla.call="inla.mkl.work"); library(rmarkdown); render("'$<'", c("html_document"))'
	 R --vanilla -e 'library(INLA); inla.setOption(inla.call="inla.mkl.work"); library(rmarkdown); render("'$<'", c("html_document"))'

%.pdf : %.Rnw
      #	R --vanilla -e 'library(INLA);INLA:::inla.my.update(b=T); inla.setOption(inla.call="inla.mkl.work"); library(knitr); knit2pdf("'$<'")'
	R --vanilla -e 'library(INLA); inla.setOption(inla.call="inla.mkl.work"); library(knitr); knit2pdf("'$<'")'

