-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
30 lines (22 loc) · 974 Bytes
/
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
# adapted from https://gist.github.com/hjst/4f2f2c2ca9bd550e50c7f06cb17775b2
PLANTUML_JAR_URL = https://sourceforge.net/projects/plantuml/files/plantuml.jar/download
DIAGRAMS_SRC := $(wildcard **/*.plantuml)
DIAGRAMS_PNG := $(addsuffix .png, $(basename $(DIAGRAMS_SRC)))
DIAGRAMS_SVG := $(addsuffix .svg, $(basename $(DIAGRAMS_SRC)))
all: png svg
# build PNGs, probably what we want most of the time
png: plantuml.jar $(DIAGRAMS_PNG)
# SVG are nice-to-have but don't need to build by default
svg: plantuml.jar $(DIAGRAMS_SVG)
# clean up compiled files
clean:
rm -f plantuml.jar $(DIAGRAMS_PNG) $(DIAGRAMS_SVG)
# If the JAR file isn't already present, download it
plantuml.jar:
curl -sSfL $(PLANTUML_JAR_URL) -o plantuml.jar
# Each PNG output depends on its corresponding .plantuml file
**/%.png: **/%.plantuml
java -jar plantuml.jar -tpng $^
# Each SVG output depends on its corresponding .plantuml file
**/%.svg: **/%.plantuml
java -jar plantuml.jar -tsvg $^