]> Lady’s Gitweb - Shushe/blobdiff - GNUmakefile
Get destinations from “with metadata” parsed file
[Shushe] / GNUmakefile
index a3624ccd944425e9185ab93f66f6ea3e78256037..33fa6018a34b19c2862d0d7d97169409061a1836 100644 (file)
@@ -1,4 +1,4 @@
-# SPDX-FileCopyrightText: 2023, 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
+# SPDX-FileCopyrightText: 2023, 2024, 2025, 2026 Lady <https://www.ladys.computer/about/#lady>
 # SPDX-License-Identifier: MPL-2.0
 
 SHELL = /bin/sh
 # SPDX-License-Identifier: MPL-2.0
 
 SHELL = /bin/sh
@@ -8,7 +8,7 @@ override define makefileinfo
  ╭────────────────────────────╮
 ╔╡ ⁌ ⛩📰 书社 ∷ GNUmakefile ╞═════════════════════════════════╗
 ║╰────────────────────────────╯                                ║
  ╭────────────────────────────╮
 ╔╡ ⁌ ⛩📰 书社 ∷ GNUmakefile ╞═════════════════════════════════╗
 ║╰────────────────────────────╯                                ║
-╟┬  Prerequisites ───────────────────────────────────────────┬╢
+╟┬ § Prerequisites ───────────────────────────────────────────┬╢
 ║│                                                            │║
 ║│ Requires G·N·U Make, at least version 3.81, the Fine Free  │║
 ║│ File Command, and the various programs packaged with       │║
 ║│                                                            │║
 ║│ Requires G·N·U Make, at least version 3.81, the Fine Free  │║
 ║│ File Command, and the various programs packaged with       │║
@@ -51,7 +51,7 @@ override define makefileinfo
 ║│ program `program´ by overriding the corresponding variable │║
 ║│ `PROGRAM´ when calling Make.                               │║
 ║╰────────────────────────────────────────────────────────────╯║
 ║│ program `program´ by overriding the corresponding variable │║
 ║│ `PROGRAM´ when calling Make.                               │║
 ║╰────────────────────────────────────────────────────────────╯║
-╟┬  Usage ───────────────────────────────────────────────────┬╢
+╟┬ § Usage ───────────────────────────────────────────────────┬╢
 ║│                                                            │║
 ║│ • `make all´ (default): Compile, but do not install, all   │║
 ║│   files.                                                   │║
 ║│                                                            │║
 ║│ • `make all´ (default): Compile, but do not install, all   │║
 ║│   files.                                                   │║
@@ -81,9 +81,9 @@ override define makefileinfo
 ║│ See `README.markdown´ for a more involved description of   │║
 ║│ the capabilities and configuration of this program.        │║
 ║╰────────────────────────────────────────────────────────────╯║
 ║│ See `README.markdown´ for a more involved description of   │║
 ║│ the capabilities and configuration of this program.        │║
 ║╰────────────────────────────────────────────────────────────╯║
-╟┬  Copyright & License ─────────────────────────────────────┬╢
+╟┬ § Copyright & License ─────────────────────────────────────┬╢
 ║│                                                            │║
 ║│                                                            │║
-║│ Copyright © 2023–2025 Lady [@ Ladys Computer].             │║
+║│ Copyright © 2023–2026 Lady [@ Ladys Computer].             │║
 ║│                                                            │║
 ║│ This Source Code Form is subject to the terms of the       │║
 ║│ Mozilla Public License, v 2.0. If a copy of the M·P·L was  │║
 ║│                                                            │║
 ║│ This Source Code Form is subject to the terms of the       │║
 ║│ Mozilla Public License, v 2.0. If a copy of the M·P·L was  │║
