summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile37
1 files changed, 37 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..cd39586
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,37 @@
+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))
+
+.SUFFIXES: .dtd .rnc .dep
+.PHONY: depend all clean
+
+all: .depend $(RNCS)
+
+depend: .depend
+
+clean:
+ -rm *.dtd *.dep .depend
+
+.depend: $(DTDDEPS)
+ cat *.dep > $@
+
+.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; \
+ $(MAKE) "$$dep.dep" || exit 1; \
+ done
+
+.dtd.rnc:
+ trang -I dtd -O rnc $< $@
+
+%.dtd:
+ wget --no-verbose http://www.gentoo.org/dtd/$@
+
+-include .depend
+
+# This cannot be calculcated at buildtime
+#common.dtd: funnychars.dtd