X-Git-Url: https://git.ladys.computer/Shrine-XSLT/blobdiff_plain/a47140cf7262ffb49c2fe4e109deb960dd9ca6dc..4d8377e284700e08be7ab2b65b956bbc53334835:/GNUmakefile diff --git a/GNUmakefile b/GNUmakefile index fa30f68..b8bbd4a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -2,9 +2,10 @@ SHELL = /bin/sh # 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 :— # -# • 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). +# • 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). # -# • 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). +# • 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). +# Other files in the corresponding directory (i·e without the `.xml`) are copied over verbatim. # Only one level of subdirectory is supported. # # By default, running `make` will do this for all applicable source files. @@ -16,7 +17,6 @@ SHELL = /bin/sh # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. # If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -XHTMLEXT = xhtml XSLT = xsltproc XSLTOPTS = @@ -25,22 +25,31 @@ footers := $(wildcard *-footer.xml) override prerequisites := transform.xslt $(headers) $(footers) override indexsources := $(wildcard sources/index.xml sources/index-*.xml) -override indices := $(patsubst sources/%.xml,public/%.$(XHTMLEXT),$(indexsources)) +override indices := $(patsubst sources/%.xml,public/%.html,$(indexsources)) override pagesources := $(filter-out $(indexsources),$(wildcard sources/*.xml sources/*/*.xml)) -override pages := $(patsubst sources/%.xml,public/%/index.$(XHTMLEXT),$(pagesources)) +override pages := $(patsubst sources/%.xml,public/%/index.html,$(pagesources)) + +override resourcesources := $(wildcard $(addsuffix /*,$(basename $(pagesources)))) +override resources := $(patsubst sources/%,public/%,$(resourcesources)) + +override content := $(indices) $(pages) override makexslt = $(XSLT) --nonet --novalid $(XSLTOPTS) -o $(2) transform.xslt $(1) -all: $(indices) $(pages) ; +all: $(content) $(resources); -$(indices): public/%.$(XHTMLEXT): sources/%.xml $(prerequisites) - $(call makexslt,$<,$@) +$(indices): public/%.html: sources/%.xml $(prerequisites) + @echo "Generating $@…" + @$(call makexslt,$<,$@) -$(pages): public/%/index.$(XHTMLEXT): sources/%.xml $(prerequisites) - $(call makexslt,$<,$@) +$(pages): public/%/index.html: sources/%.xml $(prerequisites) + @echo "Generating $@…" + @$(call makexslt,$<,$@) -clean: - rm -f $(indices) $(pages) +$(resources): public/%: sources/% + @echo "Copying over $@…" + @mkdir -p $(dir $<) + @cp $< $@ -.PHONY: all clean ; +.PHONY: all ;