This repository has been archived by the owner on Sep 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
99 lines (81 loc) · 2.28 KB
/
Makefile
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
################################################################################
# From : https://gist.github.com/halpo/1405945
# See also :https://gist.github.com/cboettig/1591001 for more examples
# Description of File:
# Makefile for knitr compiling
#
################################################################################
all:pdf # default rule DO NOT EDIT
################################################################################
MAINFILE := test
RNWFILES :=
RFILES :=
TEXFILES :=
CACHEDIR := cache
FIGUREDIR := figures
LATEXMK_FLAGS :=
##### Explicit Dependencies #####
################################################################################
RNWTEX = $(RNWFILES:.Rnw=.tex)
ROUTFILES = $(RFILES:.R=.Rout)
RDATAFILES= $(RFILES:.R=.Rdata)
MAINTEX = $(MAINFILE:=.tex)
MAINPDF = $(MAINFILE:=.pdf)
ALLTEX = $(MAINTEX) $(RNWTEX) $(TEXFILES)
PDFLT = pdflatex -synctex=1 -interaction=nonstopmode -shell-escape
CHAPTERNAME = HopeLankSmithPaquetYdenberg_SESA
#lualatex
# Dependencies
$(RNWTEX): $(RDATAFILES)
$(MAINTEX): $(RNWTEX) $(TEXFILES)
$(MAINPDF): $(MAINTEX) $(ALLTEX)
.PHONY:pdf tex clean clearcache cleanall
pdf: $(MAINPDF)
tex: $(RDATAFILES) $(ALLTEX)
$(CACHEDIR):
mkdir $(CACHEDIR)
$(FIGUREDIR):
mkdir $(FIGUREDIR)
copyfiles:
cp ../ThesisChapter/* .
%.tex: %.Rnw
Rscript \
-e "library(knitr)" \
-e "knitr::opts_chunk[['set']](fig.path='$(FIGUREDIR)/$*-')" \
-e "knitr::opts_chunk[['set']](cache.path='$(CACHEDIR)/$*-')" \
-e "knitr::knit('$<','$@')"
%.R:%.Rnw
Rscript -e "Sweave('$^', driver=Rtangle())"
%.Rout:%.R
R CMD BATCH "$^" "$@"
%.bib: %.tex
if [ ! -e $*.aux ];\
then\
$(PDFLT) $*.tex;\
fi;
bibtex $*.aux
%.pdf: %.tex %.bib
$(PDFLT) $*
$(PDFLT) $*
# $(PDFLT) $<
#latexmk -pdf $<
clean:
-latexmk -c -quiet $(MAINFILE).tex
-rm -f $(MAINTEX) $(RNWTEX)
-rm -rf $(FIGUREDIR)
-rm *tikzDictionary
-rm $(MAINPDF)
clearcache:
-rm -rf cache
cleanall: clean clearcache
buildms:
Rscript \
-e "library(knitr)" \
-e "library(tidyverse)" \
-e "knitr::opts_chunk[['set']](fig.path='$(FIGUREDIR)/$*-')" \
-e "knitr::opts_chunk[['set']](cache.path='$(CACHEDIR)/$*-')" \
-e "knitr::knit('$(CHAPTERNAME).Rnw','$(CHAPTERNAME).tex')"
$(PDFLT) $(CHAPTERNAME)
bibtex $(CHAPTERNAME).aux
$(PDFLT) $(CHAPTERNAME)
# removeandbackup