1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-22 01:02:17 -05:00

Add targets to build IETF refs in Makefile

This commit is contained in:
Sam Whited 2017-01-09 13:14:02 -06:00
parent f14446b90a
commit c505afdc96

View File

@ -1,12 +1,12 @@
.SILENT: .SILENT:
OUTDIR?=build OUTDIR?=build
RESOURCESDIR=$(OUTDIR)/resources REFSDIR?=$(OUTDIR)/refs
TEMPDIR?=$(OUTDIR)/xepbuild XMLDEPS=xep.xsd xep.ent xep.dtd ref.xsl $(OUTDIR)
XMLDEPS=xep.xsl xep.xsd xep.ent xep.dtd ref.xsl $(OUTDIR)
TEXMLDEPS=xep2texml.xsl $(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf TEXMLDEPS=xep2texml.xsl $(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf
XMPPIMAGESURL=https://xmpp.org/images XMPPIMAGESURL=https://xmpp.org/images
XEPDIRS=. inbox XEPDIRS=. inbox
HTMLDEPS=xep.xsl $(OUTDIR)/prettify.css $(OUTDIR)/prettify.js $(OUTDIR)/xmpp.css
.PHONY: help .PHONY: help
@ -15,6 +15,7 @@ help:
@echo ' ' @echo ' '
@echo ' help - (this message)' @echo ' help - (this message)'
@echo ' all - build all XEPs (same as make html)' @echo ' all - build all XEPs (same as make html)'
@echo ' refs - build all IETF refs'
@echo ' html - build all XEPs' @echo ' html - build all XEPs'
@echo ' clean - recursively unlink the build tree' @echo ' clean - recursively unlink the build tree'
@echo ' preview - builds html whenever an XEP changes (requires inotify-tools)' @echo ' preview - builds html whenever an XEP changes (requires inotify-tools)'
@ -33,8 +34,11 @@ html: $(patsubst %.xml, $(OUTDIR)/%.html, $(wildcard *.xml))
.PHONY: pdf .PHONY: pdf
pdf: $(patsubst %.xml, $(OUTDIR)/%.pdf, $(wildcard *.xml)) pdf: $(patsubst %.xml, $(OUTDIR)/%.pdf, $(wildcard *.xml))
.PHONY: refs
refs: $(patsubst xep-%.xml, $(REFSDIR)/reference.XSF.XEP-%.xml, $(wildcard *.xml))
.PHONY: xep-% .PHONY: xep-%
xep-%: $(OUTDIR)/xep-%.html ; xep-%: $(OUTDIR)/xep-%.html $(REFSDIR)/reference.XSF.XEP-%.xml;
.PHONY: xep-%.html .PHONY: xep-%.html
xep-%.html: $(OUTDIR)/xep-%.html ; xep-%.html: $(OUTDIR)/xep-%.html ;
@ -42,10 +46,10 @@ xep-%.html: $(OUTDIR)/xep-%.html ;
.PHONY: xep-%.pdf .PHONY: xep-%.pdf
xep-%.pdf: $(OUTDIR)/xep-%.pdf ; xep-%.pdf: $(OUTDIR)/xep-%.pdf ;
.PHONY: dependencies $(REFSDIR)/reference.XSF.XEP-%.xml: xep-%.xml $(XMLDEPS) ref.xsl $(REFSDIR)
dependencies: $(OUTDIR)/prettify.css $(OUTDIR)/prettify.js $(OUTDIR)/xmpp.css ; xsltproc --path $(CURDIR) ref.xsl "$<" > "$@" && echo "Finished building $@"
$(OUTDIR)/%.html: %.xml $(XMLDEPS) dependencies $(OUTDIR)/%.html: %.xml $(XMLDEPS) $(HTMLDEPS)
xmllint --nonet --noout --noent --loaddtd --valid "$<" xmllint --nonet --noout --noent --loaddtd --valid "$<"
# Check for non-data URIs # Check for non-data URIs
! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true ! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true
@ -56,7 +60,7 @@ $(OUTDIR)/%.html: %.xml $(XMLDEPS) dependencies
$(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf: $(OUTDIR) $(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf: $(OUTDIR)
cp "resources/$(notdir $@)" "$@" cp "resources/$(notdir $@)" "$@"
$(OUTDIR)/%.pdf: %.xml $(TEXMLDEPS) $(XMLDEPS) dependencies $(OUTDIR)/%.pdf: %.xml $(XMLDEPS) $(TEXMLDEPS)
xmllint --nonet --noout --noent --loaddtd --valid "$<" xmllint --nonet --noout --noent --loaddtd --valid "$<"
# Check for non-data URIs # Check for non-data URIs
! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true ! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true
@ -74,7 +78,7 @@ $(OUTDIR)/%.js: %.js
$(OUTDIR)/%.css: %.css $(OUTDIR)/%.css: %.css
cp "$<" "$@" cp "$<" "$@"
$(TEMPDIR) $(OUTDIR) $(RESOURCESDIR): $(REFSDIR) $(OUTDIR):
mkdir -p $@ mkdir -p $@
.PHONY: clean .PHONY: clean