-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (27 loc) · 1.07 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
# -- Variables -----------------------------------------------------------------
OUTPUT_DIRECTORY := Bookdown
INDEX_FILE := ReadMe.md
OUTPUT_NAME := WFL-M35
EPUB_FILE := $(OUTPUT_DIRECTORY)/$(OUTPUT_NAME).epub
HTML_FILE := $(OUTPUT_DIRECTORY)/$(OUTPUT_NAME).html
PDF_FILE := $(OUTPUT_DIRECTORY)/$(OUTPUT_NAME).pdf
# -- Rules ---------------------------------------------------------------------
# =================
# = Documentation =
# =================
doc: $(EPUB_FILE) $(HTML_FILE) $(PDF_FILE)
epub: $(EPUB_FILE)
html: $(HTML_FILE)
pdf: $(PDF_FILE)
# Generate EPUB document
$(EPUB_FILE): $(INDEX_FILE)
Rscript -e "bookdown::render_book('$(INDEX_FILE)', 'bookdown::epub_book')"
# Generate (GitBook) HTML document
$(HTML_FILE): $(INDEX_FILE)
Rscript -e "bookdown::render_book('$(INDEX_FILE)', 'bookdown::gitbook')"
Rscript -e "file.rename('$(HTML_FILE)', '$(OUTPUT_DIRECTORY)/index.html')"
# Generate PDF
$(PDF_FILE): $(INDEX_FILE)
Rscript -e "bookdown::render_book('$(INDEX_FILE)', 'bookdown::pdf_book')"
clean:
Rscript -e "unlink('$(OUTPUT_DIRECTORY)', recursive = TRUE)"