-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
116 lines (87 loc) · 3.48 KB
/
Makefile
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Makefile for Aparecium
#
# 2021-11-04
# Put Aparecium.html and xhtml into doc (not build)
#
# 2021-10-04
#
# The only complication here is that every time we re-tangle,
# tangle.xsl generates all the files, whether those scraps
# changed or not. So we tangle into a temporary directory
# and then use rsync --checksum to copy the output to the
# build directory only if it has changed.
BINDIR=/home/cmsmcq/bin
### BINDIR=../../../bin
### XSLTDIR=../../../blackmesatech.com/lib
XSLT=$(BINDIR)/saxon-he-wrapper.sh
WEAVEHTML=src/local.xsl
# Aparecium is a literate program. To generate all outputs,
# weave it and tangle it.
all: tangled woven testharness
# Weave
#
# For the moment, we just weave to HTML; someday it would probably
# be nice to weave to TeX or LaTeX and thence to PDF.
woven: doc/Aparecium.xhtml
doc/Aparecium.xhtml: doc/Aparecium.html
-tidy -output $@ -asxhtml $< 2>/dev/null
doc/Aparecium.html: src/Aparecium.xml
$(XSLT) $< $(WEAVEHTML) $@
# Tangle
#
# Note that tmp contains a symbolic link to the tangle stylesheet.
# e.g. (cd tmp; ln -s ../lib/tangle.xsl .)
# That tangle.xsl is a physical copy of the current tangle in the
# SWeb project, and will need to be replaced periodically to pick
# up any improvements.
#
# We use Aparecium.xqm as a canary: if it is older than the sweb
# source, we retangle everything.
tangled: build/Aparecium.xqm
# As Preston Briggs pointed out a long time ago, we need to produce
# the output and then compare it with what we produced last time,
# to avoid putting a new timestamp on something that has not changed.
# We use rsync to do that and we do it only on *.xqm. If we end
# up producing other files, this will need to change. (We could
# do it for everything in tmp, but we don't want to copy tangle.xsl.)
#
# Don't use --archive, it causes updates even when the file has not
# changed.
build/Aparecium.xqm: src/Aparecium.xml
(cd tmp; $(XSLT) ../$< tangle.xsl zzz.tangle.out version='pfg')
rsync --checksum tmp/*.xqm build
# Addendum: test harness. Same operations (they should perhaps
# be factored out into general rules)`
testharness: tests/test-driver.xq \
build/test-harness.xqm \
doc/test-harness.xhtml
build/test-harness.xqm: src/test-harness.xml
(cd tmp; $(XSLT) ../$< tangle.xsl zzz.tangle.out version='v3')
rsync --checksum tmp/test-harness.xqm build
rsync --checksum tmp/test-driver.xq tests
tests/test-driver.xq: build/test-harness.xqm
rsync --checksum tmp/test-driver.xq tests
doc/test-harness.xhtml: doc/test-harness.html
-tidy -output $@ -asxhtml $< 2>/dev/null
doc/test-harness.html: src/test-harness.xml
$(XSLT) $< $(WEAVEHTML) $@
## swebtohtml.xsl is shared
lib: lib/swebtohtml.xsl lib/tltohtml.xsl
lib/swebtohtml.xsl: /home/cmsmcq/blackmesatech.com/lib/swebtohtml.xsl
cp -p $< $@
lib/tltohtml.xsl: /home/cmsmcq/blackmesatech.com/lib/tltohtml.xsl
cp -p $< $@
## Processing new version of ixml spec grammar
## First, manually copy as ixml.yyyy-mm-dd.ixml.xml.
## Then inline hidden nonterminals
lib/ixml.%.01.inlined.xml: lib/ixml.%.ixml.xml
$(XSLT) $< ../Gingersnap/src/ixml-inline-hidden-nonterminals.xsl $@
## Then annotate.
lib/ixml.%.02.pc.xml: lib/ixml.%.01.inlined.xml
$(XSLT) $< ../Gingersnap/src/ixml-annotate-pc.xsl $@
## Then remove unreachables.
lib/ixml.%.03.clean.xml: lib/ixml.%.02.pc.xml
$(XSLT) $< ../Gingersnap/src/remove-unreachables.xsl $@
## Then compile. (command line would be nice.)
lib/ixml.%.inlined.compiled.xml: lib/ixml.%.03.clean.xml
basex -o $@ -b file=$(realpath $<) lib/compile-grammar.xq