notes/Makefile

55 lines
1.4 KiB
Makefile
Raw Normal View History

2018-10-13 13:23:37 +02:00
.PHONY: default clean
2018-10-15 20:12:05 +02:00
COPY_PDF=$(shell find . -name '*.pdf' -not -path './build/*')
COPY_TARGETS=$(COPY_PDF:%.pdf=build/%.pdf)
COPY_JPG=$(shell find . -name '*.jpg' -not -path './build/*')
COPY_TARGETS_JPG=$(COPY_JPG:%.jpg=build/%.jpg)
2018-10-13 13:23:37 +02:00
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)
2018-10-13 16:19:34 +02:00
COMPRESS_TARGETS=$(HTML_TARGETS:%=%.gz)
COMPRESS_TARGETS+=$(TEX_TARGETS:%=%.gz)
2019-01-31 15:20:08 +01:00
default: $(DOT_TARGETS) $(HTML_TARGETS) $(COPY_TARGETS) $(COPY_TARGETS_JPG) $(TEX_TARGETS)
2018-10-13 13:23:37 +02:00
2018-10-13 16:19:34 +02:00
compress: default $(COMPRESS_TARGETS)
2018-10-13 13:23:37 +02:00
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 -shell-escape -pdf -outdir=$$(dirname $@) $<
2018-10-13 13:23:37 +02:00
2018-10-13 16:19:34 +02:00
%.gz: %
gzip -k -f -9 $<
2018-10-15 20:12:05 +02:00
build/%.pdf: %.pdf
@mkdir -p $$(dirname $@)
cp $< $@
build/%.jpg: %.jpg
@mkdir -p $$(dirname $@)
cp $< $@
2018-10-13 13:23:37 +02:00
clean:
rm -r build