Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Make all markdown files in directory into PDFs
# Produce PDFs from all Markdown files in a directory
# Lincoln Mullen | |
# List files to be made by finding all *.md files and appending .pdf
PDFS := $(patsubst,,$(wildcard *.md))
# The all rule makes all the PDF files listed
all : $(PDFS)
# This generic rule accepts PDF targets with corresponding Markdown
# source, and makes them using pandoc :
pandoc $< -o $@
# Remove all PDF outputs
clean :
rm $(PDFS)
# Remove all PDF outputs then build them again
rebuild : clean all
Copy link

mesbahamin commented Aug 13, 2016

Exactly what I was looking for, and I learned a thing or two about makefiles too. Thanks!

Copy link

eliaszica commented May 30, 2017

Very useful, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment