TMPDIR ?= _tmp BUILDDIR ?= _build PAGESDIR ?= pages DATADIR ?= data TEMPLATE ?= $(DATADIR)/template.html PAGES != find $(PAGESDIR) -name '*.md' OUTPUTPAGES = $(patsubst $(PAGESDIR)/%.md,$(BUILDDIR)/%.html,$(PAGES)) STYLE != find style -type f OUTPUTSTYLE = $(patsubst %,$(BUILDDIR)/%,$(STYLE)) OUTPUT = $(OUTPUTPAGES) $(OUTPUTSTYLE) .PHONY: all all: build .PHONY: build build: $(OUTPUT) $(BUILDDIR)/%.html: $(PAGESDIR)/%.md $(TEMPLATE) mkdir -p $(dir $@) pandoc -s --toc --template $(TEMPLATE) -o $@ $< $(BUILDDIR)/%: % mkdir -p $(dir $@) cp $< $@ .PHONY: clean distclean clean: rm -rf $(BUILDDIR) distclean: clean rm -rf $(TMPDIR)