1 # SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
2 # SPDX-License-Identifier: MPL-2.0
6 # Copyright © 2024 Lady [@ Ladys Computer].
8 # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
9 # If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
11 xmls := $(wildcard data/*/bibl) $(wildcard data/*/info) $(wildcard data/*/fortunes/*)
13 lint : $(foreach xml,$(xmls),lint][$(xml)) ;
15 $(foreach xml,$(xmls),lint][$(xml)) : lint][% :
16 @xmllint --valid --noout '$*'
17 @$(if $(findstring /fortunes/,$*),if ! xmllint --xpath '//*[local-name()="seg" and namespace-uri()="http://www.tei-c.org/ns/1.0" and @type="callout"]' '$*' >/dev/null 2>/dev/null; then printf '%s\n' 'No callout in file <$*>'; false; fi; if xmllint --xpath '//*[local-name()="seg" and namespace-uri()="http://www.tei-c.org/ns/1.0" and @type="callout"][2]' '$*' >/dev/null 2>/dev/null; then printf '%s\n' 'Multiple callouts in file <$*>'; false; fi,:)
19 .IGNORE : $(foreach xml,$(xmls),lint][$(xml)) ;
21 .PHONY : lint $(foreach xml,$(xmls),lint][$(xml)) ;