Making schemas (Makefile)

SAXON=saxon
DTD_PARTS=xproc_dtd_1.ent xproc_dtd_2.ent xproc_dtd_3.ent xproc_dtd_4.ent

XSD_PARTS=xproc_xsd_1.frag xproc_xsd_2.frag xproc_xsd_3.frag

all: steps.rnc xproc.rng xproc.dtd xproc.xsd

steps.rnc: ../typed-pipeline-library.xml ../../style/library-to-rnc.xsl
	$(SAXON) ../typed-pipeline-library.xml ../../style/library-to-rnc.xsl $@

xproc.rng: xproc.rnc steps.rnc
	trang $< $@

xproc.dtd: $(DTD_PARTS)
	cat $^ > $@

xproc_dtd_2.ent xproc_dtd_4.ent: ../typed-pipeline-library.xml ../../style/library-to-dtd.xsl
	$(SAXON) ../typed-pipeline-library.xml ../../style/library-to-dtd.xsl step-cm=xproc_dtd_2.ent step-decls=xproc_dtd_4.ent

xproc.xsd: $(XSD_PARTS)
	cat $^ > $@

xproc_xsd_2.frag: ../typed-pipeline-library.xml ../../style/library-to-xsd.xsl
	$(SAXON) ../typed-pipeline-library.xml ../../style/library-to-xsd.xsl | sed '1d;/xmlns:/d;/<.wrapper/d' > $@

clean:
	rm -f xproc.rng xproc.dtd xproc.xsd xproc_dtd_2.ent xproc_dtd_4.ent xproc_xsd_2.frag

testDTD: xproc.dtd
	for f in ../examples/*.{xml,xpl} ;\
	 do de=`lxprintf -e '/*' '%s\n' 'local-name(.)' $$f` ;\
	 case $$de in \
	  pipeline|declare-step|library) \
	    rxp -VNxsz -D p:$$de ../schemas/xproc.dtd $$f ;;\
	  esac ;\
	 done 2> errs_dtd.tmp || :
	diff -bw errs_dtd.txt errs_dtd.tmp