]> Lady’s Gitweb - Shrine-XSLT/blob - GNUmakefile
fa30f687cb69cdac54028375b125ff20b20bddfe
[Shrine-XSLT] / GNUmakefile
1 SHELL = /bin/sh
2
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 :—
4 #
5 # • For files with a location of `sources/index.xml` or `sources/index-*.xml`, the transformed file will be written to `public/%.xhtml` (where `%` is the filename).
6 #
7 # • For all other files with a location of `sources/*.xml` or `sources/*/*.xml`, the transformed file will be written to `public/%/index.xhtml` (where `%` is the filename and subdirectory if applicable).
8 # Only one level of subdirectory is supported.
9 #
10 # By default, running `make` will do this for all applicable source files.
11 #
12 # ___
13 #
14 # © 2022 Lady [@ Lady’s Computer]
15 #
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/.
18
19 XHTMLEXT = xhtml
20 XSLT = xsltproc
21 XSLTOPTS =
22
23 headers := $(wildcard *-header.xml)
24 footers := $(wildcard *-footer.xml)
25 override prerequisites := transform.xslt $(headers) $(footers)
26
27 override indexsources := $(wildcard sources/index.xml sources/index-*.xml)
28 override indices := $(patsubst sources/%.xml,public/%.$(XHTMLEXT),$(indexsources))
29
30 override pagesources := $(filter-out $(indexsources),$(wildcard sources/*.xml sources/*/*.xml))
31 override pages := $(patsubst sources/%.xml,public/%/index.$(XHTMLEXT),$(pagesources))
32
33 override makexslt = $(XSLT) --nonet --novalid $(XSLTOPTS) -o $(2) transform.xslt $(1)
34
35 all: $(indices) $(pages) ;
36
37 $(indices): public/%.$(XHTMLEXT): sources/%.xml $(prerequisites)
38 $(call makexslt,$<,$@)
39
40 $(pages): public/%/index.$(XHTMLEXT): sources/%.xml $(prerequisites)
41 $(call makexslt,$<,$@)
42
43 clean:
44 rm -f $(indices) $(pages)
45
46 .PHONY: all clean ;
This page took 0.048996 seconds and 3 git commands to generate.