Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Forked from MLKrisJohnson/Makefile
Created August 9, 2020 19:14
Show Gist options
  • Save kristopherjohnson/c804c1d7f559ac7b11b6bdcb3d04c898 to your computer and use it in GitHub Desktop.
Save kristopherjohnson/c804c1d7f559ac7b11b6bdcb3d04c898 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