commit: 01be8b7fbd93d4497d4dd7942d321f30c444ab0f
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 5 11:27:27 2019 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Dec 10 08:46:37 2019 +0000
URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=01be8b7f
Makefile: Add "validate" rule.
Make XMLS list available separately from HTMLS. Same for SVGS and
IMAGES, for consistency.
Require xmllint as prerequisite. (This doesn't add any new dependencies,
because dev-libs/libxml2 is already pulled in by libxslt.)
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
Makefile | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 3da7c99..61daef4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,12 @@
# These "find" commands match text.xml and *.svg files, respectively,
# but only after excluding the .git directory from the search for
# performance and overall sanity reasons.
-HTMLS := $(subst text.xml,index.html,\
- $(shell find ./ -name .git -prune -o \( -type f -name 'text.xml' -print \)))
-IMAGES := $(patsubst %.svg,%.png,\
- $(shell find ./ -name .git -prune -o \( -type f -name '*.svg' -print \)))
+XMLS := $(shell find . -name .git -prune -o -type f -name 'text.xml' -print)
+SVGS := $(shell find . -name .git -prune -o -type f -name '*.svg' -print)
+HTMLS := $(subst text.xml,index.html,$(XMLS))
+IMAGES := $(patsubst %.svg,%.png,$(SVGS))
-all: prereq $(HTMLS) $(IMAGES)
+all: prereq validate $(HTMLS) $(IMAGES)
prereq:
@type convert >/dev/null 2>&1 || \
@@ -15,6 +15,9 @@ prereq:
@type xsltproc >/dev/null 2>&1 || \
{ echo "dev-libs/libxslt is required" >&2;\
exit 1; }
+ @type xmllint >/dev/null 2>&1 || \
+ { echo "dev-libs/libxml2 is required" >&2;\
+ exit 1; }
%.png : %.svg
convert $< $@
@@ -34,7 +37,11 @@ prereq:
%.html: $$(dir $$@)text.xml devbook.xsl xsl/*.xsl $$(subst
text.xml,index.html,$$(wildcard $$(dir $$@)*/text.xml))
xsltproc devbook.xsl $< > $@
+validate: prereq
+ @xmllint --noout --dtdvalid devbook.dtd $(XMLS) \
+ && echo "xmllint validation successful"
+
clean:
rm -f $(HTMLS) $(IMAGES)
-.PHONY: all prereq clean
+.PHONY: all prereq validate clean