diff options
author | 2019-12-05 12:27:27 +0100 | |
---|---|---|
committer | 2019-12-10 09:46:37 +0100 | |
commit | 01be8b7fbd93d4497d4dd7942d321f30c444ab0f (patch) | |
tree | 2e596f444a21bde3283704d324180980dbdb71ec /Makefile | |
parent | devbook.dtd: Add DTD. (diff) | |
download | devmanual-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-- | Makefile | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -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 |