notes/Makefile

33 lines
934 B
Makefile
Raw Normal View History

2018-10-13 13:23:37 +02:00
.PHONY: default clean
MD_SOURCES=$(shell find . -name '*.md' -not -path "./templates/*")
HTML_TARGETS=$(MD_SOURCES:%.md=build/%.html)
PDF_TARGETS=$(MD_SOURCES:%.md=build/%.pdf)
DOT_SOURCES=$(shell find . -name '*.dot' -not -path "./templates/*")
DOT_TARGETS=$(DOT_SOURCES:%.dot=build/%.png)
TEX_SOURCES=$(shell find . -not -path "./templates/*" -name '*.tex')
TEX_TARGETS=$(TEX_SOURCES:%.tex=build/%.pdf)
default: $(DOT_TARGETS) $(HTML_TARGETS) $(PDF_TARGETS) $(TEX_TARGETS)
build/%.html: %.md
@mkdir -p $$(dirname $@)
pandoc -s --mathjax --template ./templates/mindoc.html --toc --toc-depth=2 -o $@ $<
build/%.pdf: %.md
@mkdir -p $$(dirname $@)
pandoc --resource-path=$$(dirname $@) --template ./templates/eisvogel.tex --toc --toc-depth=2 -o $@ $<
build/%.png: %.dot
@mkdir -p $$(dirname $@)
dot -Tpng -o $@ $<
build/%.pdf: %.tex
@mkdir -p $$(dirname $@)
latexmk -pdf -outdir=$$(dirname $@) $<
clean:
rm -r build