forked from kingaa/sbied
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrules.mk
53 lines (39 loc) · 1.21 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
44
45
46
47
48
49
50
51
52
# REXE = Rscript --vanilla
# For some reason, --vanilla fails on my Mac
REXE = Rscript --no-save --no-restore --no-init-file
RBATCH = R CMD BATCH --no-save --no-restore
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
slides.pdf handout.pdf notes.pdf: main.tex
quiz.pdf quiz_soln.pdf: quiz_main.tex
.INTERMEDIATE: main.tex slides.tex handout.tex notes.tex \
quiz.tex quiz_soln.tex quiz_main.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\")"
%.Rout: %.R
$(RBATCH) $*.R $@
%.Rout.save: %.R
$(RBATCH) $*.R $@
%.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 *.cut
$(RM) Rplots.*
fresh: clean
$(RM) *.bbl
$(RM) -r tmp