forked from KhronosGroup/OpenCL-Docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
498 lines (396 loc) · 17.6 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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
# Copyright (c) 2013-2020 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
QUIET ?=
ASCIIDOCTOR ?= asciidoctor
XMLLINT ?= xmllint
DBLATEX ?= dblatex
DOS2UNIX ?= dos2unix
RM = rm -f
RMRF = rm -rf
MKDIR = mkdir -p
CP = cp
GS_EXISTS := $(shell command -v gs 2> /dev/null)
GITHEAD = ./.git/logs/HEAD
# Target directories for output files
# HTMLDIR - 'html' target
# PDFDIR - 'pdf' target
# CHECKDIR - 'allchecks' target
OUTDIR := out
HTMLDIR := $(OUTDIR)/html
PDFDIR := $(OUTDIR)/pdf
# PDF Equations are written to SVGs, this dictates the location to store those files (temporary)
PDFMATHDIR := $(OUTDIR)/equations_temp
# Set VERBOSE to -v to see what asciidoc is doing.
VERBOSE =
# asciidoc attributes to set.
# NOTEOPTS sets options controlling which NOTEs are generated
# ATTRIBOPTS sets the api revision and enables MathJax generation, and
# the path to generate include files
# ADOCOPTS options for asciidoc->HTML5 output (book document type)
# ADOCMANOPTS options for asciidoc->HTML5 output (manpage document type)
# Currently unused in CL spec
NOTEOPTS = -a editing-notes
# Spell out RFC2822 format as not all date commands support -R
SPECDATE = $(shell echo `date -u "+%a, %d %b %Y %T %z"`)
# Generate Asciidoc attributes for spec version and remark
# The dependency on HEAD is per the suggestion in
# http://neugierig.org/software/blog/2014/11/binary-revisions.html
ifeq ($(wildcard $(GITHEAD)),)
# If GITHEAD does not exist, don't include branch info.
SPECREVISION = Git tag information not available
SPECREMARK = Git branch information not available
else
# Expect the tag to be in the format MAJOR.MINOR-REVISION, e.g. 2.2-9.
# If your current commit is not a tag then a commit hash will be appended.
# If you have locally modified files then -dirty will be appended.
# Could use `git log -1 --format="%cd"` to get branch commit date
SPECREVISION = $(shell echo `git describe --tags --dirty`)
# This used to be a dependency in the spec html/pdf targets,
# but that's likely to lead to merge conflicts. Just regenerate
# when pushing a new spec for review to the sandbox.
SPECREMARK = from git branch: $(shell echo `git symbolic-ref --short HEAD`) \
commit: $(shell echo `git log -1 --format="%H"`)
endif
ATTRIBOPTS = -a revnumber="$(SPECREVISION)" \
-a revdate="$(SPECDATE)" \
-a revremark="$(SPECREMARK)" \
-a stem=latexmath \
-a generated=$(GENERATED)
ADOCEXTS = -r $(CURDIR)/config/sectnumoffset-treeprocessor.rb -r $(CURDIR)/config/spec-macros.rb
ADOCOPTS = -d book $(ATTRIBOPTS) $(NOTEOPTS) $(VERBOSE) $(ADOCEXTS)
ADOCMANOPTS = -d manpage $(ATTRIBOPTS) $(NOTEOPTS) $(VERBOSE) $(ADOCEXTS)
# ADOCHTMLOPTS relies on the relative runtime path from the output HTML
# file to the katex scripts being set with KATEXDIR. This is overridden
# by some targets.
# ADOCHTMLOPTS also relies on the absolute build-time path to the
# 'stylesdir' containing our custom CSS.
KATEXDIR = ../katex
ADOCHTMLEXTS = -r $(CURDIR)/config/katex_replace.rb
ADOCHTMLOPTS = $(ADOCHTMLEXTS) -a katexpath=$(KATEXDIR) \
-a stylesheet=khronos.css -a stylesdir=$(CURDIR)/config
ADOCPDFEXTS = -r asciidoctor-pdf -r asciidoctor-mathematical --trace
ADOCPDFOPTS = $(ADOCPDFEXTS) -a mathematical-format=svg \
-a imagesoutdir=$(PDFMATHDIR)
# Where to put dynamically generated dependencies of the spec and other
# targets, from API XML. GENERATED and APIINCDIR specify the location of
# the API interface includes.
# GENDEPENDS could have multiple dependencies.
GENERATED = $(CURDIR)/generated
APIINCDIR = $(GENERATED)/api
VERSIONDIR = $(APIINCDIR)/version-notes
GENDEPENDS = $(APIINCDIR)/timeMarker
.PHONY: directories
# README.md is a proxy for all the katex files that need to be installed
katexinst: $(OUTDIR)/katex/README.md
$(OUTDIR)/katex/README.md: katex/README.md
$(QUIET)$(MKDIR) $(OUTDIR)
$(QUIET)$(RMRF) $(OUTDIR)/katex
$(QUIET)$(CP) -rf katex $(OUTDIR)
all: api env ext extensions cxx c icdinst
allman: manhtmlpages
api: apihtml apipdf
env: envhtml envpdf
ext: exthtml extpdf
extensions: extensionshtml extensionspdf
cxx: cxxhtml cxxpdf
cxx4opencl: cxx4openclhtml cxx4openclpdf
c: chtml cpdf
icdinst: icdinsthtml icdinstpdf
html: apihtml envhtml exthtml extensionshtml cxxhtml chtml icdinsthtml
pdf: apipdf envpdf extpdf extensionspdf cxxpdf cpdf icdinstpdf
# Spec targets.
# There is some complexity to try and avoid short virtual targets like
# 'html' causing specs to *always* be regenerated.
src:
@echo APISPECSRC = $(APISPECSRC)
@echo ENVSPECSRC = $(ENVSPECSRC)
@echo EXTSPECSRC = $(EXTSPECSRC)
# API spec
# Top-level spec source file
APISPEC = OpenCL_API
APISPECSRC = $(APISPEC).txt $(GENDEPENDS) \
$(shell grep ^include:: $(APISPEC).txt | sed -e 's/^include:://' -e 's/\[\]/ /' | xargs echo)
apihtml: $(HTMLDIR)/$(APISPEC).html $(APISPECSRC)
$(HTMLDIR)/$(APISPEC).html: $(APISPECSRC) katexinst
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(APISPEC).txt
apipdf: $(PDFDIR)/$(APISPEC).pdf $(APISPECSRC)
$(PDFDIR)/$(APISPEC).pdf: $(APISPECSRC)
$(QUIET)$(MKDIR) $(PDFDIR)
$(QUIET)$(MKDIR) $(PDFMATHDIR)
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(APISPEC).txt
ifndef GS_EXISTS
$(QUIET) echo "Warning: Ghostscript not installed, skipping pdf optimization"
else
$(QUIET)$(CURDIR)/config/optimize-pdf $@
$(QUIET)rm $@
$(QUIET)mv $(PDFDIR)/$(APISPEC)-optimized.pdf $@
endif
# Environment spec
# Top-level spec source file
ENVSPEC = OpenCL_Env
ENVSPECSRC = $(ENVSPEC).txt $(GENDEPENDS) \
$(shell grep ^include:: $(ENVSPEC).txt | sed -e 's/^include:://' -e 's/\[\]/ /' | xargs echo)
envhtml: $(HTMLDIR)/$(ENVSPEC).html $(ENVSPECSRC)
$(HTMLDIR)/$(ENVSPEC).html: $(ENVSPECSRC) katexinst
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(ENVSPEC).txt
envpdf: $(PDFDIR)/$(ENVSPEC).pdf $(ENVSPECSRC)
$(PDFDIR)/$(ENVSPEC).pdf: $(ENVSPECSRC)
$(QUIET)$(MKDIR) $(PDFDIR)
$(QUIET)$(MKDIR) $(PDFMATHDIR)
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(ENVSPEC).txt
ifndef GS_EXISTS
$(QUIET) echo "Warning: Ghostscript not installed, skipping pdf optimization"
else
$(QUIET)$(CURDIR)/config/optimize-pdf $@
$(QUIET)rm $@
$(QUIET)mv $(PDFDIR)/$(ENVSPEC)-optimized.pdf $@
endif
# Extensions spec
EXTSPEC = OpenCL_Ext
EXTSPECSRC = $(EXTSPEC).txt $(GENDEPENDS) \
$(shell grep ^include:: $(EXTSPEC).txt | sed -e 's/^include:://' -e 's/\[\]/ /' | xargs echo)
exthtml: $(HTMLDIR)/$(EXTSPEC).html $(EXTSPECSRC)
$(HTMLDIR)/$(EXTSPEC).html: $(EXTSPECSRC) katexinst
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(EXTSPEC).txt
extpdf: $(PDFDIR)/$(EXTSPEC).pdf $(EXTSPECSRC)
$(PDFDIR)/$(EXTSPEC).pdf: $(EXTSPECSRC)
$(QUIET)$(MKDIR) $(PDFDIR)
$(QUIET)$(MKDIR) $(PDFMATHDIR)
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(EXTSPEC).txt
ifndef GS_EXISTS
$(QUIET) echo "Warning: Ghostscript not installed, skipping pdf optimization"
else
$(QUIET)$(CURDIR)/config/optimize-pdf $@
$(QUIET)rm $@
$(QUIET)mv $(PDFDIR)/$(EXTSPEC)-optimized.pdf $@
endif
# Individual extensions spec(s)
EXTDIR = extensions
EXTENSIONSSPEC = extensions
EXTENSIONSSPECSRC = $(EXTDIR)/$(EXTENSIONSSPEC).txt \
$(shell grep ^include:: $(EXTDIR)/$(EXTENSIONSSPEC).txt | sed -e 's/^include:://' -e 's/\[\]/ /' | xargs echo)
# Included extension documents
EXTENSIONS := $(notdir $(wildcard $(EXTDIR)/[A-Za-z]*.asciidoc))
EXTENSIONS_HTML = $(patsubst %.asciidoc,$(HTMLDIR)/%.html,$(EXTENSIONS))
EXTENSIONS_PDF = $(patsubst %.asciidoc,$(PDFDIR)/%.pdf,$(EXTENSIONS))
extensionshtml: $(HTMLDIR)/$(EXTENSIONSSPEC).html $(EXTENSIONSSPECSRC) $(EXTENSIONS_HTML)
$(HTMLDIR)/$(EXTENSIONSSPEC).html: $(EXTENSIONSSPECSRC) katexinst
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(EXTDIR)/$(EXTENSIONSSPEC).txt
# I don't know why the pattern rule below requires vpath be overridden
# to point to the extensions/ directory, since the rule itself already
# points there.
vpath %.asciidoc $(EXTDIR)
$(HTMLDIR)/%.html: $(EXTDIR)/%.asciidoc
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $<
extensionspdf: $(PDFDIR)/$(EXTENSIONSSPEC).pdf $(EXTENSIONSSPECSRC)
$(PDFDIR)/$(EXTENSIONSSPEC).pdf: $(EXTENSIONSSPECSRC)
$(QUIET)$(MKDIR) $(PDFDIR)
$(QUIET)$(MKDIR) $(PDFMATHDIR)
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(EXTDIR)/$(EXTENSIONSSPEC).txt
ifndef GS_EXISTS
$(QUIET) echo "Warning: Ghostscript not installed, skipping pdf optimization"
else
$(QUIET)$(CURDIR)/config/optimize-pdf $@
$(QUIET)rm $@
$(QUIET)mv $(PDFDIR)/$(EXTENSIONSSPEC)-optimized.pdf $@
endif
# Language Extensions spec
CEXTDOC = OpenCL_LangExt
CEXTDOCSRC = $(CEXTDOC).txt $(GENDEPENDS) \
$(shell grep ^include:: $(CEXTDOC).txt | sed -e 's/^include:://' -e 's/\[\]/ /' | xargs echo)
cexthtml: $(HTMLDIR)/$(CEXTDOC).html $(CEXTDOCSRC)
$(HTMLDIR)/$(CEXTDOC).html: $(CEXTDOCSRC) katexinst
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(CEXTDOC).txt
cextpdf: $(PDFDIR)/$(CEXTDOC).pdf $(CEXTDOCSRC)
$(PDFDIR)/$(CEXTDOC).pdf: $(CEXTDOCSRC)
$(QUIET)$(MKDIR) $(PDFDIR)
$(QUIET)$(MKDIR) $(PDFMATHDIR)
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(CEXTDOC).txt
ifndef GS_EXISTS
$(QUIET) echo "Warning: Ghostscript not installed, skipping pdf optimization"
else
$(QUIET)$(CURDIR)/config/optimize-pdf $@
$(QUIET)rm $@
$(QUIET)mv $(PDFDIR)/$(CEXTDOC)-optimized.pdf $@
endif
# C++ (cxx) spec
CXXSPEC = OpenCL_Cxx
CXXSPECSRC = $(CXXSPEC).txt $(GENDEPENDS) \
$(shell grep ^include:: $(CXXSPEC).txt | sed -e 's/^include:://' -e 's/\[\]/ /' | xargs echo)
cxxhtml: $(HTMLDIR)/$(CXXSPEC).html $(CXXSPECSRC)
$(HTMLDIR)/$(CXXSPEC).html: $(CXXSPECSRC) katexinst
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(CXXSPEC).txt
cxxpdf: $(PDFDIR)/$(CXXSPEC).pdf $(CXXSPECSRC)
$(PDFDIR)/$(CXXSPEC).pdf: $(CXXSPECSRC)
$(QUIET)$(MKDIR) $(PDFDIR)
$(QUIET)$(MKDIR) $(PDFMATHDIR)
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(CXXSPEC).txt
ifndef GS_EXISTS
$(QUIET) echo "Warning: Ghostscript not installed, skipping pdf optimization"
else
$(QUIET)$(CURDIR)/config/optimize-pdf $@
$(QUIET)rm $@
$(QUIET)mv $(PDFDIR)/$(CXXSPEC)-optimized.pdf $@
endif
# C spec
CSPEC = OpenCL_C
CSPECSRC = $(CSPEC).txt $(GENDEPENDS) \
$(shell grep ^include:: $(CSPEC).txt | sed -e 's/^include:://' -e 's/\[\]/ /' | xargs echo)
chtml: $(HTMLDIR)/$(CSPEC).html $(CSPECSRC)
$(HTMLDIR)/$(CSPEC).html: $(CSPECSRC) katexinst
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(CSPEC).txt
cpdf: $(PDFDIR)/$(CSPEC).pdf $(CSPECSRC)
$(PDFDIR)/$(CSPEC).pdf: $(CSPECSRC)
$(QUIET)$(MKDIR) $(PDFDIR)
$(QUIET)$(MKDIR) $(PDFMATHDIR)
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(CSPEC).txt
ifndef GS_EXISTS
$(QUIET) echo "Warning: Ghostscript not installed, skipping pdf optimization"
else
$(QUIET)$(CURDIR)/config/optimize-pdf $@
$(QUIET)rm $@
$(QUIET)mv $(PDFDIR)/$(CSPEC)-optimized.pdf $@
endif
# C++ for OpenCL doc
CXX4OPENCLDOC = CXX_for_OpenCL
CXX4OPENCLDOCSRC = $(CXX4OPENCLDOC).txt $(GENDEPENDS) \
$(shell grep ^include:: $(CXX4OPENCLDOC).txt | sed -e 's/^include:://' -e 's/\[\]/ /' | xargs echo)
cxx4openclhtml: $(HTMLDIR)/$(CXX4OPENCLDOC).html $(CXX4OPENCLDOCSRC)
$(HTMLDIR)/$(CXX4OPENCLDOC).html: $(CXX4OPENCLDOCSRC) katexinst
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(CXX4OPENCLDOC).txt
cxx4openclpdf: $(PDFDIR)/$(CXX4OPENCLDOC).pdf $(CXX4OPENCLDOCSRC)
$(PDFDIR)/$(CXX4OPENCLDOC).pdf: $(CXX4OPENCLDOCSRC)
$(QUIET)$(MKDIR) $(PDFDIR)
$(QUIET)$(MKDIR) $(PDFMATHDIR)
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(CXX4OPENCLDOC).txt
ifndef GS_EXISTS
$(QUIET) echo "Warning: Ghostscript not installed, skipping pdf optimization"
else
$(QUIET)$(CURDIR)/config/optimize-pdf $@
$(QUIET)rm $@
$(QUIET)mv $(PDFDIR)/$(CXX4OPENCLDOC)-optimized.pdf $@
endif
# ICD installation guidelines
ICDINSTSPEC = OpenCL_ICD_Installation
ICDINSTSPECSRC = $(ICDINSTSPEC).txt \
$(shell grep ^include:: $(ICDINSTSPEC).txt | sed -e 's/^include:://' -e 's/\[\]/ /' | xargs echo)
icdinsthtml: $(HTMLDIR)/$(ICDINSTSPEC).html $(ICDINSTSPECSRC)
$(HTMLDIR)/$(ICDINSTSPEC).html: $(ICDINSTSPECSRC) katexinst
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(ICDINSTSPEC).txt
icdinstpdf: $(PDFDIR)/$(ICDINSTSPEC).pdf $(ICDINSTSPECSRC)
$(PDFDIR)/$(ICDINSTSPEC).pdf: $(ICDINSTSPECSRC)
$(QUIET)$(MKDIR) $(PDFDIR)
$(QUIET)$(MKDIR) $(PDFMATHDIR)
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(ICDINSTSPEC).txt
ifndef GS_EXISTS
$(QUIET) echo "Warning: Ghostscript not installed, skipping pdf optimization"
else
$(QUIET)$(CURDIR)/config/optimize-pdf $@
$(QUIET)rm $@
$(QUIET)mv $(PDFDIR)/$(ICDINSTSPEC)-optimized.pdf $@
endif
# Clean generated and output files
clean: clean_html clean_pdf clean_generated
clean_html:
$(QUIET)$(RMRF) $(HTMLDIR) $(MANHTMLDIR) $(OUTDIR)/katex
clean_pdf:
$(QUIET)$(RMRF) $(PDFDIR) $(PDFMATHDIR)
clean_generated:
$(QUIET)$(RMRF) $(APIINCDIR)/* $(SCRIPTS)/clapi.py
$(QUIET)$(RM) man/apispec.txt $(MANGENSOURCES) $(MANTMP)
$(QUIET)$(RMRF) $(PDFMATHDIR)
# Ref page targets for individual pages
MANDIR := man
MANSECTION := 3
# These lists should be autogenerated
# Ref page sources for all CL interfaces
# Most are autogenerated; $(MANCOPYRIGHT) are static
# Static asciidoctor files in the man/ directory that aren't refpages
MANCOPYRIGHT = $(MANDIR)/copyright-ccby.txt $(MANDIR)/footer.txt
# MANSOURCES is the list of individual refpage sources, excluding the
# copyright, single-page index, and any include files.
MANSOURCES = $(filter-out $(MANCOPYRIGHT) $(MANDIR)/apispec.txt $(wildcard $(MANDIR)/*Inc.txt), $(wildcard $(MANDIR)/[A-Za-z]*.txt))
# MANGENSOURCES is the list of generated refpage sources, excluding the
# static index page but including the files copied from static/
MANGENSOURCES= $(filter-out $(MANDIR)/intro.txt, $(MANSOURCES))
# MANTMP are temp files created by the rules
MANTMP = $(LOGFILE) $(MANDIR)/tocbody $(MANDIR)/toc.html \
$(MANDIR)/rewritebody $(MANDIR)/.htaccess
# Generation of ref page asciidoctor sources by extraction from the
# specification(s).
#
# Should have a proper dependency causing the man page sources to be
# generated by running genRef.py (once), but adding $(MANSOURCES) to the
# targets causes genRef.py to run once/target.
#
# Should pass in $(EXTOPTIONS) to determine which pages to generate.
# For now, all core and extension ref pages are extracted by genRef.py.
LOGFILE = man/logfile
## Temporary - eventually should be all spec asciidoctor source files
SPECFILES = $(wildcard api/*.asciidoc) $(wildcard man/static/*.txt) OpenCL_API.txt OpenCL_C.txt
##SPECFILES = api/opencl_platform_layer.txt
SCRIPTS = scripts
GENREF = $(SCRIPTS)/genRef.py
man/apispec.txt: $(SPECFILES) $(GENREF) $(SCRIPTS)/reflib.py $(SCRIPTS)/clapi.py
$(PYTHON) $(GENREF) -rewrite man/rewritebody -toc man/tocbody \
-log $(LOGFILE) $(SPECFILES)
cat man/tochead man/tocbody man/toctail > man/toc.html
cat man/rewritehead > man/.htaccess
sort < man/rewritebody >> man/.htaccess
$(CP) -p $(MANDIR)/static/*.txt $(MANDIR)/
# These targets are HTML5 ref pages
#
# The recursive $(MAKE) is an apparently unavoidable hack, since the
# actual list of man page sources isn't known until after
# man/apispec.txt is generated. $(GENDEPENDS) is generated before
# running the recursive make, so it doesn't trigger twice
manhtmlpages: man/apispec.txt $(GENDEPENDS)
$(MAKE) -e buildmanpages
$(CP) $(MANDIR)/*.jpg $(MANDIR)/*.gif $(MANDIR)/*.css $(MANDIR)/*.html $(MANHTMLDIR)
$(CP) $(MANDIR)/.htaccess $(MANHTMLDIR)/.htaccess
MANHTMLDIR = $(OUTDIR)/man/html
MANHTML = $(MANSOURCES:$(MANDIR)/%.txt=$(MANHTMLDIR)/%.html)
buildmanpages: $(MANHTML)
$(MANHTMLDIR)/%.html: KATEXDIR = ../../katex
$(MANHTMLDIR)/%.html: $(MANDIR)/%.txt $(MANCOPYRIGHT) $(GENDEPENDS) katexinst
$(QUIET)$(MKDIR) $(MANHTMLDIR)
$(QUIET)$(ASCIIDOCTOR) -b html5 -a cross-file-links \
$(ADOCMANOPTS) $(ADOCHTMLOPTS) -o $@ $<
$(MANHTMLDIR)/intro.html: $(MANDIR)/intro.txt $(MANCOPYRIGHT)
$(QUIET)$(MKDIR) $(MANHTMLDIR)
$(QUIET)$(ASCIIDOCTOR) -b html5 -a cross-file-links \
$(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $<
# Targets generated from the XML and registry processing scripts
# clapi.py - Python encoding of the registry
# $(APIINCDIR)/timeMarker - proxy for 'apiinc' - generate API interfaces
#
# $(GENSCRIPTEXTRA) are extra options that can be passed to the
# generation script, such as
# '-diag diag'
REGISTRY = xml
APIXML = $(REGISTRY)/cl.xml
GENSCRIPT = $(SCRIPTS)/gencl.py
DICTSCRIPT = $(SCRIPTS)/gen_dictionaries.py
VERSIONSCRIPT = $(SCRIPTS)/gen_version_notes.py
GENSCRIPTOPTS = $(VERSIONOPTIONS) $(EXTOPTIONS) $(GENSCRIPTEXTRA) -registry $(APIXML)
GENSCRIPTEXTRA =
$(SCRIPTS)/clapi.py: $(APIXML) $(GENSCRIPT)
$(QUIET)$(PYTHON) $(GENSCRIPT) $(GENSCRIPTOPTS) -o $(SCRIPTS) clapi.py
apiinc: $(APIINCDIR)/timeMarker
$(APIINCDIR)/timeMarker: $(APIXML) $(DICTSCRIPT) $(GENSCRIPT) $(VERSIONSCRIPT)
$(QUIET)$(MKDIR) -p $(APIINCDIR)
$(QUIET)$(PYTHON) $(DICTSCRIPT) -registry $(APIXML) -o $(APIINCDIR)
$(QUIET)$(MKDIR) -p $(VERSIONDIR)
$(QUIET)$(PYTHON) $(VERSIONSCRIPT) -registry $(APIXML) -o $(VERSIONDIR)
$(QUIET)$(PYTHON) $(GENSCRIPT) $(GENSCRIPTOPTS) -o $(APIINCDIR) apiinc