]> Lady’s Gitweb - Shrine-XSLT/commitdiff
Make source extensions configurable
authorLady <redacted>
Thu, 26 Jan 2023 05:11:08 +0000 (21:11 -0800)
committerLady <redacted>
Sat, 29 Apr 2023 03:06:36 +0000 (20:06 -0700)
GNUmakefile

index a6b7b4acd46440336a8a14c3f66d2d495d8428dd..7f20dea36fa87d58640751d0b04d03ef7c7e324c 100644 (file)
@@ -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,$<,$@)
This page took 0.026816 seconds and 4 git commands to generate.