@@ -545,6 +545,7 @@ override dependenciesforfile := $(foreach file,$(filter-out $(assetfiles),$(sour
 # (callable) Get the list of dependency leiris for the given source files.
 #
 # Recursive dependencies are marked with a leading `-´.
 # (callable) Get the list of dependency leiris for the given source files.
 #
 # Recursive dependencies are marked with a leading `-´.
+# Soft dependencies are marked with a leading `?´.
 override dependencyuris = $(foreach file,$1,$(subst |, ,$(patsubst $(file)|%,%,$(filter $(file)|%,$(dependenciesforfile)))))
 
 # (callable) Get the list of recursive dependencies for the given source files.
 override dependencyuris = $(foreach file,$1,$(subst |, ,$(patsubst $(file)|%,%,$(filter $(file)|%,$(dependenciesforfile)))))
 
 # (callable) Get the list of recursive dependencies for the given source files.
@@ -555,7 +556,7 @@ override recursives = $(foreach uri,$(filter -%,$(call dependencyuris,$1)),$(cal
 # (callable) Get the list of (nonrecursive) dependencies for the given source files.
 #
 # If the file cannot have dependencies (e·g is an asset file), the resulting value will be the empty string.
 # (callable) Get the list of (nonrecursive) dependencies for the given source files.
 #
 # If the file cannot have dependencies (e·g is an asset file), the resulting value will be the empty string.
-override dependencies = $(foreach uri,$(filter-out -%,$(call dependencyuris,$1)),$(call sourcefile,$(uri)))
+override dependencies = $(foreach uri,$(filter-out -%,$(call dependencyuris,$1)),$(call sourcefile,$(if $(filter ?%,$(uri)),$(patsubst ?%,%,$(uri)),$(uri))))
 endif
 
 # Collect all files with recursive dependencies.
 endif
 
 # Collect all files with recursive dependencies.
@@ -624,7 +625,7 @@ install : $(call installed,$(recursivefiles) $(installablefiles)) ;
 
 # List all source files and includes and their computed types.
 list :
 
 # List all source files and includes and their computed types.
 list :
-       @$(PRINTF) '%b' $(call quote,$(foreach file,$(sort $(sourcefiles)) $(sort $(sourceincludes)),\0033[1m$(file)\0033[22m|$(call typeoffile,$(file))|[\0033[3m$(if $(filter $(file),$(xmlfiles)),xml,$(if $(filter $(file),$(plaintextfiles)),text,asset))$(if $(filter $(file),$(sourceincludes)),|include,)\0033[23m]$(if $(call dependencies,$(file))$(call recursives,$(file)), $(strip $(foreach recursive,$(call recursives,$(file)),\0033[93;41m•|Recursive|Dependency|\0033[39;49m|$(recursive)) $(foreach dependency,$(call dependencies,$(file)),\0033[2m•|Dependency|\0033[22m|$(dependency))))$(if $(filter $(file),$(sourcefiles)), $(foreach dest,$(call destination,$(file)),→|<\0033[4m/$(dest)\0033[24m>),) )) | $(TR) ' |' '\n '
+       @$(PRINTF) '%b' $(call quote,$(foreach file,$(sort $(sourcefiles)) $(sort $(sourceincludes)),\0033[1m$(file)\0033[22m|$(call typeoffile,$(file))|[\0033[3m$(if $(filter $(file),$(xmlfiles)),xml,$(if $(filter $(file),$(plaintextfiles)),text,asset))$(if $(filter $(file),$(sourceincludes)),|include,)\0033[23m]$(if $(call dependencyuris,$(file)), $(strip $(foreach dep,$(call dependencyuris,$(file)),$(if $(filter -%,$(dep)),\0033[93;41m•|Recursive|Dependency|\0033[39;49m|$(call sourcefile,$(patsubst -%,%,$(dep))),$(if $(filter ?%,$(dep)),\0033[2m•|Soft|Dependency|\0033[22m|$(call sourcefile,$(patsubst ?%,%,$(dep))),\0033[2m•|Dependency|\0033[22m|$(call sourcefile,$(dep)))))))$(if $(filter $(file),$(sourcefiles)), $(foreach dest,$(call destination,$(file)),→|<\0033[4m/$(dest)\0033[24m>),) )) | $(TR) ' |' '\n '
 
 # Lists out the destinations of all resulting files (relative to `DESTDIR´).
 listout :
 
 # Lists out the destinations of all resulting files (relative to `DESTDIR´).
 listout :
@@ -688,7 +689,7 @@ $(call metadata,$(sourcefiles) $(sourceincludes)) : % : $$(call datadata,$$@) $(
 # Collect the metadata into a single file, and generate the dependencies and destinations files as side·effects.
 #
 # Doing this all in one step reduces the number of calls to `xsltproc´ required, but requires that it be called from the build directory (necessitating a subshell).
 # Collect the metadata into a single file, and generate the dependencies and destinations files as side·effects.
 #
 # Doing this all in one step reduces the number of calls to `xsltproc´ required, but requires that it be called from the build directory (necessitating a subshell).
-$(BUILDDIR)/dependencies $(BUILDDIR)/destinations $(BUILDDIR)/metadata : $(call diffprereqs,metadatas,$(call metadata,$(sort $(sourcefiles) $(sourceincludes)))) $$(call parseresult,$(sourcefiles) $(sourceincludes)) $(THISDIR)/lib/expandmetadata.xslt
+$(BUILDDIR)/dependencies $(BUILDDIR)/destinations $(BUILDDIR)/metadata : $(call diffprereqs,metadatas,$(call metadata,$(sort $(sourcefiles) $(sourceincludes)))) $(call diffprereqs,parseds,$$(call parsed,$(sort $(sourcefiles) $(sourceincludes)))) $(THISDIR)/lib/expandmetadata.xslt
        $(call inform,$(PRINTF) '%s\n' 'Compiling metadata…' >&2)
        $(silent){ $(PRINTF) '<?xml version="1.0"?><rdf:RDF xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#" xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:书社vocab="urn:fdc:ladys.computer:20231231:Shu1She4:vocab:"><书社vocab:BuildDirectory nfo:fileUrl="%s"/>' $(call quote,$(call attresc,$(call fileuri,$(BUILDDIR)))); {$(foreach meta,$(call metadata,$(sort $(sourcefiles) $(sourceincludes))), $(CAT) $(call quote,$(meta));) } | $(SED) 's/<?xml version="1.0"?>//g'; $(PRINTF) '%s\n' '</rdf:RDF>'; } | ( $(CD) $(call quote,$(BUILDDIR)); $(XSLTPROC) --nonet --novalid --nomkdir $(call quote,$(abspath $(THISDIR)/lib/expandmetadata.xslt)) - ) | $(XMLLINT) --nonet --nsclean - >|$(call quote,$(BUILDDIR)/metadata)
 
        $(call inform,$(PRINTF) '%s\n' 'Compiling metadata…' >&2)
        $(silent){ $(PRINTF) '<?xml version="1.0"?><rdf:RDF xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#" xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:书社vocab="urn:fdc:ladys.computer:20231231:Shu1She4:vocab:"><书社vocab:BuildDirectory nfo:fileUrl="%s"/>' $(call quote,$(call attresc,$(call fileuri,$(BUILDDIR)))); {$(foreach meta,$(call metadata,$(sort $(sourcefiles) $(sourceincludes))), $(CAT) $(call quote,$(meta));) } | $(SED) 's/<?xml version="1.0"?>//g'; $(PRINTF) '%s\n' '</rdf:RDF>'; } | ( $(CD) $(call quote,$(BUILDDIR)); $(XSLTPROC) --nonet --novalid --nomkdir $(call quote,$(abspath $(THISDIR)/lib/expandmetadata.xslt)) - ) | $(XMLLINT) --nonet --nsclean - >|$(call quote,$(BUILDDIR)/metadata)
 
This page took 0.266736 seconds and 4 git commands to generate.