langchart/Makefile

61 lines
1.1 KiB
Makefile
Raw Permalink Normal View History

2021-04-15 17:54:46 +02:00
DARK_BASE_ATTRS=\
2021-04-09 21:26:15 +02:00
color=white \
2021-04-15 17:54:46 +02:00
fontcolor=white
DARK_GRAPH_ATTRS=\
$(DARK_BASE_ATTRS) \
bgcolor=gray8
DARK_NODE_ATTRS=\
$(DARK_BASE_ATTRS)
DARK_EDGE_ATTRS=\
$(DARK_BASE_ATTRS)
BASE_ATTRS=\
2021-04-09 21:39:46 +02:00
fontname="sans-serif"
2021-03-30 21:50:03 +02:00
2021-04-09 21:26:15 +02:00
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))
2021-03-30 21:50:03 +02:00
2021-04-15 17:54:46 +02:00
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)
2021-03-30 15:06:01 +02:00
.PHONY: All
2021-04-15 17:54:46 +02:00
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
2021-03-30 15:06:01 +02:00
.PHONY: clean
clean:
rm -rf build
2021-04-15 17:54:46 +02:00
$(BUILD_PATH_PREFIX)build/%.svg: %.dot
2021-03-30 15:06:01 +02:00
@mkdir -p $(@D)
2021-04-15 17:54:46 +02:00
$(DOT_CMD) -Tsvg $< -o $@
2021-03-30 15:06:01 +02:00
2021-04-15 17:54:46 +02:00
$(BUILD_PATH_PREFIX)build/%.png: %.dot
2021-03-30 15:06:01 +02:00
@mkdir -p $(@D)
2021-04-15 17:54:46 +02:00
$(DOT_CMD) -Tpng $< -o $@
2021-04-09 21:26:15 +02:00