-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (47 loc) · 1.55 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
# Makefile
# Converts Markdown to other formats (HTML, PDF, DOCX, EPUB) using Pandoc and MkDocs
#
# Run "make" (or "make all") to convert to all other formats
# Run "make clean" to delete converted files
# Prerequisites
# Install pandoc, latex and mkdocs in your environment
# - Ubuntu: `sudo apt-get install pandoc`
#
# Parameters and Variables
# https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html#Automatic-Variables
#
# Convert .docx to .md
# pandoc --extract-media ./assets input.docx -o output.md
SOURCE_DOCS := $(wildcard docs/*.md)
BUILD_DIR :=./build
SITE_DIR :=./site
EXPORTED_DOCS=\
$(SOURCE_DOCS:.md=.pdf) \
$(SOURCE_DOCS:.md=.docx) \
$(SOURCE_DOCS:.md=.epub)
RM=/bin/rm
PANDOC=pandoc
MKDOCS=mkdocs
PANDOC_OPTIONS=--toc --metadata title="The European Digital Identity Wallet Architecture and Reference Framework" --metadata lang="en" --data-dir docs/media
PANDOC_PDF_OPTIONS= --pdf-engine=xelatex
PANDOC_DOCX_OPTIONS=
PANDOC_EPUB_OPTIONS=--to epub3
# Pattern-matching Rules
%.pdf : %.md
mkdir -p $(BUILD_DIR)/pdf
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_PDF_OPTIONS) -o $(BUILD_DIR)/pdf/$(notdir $@) $<
%.docx : %.md
mkdir -p $(BUILD_DIR)/docx
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_DOCX_OPTIONS) -o $(BUILD_DIR)/docx/$(notdir $@) $<
%.epub : %.md
mkdir -p $(BUILD_DIR)/epub
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_EPUB_OPTIONS) -o $(BUILD_DIR)/epub/$(notdir $@) $<
# Targets and dependencies
.PHONY: all clean
all : $(EXPORTED_DOCS) mkdocs
mkdocs:
$(MKDOCS) build
serve:
$(MKDOCS) serve
clean:
- $(RM) -rf $(BUILD_DIR) $(SITE_DIR)