-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (24 loc) · 819 Bytes
/
Makefile
File metadata and controls
34 lines (24 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.POSIX:
.SILENT:
.PHONY: all build clean validate
xsltproc ?= xsltproc
xmllint ?= xmllint
OUTDIR ?= registrar
srcs != find . -maxdepth 1 -name '*.xml'
html = ${srcs:./%.xml=$(OUTDIR)/%.html}
xml = ${srcs:./%.xml=$(OUTDIR)/%.xml}
all: validate build
build: $(html) $(xml)
cp *.html "$(OUTDIR)"
validate:
for srcfile in $(srcs); do \
$(xmllint) --nonet --noout --noent --loaddtd --valid "$${srcfile}" > /dev/null; \
done
clean:
rm -rf "$(OUTDIR)"
$(OUTDIR):
mkdir -p "$@"
$(html): $(OUTDIR) ${@:$(OUTDIR)/%.html=%.xml} ${@:$(OUTDIR)/%.html=%.xsl}
$(xsltproc) --stringparam OUTPUT_FILENAME "$@" "${@:$(OUTDIR)/%.html=%.xsl}" "${@:$(OUTDIR)/%.html=%.xml}" > "$@"
$(xml): $(OUTDIR) ${@:$(OUTDIR)/%=%} ${@:$(OUTDIR)/%.xml=%-xml.xsl}
$(xsltproc) "${@:$(OUTDIR)/%.xml=%-xml.xsl}" "${@:$(OUTDIR)/%=%}" > "$@"