summaryrefslogtreecommitdiff
path: root/repo/www/Makefile
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-04-12 20:00:08 +0200
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-04-12 20:37:05 +0200
commit629664bd50ed4e72cffc33bf2e7082119d483469 (patch)
treeef2d3a67c6e2e5030a1c542812980b4db1258db2 /repo/www/Makefile
parent05e08f7a2aa8caa8479501ccc6123baed695a06d (diff)
downloadmemory-leaks-629664bd50ed4e72cffc33bf2e7082119d483469.tar.xz
Finish fixing some files being inaccessible
Make generate-deps.py compute the list of indices instead of relying on the list of source folders that contain text files, otherwise we will miss intermediate folders that do not contain any file. Remove TODO entry to maintain Makefile dependencies to scripts: that sounds too tedious. Let's assume that at some point the Makefile and these scripts will be bundled together into a proper package.
Diffstat (limited to 'repo/www/Makefile')
-rw-r--r--repo/www/Makefile22
1 files changed, 12 insertions, 10 deletions
diff --git a/repo/www/Makefile b/repo/www/Makefile
index bc9933a..9050626 100644
--- a/repo/www/Makefile
+++ b/repo/www/Makefile
@@ -1,28 +1,30 @@
-# TODO: set dependencies to scripts correctly
+# 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 = $(sort $(call dirname,$(shell git ls-files $(text_patterns))))
-page_folders = $(patsubst $(TOP_DIR)%,$(OUT_DIR)%,$(text_folders))
-indices = $(addsuffix /index.html,$(page_folders))
+text_folders = $(call dirnames,$(shell git ls-files $(text_patterns)))
all: site
+# Defines $(pages) and $(indices).
dependencies = deps.mk
include $(dependencies)
-$(dependencies): generate-deps.py $(text_folders)
- python3 $< "$(TEXT_FILES)" $(OUT_DIR)
+$(dependencies): $(text_folders)
+ ./generate-deps.py "$(TEXT_FILES)" $(OUT_DIR)
site: $(pages) $(indices)
-$(page_folders):
+# $(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):
@@ -30,8 +32,8 @@ $(pages):
# ⚠ When tweaking this rule, check whether it still works for the
# top-level index.html.
-$(indices): $(OUT_DIR)%/index.html: $(TOP_DIR)% generate-index.py | $(OUT_DIR)%
- python3 generate-index.py "$(TEXT_FILES)" "$<" $@
+$(indices): $(OUT_DIR)/%index.html:
+ ./generate-index.py "$(TEXT_FILES)" "$(patsubst %/,%,$*)" $@
clean:
-rm $(dependencies)