about summary refs log tree commit diff
path: root/makefile
blob: 8a24e90c85038b84e81527e4e9b6f3e590bc6952 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
all: gen

# content
PANDOC ?= pandoc
PANDOC_PREPROC ?= preproc.lua
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)

# see https://pandoc.org/MANUAL.html#pandocs-markdown
%.htm: %.md $(PANDOC_PREPROC)
	@ echo "<!-- Generated file, you may edit and discard $< :) -->" >$@
	$(PANDOC) -fmarkdown+wikilinks_title_after_pipe+autolink_bare_uris -thtml5 --lua-filter=$(PANDOC_PREPROC) --strip-comments $< >>$@

# generator
ZIG     ?= zig
gen_SRC := src/main.zig
gen_BIN := bin/gen

$(gen_BIN): $(gen_SRC)
	$(ZIG) build-exe -lc -O Debug -freference-trace -femit-bin=$@ $<


clean:
	@ rm -rf site/* bin/* $(md_SRC:%.md=%.htm)

gen: $(gen_BIN) $(SRC)
	@ mkdir -p site/ && $(gen_BIN)

watch:
	@ find . -print | entr -nc -dd -- $(MAKE)

watch-and-serve:
	@ ${MAKE} -j2 watch serve

was: watch-and-serve

.PHONY: all clean serve watch watch-and-serve was

include serve.mk
include webdeploy.mk
include edit.mk