-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
306 lines (271 loc) · 10.1 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
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# Makefile for the Neo4j documentation
#
PROJECTNAME = neo4j-manual
BUILDDIR = $(CURDIR)/target
SRCDIR = $(BUILDDIR)/classes
SRCFILE = $(SRCDIR)/$(PROJECTNAME).txt
IMGDIR = $(SRCDIR)/images
CSSDIR = $(SRCDIR)/css
JSDIR = $(SRCDIR)/js
CONFDIR = $(SRCDIR)/conf
DOCBOOKFILE = $(BUILDDIR)/$(PROJECTNAME)-shortinfo.xml
DOCBOOKFILEHTML = $(BUILDDIR)/$(PROJECTNAME)-html.xml
FOPDIR = $(BUILDDIR)/pdf
FOPFILE = $(FOPDIR)/$(PROJECTNAME).fo
FOPPDF = $(FOPDIR)/$(PROJECTNAME).pdf
TEXTWIDTH = 80
TEXTDIR = $(BUILDDIR)/text
TEXTFILE = $(TEXTDIR)/$(PROJECTNAME).txt
TEXTHTMLFILE = $(TEXTFILE).html
SINGLEHTMLDIR = $(BUILDDIR)/html
SINGLEHTMLFILE = $(SINGLEHTMLDIR)/$(PROJECTNAME).html
ANNOTATEDDIR = $(BUILDDIR)/annotated
ANNOTATEDFILE = $(HTMLDIR)/$(PROJECTNAME).html
CHUNKEDHTMLDIR = $(BUILDDIR)/chunked
CHUNKEDOFFLINEHTMLDIR = $(BUILDDIR)/chunked-offline
CHUNKEDTARGET = $(BUILDDIR)/$(PROJECTNAME).chunked
CHUNKEDSHORTINFOTARGET = $(BUILDDIR)/$(PROJECTNAME)-html.chunked
MANPAGES = $(BUILDDIR)/manpages
UPGRADE = $(BUILDDIR)/upgrade
FILTERSRC = $(CURDIR)/src/bin/resources
FILTERDEST = ~/.asciidoc/filters
SCRIPTDIR = $(CURDIR)/src/build
ASCIIDOC = $(CURDIR)/src/bin/asciidoc/asciidoc.py
A2X = $(CURDIR)/src/bin/asciidoc/a2x.py
ifdef VERBOSE
V = -v
VA = VERBOSE=1
endif
ifdef KEEP
K = -k
KA = KEEP=1
endif
ifdef VERSION
VERSNUM =$(VERSION)
else
VERSNUM =-neo4j-version
endif
ifdef IMPORTDIR
IMPDIR = --attribute importdir="$(IMPORTDIR)"
else
IMPDIR = --attribute importdir="$(BUILDDIR)/docs"
IMPORTDIR = "$(BUILDDIR)/docs"
endif
ifneq (,$(findstring SNAPSHOT,$(VERSNUM)))
GITVERSNUM =master
else
GITVERSNUM =$(VERSION)
endif
ifndef VERSION
GITVERSNUM =master
endif
VERS = --attribute revnumber=$(VERSNUM)
GITVERS = --attribute gitversion=$(GITVERSNUM)
ASCIIDOC_FLAGS = $(V) $(VERS) $(GITVERS) $(IMPDIR)
A2X_FLAGS = $(K) $(ASCIIDOC_FLAGS)
.PHONY: all dist docbook help clean pdf html offline-html singlehtml text cleanup annotated manpages upgrade installfilter html-check text-check check yearcheck
help:
@echo "Please use 'make <target>' where <target> is one of"
@echo " clean to clean the build directory"
@echo " dist to generate the common distribution formats"
@echo " pdf to generate a PDF file using FOP"
@echo " html to make standalone HTML files"
@echo " singlehtml to make a single large HTML file"
@echo " text to make text files"
@echo " annotated to make a single annotated HTML file"
@echo " manpages to make the manpages"
@echo "For verbose output, use 'VERBOSE=1'".
@echo "To keep temporary files, use 'KEEP=1'".
@echo "To set the version, use 'VERSION=[the version]'".
@echo "To set the importdir, use 'IMPORTDIR=[the importdir]'".
dist: installfilter offline-html html html-check text text-check pdf manpages upgrade cleanup yearcheck
check: html-check text-check cleanup
clean:
-rm -rf "$(BUILDDIR)/"*
cleanup:
#
#
# Cleaning up.
#
#
ifndef KEEP
rm -f "$(DOCBOOKFILEPDF)"
rm -f "$(DOCBOOKFILE)"
rm -f "$(BUILDDIR)/"*.xml
rm -f "$(ANNOTATEDDIR)/"*.xml
rm -f "$(FOPDIR)/images"
rm -f "$(FOPFILE)"
rm -f "$(UPGRADE)/"*.xml
rm -f "$(UPGRADE)/"*.html
endif
installfilter:
#
#
# Installing asciidoc filters.
#
#
mkdir -p $(FILTERDEST)
cp -fr "$(FILTERSRC)/"* $(FILTERDEST)
copyimages:
#
#
# Copying images from source projects.
#
#
"$(SCRIPTDIR)/copy-images.sh" "$(IMPORTDIR)" "$(IMGDIR)"
html-check: offline-html
#
#
# Checking that identifiers exist where they should.
#
"$(SCRIPTDIR)/htmlcheck.sh" "$(CHUNKEDOFFLINEHTMLDIR)"
text-check: text
#
#
# Checking that snippets are in place.
#
"$(SCRIPTDIR)/textcheck.sh" "$(TEXTFILE)"
docbook-shortinfo: manpages copyimages
#
#
# Building docbook output with short info.
# Checking DocBook validity.
#
#
mkdir -p "$(BUILDDIR)"
"$(ASCIIDOC)" $(ASCIIDOC_FLAGS) --backend docbook --attribute docinfo1 --doctype book --conf-file="$(CONFDIR)/asciidoc.conf" --conf-file="$(CONFDIR)/docbook45.conf" --out-file "$(DOCBOOKFILE)" "$(SRCFILE)"
xmllint --nonet --noout --xinclude --postvalid "$(DOCBOOKFILE)"
docbook-html: manpages copyimages
#
#
# Building docbook output with short info for html outputs.
# Checking for missing include files.
# Checking DocBook validity.
#
#
mkdir -p "$(BUILDDIR)"
"$(ASCIIDOC)" $(ASCIIDOC_FLAGS) --backend docbook --attribute docinfo1 --doctype book --conf-file="$(CONFDIR)/asciidoc.conf" --conf-file="$(CONFDIR)/docbook45.conf" --conf-file="$(CONFDIR)/linkedimages.conf" --out-file "$(DOCBOOKFILEHTML)" "$(SRCFILE)" 2>&1 | "$(SCRIPTDIR)/outputcheck-includefiles.sh"
xmllint --nonet --noout --xinclude --postvalid "$(DOCBOOKFILEHTML)"
pdf: docbook-shortinfo copyimages
#
#
# Building PDF.
#
#
mkdir -p "$(FOPDIR)"
cd "$(FOPDIR)"
xsltproc --xinclude --output "$(FOPFILE)" "$(CONFDIR)/fo.xsl" "$(DOCBOOKFILE)"
ln -s "$(SRCDIR)/images" "$(FOPDIR)/images"
#export FOP_OPTS="-Xmx2048m"
#fop -fo $(FOPFILE) -pdf $(FOPPDF) -c $(CONFDIR)/fop.xml
# For fop 1.0, timezone has to be a non-negative one.
MAVEN_OPTS="-Xmx2048m -Duser.timezone=GMT" mvn -f="fop-pom.xml" -e exec:java -Dexec.mainClass="org.apache.fop.cli.Main" -Djava.awt.headless=true -Dexec.args="-fo '$(FOPFILE)' -pdf '$(FOPPDF)' -c '$(CONFDIR)/fop.xml'" 2>&1 | "$(SCRIPTDIR)/outputcheck-images-fop.sh"
html: manpages copyimages docbook-html
#
#
# Building html output.
# Checking for missing images/resources.
#
#
"$(A2X)" $(V) -L -f chunked -D "$(BUILDDIR)" --xsl-file="$(CONFDIR)/chunked.xsl" -r "$(IMGDIR)" -r "$(CSSDIR)" --xsltproc-opts "--stringparam admon.graphics 1" --xsltproc-opts "--xinclude" --xsltproc-opts "--stringparam chunk.section.depth 1" --xsltproc-opts "--stringparam toc.section.depth 1" "$(DOCBOOKFILEHTML)" 2>&1 | "$(SCRIPTDIR)/outputcheck-images.sh"
rm -rf "$(CHUNKEDHTMLDIR)"
mv "$(CHUNKEDSHORTINFOTARGET)" "$(CHUNKEDHTMLDIR)"
cp -fr "$(JSDIR)" "$(CHUNKEDHTMLDIR)/js"
cp -fr "$(CSSDIR)/"* "$(CHUNKEDHTMLDIR)/css"
cp -fr "$(SRCDIR)/images/"*.png "$(CHUNKEDHTMLDIR)/images"
offline-html: manpages copyimages docbook-html
#
#
# Building html output for offline use.
#
#
"$(A2X)" $(V) -L -f chunked -D "$(BUILDDIR)" --xsl-file="$(CONFDIR)/chunked-offline.xsl" -r "$(IMGDIR)" -r "$(CSSDIR)" --xsltproc-opts "--stringparam admon.graphics 1" --xsltproc-opts "--xinclude" --xsltproc-opts "--stringparam chunk.section.depth 1" --xsltproc-opts "--stringparam toc.section.depth 1" "$(DOCBOOKFILEHTML)"
rm -rf "$(CHUNKEDOFFLINEHTMLDIR)"
mv "$(CHUNKEDSHORTINFOTARGET)" "$(CHUNKEDOFFLINEHTMLDIR)"
cp -fr "$(JSDIR)" "$(CHUNKEDOFFLINEHTMLDIR)/js"
cp -fr "$(CSSDIR)/"* "$(CHUNKEDOFFLINEHTMLDIR)/css/"
cp -fr "$(SRCDIR)/images/"*.png "$(CHUNKEDOFFLINEHTMLDIR)/images"
# currently builds docbook format first
singlehtml: dist
#
#
# Building single html file output.
#
#
mkdir -p "$(SINGLEHTMLDIR)"
"$(A2X)" $(A2X_FLAGS) -L -f xhtml -D "$(SINGLEHTMLDIR)" --conf-file="$(CONFDIR)/xhtml.conf" --asciidoc-opts "--conf-file=\"$(CONFDIR)/asciidoc.conf\"" --asciidoc-opts "--conf-file=\"$(CONFDIR)/docbook45.conf\"" --asciidoc-opts "--conf-file=\"$(CONFDIR)/linkedimages.conf\"" --xsl-file="$(CONFDIR)/xhtml.xsl" --xsltproc-opts "--stringparam admon.graphics 1" "$(SRCFILE)"
cp -fr "$(JSDIR)" "$(SINGLEHTMLDIR)/js"
cp -fr "$(CSSDIR)" "$(SINGLEHTMLDIR)/css"
cp -fr "$(IMGDIR)" "$(SINGLEHTMLDIR)/images"
mv "$(SINGLEHTMLDIR)/$(PROJECTNAME).html" "$(SINGLEHTMLDIR)/index.html"
# builds docbook format first
annotated: dist
#
#
# Building annotated html output.
#
#
mkdir -p "$(ANNOTATEDDIR)"
"$(A2X)" $(A2X_FLAGS) -L -a showcomments -f xhtml -D "$(ANNOTATEDDIR)" --conf-file="$(CONFDIR)/xhtml.conf" --asciidoc-opts "--conf-file=\"$(CONFDIR)/asciidoc.conf\"" --asciidoc-opts "--conf-file=\"$(CONFDIR)/docbook45.conf\"" --asciidoc-opts "--conf-file=\"$(CONFDIR)/linkedimages.conf\"" --xsl-file="$(CONFDIR)/xhtml.xsl" --xsltproc-opts "--stringparam admon.graphics 1" "$(SRCFILE)"
cp -fr "$(SRCDIR)/js" "$(ANNOTATEDDIR)/js"
cp -fr "$(SRCDIR)/css/"* "$(ANNOTATEDDIR)/css"
cp -fr "$(SRCDIR)/images/"*.png "$(ANNOTATEDDIR)/images"
mv "$(ANNOTATEDDIR)/$(PROJECTNAME).html" "$(ANNOTATEDDIR)/index.html"
text: docbook-shortinfo
#
#
# Building text output.
#
#
mkdir -p "$(TEXTDIR)"
cd "$(TEXTDIR)"
xsltproc --xinclude --stringparam callout.graphics 0 --stringparam navig.graphics 0 --stringparam admon.textlabel 1 --stringparam admon.graphics 0 --output "$(TEXTHTMLFILE)" "$(CONFDIR)/text.xsl" "$(DOCBOOKFILE)"
cd "$(SRCDIR)"
cp -f "$(SCRIPTDIR)/bom" "$(TEXTFILE)"
w3m -cols "$(TEXTWIDTH)" -dump -T text/html -no-graph "$(TEXTHTMLFILE)" >> "$(TEXTFILE)"
ifndef KEEP
rm -f "$(TEXTHTMLFILE)"
rm -f "$(TEXTDIR)/"*.html
rm -f "$(CURDIR)/"*.html
endif
manpages:
#
#
# Building manpages.
#
#
mkdir -p "$(MANPAGES)"
"$(SCRIPTDIR)/manpage.sh" "$(V)" "$(MANPAGES)" "$(IMPORTDIR)" "$(A2X)" "$(SCRIPTDIR)" "neo4j server" "neo4j-shell shell" "neo4j-coordinator server" "neo4j-coordinator-shell server"
# clean up
mkdir -p "$(ANNOTATEDDIR)"
cp "$(MANPAGES)/"*.xml "$(ANNOTATEDDIR)"
mv "$(MANPAGES)/"*.xml "$(BUILDDIR)"
rm -rf "$(MANPAGES)/"*.html
# gzip -q "$(MANPAGES)/"*
upgrade:
#
#
# Building upgrade text.
#
#
mkdir -p "$(UPGRADE)"
"$(A2X)" -k -f text -D "$(UPGRADE)" "$(IMPORTDIR)/neo4j-docs-jar/ops/upgrades.txt"
cp -f "$(SCRIPTDIR)/bom" "$(UPGRADE)/UPGRADE.txt"
cat "$(UPGRADE)/upgrades.text" >> "$(UPGRADE)/UPGRADE.txt"
rm "$(UPGRADE)/upgrades.text"
slidestest:
#
#
# Building slides.
#
#
"$(ASCIIDOC)" $(ASCIIDOC_FLAGS) --backend docbook --doctype article --conf-file="$(CONFDIR)/asciidoc.conf" --conf-file="$(CONFDIR)/docbook45.conf" --conf-file="$(CONFDIR)/docbook45-slides.conf" --out-file ./target/slidestest/article-slides.xml ./target/docs/neo4j-examples-docs-jar/dev/examples/hello-world.txt
xsltproc --xinclude --output ./target/slidestest/slides /usr/share/xml/docbook/stylesheet/docbook-xsl/slides/xhtml/default.xsl ./target/slidestest/article-slides.xml
xmllint --nonet --noout --xinclude --postvalid ./target/slidestest/article-slides.xml
yearcheck:
#
#
# Check that the manual has the correct year set.
#
#
"$(SCRIPTDIR)/yearcheck.sh" "$(SRCDIR)"