forked from batpigandme/tidynomicon
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
66 lines (49 loc) · 1.57 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
.PHONY : all check clean commands settings
STEM=tidynomicon
CONFIG=_bookdown.yml _output.yml
SRC=${CONFIG} $(wildcard *.Rmd) $(wildcard *.md)
OUT=_book
EPUB=${OUT}/${STEM}.epub
HTML=${OUT}/index.html
PDF=${OUT}/${STEM}.pdf
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
@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}
## test : tests on utilities.
test :
@pytest
## settings : echo all variable values.
settings :
@echo STEM ${STEM}
@echo CONFIG ${CONFIG}
@echo SRC ${SRC}
@echo EPUB ${EPUB}
@echo HTML ${HTML}
@echo PDF ${PDF}