summaryrefslogtreecommitdiff
path: root/repo/www/Makefile
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-04-12 23:06:07 +0200
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-04-12 23:06:07 +0200
commit12e18454ba07c3b7747f8b868f6830f05de149c4 (patch)
tree317c3f700b9d088cf30466a197ffc512d12fc183 /repo/www/Makefile
parent629664bd50ed4e72cffc33bf2e7082119d483469 (diff)
downloadmemory-leaks-12e18454ba07c3b7747f8b868f6830f05de149c4.tar.xz
Add intermediate step to cache site tree
Seems kind of wasteful to recompute it every time. Also, now subsequent scripts don't have to care about file extensions anymore.
Diffstat (limited to 'repo/www/Makefile')
-rw-r--r--repo/www/Makefile16
1 files changed, 10 insertions, 6 deletions
diff --git a/repo/www/Makefile b/repo/www/Makefile
index 9050626..fdc0112 100644
--- a/repo/www/Makefile
+++ b/repo/www/Makefile
@@ -1,5 +1,3 @@
-# TODO: add a target for the file tree; use it in generate-* scripts.
-
TOP_DIR = ../..
OUT_DIR = $(TOP_DIR)/public
TEXT_FILES = md org
@@ -12,12 +10,18 @@ text_folders = $(call dirnames,$(shell git ls-files $(text_patterns)))
all: site
+# Maps folders to their contents (files and subfolders).
+site_tree = site-tree.json
# Defines $(pages) and $(indices).
dependencies = deps.mk
-include $(dependencies)
-$(dependencies): $(text_folders)
- ./generate-deps.py "$(TEXT_FILES)" $(OUT_DIR)
+$(site_tree): $(text_folders)
+ ./generate-tree.py -o $@ $(TEXT_FILES)
+
+$(dependencies): $(site_tree)
+ ./generate-deps.py $< $@ $(OUT_DIR)
+
+include $(dependencies)
site: $(pages) $(indices)
@@ -33,7 +37,7 @@ $(pages):
# ⚠ 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 %/,%,$*)" $@
+ ./generate-index.py $(site_tree) "$(patsubst %/,%,$*)" $@
clean:
-rm $(dependencies)