forked from webb/xml-schema-documentation-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
241 lines (199 loc) · 7.49 KB
/
Makefile.in
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#############################################################################
# Don't touch these...
#############################################################################
this_makefile := ${lastword ${MAKEFILE_LIST}}
SHELL = @bash@ -o pipefail -o errexit -o nounset
# all targets are never automatically deleted because they are intermediate
.SECONDARY:
# delete the target of a rule if it has changed and its recipe exits with a
# nonzero exit status
.DELETE_ON_ERROR:
depend = false
#HELP:Default target is "all". Targets include:
.DEFAULT_GOAL = all
#############################################################################
# AUTOCONF inputs
srcdir = @srcdir@
builddir = @builddir@
install_dir = @install_dir@
xml_catalog = @xml_catalog@
#############################################################################
# COMMANDS
# autoconf stuff
MKDIR_P = @MKDIR_P@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_DATA = @INSTALL_DATA@
SED = @SED@
# unix stuff
find = @find@
touch = @touch@
# webb stuff
saxon = java \
-classpath ${srcdir}/lib/jars/Saxon-HE-9.7.0-7.jar:${srcdir}/lib/jars/xml-resolver-1.2.jar \
-Dxml.catalog.files=${srcdir}/lib/xml-catalog/xml-catalog.xml \
-Dxml.catalog.verbosity=999 \
net.sf.saxon.Transform \
-r:org.apache.xml.resolver.tools.CatalogResolver \
-x:org.apache.xml.resolver.tools.ResolvingXMLReader \
-y:org.apache.xml.resolver.tools.ResolvingXMLReader \
--suppressXsltNamespaceCheck:on \
# additional params to ${saxon}:
# -s:inputs/empty.xml \
# -xsl:xsl/mode-component-diagram.xsl \
# -o:build/nc/PersonType/diagram.dot \
# -im:"{}component-diagram" \
# +prefixes-file=./build/prefixes.xml \
# +xml-catalog-file=./inputs/person-subset/niem/xml-catalog.xml \
# +backlinks-file=./build/backlinks.xml \
# root-path=/Users/wr/r/niem/release/model/src/build \
# prefix=nc \
# local-name=PersonType
#############################################################################
# variables
build_dir = ${builddir}/build
prefixes_file = ${build_dir}/prefixes.xml
all_sources = ${wildcard ${srcdir}/xsl/*.xsl}
definitions_mk = ${build_dir}/definitions.mk
backlinks_file = ${build_dir}/backlinks.xml
tokens_dir = ${build_dir}/tokens
built_all_token = ${tokens_dir}/built-all
installed_token = ${tokens_dir}/installed
make_dirs_token = ${tokens_dir}/make-dirs
generate_diagrams_token = ${tokens_dir}/generate-diagrams
process_diagrams_token = ${tokens_dir}/process-diagrams
ifneq (${depend},false)
.DEFAULT_GOAL = depend
.PHONY: depend
depend: ${definitions_mk}
${prefixes_file}: ${xml_catalog} ${srcdir}/xsl/collect-prefixes.xsl
${MKDIR_P} ${dir $@}
${saxon} -s:$< -o:$@ -xsl:${srcdir}/xsl/collect-prefixes.xsl
${definitions_mk}: ${xml_catalog} ${prefixes_file} ${all_sources}
${MKDIR_P} ${dir $@}
${saxon} \
-s:${srcdir}/inputs/empty.xml \
-o:$@ \
-xsl:${srcdir}/xsl/generate-makefile.xsl \
+prefixes-file=${prefixes_file} \
+xml-catalog-file=${xml_catalog}
else
namespaces =
-include ${definitions_mk}
ifeq (${namespaces},)
${warning Prequisites/dependencies not present. Run "make depend=true"}
endif
define run_install =
${MKDIR_P} ${install_dir}/$1
${INSTALL_DATA} ${build_dir}/$1/index.html ${install_dir}/$1/index.html
endef
define run_build_namespace_index =
${MKDIR_P} ${build_dir}/$1
${saxon} \
-s:${srcdir}/inputs/empty.xml \
-o:$@ \
-xsl:${srcdir}/xsl/generate-namespace-index.xsl \
+prefixes-file=${prefixes_file} \
+xml-catalog-file=${xml_catalog} \
prefix=$1
endef
define run_build_component_index =
${MKDIR_P} ${build_dir}/$1
${saxon} \
-s:${srcdir}/inputs/empty.xml \
-o:${build_dir}/$1/index.html \
-xsl:${srcdir}/xsl/mode-component-page.xsl \
-im:"{}component-page" \
+prefixes-file=${prefixes_file} \
+xml-catalog-file=${xml_catalog} \
+backlinks-file=${backlinks_file} \
root-path=${realpath ${build_dir}} \
prefix=${word 1,${subst /, ,$1}} \
local-name=${word 2,${subst /, ,$1}}
endef
all_files = \
${build_dir}/index.html \
${build_dir}/json-schema.json \
${namespaces:%=${build_dir}/%/index.html} \
${components:%=${build_dir}/%/index.html} \
install_files = ${all_files:${build_dir}/%=${install_dir}/%}
#############################################################################
.PHONY: all # build everything from $xml_catalog
#HELP: Default xml_catalog=@xml_catalog@
all: ${all_files}
${backlinks_file}: ${xml_catalog} | ${prefixes_file} ${xml_catalog} ${all_sources}
${MKDIR_P} ${dir $@}
${saxon} -s:$< -o:$@ -xsl:${srcdir}/xsl/collect-backlinks.xsl \
+prefixes-file=${prefixes_file} \
+xml-catalog-file=${xml_catalog}
${build_dir}/index.html: | ${prefixes_file} ${xml_catalog}
${MKDIR_P} ${build_dir}
${saxon} \
-s:${srcdir}/inputs/empty.xml \
-o:$@ \
-xsl:${srcdir}/xsl/generate-root-index.xsl \
+prefixes-file=${prefixes_file} \
+xml-catalog-file=${xml_catalog}
${build_dir}/json-schema-unformatted.json: | ${backlinks_file} ${xml_catalog}
${saxon} \
-s:${srcdir}/inputs/empty.xml \
-o:$@ \
-xsl:${srcdir}/xsl/generate-json-schema.xsl \
+prefixes-file=${prefixes_file} \
+xml-catalog-file=${xml_catalog} \
+backlinks-file=${backlinks_file}
${build_dir}/json-schema.json: ${build_dir}/json-schema-unformatted.json
jq . $< > $@
${build_dir}/%/diagram.png.base64: ${build_dir}/%/diagram.png
base64 --wrap=0 $< > $@
${build_dir}/%/diagram.png ${build_dir}/%/diagram.map: ${build_dir}/%/diagram.dot
dot -Tpng -o${build_dir}/$*/diagram.png -Tcmapx -o${build_dir}/$*/diagram.map $<
${build_dir}/%/diagram.dot: | ${backlinks_file}
${MKDIR_P} ${dir $@}
${saxon} \
-s:${srcdir}/inputs/empty.xml \
-o:$@ \
-xsl:${srcdir}/xsl/mode-component-diagram.xsl \
-im:"{}component-diagram" \
+prefixes-file=${prefixes_file} \
+xml-catalog-file=${xml_catalog} \
+backlinks-file=${backlinks_file} \
root-path=${realpath ${build_dir}} \
prefix=${word 1,${subst /, ,$*}} \
local-name=${word 2,${subst /, ,$*}}
#############################################################################
.PHONY: install # install everything to $install_dir
#HELP: Default install_dir=@install_dir@
install: ${install_files}
${install_dir}/%: ${build_dir}/%
${MKDIR_P} ${dir $@}
${INSTALL_DATA} $< $@
endif
#############################################################################
.PHONY: valid
valid: \
${patsubst ${srcdir}/%,${tokens_dir}/xsd-valid/%,${wildcard ${srcdir}/inputs/person/instance-*.xml}} \
${patsubst ${srcdir}/%,${tokens_dir}/json-valid/%,${wildcard ${srcdir}/inputs/person/instance-*.json}}
${tokens_dir}/xsd-valid/inputs/person/%.xml: ${srcdir}/inputs/person/%.xml ${srcdir}/inputs/person/subset/niem/xml-catalog.xml
xs-validate --catalog=${srcdir}/inputs/person/subset/niem/xml-catalog.xml $<
${MKDIR_P} ${dir $@}
touch $@
${tokens_dir}/json-valid/inputs/person/%.json: ${srcdir}/inputs/person/%.json ${build_dir}/json-schema.json
ajv validate -s ${build_dir}/json-schema.json -d $<
${MKDIR_P} ${dir $@}
touch $@
#############################################################################
# convenience targets
.PHONY: clean # clean regular build products
clean:
${RM} -r ${build_dir}
.PHONY: distclean # Clean all products
distclean: clean
${RM} config.log config.status Makefile
#############################################################################
# make help: this must be the last target
.PHONY: help # Print this help
help:
@ ${SED} -e '/^\.PHONY:/s/^\.PHONY: *\([^ #]*\) *\#\( *\)\([^ ].*\)/\2\1: \3/p;/^[^#]*#HELP:/s/[^#]*#HELP:\(.*\)/\1/p;d' ${this_makefile}
# don't put anything after this