notes/Makefile
2018-10-13 16:19:34 +02:00

42 lines
1.1 KiB
Makefile

.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)
COMPRESS_TARGETS=$(HTML_TARGETS:%=%.gz)
COMPRESS_TARGETS+=$(PDF_TARGETS:%=%.gz)
COMPRESS_TARGETS+=$(TEX_TARGETS:%=%.gz)
default: $(DOT_TARGETS) $(HTML_TARGETS) $(PDF_TARGETS) $(TEX_TARGETS)
compress: default $(COMPRESS_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 $@) $<
%.gz: %
gzip -k -f -9 $<
clean:
rm -r build