-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathMakefile
61 lines (48 loc) · 1.85 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
# A Makefile for generating the PDFs from the R Markdown files.
#
# * Type "make slides" in this directory to generate a PDF of the
# slides from the R Markdown source.
#
# * Type "make test" to generate a PDF of the slides that also runs
# a lot of the R code.
#
# * Optionally, type "make handout" to generate a PDF document that
# can be used as a handout to distribute to workshop participants,
# or as an instructor aid. For improved layout, I recommend setting
# the YAML header in slides.Rmd to
#
# ---
# title: "Large-scale data analysis in R"
# author: Peter Carbonetto
# header-includes:
# - \usepackage{newcent}
# ---
#
# * Type "make clean" to discard the generated PDFs, and all accompanying
# output.
#
# RULES
# -----
all: slides
slides: slides.pdf
test: slides_test.pdf
handout: handout.pdf
slides_with_notes.Rmd : docs/slides_with_notes.Rmd
cp docs/slides_with_notes.Rmd slides_with_notes.Rmd
slides.Rmd : slides_with_notes.Rmd
grep -v '^>' slides_with_notes.Rmd > slides.Rmd
# Create the slides.
slides.pdf : slides.Rmd
Rscript -e 'knitr::opts_chunk$$set(eval = FALSE); rmarkdown::render("slides.Rmd")'
# Create the slides with the instructor's notes.
slides_with_notes.pdf : slides_with_notes.Rmd
Rscript -e 'knitr::opts_chunk$$set(eval = FALSE); rmarkdown::render("slides_with_notes.Rmd",output_format = "pdf_document")'
# Generate the slides while also testing the R code.
slides_test.pdf : slides.Rmd
Rscript -e 'knitr::opts_chunk$$set(eval = TRUE); rmarkdown::render("slides.Rmd",output_file = "slides_test.pdf")'
# Create the handout.
handout.pdf : slides.Rmd
Rscript -e 'knitr::opts_chunk$$set(eval = FALSE); rmarkdown::render("slides.Rmd",output_format = "pdf_document",output_file = "handout.pdf")'
clean:
rm -f slides.pdf slides_test.pdf handout.pdf
rm -f slides_with_notes.Rmd rm -f slides_with_notes.pdf