blob: 905062646e1d536cb415b7bde3a1dd8c312a558d (
plain)
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
|
# TODO: add a target for the file tree; use it in generate-* scripts.
TOP_DIR = ../..
OUT_DIR = $(TOP_DIR)/public
TEXT_FILES = md org
dirname = $(patsubst %/,%,$(dir $(1)))
dirnames = $(sort $(call dirname,$(1)))
text_patterns = $(foreach ext,$(TEXT_FILES),'$(TOP_DIR)/**.$(ext)')
text_folders = $(call dirnames,$(shell git ls-files $(text_patterns)))
all: site
# Defines $(pages) and $(indices).
dependencies = deps.mk
include $(dependencies)
$(dependencies): $(text_folders)
./generate-deps.py "$(TEXT_FILES)" $(OUT_DIR)
site: $(pages) $(indices)
# $(text_folders) may be missing some intermediate folders since it
# only contains folders that hold some text files. Rely on the full
# list of HTML pages and indices.
$(call dirnames,$(pages) $(indices)):
mkdir -p $@
$(pages):
pandoc -s $< -o $@
# ⚠ When tweaking this rule, check whether it still works for the
# top-level index.html.
$(indices): $(OUT_DIR)/%index.html:
./generate-index.py "$(TEXT_FILES)" "$(patsubst %/,%,$*)" $@
clean:
-rm $(dependencies)
-rm -r $(OUT_DIR)
|