diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-08-19 00:10:08 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-08-19 00:10:08 +0200 |
| commit | 30e831c9602ea5d4d0603f5ad03baff481771b4b (patch) | |
| tree | 7548cd29ed5ecf3e975df5a2e6ae130ae488f36f /repo/www/Makefile | |
| parent | 338f941477ef6815bd4638bf166f1fddb5a4b3d3 (diff) | |
| download | memory-leaks-30e831c9602ea5d4d0603f5ad03baff481771b4b.tar.xz | |
Put extensions in Lua module instead of sneaking them in environment
Note that neither .cache/config.lua nor .cache/site-tree.json get
updated when EXTENSIONS changes. This could be hacked as follows:
config = EXTENSIONS="$(EXTENSIONS)"
ifneq "$(shell test -f $(config_token) && cat $(config_token))" \
"$(shell ./generate-config-token.py $(config))"
.PHONY: $(lua_config) $(site_tree) $(config_token)
endif
Plus a recipe for config_token, and some dependencies on it.
Diffstat (limited to 'repo/www/Makefile')
| -rw-r--r-- | repo/www/Makefile | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/repo/www/Makefile b/repo/www/Makefile index f88672c..aa48971 100644 --- a/repo/www/Makefile +++ b/repo/www/Makefile @@ -23,6 +23,8 @@ cache = .cache title = $(cache)/title # Maps folders to their contents (files and subfolders). site_tree = $(cache)/site-tree.json +# Lua module to let filters know about the configuration. +lua_config = $(cache)/config.lua # Defines $(pages) and $(indices). dependencies = $(cache)/deps.mk @@ -32,6 +34,9 @@ $(title): $(top_readme) | $(cache) $(site_tree): $(page_folders) | $(cache) ./generate-tree.py -o $@ $(EXTENSIONS) +$(lua_config): | $(cache) + ./generate-lua-config.py EXTENSIONS="$(EXTENSIONS)" > $@ + $(dependencies): $(site_tree) | $(cache) ./generate-deps.py $< $@ $(OUT_DIR) @@ -49,10 +54,10 @@ $(html_folders) $(cache): $(pages) $(subindices): $(title) -$(pages) $(indices): $(html_template) +$(pages) $(indices): $(html_template) $(lua_filters) $(lua_config) $(pages): $(OUT_DIR)/%.html: - $(call v,PAGE,$*) EXTENSIONS="$(EXTENSIONS)" \ + $(call v,PAGE,$*) \ ./generate-page.py --site-title="$$(cat $(title))" --title="$*" \ $(foreach f,$(lua_filters),--lua-filter $(f)) \ --template=$(html_template) $< $@ @@ -66,7 +71,7 @@ $(subindices): index_options = --site-title="$$(cat $(title))" # ⚠ When tweaking this rule, check whether it still works for the # top-level index.html. $(indices): $(OUT_DIR)/%index.html: - $(call v,INDEX,$*) EXTENSIONS="$(EXTENSIONS)" \ + $(call v,INDEX,$*) \ ./generate-index.py $(index_options) --template=$(html_template) \ $(foreach f,$(lua_filters),--lua-filter $(f)) \ $(site_tree) "$(patsubst %/,%,$*)" $@ |
