Skip to content

Instantly share code, notes, and snippets.

@aquilax
Last active February 28, 2024 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aquilax/2fe8dddb45d468287ec46fad5b418de2 to your computer and use it in GitHub Desktop.
Save aquilax/2fe8dddb45d468287ec46fad5b418de2 to your computer and use it in GitHub Desktop.
Generate diagrams
# Define variables
SRCDIR := .
DOTFILES := $(shell find $(SRCDIR) -type f -name '*.dot')
PUMLFILES := $(shell find $(SRCDIR) -type f -name '*.puml')
MERMAIDFILES := $(shell find $(SRCDIR) -type f -name '*.mmd')
PNGFILES := $(DOTFILES:.dot=.png) $(PUMLFILES:.puml=.png) $(MERMAIDFILES:.mmd=.png)
DOT := dot
PLANTUML := java -jar plantuml-1.2023.4.jar
MERMAID := mmdc
# Define the default target
all: $(PNGFILES)
# Define the rule to create PNG files from DOT files
%.png: %.dot
$(DOT) -Tpng $< -o $@
# Define the rule to create PNG files from PlantUML files
%.png: %.puml
$(PLANTUML) -tpng $<
# Define the rule to create PNG files from Mermaid files
%.png: %.mmd
$(MERMAID) -i $< -o $@
# Define the clean target
clean:
rm -f $(PNGFILES)
.PHONY: all clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment