-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrules.mk
44 lines (32 loc) · 1.01 KB
/
rules.mk
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
31
32
33
34
35
36
37
38
39
40
41
42
43
# REXE = Rscript --vanilla
# For some reason, --vanilla fails on my Mac
REXE = Rscript --no-save --no-restore --no-init-file
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
slides.pdf handout.pdf notes.pdf: main.tex
.INTERMEDIATE: main.tex slides.tex notes.tex
%.html: %.Rmd
PATH=/usr/lib/rstudio/bin/pandoc:$$PATH \
$(REXE) -e "rmarkdown::render(\"$*.Rmd\",output_format=\"html_document\")"
%.html: %.md
PATH=/usr/lib/rstudio/bin/pandoc:$$PATH \
$(REXE) -e "rmarkdown::render(\"$*.md\",output_format=\"html_document\")"
%.R: %.Rnw
$(REXE) -e "knitr::purl(\"$*.Rnw\",output=\"$*.R\",documentation=0)"
%.R: %.Rmd
$(REXE) -e "knitr::purl(\"$*.Rmd\",output=\"$*.R\",documentation=0)"
%.tex: %.Rnw
$(REXE) -e "knitr::knit(\"$*.Rnw\",output=\"$*.tex\")"
%.pdf: export BSTINPUTS=$(ROOT_DIR)
%.pdf: %.tex
pdflatex $*
bibtex $*
pdflatex $*
pdflatex $*
clean:
$(RM) *.bak
$(RM) *.o *.so
$(RM) *.log *.aux *.out *.blg *.toc *.nav *.snm *.vrb *.brf
$(RM) Rplots.*
fresh: clean
$(RM) *.bbl
$(RM) -r tmp