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