-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
69 lines (54 loc) · 1.73 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
BUILD_DIR := gen
PANDOC := pandoc
PANDOC_OPTS_ALL := -S --toc \
--top-level-division=chapter \
--filter pandoc-fignos
PANDOC_PDF_OPTS := $(PANDOC_OPTS_ALL) \
--default-image-extension=pdf \
--variable links-as-notes \
--template=templates/latex-template.tex
PANDOC_PRINT_OPTS := $(PANDOC_PDF_OPTS) --no-highlight
PANDOC_EPUB_OPTS := $(PANDOC_OPTS_ALL) \
--default-image-extension=png \
-t epub3 --toc-depth=1 \
--epub-cover-image=cover.png
PANDOC_WORD_OPTS := $(PANDOC_OPTS_ALL) \
--default-image-extension=pdf \
--variable links-as-notes \
--toc-depth=1
#CHAPTERS := 000_header.md \
06_point_free_programming.md \
07_conclusions.md
CHAPTERS := 000_header.md \
00_Introduction.md \
01_functions_in_R.md \
02_pure_functional_programming.md \
03_scope_and_closures.md \
04_higher_order_functions.md \
05_filter_map_and_reduce.md \
06_point_free_programming.md \
07_conclusions.md
book.pdf: pdf_book.md templates/latex-template.tex
$(PANDOC) $(PANDOC_PDF_OPTS) -o $@ pdf_book.md
print_book.pdf: pdf_book.md templates/latex-template.tex
$(PANDOC) $(PANDOC_PRINT_OPTS) -o $@ pdf_book.md
book.docx: pdf_book.md
$(PANDOC) $(PANDOC_WORD_OPTS) -o $@ pdf_book.md
book.epub: ebook.md
$(PANDOC) $(PANDOC_EPUB_OPTS) -o $@ ebook.md
book.mobi: book.epub
./kindlegen book.epub -o book.mobi
pdf_book.md: $(CHAPTERS) Makefile
cat $(CHAPTERS) | gpp -DPDF > pdf_book.Rmd
./runknitr.sh pdf_book.Rmd
rm pdf_book.Rmd
ebook.md: $(CHAPTERS) Makefile
cat $(CHAPTERS) | gpp -DEPDF > ebook.Rmd
./runknitr.sh ebook.Rmd
rm ebook.Rmd
all: book.pdf book.epub book.mobi
%.md: %.Rmd
./runknitr.sh $<
clean:
rm book.pdf book.epub book.mobi pdf_book.Rmd ebook.Rmd
rm pdf_book.md ebook.md