Skip to content

Instantly share code, notes, and snippets.

@jacebrowning
Forked from lmullen/gist:3767386
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacebrowning/9376324 to your computer and use it in GitHub Desktop.
Save jacebrowning/9376324 to your computer and use it in GitHub Desktop.
# Produce PDFs from all Markdown files in a directory
#
# https://gist.githubusercontent.com/jacebrowning/9376324/raw/Makefile
#
# On Windows, install:
#
# - https://pandoc.googlecode.com/files/pandoc-1.12.3.msi
# - http://mirrors.ctan.org/systems/win32/miktex/setup/basic-miktex-2.9.5105.exe
# List files to be made by finding all *.md files and appending .pdf
PDFS := $(patsubst %.md,%.md.pdf,$(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
%.md.pdf: %.md Makefile
pandoc $< -o $@ --table-of-contents
# Remove all PDF outputs
clean:
rm $(PDFS)
# Remove all PDF outputs then build them again
rebuild: clean all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment