blob: b55d3a38fe5631cebd89e1c10e304cb17e648534 (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
DTDS = book.dtd gleps.dtd glsa.dtd guide.dtd metadata.dtd metadoc.dtd \
project.dtd projects.dtd repositories.dtd userinfo.dtd
DTDDEPS = $(patsubst %.dtd,%.dep,$(DTDS))
RNCS = $(patsubst %.dtd,%.rnc,$(DTDS))
ifdef ($(PV),)
PN=nxml-gentoo-schemas-$(PV)
else
PN=nxml-gentoo-schemas-$(shell date '+%Y%m%d')
endif
TARBALL=$(PN).tar.xz
.SUFFIXES: .dtd .rnc .dep
.PHONY: depend all clean
.PRECIOUS: $(RNCS) $(DTDS)
.INTERMEDIATE: $(DTDDEPS)
all: .depend $(TARBALL)
depend: .depend
clean:
rm -f *.dtd *.dep .depend
.depend: $(DTDDEPS)
cat *.dep > $@
$(TARBALL): Makefile LICENCE DONATING schemas.xml $(RNCS)
mkdir -p $(PN)
cp $^ $(PN)
tar cJf $@ $(PN)
.dtd.dep:
echo > $@
sed -n -e '/ENTITY/s|<!ENTITY % \w\+ SYSTEM "\(.*\)\.dtd">|\1|p' $< | \
while read dep; do \
echo "$(patsubst %.dtd,%.rnc,$<): $$dep.rnc $$dep.dtd" >> $@ || exit 1; \
echo "$(TARBALL): $$dep.rnc" >> $@ || exit 1; \
$(MAKE) "$$dep.dep" || exit 1; \
done
.dtd.rnc:
trang -I dtd -O rnc $< $@
# Trang will guess "packages" as start element, which causes Emacs
# nXML validation to fail. So specify the start elements explicitly.
metadata.rnc: metadata.dtd
trang -I dtd -O rnc -i no-generate-start $< $@
echo 'start = catmetadata | pkgmetadata' >> $@
%.dtd:
wget -N --no-verbose https://www.gentoo.org/dtd/$@
-include .depend
|