Last active
April 25, 2019 15:49
-
-
Save steveherrin/eb688a0cf999f752ad7f9baf705200be to your computer and use it in GitHub Desktop.
Mermaid Makefile
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
SOURCES := $(shell find . -name '*.mmd' -not -path "node_modules") | |
SVGS := $(SOURCES:%.mmd=%.svg) | |
DATEFILE := .last_build.$(shell date +%Y-%m-%d).date | |
MERMAID_CLI := node_modules/.bin/mmdc | |
all: $(MERMAID_CLI) $(SVGS) | |
$(MERMAID_CLI): node_modules | |
node_modules: package.json | |
@npm install | |
%.svg: %.mmd $(DATEFILE) | |
$(MERMAID_CLI) -i $< -o $@ | |
$(DATEFILE): | |
@rm -f .last_build.*.date | |
@touch $@ | |
clean: | |
@rm -f $(SVGS) | |
@rm -f .last_build.*.date | |
cleaner: clean | |
@rm -rf node_modules | |
.PHONY: all clean cleaner |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment