2025-05-12 01:25:05 +00:00
|
|
|
#%SRCPAT% \.md
|
|
|
|
|
2025-05-09 01:50:03 +00:00
|
|
|
############
|
|
|
|
# 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
|
2025-05-11 20:06:35 +00:00
|
|
|
all: pdf
|
2025-05-09 01:50:03 +00:00
|
|
|
|
|
|
|
pdf: pdfPub pdfInt
|
|
|
|
pdfPub: $(pdfFilesPub)
|
|
|
|
pdfInt: $(pdfFilesInt)
|
|
|
|
|
|
|
|
tex: texPub texInt
|
|
|
|
texPub: $(texFilesPub)
|
|
|
|
texInt: $(texFilesInt)
|
|
|
|
|
|
|
|
|
|
|
|
###########
|
|
|
|
# Recipes #
|
|
|
|
###########
|
|
|
|
|
2025-05-11 20:49:17 +00:00
|
|
|
compile_md = pandoc \
|
|
|
|
$(2) \
|
2025-05-09 01:50:03 +00:00
|
|
|
--standalone \
|
|
|
|
--from markdown \
|
2025-05-11 20:49:17 +00:00
|
|
|
--to $(1) \
|
2025-05-12 01:25:05 +00:00
|
|
|
--template lev-protokoll \
|
2025-05-09 01:50:03 +00:00
|
|
|
--variable colorlinks:true \
|
|
|
|
--variable csquotes:true \
|
|
|
|
--variable lang:de-DE \
|
2025-05-11 20:49:17 +00:00
|
|
|
--output $(3)
|
|
|
|
|
|
|
|
GSFLAGS := \
|
|
|
|
-sDEVICE=pdfwrite \
|
|
|
|
-dNOOUTERSAVE \
|
|
|
|
-dNOPAUSE \
|
|
|
|
-dQUIET \
|
|
|
|
-dBATCH
|
|
|
|
|
|
|
|
postprocess_pdf = gs \
|
|
|
|
$(GSFLAGS) \
|
|
|
|
-sPAPERSIZE=a4 \
|
|
|
|
-dFIXEDMEDIA \
|
|
|
|
-dPDFFitPage \
|
|
|
|
-dCompatibilityLevel=1.7 \
|
|
|
|
-dPDFSETTINGS=/ebook \
|
|
|
|
-sOutputFile=$(2) \
|
|
|
|
$(1) \
|
|
|
|
2>/dev/null
|
|
|
|
|
|
|
|
convert_pdfa = /opt/pdfa/bin/gs-919-linux_x86_64 \
|
|
|
|
$(GSFLAGS) \
|
|
|
|
-dPDFA=2 \
|
|
|
|
-sProcessColorModel=DeviceRGB \
|
|
|
|
-dPDFACompatibilityPolicy=1 \
|
|
|
|
-sOutputFile=$(2) \
|
|
|
|
/opt/pdfa/PDFA_def.ps \
|
|
|
|
$(1) \
|
|
|
|
2>/dev/null
|
2025-05-09 01:50:03 +00:00
|
|
|
|
2025-05-11 20:49:17 +00:00
|
|
|
md2pdf = $(call compile_md,pdf,$(1),-) | $(call postprocess_pdf,-,$(2))
|
2025-05-09 01:50:03 +00:00
|
|
|
|
2025-05-11 20:49:17 +00:00
|
|
|
md2pdfa = $(call md2pdf,$(1),-) | $(call convert_pdfa,-,$(2))
|
|
|
|
|
|
|
|
# pdf
|
|
|
|
|
2025-05-12 01:25:05 +00:00
|
|
|
%$(suffixPub).pdf: %.md lev-shorthands.sty
|
|
|
|
python3 /opt/lenaisten/redact.py $< | $(call md2pdfa,-,$@)
|
2025-05-11 20:06:35 +00:00
|
|
|
|
2025-05-12 01:25:05 +00:00
|
|
|
%$(suffixInt).pdf: %.md lev-shorthands.sty
|
|
|
|
python3 /opt/lenaisten/redact.py -i $< | $(call md2pdfa,-,$@)
|
2025-05-11 20:49:17 +00:00
|
|
|
|
|
|
|
# tex
|
|
|
|
|
2025-05-12 01:25:05 +00:00
|
|
|
%$(suffixPub).tex: %.md lev-shorthands.sty
|
|
|
|
python3 /opt/lenaisten/redact.py $< | $(call compile_md,latex,-,$@)
|
2025-05-11 20:06:35 +00:00
|
|
|
|
2025-05-12 01:25:05 +00:00
|
|
|
%$(suffixInt).tex: %.md lev-shorthands.sty
|
|
|
|
python3 /opt/lenaisten/redact.py -i $< | $(call compile_md,latex,-,$@)
|