make serve function

This commit is contained in:
2020-08-28 18:24:58 +02:00
parent 7a711e8286
commit 909f637722
2 changed files with 22 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
src := content
cache := .cache
www := _site/posts
www_root := _site
www := $(www_root)/posts
post_index := $(www_root)/posts.html
post_compiler := src/webcc.ml
builddir := _build/default
@@ -10,7 +12,9 @@ POSTCC := $(builddir)/$(patsubst %.ml,%.exe,$(post_compiler))
post-sources := $(shell find $(src)/ -type f)
post-htmls := $(patsubst $(src)/%.md,$(www)/%.html,$(post-sources))
all: $(POSTCC) $(post-htmls)
.PHONY: all serve clean $(post_index)
all: $(POSTCC) $(post-htmls) $(post_index) $(www_root)/static
$(www):
mkdir -p $(www)
@@ -18,8 +22,20 @@ $(www):
$(www)/%.html: $(src)/%.md $(www)
$(POSTCC) $< -o $@
# make sure that this target is .PHONY!
$(post_index):
echo LOL > $@
$(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