2024-01-05 21:36:04 +00:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
#
|
|
|
|
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
|
|
|
|
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
|
|
|
|
|
2021-07-23 13:39:44 +00:00
|
|
|
##
|
|
|
|
## GRAPHVIZ MODULE
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2021-07-23 14:07:42 +00:00
|
|
|
## External variables influencing build process (API)
|
2021-07-23 13:39:44 +00:00
|
|
|
##
|
2021-07-23 14:07:42 +00:00
|
|
|
GRAPHVIZ_SRC_DIR ?=
|
|
|
|
GRAPHVIZ_DEST_DIR ?=
|
2021-07-23 13:39:44 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
## Internal variables
|
|
|
|
##
|
|
|
|
|
|
|
|
## Find .dot graphs
|
2021-07-23 14:07:42 +00:00
|
|
|
GRAPHVIZ_DOT := $(shell find $(GRAPHVIZ_SRC_DIR) \( -name '*.dot' ! -name '_*' \))
|
|
|
|
GRAPHVIZ_DOT_SVG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.dot,$(GRAPHVIZ_DEST_DIR)/%.dot.svg,$(GRAPHVIZ_DOT))
|
2024-01-05 21:36:04 +00:00
|
|
|
GRAPHVIZ_DOT_PNG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.dot,$(GRAPHVIZ_DEST_DIR)/%.dot.png,$(GRAPHVIZ_DOT))
|
|
|
|
GRAPHVIZ_DOT_PDF := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.dot,$(GRAPHVIZ_DEST_DIR)/%.dot.pdf,$(GRAPHVIZ_DOT))
|
2021-07-23 13:39:44 +00:00
|
|
|
|
|
|
|
## Find .circo graphs
|
2021-07-23 14:07:42 +00:00
|
|
|
GRAPHVIZ_CIRCO := $(shell find $(GRAPHVIZ_SRC_DIR) \( -name '*.circo' ! -name '_*' \))
|
|
|
|
GRAPHVIZ_CIRCO_SVG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.circo,$(GRAPHVIZ_DEST_DIR)/%.circo.svg,$(GRAPHVIZ_CIRCO))
|
2024-01-05 21:36:04 +00:00
|
|
|
GRAPHVIZ_CIRCO_PNG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.circo,$(GRAPHVIZ_DEST_DIR)/%.circo.png,$(GRAPHVIZ_CIRCO))
|
|
|
|
GRAPHVIZ_CIRCO_PDF := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.circo,$(GRAPHVIZ_DEST_DIR)/%.circo.pdf,$(GRAPHVIZ_CIRCO))
|
|
|
|
|
2021-07-23 14:07:42 +00:00
|
|
|
GRAPHVIZ_SVG := $(GRAPHVIZ_DOT_SVG) $(GRAPHVIZ_CIRCO_SVG)
|
2024-01-05 21:36:04 +00:00
|
|
|
GRAPHVIZ_PNG := $(GRAPHVIZ_DOT_PNG) $(GRAPHVIZ_CIRCO_PNG)
|
|
|
|
GRAPHVIZ_PDF := $(GRAPHVIZ_DOT_PDF) $(GRAPHVIZ_CIRCO_PDF)
|
2021-07-23 13:39:44 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
## Prerequisistes (system packages)
|
|
|
|
##
|
2021-07-23 14:07:42 +00:00
|
|
|
GRAPHVIZ_APT_PACKAGES := graphviz
|
2021-07-23 13:39:44 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
## Rules
|
|
|
|
##
|
|
|
|
|
2023-12-18 16:24:39 +00:00
|
|
|
$(GRAPHVIZ_DEST_DIR):
|
|
|
|
mkdir -p $(GRAPHVIZ_DEST_DIR)
|
|
|
|
|
|
|
|
$(GRAPHVIZ_DEST_DIR)/%.dot.svg: $(GRAPHVIZ_SRC_DIR)/%.dot | $(GRAPHVIZ_DEST_DIR)
|
2021-07-23 13:39:44 +00:00
|
|
|
dot -Tsvg $< > $@
|
|
|
|
|
2023-12-18 16:24:39 +00:00
|
|
|
$(GRAPHVIZ_DEST_DIR)/%.circo.svg: $(GRAPHVIZ_SRC_DIR)/%.circo | $(GRAPHVIZ_DEST_DIR)
|
2021-07-23 13:39:44 +00:00
|
|
|
circo -Tsvg $< > $@
|
|
|
|
|
2021-07-23 14:07:42 +00:00
|
|
|
$(GRAPHVIZ_SVG): | $(GRAPHVIZ_DEST_DIR)
|
2021-07-23 13:39:44 +00:00
|
|
|
|
2024-01-05 21:36:04 +00:00
|
|
|
$(GRAPHVIZ_PDF): | $(GRAPHVIZ_DEST_DIR)
|
|
|
|
|
|
|
|
$(GRAPHVIZ_PNG): | $(GRAPHVIZ_DEST_DIR)
|
|
|
|
|
|
|
|
.PHONY: graphviz-build-dot-svg
|
2021-07-23 14:07:42 +00:00
|
|
|
graphviz-build-dot-svg: $(GRAPHVIZ_DOT_SVG)
|
2021-07-23 13:39:44 +00:00
|
|
|
|
2024-01-05 21:36:04 +00:00
|
|
|
.PHONY: graphviz-build-circo-svg
|
2021-07-23 14:07:42 +00:00
|
|
|
graphviz-build-circo-svg: $(GRAPHVIZ_CIRCO_SVG)
|
2021-07-23 13:39:44 +00:00
|
|
|
|
2024-01-05 21:36:04 +00:00
|
|
|
.PHONY: graphviz-build-svg
|
2021-07-23 14:07:42 +00:00
|
|
|
graphviz-build-svg: graphviz-build-dot-svg graphviz-build-circo-svg
|
|
|
|
|
2024-01-05 21:36:04 +00:00
|
|
|
.PHONY: graphviz-buil
|
2021-07-23 14:07:42 +00:00
|
|
|
graphviz-build: graphviz-build-svg
|
|
|
|
|
|
|
|
|
|
|
|
# Clean
|
|
|
|
#
|
2024-01-05 21:36:04 +00:00
|
|
|
.PHONY: graphviz-clean-svg
|
2021-07-23 13:39:44 +00:00
|
|
|
graphviz-clean-svg:
|
2021-07-23 14:07:42 +00:00
|
|
|
rm -f $(GRAPHVIZ_SVG)
|
2021-07-23 13:39:44 +00:00
|
|
|
|
2024-01-05 21:36:04 +00:00
|
|
|
.PHONY: graphviz-clean-pdf
|
|
|
|
graphviz-clean-pdf:
|
|
|
|
rm -f $(GRAPHVIZ_PDF)
|
|
|
|
|
|
|
|
.PHONY: graphviz-clean-png
|
|
|
|
graphviz-clean-png:
|
|
|
|
rm -f $(GRAPHVIZ_PNG)
|
|
|
|
|
|
|
|
.PHONY: graphviz-clean
|
|
|
|
graphviz-clean: graphviz-clean-svg graphviz-clean-png graphviz-clean-pdf
|
2021-07-23 13:39:44 +00:00
|
|
|
|