############ # Settings # ############ suffixPub := suffixInt := _intern ########### # Default # ########### suffixSubst = $(patsubst %.$(2),%$(4).$(3),$(1)) mdFiles := $(wildcard *.md) pdfFilesPub := $(call suffixSubst,$(mdFiles),md,pdf,$(suffixPub)) texFilesPub := $(call suffixSubst,$(mdFiles),md,tex,$(suffixPub)) pdfFilesInt := $(call suffixSubst,$(mdFiles),md,pdf,$(suffixInt)) texFilesInt := $(call suffixSubst,$(mdFiles),md,tex,$(suffixInt)) .PHONY: all pdf pdfPub pdfInt tex texPub texInt all: pdf pdf: pdfPub pdfInt pdfPub: $(pdfFilesPub) pdfInt: $(pdfFilesInt) tex: texPub texInt texPub: $(texFilesPub) texInt: $(texFilesInt) ########### # Recipes # ########### compile = pandoc \ $(1) \ --standalone \ --from markdown \ --to latex \ --template lenaisten \ --variable colorlinks:true \ --variable csquotes:true \ --variable lang:de-DE \ --output $(2) %$(suffixPub).pdf: %.md lenaisten-defs.sty python3 ./redact.py $< | $(call compile,-,$@) %$(suffixPub).tex: %.md lenaisten-defs.sty python3 ./redact.py $< | $(call compile,-,$@) %$(suffixInt).pdf: %.md lenaisten-defs.sty python3 ./redact.py -i $< | $(call compile,-,$@) %$(suffixInt).tex: %.md lenaisten-defs.sty python3 ./redact.py -i $< | $(call compile,-,$@)