X-Git-Url: https://git.ladys.computer/Shrine-XSLT/blobdiff_plain/820c8ba68006a97a11027c972493391bf58b06e9..4d8377e284700e08be7ab2b65b956bbc53334835:/GNUmakefile?ds=sidebyside

diff --git a/GNUmakefile b/GNUmakefile
index ecf9f9d..b8bbd4a 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -5,6 +5,7 @@ SHELL = /bin/sh
 # • 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.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.
@@ -29,11 +30,14 @@ 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.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: $(content) ;
+all: $(content) $(resources);
 
 $(indices): public/%.html: sources/%.xml $(prerequisites)
 	@echo "Generating $@…"
@@ -43,4 +47,9 @@ $(pages): public/%/index.html: sources/%.xml $(prerequisites)
 	@echo "Generating $@…"
 	@$(call makexslt,$<,$@)
 
+$(resources): public/%: sources/%
+	@echo "Copying over $@…"
+	@mkdir -p $(dir $<)
+	@cp $< $@
+
 .PHONY: all ;