markdown := $(wildcard *.mdwn) hypertext = $(subst index/index,index,$(markdown:%.mdwn=%/index.html)) all: $(hypertext) %.html %/index.html: %.mdwn $(if $(filter-out ./,$(dir $@)),mkdir -p $(dir $@)) pandoc -f markdown -t html -o $@ $< clean: find -type f -name '*.html' -delete find -type d -empty -delete .PHONY: all clean