Continuing the spirit of documenting those little recipes I find myself continually drawing upon, a makefile for turning a directory of markdown sources to HTML using pandoc and simply by typing make.

# find all .md files in the directory
mdsrc=$(shell ls *.md)
# map *.mp => *.html for mdsrc
html_from_md=$(mdsrc:%.md=%.html)
 
all: $(html_from_md)
 
# Implicit rule to know how to make .html from .md
%.html: %.md
	pandoc --from markdown \
		--to html \
		--standalone \
		--css styles.css \
		$< -o $@
 
# special rule for debugging variables
print-%:
	@echo '$*=$($*)'

Note the assumption of the presence of a stylesheet named styles.css.