Last active
October 14, 2019 22:04
-
-
Save colindean/8a323d40a594197edde21de1226ab5b0 to your computer and use it in GitHub Desktop.
Generic base Makefile for a directory with Graphviz dot files to generate PNG and SVG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reusable Graphviz dot -> (PNG,SVG) makefile | |
DOT=dot | |
PNGCRUSH=pngcrush | |
SVGO=svgo | |
DOTS=$(wildcard *.dot) | |
PNGS=$(DOTS:.dot=.png) | |
SVGS=$(DOTS:.dot=.svg) | |
diagrams: $(PNGS) $(SVGS) | |
%.png: %.dot | |
$(DOT) "-Tpng" "$<" -o "$@" | |
[[ -f "$@" ]] && [[ -n "$(shell command -v $(PNGCRUSH))" ]] && $(PNGCRUSH) -ow "$@" | |
%.svg: %.dot | |
$(DOT) "-Tsvg" "$<" -o "$@" | |
[[ -f "$@" ]] && [[ -n "$(shell command -v $(SVGO))" ]] && $(SVGO) --multipass -i "$@" | |
clean: | |
rm $(PNGS) $(SVGS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment