From: Lady Date: Thu, 26 Jan 2023 05:11:08 +0000 (-0800) Subject: Make source extensions configurable X-Git-Tag: 0.4.0~2 X-Git-Url: https://git.ladys.computer/Shrine-XSLT/commitdiff_plain/d84110047a12df4dec06d33d63bb157a788a8831?ds=sidebyside Make source extensions configurable --- diff --git a/GNUmakefile b/GNUmakefile index a6b7b4a..7f20dea 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -14,13 +14,15 @@ SHELL = /bin/sh # # ___ # -# © 2022 Lady [@ Lady’s Computer] +# © 2022–2023 Lady [@ Lady’s Computer] # # 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/. BASEIRI = http://example.com DATETIME = $(shell date -Iseconds) +FEED_EXT = .atom +SOURCE_EXT = .xml TRANSFORM = transform.xslt XSLT = xsltproc XSLTOPTS = @@ -29,17 +31,17 @@ headers := $(wildcard *-header.xml) footers := $(wildcard *-footer.xml) override prerequisites := $(TRANSFORM) $(headers) $(footers) -override indexsources := $(wildcard sources/index.xml sources/index-*.xml) -override indices := $(patsubst sources/%.xml,public/%.html,$(indexsources)) +override indexsources := $(wildcard sources/index$(SOURCE_EXT) sources/index-*$(SOURCE_EXT)) +override indices := $(patsubst sources/%$(SOURCE_EXT),public/%.html,$(indexsources)) -override pagesources := $(filter-out $(indexsources),$(wildcard sources/*.xml sources/*/*.xml)) -override pages := $(patsubst sources/%.xml,public/%/index.html,$(pagesources)) +override pagesources := $(filter-out $(indexsources),$(wildcard sources/*$(SOURCE_EXT) sources/*/*$(SOURCE_EXT))) +override pages := $(patsubst sources/%$(SOURCE_EXT),public/%/index.html,$(pagesources)) override resourcesources := $(wildcard $(addsuffix /*,$(basename $(pagesources)))) override resources := $(patsubst sources/%,public/%,$(resourcesources)) -override feedsources := $(filter-out $(resourcesources),$(wildcard sources/*.atom sources/*/*.atom)) -override feeds := $(patsubst sources/%.atom,public/%.atom,$(feedsources)) +override feedsources := $(filter-out $(resourcesources),$(wildcard sources/*$(FEED_EXT) sources/*/*$(FEED_EXT))) +override feeds := $(patsubst sources/%$(FEED_EXT),public/%.atom,$(feedsources)) override content := $(indices) $(pages) @@ -59,12 +61,12 @@ override makexslt = $(XSLT) --nonet --novalid $(XSLTOPTS) --stringparam BASEIRI all: $(content) $(resources) $(feeds); -$(indices): public/%.html: sources/%.xml $(prerequisites) +$(indices): public/%.html: sources/%$(SOURCE_EXT) $(prerequisites) @echo "Generating $@…" @mkdir -p $(dir $@) @$(call makexslt,$<,$@) -$(pages): public/%/index.html: sources/%.xml $(prerequisites) +$(pages): public/%/index.html: sources/%$(SOURCE_EXT) $(prerequisites) @echo "Generating $@…" @mkdir -p $(dir $@) @$(call makexslt,$<,$@) @@ -74,7 +76,7 @@ $(resources): public/%: sources/% @mkdir -p $(dir $@) @cp $< $@ -$(feeds): public/%.atom: sources/%.atom $(TRANSFORM) +$(feeds): public/%.atom: sources/%$(FEED_EXT) $(TRANSFORM) @echo "Generating $@…" @mkdir -p $(dir $@) @$(call makexslt,$<,$@)