2020-08-28 18:21:05 +02:00
|
|
|
src := content
|
|
|
|
cache := .cache
|
2020-08-28 18:24:58 +02:00
|
|
|
www_root := _site
|
|
|
|
www := $(www_root)/posts
|
|
|
|
post_index := $(www_root)/posts.html
|
2020-08-29 14:28:11 +02:00
|
|
|
feed := $(www_root)/feed.xml
|
2020-08-28 18:21:05 +02:00
|
|
|
|
|
|
|
post_compiler := src/webcc.ml
|
|
|
|
builddir := _build/default
|
|
|
|
|
|
|
|
POSTCC := $(builddir)/$(patsubst %.ml,%.exe,$(post_compiler))
|
2020-08-29 12:52:21 +02:00
|
|
|
INDEXCC := $(POSTCC) -i
|
2020-08-29 14:28:11 +02:00
|
|
|
FEEDCC := $(POSTCC) -a
|
2020-08-28 18:21:05 +02:00
|
|
|
|
|
|
|
post-sources := $(shell find $(src)/ -type f)
|
|
|
|
post-htmls := $(patsubst $(src)/%.md,$(www)/%.html,$(post-sources))
|
|
|
|
|
2020-08-29 12:52:21 +02:00
|
|
|
.PHONY: all serve clean $(POSTCC)
|
2020-08-28 18:24:58 +02:00
|
|
|
|
2020-08-29 14:28:11 +02:00
|
|
|
all: $(POSTCC) $(post-htmls) $(post_index) $(feed) $(www_root)/static
|
2020-08-28 20:22:52 +02:00
|
|
|
cp -R ~/www/* $(www_root)
|
2020-08-28 18:21:05 +02:00
|
|
|
|
|
|
|
$(www):
|
|
|
|
mkdir -p $(www)
|
|
|
|
|
|
|
|
$(www)/%.html: $(src)/%.md $(www)
|
|
|
|
$(POSTCC) $< -o $@
|
|
|
|
|
2020-08-29 12:52:21 +02:00
|
|
|
$(post_index): $(post-sources)
|
|
|
|
$(INDEXCC) $^ -o $@
|
2020-08-28 18:24:58 +02:00
|
|
|
|
2020-08-29 14:28:11 +02:00
|
|
|
$(feed): $(post-sources)
|
|
|
|
$(FEEDCC) $^ -o $@
|
|
|
|
|
2020-08-29 12:56:12 +02:00
|
|
|
$(www_root)/static: static
|
|
|
|
cp -R static $(www_root)
|
2020-08-28 18:24:58 +02:00
|
|
|
|
2020-08-28 18:21:05 +02:00
|
|
|
$(POSTCC): $(post_compiler)
|
|
|
|
dune build
|
|
|
|
|
|
|
|
clean:
|
2020-08-28 18:24:58 +02:00
|
|
|
rm -fr $(www_root)
|
|
|
|
|
|
|
|
serve:
|
|
|
|
cd $(www_root) && python -m SimpleHTTPServer
|