Skip to content

Instantly share code, notes, and snippets.

@MLKrisJohnson
Created August 5, 2020 17:47
Show Gist options
  • Save MLKrisJohnson/52d3c184da6a74aa4243e0d37654baa8 to your computer and use it in GitHub Desktop.
Save MLKrisJohnson/52d3c184da6a74aa4243e0d37654baa8 to your computer and use it in GitHub Desktop.
Makefile that runs GraphViz Dot utility on all *.gv files in the current directory
# Makefile for GraphViz files in this directory
#
# `make all` - build all targets
# `make clean` - delete all targets
# `make listtargets` - print list of all targets
# `brew install graphviz`, or download from <http://graphviz.org/download/>
# to get the `dot` utility.
DOT?=dot
# Pattern rules
%.png : %.gv
$(DOT) -Tpng -o $@ $<
%.svg : %.gv
$(DOT) -Tsvg -o $@ $<
# Process all *.gv files in this directory, producing .png and .svg output.
SRC_FILES=$(wildcard *.gv)
OUT_FILES=$(SRC_FILES:.gv=.png) $(SRC_FILES:.gv=.svg)
all: $(OUT_FILES)
.PHONY: all
listtargets:
@echo $(OUT_FILES)
.PHONY: listtargets
clean:
- $(RM) $(OUT_FILES)
.PHONY: clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment