notes/Makefile
Valentin Brandl 4f8b9c95aa
All checks were successful
the build was successful
Also copy exercises
2018-10-15 20:12:05 +02:00

49 lines
1.3 KiB
Makefile

.PHONY: default clean
COPY_PDF=$(shell find . -name '*.pdf' -not -path './build/*')
COPY_TARGETS=$(COPY_PDF:%.pdf=build/%.pdf)
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) $(COPY_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 $<
build/%.pdf: %.pdf
@mkdir -p $$(dirname $@)
cp $< $@
clean:
rm -r build