forked from batpigandme/tidynomicon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (58 loc) · 1.91 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
.PHONY : all check clean commands settings
STEM=tidynomicon
CONFIG=_bookdown.yml _output.yml
FIXED=CITATION.md CONDUCT.md CONTRIBUTING.md LICENSE.md README.md
TEMP=$(patsubst %.Rmd,%.md,$(wildcard *.Rmd))
SRC=${CONFIG} ${FIXED} $(wildcard *.Rmd)
OUT=_book
EPUB=${OUT}/${STEM}.epub
HTML=${OUT}/index.html
PDF=${OUT}/${STEM}.pdf
DATABASE=data/example.db
all : commands
#-------------------------------------------------------------------------------
## commands : show all commands.
commands :
@grep -h -E '^##' ${MAKEFILE_LIST} | sed -e 's/## //g'
## everything : rebuild all versions.
everything : ${HTML} ${PDF} ${EPUB}
## html : build HTML version.
html : ${HTML}
## pdf : build PDF version.
pdf : ${PDF}
## epub : build epub version.
epub : ${EPUB}
#-------------------------------------------------------------------------------
${HTML} : ${SRC}
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook'); warnings()"
${PDF} : ${SRC}
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::pdf_book'); warnings()"
${EPUB} : ${SRC}
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::epub_book'); warnings()"
#-------------------------------------------------------------------------------
## clean : clean up generated files.
clean :
@rm -rf ${OUT} ${STEM}.Rmd ${TEMP} *.utf8.md *.knit.md
@find . -name '*~' -exec rm {} \;
## check : internal checks.
check :
@bin/chunks.py ${SRC}
@bin/gloss.py ./gloss.md ${SRC}
@bin/links.py etc/links.md ${SRC}
## database : make example database for advanced topics chapter.
database :
@rm -f ${DATABASE}
@sqlite3 ${DATABASE} < data/create_db.sql
## test : tests on utilities.
test :
@pytest
## settings : echo all variable values.
settings :
@echo STEM ${STEM}
@echo CONFIG ${CONFIG}
@echo FIXED ${FIXED}
@echo SRC ${SRC}
@echo TEMP ${TEMP}
@echo EPUB ${EPUB}
@echo HTML ${HTML}
@echo PDF ${PDF}