Published: Tuesday, Feb 19, 2013 Last modified: Tuesday, Nov 26, 2024

Store markdown formatted index.mdwn files in a directory hierarchy. Store the style.css, header.inc & footer.inc in the base directory with the following Makefile:

INFILES = $(shell find . -name "*.mdwn")
OUTFILES = $(INFILES:.mdwn=.html)

all: $(OUTFILES)

%.html: %.mdwn footer.inc header.inc style.css
	m4 -PEIinc header.inc > $@
	markdown $< >> $@
	cat footer.inc >> $@

clean:
	rm -f $(OUTFILES)

PHONY: all clean

Now simply run make to generate your site.