-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (35 loc) · 1.01 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
##
# Build the PlantUML k8s library
#
# @file
# @version 0.1
SDIR = src
DEST ?= k8s
PLANTUML ?= plantuml.jar
SVG_SRC = $(call rwildcard, src/, *.svg)
PNG_SRC = $(SVG_SRC:svg=png)
SPRITE_SRC = $(PNG_SRC:png=sprite)
BUILD_DIRS = $(subst $(SDIR),$(DEST),$(sort $(dir $(SVG_SRC))))
PUML_FILES = $(addsuffix all.puml, $(BUILD_DIRS))
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
all: make_dirs $(PNG_SRC) $(SPRITE_SRC) $(PUML_FILES) $(DEST)/common.puml
.PHONY: make_dirs
make_dirs: $(BUILD_DIRS)
$(BUILD_DIRS):
mkdir -p $@
%.png: %.svg
cat $< | sed -e "s/326ce5/000000/g" | rsvg-convert -b white -w 128 -f png > $@
%.sprite: %.png
java -jar $(PLANTUML) -encodesprite 16z $< > $@
sed -i -e 's#\$$\w\+\b#\$$$(subst -,_,$(notdir $*))#' $@
%.puml: $(SPRITE_SRC)
cat $(dir $(@:$(DEST)/%=$(SDIR)/%))*.sprite > $@
$(DEST)/common.puml: common
cp common $(DEST)/common.puml
.PHONY: clean
clean:
rm $(PNG_SRC) $(SPRITE_SRC)
.PHONY: distclean
distclean: clean
rm -rf $(DEST)/
# end