1# Copyright 2014-2023 The Khronos Group Inc.
2# SPDX-License-Identifier: Apache-2.0
3
4# Configure Vulkan spec Antora tree with generated files and transformed
5# markup files.
6# Branch selection will come later. For now it is the current branch.
7
8RMRF = rm -rf
9
10JSAPIMAP = ./gen/apimap.cjs
11XREFMAPS = $(PYXREFMAP) $(JSXREFMAP)
12PYXREFMAP = antora/xrefMap.py
13JSXREFMAP = antora/xrefMap.cjs
14JSPAGEMAP = antora/modules/ROOT/partials/gen/pageMap.cjs
15
16setup: setup_spec setup_proposals
17
18# Rewrite Vulkan spec sources and images into the module directory, ROOT
19# component
20# Page headers are added to pull in required attributes
21# Also creates apimap.cjs, pageMap.cjs, and xrefMap.cjs for use by the
22# Antora version of the spec macros. They are copied into the Antora
23# playbook repository prior to building the site.
24setup_spec: xrefmaps spec_pages
25
26# Generate the (anchor name -> [ chapter anchor, anchor title ]) maps
27# (xrefMap.py / xrefMap.cjs), and the API information (jsapi /
28# apimap.cjs) from spec HTML
29xrefmaps:
30	$(RMRF) gen
31	./makeSpec QUIET=@ -clean -spec all -genpath gen generated jsapi html
32	scripts/map_html_anchors.py gen/out/html/vkspec.html \
33	    -pyfile $(PYXREFMAP) -jsfile $(JSXREFMAP)
34
35# Rewrite spec sources
36# Individual files must be specified last
37spec_pages:
38	scripts/antora-prep.py \
39	    -root . \
40	    -component $(shell realpath antora/modules/ROOT) \
41	    -xrefpath antora \
42	    -pageHeaders antora/pageHeaders-spec.adoc \
43	    -pagemappath $(JSPAGEMAP) \
44	    ./config/attribs.adoc \
45	    ./config/copyright-ccby.adoc \
46	    ./config/copyright-spec.adoc \
47	    ./images/*.svg \
48	    `find ./gen ./chapters ./appendices -name '[A-Za-z]*.adoc' | grep -v /vulkanscdeviations.adoc` \
49	    $(JSAPIMAP)
50
51# Rewrite proposals into the module directory, 'proposals' component
52# No additional pageHeaders required.
53setup_proposals:
54	scripts/antora-prep.py \
55	    -root . \
56	    -component $(shell realpath antora/modules/proposals) \
57	    -xrefpath antora \
58	    ./images/tile_image.svg \
59	    `find ./proposals -name '[A-Za-z]*.adoc'`
60
61# Files generated by 'setup' target
62ANTORA_GENERATED = \
63	antora/modules/ROOT/images \
64	antora/modules/ROOT/pages/appendices \
65	antora/modules/ROOT/pages/chapters \
66	antora/modules/ROOT/pages/gen \
67	antora/modules/ROOT/partials \
68	antora/modules/proposals/pages/proposals \
69	antora/modules/proposals/partials \
70	antora/modules/proposals/images \
71	$(JSXREFMAP) \
72	$(PYXREFMAP)
73
74clean:
75	$(RMRF) $(ANTORA_GENERATED)
76