PANDOC      = pandoc
PDF_ENGINE  = weasyprint
TEMPLATE    = template.html
CSS         = style.css
PPTX_REF    = reference.pptx
PARTNERS    = $(patsubst %.md,%.pdf,$(wildcard partners/*.md))
PPTX_PARTNERS = $(patsubst %.md,%.pptx,$(wildcard partners/*.md))

.PHONY: all slides clean

all: template.pdf $(PARTNERS)

# style.css is linked directly from template.html (not passed via --css),
# but listed here so editing it triggers a rebuild of every PDF.
%.pdf: %.md $(TEMPLATE) $(CSS)
	$(PANDOC) $< -o $@ --template=$(TEMPLATE) --pdf-engine=$(PDF_ENGINE) --standalone

# Slide deck for screen-share recordings. pptx ignores style.css -- its look
# (colors/fonts) comes from reference.pptx's slide master instead, so that's
# the file to edit if the slide theme needs to change.
slides: template.pptx $(PPTX_PARTNERS)

%.pptx: %.md $(PPTX_REF)
	$(PANDOC) $< -o $@ --reference-doc=$(PPTX_REF)

clean:
	rm -f template.pdf template.pptx partners/*.pdf partners/*.pptx

partnership: template.md
	cp template.md partners/$(SLUG).md
