aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2019-12-05 12:27:27 +0100
committerUlrich Müller <ulm@gentoo.org>2019-12-10 09:46:37 +0100
commit01be8b7fbd93d4497d4dd7942d321f30c444ab0f (patch)
tree2e596f444a21bde3283704d324180980dbdb71ec /Makefile
parentdevbook.dtd: Add DTD. (diff)
downloaddevmanual-01be8b7fbd93d4497d4dd7942d321f30c444ab0f.tar.gz
devmanual-01be8b7fbd93d4497d4dd7942d321f30c444ab0f.tar.bz2
devmanual-01be8b7fbd93d4497d4dd7942d321f30c444ab0f.zip
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@gentoo.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files 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