-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (41 loc) · 1.18 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
.DEFAULT_GOAL = all
# Base Variables
PUML_JAR := tmp/plantuml.jar
PUML_JAR_URL := https://sourceforge.net/projects/plantuml/files/plantuml.jar/download
## Soure Variables
SRC_MD = $(wildcard *.md) $(wildcard docs/*.md)
PDF_MD = $(SRC_MD:.md=.pdf)
SRC_PUML = $(wildcard docs/*.puml)
PNG_PUML = $(SRC_PUML:.puml=.png)
## Phony Targets
.PHONY: all
all: docs
.PHONY: clean
clean:
rm -rf ./tmp
rm -f $(PNG_PUML) $(PDF_MD)
.PHONY: docs
docs: $(PNG_PUML) $(PDF_MD) # Render images before PDFs.
.PHONY: install
install: ${PUML_JAR}
brew cask install java
brew install graphviz libtool node
npm install -g markdown-pdf
## Real Targets
%.pdf: %.md $(PNG_PUML)
## The word parse is to gracefully ignore filenames that are
## transient dependencies.
markdown-pdf -o $@ $(word 1, $<)
docs/%.pdf: docs/%.md $(PNG_PUML)
## We must cd into this directory because images embedded
## in markdown files use relative links.
##
## The word parse is to gracefully ignore filenames that are
## transient dependencies.
cd docs && markdown-pdf -o $(notdir $@) $(notdir $(word 1, $<))
docs/%.png: docs/%.puml
java -jar ${PUML_JAR} $<
tmp:
mkdir -p tmp
${PUML_JAR}: tmp
curl -fsSL -o $@ ${PUML_JAR_URL}