summaryrefslogtreecommitdiff
blob: 5f8fd5f90eba3cc4396b8729f412d2ba94f6472a (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
DTDS = book.dtd gleps.dtd glsa.dtd guide.dtd metadata.dtd metadoc.dtd	\
       project.dtd staffing-needs.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.bz2

.SUFFIXES: .dtd .rnc .dep
.PHONY: depend all clean

all: .depend $(TARBALL)

depend: .depend

clean:
	rm -f *.dtd *.dep *.dtd .depend

.depend: $(DTDDEPS)
	cat *.dep > $@

$(TARBALL): Makefile LICENCE schemas.xml $(RNCS)
	mkdir -p $(PN)
	cp $^ $(PN)
	tar jcf $@ $(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" >> $@ || exit 1; \
		echo "$(TARBALL): $$dep.rnc" >> $@ || exit 1; \
		$(MAKE) "$$dep.dep" || exit 1; \
	done

.dtd.rnc:
	trang -I dtd -O rnc $< $@

%.dtd:
	wget --no-verbose http://www.gentoo.org/dtd/$@

-include .depend