This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 139
/
Copy pathMakefile
68 lines (50 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
67
68
BASE := $(dir $(lastword $(MAKEFILE_LIST)))
RMD=$(wildcard *_*.Rmd)
RCD=$(RMD:.Rmd=.R)
HTM=$(RMD:.Rmd=.html)
PDF=$(RMD:.Rmd=.pdf)
ODT=$(RMD:.Rmd=.odt)
DOC=$(RMD:.Rmd=.docx)
MDN=$(RMD:.Rmd=.md)
IPY=$(RMD:.Rmd=.ipynb)
site: $(RCD) $(PDF) $(HTM) $(DOC) $(ODT) $(MDN) $(IPY)
Rscript -e 'rmarkdown::render_site("index.Rmd")'
site.view: site
firefox _site/index.html &
book.pdf: *.Rmd
Rscript -e 'bookdown::render_book("index.Rmd", output_format="bookdown::pdf_book")'
mv _book/_main.pdf $@
rmdir _book
book.html: *.Rmd
Rscript -e 'bookdown::render_book("index.Rmd", output_format="bookdown::gitbook")'
mv _book _html
%.R: %.Rmd
Rscript -e 'knitr::purl("$*.Rmd")'
%.md: %.Rmd
Rscript -e 'rmarkdown::render("$*.Rmd", "rmarkdown::md_document")'
%.html: %.Rmd
Rscript -e 'rmarkdown::render("$*.Rmd", "rmarkdown::html_document")'
%.pdf: %.Rmd
Rscript -e 'rmarkdown::render("$*.Rmd", "rmarkdown::pdf_document")'
%.view: %.pdf
evince $^
%.ipynb: %.Rmd
notedown $^ --nomagic > $@
sh $(BASE)fix_ipynb.sh $@
%.docx: %.Rmd
Rscript -e 'rmarkdown::render("$*.Rmd", "rmarkdown::word_document")'
%.odt: %.Rmd
Rscript -e 'rmarkdown::render("$*.Rmd", "rmarkdown::odt_document")'
install: realclean site
sudo rsync -avzh _site/ /var/www/html/resources/
sudo chmod -R go+rX /var/www/html/resources/
rsync -avzh _site/*.ipynb adsapldsvm:notebooks/dsr/
firefox /var/www/html/resources/index.html &
clean:
rm -f *.docx *.R *.odt *.pdf *.html *.md *.ipynb
realclean: clean
rm -f *~
rm -rf _book _site _html data models
rm -rf app_education_files
wwwclean:
sudo rm -rf /var/www/html/resources/*