src := content cache := .cache www_root := _site www := $(www_root)/posts post_index := $(www_root)/posts.html post_compiler := src/webcc.ml builddir := _build/default POSTCC := $(builddir)/$(patsubst %.ml,%.exe,$(post_compiler)) post-sources := $(shell find $(src)/ -type f) post-htmls := $(patsubst $(src)/%.md,$(www)/%.html,$(post-sources)) .PHONY: all serve clean $(post_index) all: $(POSTCC) $(post-htmls) $(post_index) $(www_root)/static cp -R ~/www/* $(www_root) $(www): mkdir -p $(www) $(www)/%.html: $(src)/%.md $(www) $(POSTCC) $< -o $@ # make sure that this target is .PHONY! $(post_index): echo hm > $@ $(www_root)/static: cp -R static $@ $(POSTCC): $(post_compiler) dune build clean: rm $(POSTCC) rm -fr $(www_root) serve: cd $(www_root) && python -m SimpleHTTPServer