<commit_before>all:

XSLTPROC = xsltproc --xinclude --nonet
CANONXML = xmllint --nsclean --noblanks --c14n --nonet
XML_LINEBREAKS = perl -pe 's/>/>\n/g'
DROP_NAMESPACE = perl -pe '$$hash = chr(35); s{xmlns:tp="http://telepathy\.freedesktop\.org/wiki/DbusSpec$${hash}extensions-v0"}{}g'
RST2HTML = rst2html

XMLS = $(wildcard spec/*.xml)
INTERFACE_XMLS = $(filter spec/[[:upper:]]%.xml,$(XMLS))
INTROSPECT = $(INTERFACE_XMLS:spec/%.xml=introspect/%.xml)
ASYNC_INTROSPECT = $(INTERFACE_XMLS:spec/%.xml=introspect/async/%.xml)
CANONICAL_NAMES = $(INTERFACE_XMLS:spec/%.xml=tmp/%.name)

$(CANONICAL_NAMES): tmp/%.name: spec/%.xml tools/extract-nodename.py
	@install -d tmp
	python tools/extract-nodename.py $< > $@
	tr a-z A-Z < $@ > $@.upper
	tr A-Z a-z < $@ > $@.lower
	tr -d _ < $@ > $@.camel

TEST_XMLS = $(wildcard test/input/*.xml)
TEST_INTERFACE_XMLS = test/input/_Test.xml
TEST_INTROSPECT = test/output/_Test.introspect.xml
TEST_GENERATED_FILES = \
	test/output/spec.html \
	$(TEST_INTROSPECT) $(TEST_ASYNC_INTROSPECT)

doc/request.html doc/dispatch.html: %.html: %.txt
	$(RST2HTML) < $< > $@

GENERATED_FILES = \
	doc/request.html \
	doc/dispatch.html \
	doc/spec.html \
	doc/telepathy-spec.devhelp2 \
	$(INTROSPECT) $(ASYNC_INTROSPECT) \
	$(CANONICAL_NAMES)

doc/spec.html: $(XMLS) tools/doc-generator.xsl
	$(XSLTPROC) tools/doc-generator.xsl spec/all.xml > $@
doc/telepathy-spec.devhelp2: $(XMLS) tools/devhelp.xsl
	$(XSLTPROC) tools/devhelp.xsl spec/all.xml > $@
test/output/spec.html: $(TEST_XMLS) tools/doc-generator.xsl
	@install -d test/output
	$(XSLTPROC) tools/doc-generator.xsl test/input/all.xml > $@

$(INTROSPECT): introspect/%.xml: spec/%.xml tools/spec-to-introspect.xsl
	@install -d introspect
	$(XSLTPROC) tools/spec-to-introspect.xsl $< | $(DROP_NAMESPACE) > $@
$(TEST_INTROSPECT): $(TEST_INTERFACE_XMLS) tools/spec-to-introspect.xsl
	@install -d test/output
	$(XSLTPROC) tools/spec-to-introspect.xsl $< | $(DROP_NAMESPACE) > $@

$(ASYNC_INTROSPECT): introspect/async/%.xml: introspect/%.xml tools/make_all_async.py
	@install -d introspect/async
	python tools/make_all_async.py $< $@
$(TEST_ASYNC_INTROSPECT): $(TEST_INTROSPECT) tools/make_all_async.py
	@install -d test/output
	python tools/make_all_async.py $< $@

all: $(GENERATED_FILES)

TEST_CANONICALIZED_FILES = test/output/spec.html.canon \
			   test/output/introspect.canon

test/output/spec.html.canon: test/output/spec.html
	$(CANONXML) $< > $@
test/output/introspect.canon: test/output/_Test.introspect.xml
	$(CANONXML) $< | $(XML_LINEBREAKS) > $@
<commit_msg>If xsltproc fails, don't leave its output apparently up to date<commit_after>all:

XSLTPROC = xsltproc --xinclude --nonet
CANONXML = xmllint --nsclean --noblanks --c14n --nonet
XML_LINEBREAKS = perl -pe 's/>/>\n/g'
DROP_NAMESPACE = perl -pe '$$hash = chr(35); s{xmlns:tp="http://telepathy\.freedesktop\.org/wiki/DbusSpec$${hash}extensions-v0"}{}g'
RST2HTML = rst2html

XMLS = $(wildcard spec/*.xml)
INTERFACE_XMLS = $(filter spec/[[:upper:]]%.xml,$(XMLS))
INTROSPECT = $(INTERFACE_XMLS:spec/%.xml=introspect/%.xml)
ASYNC_INTROSPECT = $(INTERFACE_XMLS:spec/%.xml=introspect/async/%.xml)
CANONICAL_NAMES = $(INTERFACE_XMLS:spec/%.xml=tmp/%.name)

$(CANONICAL_NAMES): tmp/%.name: spec/%.xml tools/extract-nodename.py
	@install -d tmp
	python tools/extract-nodename.py $< > $@
	tr a-z A-Z < $@ > $@.upper
	tr A-Z a-z < $@ > $@.lower
	tr -d _ < $@ > $@.camel

TEST_XMLS = $(wildcard test/input/*.xml)
TEST_INTERFACE_XMLS = test/input/_Test.xml
TEST_INTROSPECT = test/output/_Test.introspect.xml
TEST_GENERATED_FILES = \
	test/output/spec.html \
	$(TEST_INTROSPECT) $(TEST_ASYNC_INTROSPECT)

doc/request.html doc/dispatch.html: %.html: %.txt
	$(RST2HTML) < $< > $@

GENERATED_FILES = \
	doc/request.html \
	doc/dispatch.html \
	doc/spec.html \
	doc/telepathy-spec.devhelp2 \
	$(INTROSPECT) $(ASYNC_INTROSPECT) \
	$(CANONICAL_NAMES)

doc/spec.html: $(XMLS) tools/doc-generator.xsl
	$(XSLTPROC) tools/doc-generator.xsl spec/all.xml > $@.tmp
	mv $@.tmp $@
doc/telepathy-spec.devhelp2: $(XMLS) tools/devhelp.xsl
	$(XSLTPROC) tools/devhelp.xsl spec/all.xml > $@.tmp
	mv $@.tmp $@
test/output/spec.html: $(TEST_XMLS) tools/doc-generator.xsl
	@install -d test/output
	$(XSLTPROC) tools/doc-generator.xsl test/input/all.xml > $@.tmp
	mv $@.tmp $@

$(INTROSPECT): introspect/%.xml: spec/%.xml tools/spec-to-introspect.xsl
	@install -d introspect
	$(XSLTPROC) tools/spec-to-introspect.xsl $< | $(DROP_NAMESPACE) > $@
$(TEST_INTROSPECT): $(TEST_INTERFACE_XMLS) tools/spec-to-introspect.xsl
	@install -d test/output
	$(XSLTPROC) tools/spec-to-introspect.xsl $< | $(DROP_NAMESPACE) > $@

$(ASYNC_INTROSPECT): introspect/async/%.xml: introspect/%.xml tools/make_all_async.py
	@install -d introspect/async
	python tools/make_all_async.py $< $@
$(TEST_ASYNC_INTROSPECT): $(TEST_INTROSPECT) tools/make_all_async.py
	@install -d test/output
	python tools/make_all_async.py $< $@

all: $(GENERATED_FILES)

TEST_CANONICALIZED_FILES = test/output/spec.html.canon \
			   test/output/introspect.canon

test/output/spec.html.canon: test/output/spec.html
	$(CANONXML) $< > $@
test/output/introspect.canon: test/output/_Test.introspect.xml
	$(CANONXML) $< | $(XML_LINEBREAKS) > $@

{'fraction_non_alphanumeric': 0.18167821401077752, 'fraction_numerical': 0.003849114703618168, 'mean_word_length': 4.522848034006376, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 42}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3148827', 'n_tokens_mistral': 2248, 'n_tokens_neox': 2124, 'n_words': 315}