3 # This GNUmakefile searches the `sources/` directory for files with an extension of `.xml` and applies `transform.xslt` to them, outputting the result in one of two locations :—
5 # • For files with a location of `sources/index.xml` or `sources/index-*.xml`, the transformed file will be written to `public/%.html` (where `%` is the filename).
7 # • For all other files with a location of `sources/*.xml` or `sources/*/*.xml`, the transformed file will be written to `public/%/index.html` (where `%` is the filename and subdirectory if applicable).
8 # Only one level of subdirectory is supported.
10 # By default, running `make` will do this for all applicable source files.
14 # © 2022 Lady [@ Lady’s Computer]
16 # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
17 # If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
22 headers := $(wildcard *-header.xml)
23 footers := $(wildcard *-footer.xml)
24 override prerequisites := transform.xslt $(headers) $(footers)
26 override indexsources := $(wildcard sources/index.xml sources/index-*.xml)
27 override indices := $(patsubst sources/%.xml,public/%.html,$(indexsources))
29 override pagesources := $(filter-out $(indexsources),$(wildcard sources/*.xml sources/*/*.xml))
30 override pages := $(patsubst sources/%.xml,public/%/index.html,$(pagesources))
32 override content := $(indices) $(pages)
34 override makexslt = $(XSLT) --nonet --novalid $(XSLTOPTS) -o $(2) transform.xslt $(1)
38 $(indices): public/%.html: sources/%.xml $(prerequisites)
39 @echo "Generating $@…"
40 @$(call makexslt,$<,$@)
42 $(pages): public/%/index.html: sources/%.xml $(prerequisites)
43 @echo "Generating $@…"
44 @$(call makexslt,$<,$@)