1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-10 03:15:00 -05:00
xeps/Makefile

65 lines
1.7 KiB
Makefile
Raw Normal View History

2015-08-31 22:41:35 -04:00
.SILENT:
OUTDIR?=build
RESOURCESDIR=$(OUTDIR)/resources
TEMPDIR?=$(OUTDIR)/xepbuild
2015-09-01 00:15:10 -04:00
XMLDEPS=xep.xsl xep.xsd xep.ent xep.dtd ref.xsl $(OUTDIR)
TEXMLDEPS=xep2texml.xsl $(TEMPDIR) $(XMLDEPS) $(RESOURCESDIR)/xmpp.pdf $(RESOURCESDIR)/xmpp-text.pdf
XMPPIMAGESURL=https://xmpp.org/images
XEPDIRS=. inbox
2015-09-01 00:15:10 -04:00
2015-08-31 22:41:35 -04:00
.PHONY: help
help:
@echo 'XEP makefile targets:'
@echo ' '
@echo ' help - (this message)'
@echo ' all - build all XEPs (same as make html)'
2015-09-01 00:15:10 -04:00
@echo ' html - build all XEPs'
2015-08-31 22:41:35 -04:00
@echo ' clean - recursively unlink the build tree'
@echo ' preview - builds html whenever an XEP changes (requires inotify-tools)'
@echo ' xep-xxxx - build xep-xxxx.html'
2015-09-01 00:15:10 -04:00
@echo ' xep-xxxx.html - build xep-xxxx.html'
2015-08-31 22:41:35 -04:00
@echo ' '
@echo 'Output directory: "$(OUTDIR)/"'
.PHONY: all
all: html
2015-09-01 00:15:10 -04:00
.PHONY: html
html: $(patsubst %.xml, $(OUTDIR)/%.html, $(wildcard *.xml))
2015-08-31 22:41:35 -04:00
.PHONY: xep-%
xep-%: $(OUTDIR)/xep-%.html ;
2015-09-01 00:15:10 -04:00
.PHONY: xep-%.html
2015-09-22 15:03:35 -04:00
xep-%.html: $(OUTDIR)/xep-%.html ;
2015-09-01 00:15:10 -04:00
.PHONY: dependencies
dependencies: $(OUTDIR)/prettify.css $(OUTDIR)/prettify.js $(OUTDIR)/xmpp.css ;
2015-08-31 22:41:35 -04:00
$(OUTDIR)/%.html: %.xml $(XMLDEPS) dependencies
2015-09-10 14:06:50 -04:00
xsltproc --path $(CURDIR) xep.xsl "$<" > "$@" && echo "Finished building $@"
2015-08-31 22:41:35 -04:00
$(OUTDIR)/%.js: %.js
cp "$<" "$@"
2015-09-01 00:15:10 -04:00
$(OUTDIR)/%.css: %.css
cp "$<" "$@"
2015-09-01 00:15:10 -04:00
$(TEMPDIR) $(OUTDIR) $(RESOURCESDIR):
mkdir -p $@
2015-08-31 22:41:35 -04:00
.PHONY: clean
clean:
rm -rf $(OUTDIR)
.PHONY: preview
preview:
inotifywait -m -e close_write,moved_to --format '%e %w %f' $(XEPDIRS) | \
while read -r event dir file; do \
if [ "$${file: -4}" == ".xml" ]; then \
xsltproc --path $(CURDIR) xep.xsl "$${dir}/$${file}" > "$(OUTDIR)/$${file%.*}.html" && echo "Built $${file%.*}.html $${event}"; \
fi \
done