langchart/Makefile
LordMZTE 1a9e1b0a01
All checks were successful
continuous-integration/drone/push Build is passing
add option to build in light mode
2021-04-15 17:54:46 +02:00

60 lines
1.1 KiB
Makefile

DARK_BASE_ATTRS=\
color=white \
fontcolor=white
DARK_GRAPH_ATTRS=\
$(DARK_BASE_ATTRS) \
bgcolor=gray8
DARK_NODE_ATTRS=\
$(DARK_BASE_ATTRS)
DARK_EDGE_ATTRS=\
$(DARK_BASE_ATTRS)
BASE_ATTRS=\
fontname="sans-serif"
GRAPH_ATTRS=\
$(BASE_ATTRS) \
NODE_ATTRS=\
$(BASE_ATTRS)
EDGE_ATTRS=\
$(BASE_ATTRS)
DOT_BASE_CMD=dot \
$(patsubst %,-G%,$(GRAPH_ATTRS)) \
$(patsubst %,-N%,$(NODE_ATTRS)) \
$(patsubst %,-E%,$(EDGE_ATTRS))
DARK_CMD_EXT=\
$(patsubst %,-G%,$(DARK_GRAPH_ATTRS)) \
$(patsubst %,-N%,$(DARK_NODE_ATTRS)) \
$(patsubst %,-E%,$(DARK_EDGE_ATTRS))
DOT_CMD=$(shell if [[ -v "LIGHT_MODE" ]]; then echo "$(DOT_BASE_CMD)"; else echo "$(DOT_BASE_CMD) $(DARK_CMD_EXT)"; fi)
BUILD_PATH_PREFIX=$(shell if [[ -v "LIGHT_MODE" ]]; then echo "light/"; fi)
.PHONY: All
All:\
$(BUILD_PATH_PREFIX)build/de.png \
$(BUILD_PATH_PREFIX)build/de.svg \
$(BUILD_PATH_PREFIX)build/en.png \
$(BUILD_PATH_PREFIX)build/en.svg
.PHONY: clean
clean:
rm -rf build
$(BUILD_PATH_PREFIX)build/%.svg: %.dot
@mkdir -p $(@D)
$(DOT_CMD) -Tsvg $< -o $@
$(BUILD_PATH_PREFIX)build/%.png: %.dot
@mkdir -p $(@D)
$(DOT_CMD) -Tpng $< -o $@