SOURCES = $(shell ls *Rmd)

%.html: %.Rmd
	@echo "KNITR_CACHE=TRUE Sweave $<"
	@KNITR_CACHE=TRUE "$(R_HOME)"/bin/R --vanilla CMD Sweave $<

%.R: %.Rmd
	@echo "KNITR_CACHE=FALSE Stangle $<"
	@KNITR_CACHE=FALSE && "$(R_HOME)"/bin/R --vanilla CMD Stangle $<

all: $(SOURCES:.Rmd=.html)

clean:
	rm -rf Rplots* *html *R *.md *_cache/ *_files/ figure/
