about summary refs log tree commit diff
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..5a5e6fd
--- /dev/null
+++ b/makefile
@@ -0,0 +1,35 @@
+all: run
+
+# content
+PANDOC  ?= pandoc
+htm_SRC := $(shell find src/inc/ -name '*.htm' -print)
+md_SRC  := $(shell find src/inc/ -name '*.md' -print)
+SRC     := $(htm_SRC) $(md_SRC:%.md=%.htm)
+DST     := site
+
+# see https://pandoc.org/MANUAL.html#pandocs-markdown
+%.htm: %.md
+	$(PANDOC) --from=markdown --to=html --output $@ $<
+
+# generator
+ZIG     ?= zig
+gen_SRC := src/main.zig
+gen_BIN := bin/gen
+
+$(gen_BIN): $(gen_SRC)
+	$(ZIG) build-exe -lc -O Debug -femit-bin=$@ $<
+
+
+clean:
+	@ rm -f $(DST)/* bin/* $(md_SRC:%.md=%.htm)
+
+run: $(gen_BIN) $(SRC)
+	@ mkdir -p $(DST) && $(gen_BIN)
+
+watch:
+	@ find . -print | entr -nc -- $(MAKE)
+
+serve:
+	@ caddy file-server -r . -l :1414
+
+.PHONY: all clean serve watch