-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrules.mk
58 lines (46 loc) · 1.3 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
53
54
55
56
57
58
REXE = Rscript --no-save --no-restore --no-init-file
RBATCH = R CMD BATCH --no-save --no-restore
RSCRIPT = Rscript --vanilla
RCMD = $(REXE) CMD
PANDOC = pandoc -s -t html5+smart --mathjax
PDFLATEX = pdflatex
BIBTEX = bibtex
CP = cp -f
RM = rm -f
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
%.pdf: export BSTINPUTS=$(ROOT_DIR)
%.pdf: export BIBINPUTS=$(ROOT_DIR)
%.pdf: export TEXINPUTS=.:$(ROOT_DIR):$(shell echo $$TEXINPUTS)
%.pdf: export SOURCE_DATE_EPOCH=954590400
%.pdf: %.tex
$(PDFLATEX) $*
-$(BIBTEX) $*
$(PDFLATEX) $*
$(PDFLATEX) $*
%.so: %.c
$(RCMD) SHLIB -o $*.so $*.c
$(RM) $*.o
%.html: %.Rmd
Rscript --vanilla -e "rmarkdown::render(\"$*.Rmd\",output_format=\"html_document\")"
%.html: %.md
Rscript --vanilla -e "rmarkdown::render(\"$*.md\",output_format=\"html_document\")"
%.R: %.Rmd
Rscript --vanilla -e "library(knitr); purl(\"$*.Rmd\",output=\"$*.R\")"
%.tex: %.Rnw
$(RSCRIPT) -e "library(knitr); knit(\"$*.Rnw\")"
%.R: %.Rnw
$(RSCRIPT) -e "library(knitr); purl(\"$*.Rnw\")"
%.idx: %.tex
-$(PDFLATEX) $*
%.ind: %.idx
$(MAKEIDX) $*
.clean:
$(RM) *.log *.blg *.ilg *.aux *.lof *.lot *.toc *.idx
$(RM) *.ttt *.fff *.out *.nav *.snm *.bak
$(RM) *.ps *.bbl *.ind *.dvi
$(RM) *.o *.so
$(RM) *.synctex.gz *-concordance.tex
$(RM) *.brf
$(RM) Rplots.*
.fresh: clean
$(RM) -r tmp