summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/crossrefenum/test/Makefile
blob: 749d63a96a088b28a683d743a76cdd445633def0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.PHONY: clean test log check

ALL=main-test.tex data-common.tex data-reledmac.tex config-formats.tex config-crossrefenum.tex format-specific-defs.tex

define MAKE_BOXES_LIST
	sed -i 's/%\\tracingoutput/\\tracingoutput/' $<
	-xelatex main-test.tex
	sed -i 's/^\\tracingoutput/%\\tracingoutput/' $<
	full_boxes_list="$$(grep -E '^\.+\\TU' main-test.log)"; \
		i_test_result_end="$$(( $$(grep -Fn '....\TU/lmr/m/sc/10 Capitulus' <<< "$$full_boxes_list" | head -n 1 | cut -d ':' -f 1) - 1))"; \
		sed -n 1,$${i_test_result_end}p <<< "$$full_boxes_list" > $@
endef

clean:
	-rm main-test.{aux,log,1,2,fdb_latexmk,fls,xdv,tuc}

test: clean $(ALL)
	latexmk -xelatex main-test.tex

log: $(ALL)
	sed -i 's/%\\tracingcommands/\\tracingcommands/' $<
	sed -i 's/%\\tracingmacros/\\tracingmacros/' $<
	-xelatex main-test.tex
	sed -i 's/^\\tracingcommands/%\\tracingcommands/' $<
	sed -i 's/^\\tracingmacros/%\\tracingmacros/' $<

validated-output: $(ALL)
	$(MAKE_BOXES_LIST)

check: test log test-output
	diff test-output validated-output
	@echo -e '\n==============\nCheck passed!\n==============\n'

test-output: $(ALL)
	$(MAKE_BOXES_LIST)

test-context: $(ALL)
	context $<