| 1 |
# Copyright 2024-2025 The Khronos Group Inc. |
| 2 |
# SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
# Makefile.release - update external files generated in Vulkan spec |
| 5 |
# repository when a public specification update is done. |
| 6 |
|
| 7 |
# Needed to get the right version of test, apparently |
| 8 |
SHELL = /bin/bash |
| 9 |
|
| 10 |
REVISION = 999 |
| 11 |
|
| 12 |
# Location of other repository clones |
| 13 |
GIT = .. |
| 14 |
SPEC = $(GIT)/Vulkan-Docs |
| 15 |
# As of 1.4.322 spec update, the build process has been changed to use a |
| 16 |
# Vulkan-Hpp located underneath Vulkan-Docs (not a submodule). |
| 17 |
# If you are using one located elsewhere then override HPP. |
| 18 |
HPP = $(SPEC)/Vulkan-Hpp |
| 19 |
REGISTRY = $(GIT)/registry/vulkan |
| 20 |
|
| 21 |
update: revision-check create-branch update-files push-branch |
| 22 |
|
| 23 |
# Working branch for the update, and a test if it exists |
| 24 |
BRANCH = update-$(REVISION) |
| 25 |
|
| 26 |
# Switch to new branch which will contain the update |
| 27 |
create-branch: revision-check |
| 28 |
git switch -q main |
| 29 |
git pull -q |
| 30 |
# If branch already exists, do nothing |
| 31 |
@if test `git branch -l $(BRANCH) | wc -l` == 1 ; then \ |
| 32 |
echo "Branch $(BRANCH) already exists" ; \ |
| 33 |
git switch $(BRANCH) ; \ |
| 34 |
else \ |
| 35 |
echo "Creating branch $(BRANCH)" ; \ |
| 36 |
git switch -c $(BRANCH) ; \ |
| 37 |
fi |
| 38 |
|
| 39 |
# Update headers and scripts in the new branch |
| 40 |
update-files: remove-files update-headers update-scripts |
| 41 |
|
| 42 |
# To ensure updates are caught, old versions of installed files are |
| 43 |
# removed. |
| 44 |
# Files in include/ to keep |
| 45 |
HEADERS_KEEP = \ |
| 46 |
include/vulkan/vk_icd.h \ |
| 47 |
include/vulkan/vk_layer.h |
| 48 |
|
| 49 |
remove-files: |
| 50 |
rm -rf $(filter-out $(HEADERS_KEEP), $(wildcard include/vulkan/*)) |
| 51 |
rm -rf include/vk_video |
| 52 |
rm -rf registry |
| 53 |
mkdir include/vk_video registry registry/profiles registry/spec_tools |
| 54 |
|
| 55 |
# Vulkan SC Vulkan-Hpp headers not published in the Vulkan-Headers repository |
| 56 |
SCHPPFILES = \ |
| 57 |
include/vulkan/vulkansc.hpp \ |
| 58 |
include/vulkan/vulkansc.cppm \ |
| 59 |
include/vulkan/vulkansc_*.hpp |
| 60 |
|
| 61 |
update-headers: |
| 62 |
if test ! -d $(SPEC)/gen/include/ ; then \ |
| 63 |
echo "No C header file source directory $(SPEC)/gen/include" ; \ |
| 64 |
exit 1 ; \ |
| 65 |
fi |
| 66 |
if test ! -d $(HPP)/vulkan ; then \ |
| 67 |
echo "No C++ header file source directory $(HPP)/vulkan" ; \ |
| 68 |
exit 1 ; \ |
| 69 |
fi |
| 70 |
cp -r $(SPEC)/gen/include/* include/ |
| 71 |
cp -r $(HPP)/vulkan/* include/vulkan/ |
| 72 |
rm -f $(SCHPPFILES) |
| 73 |
|
| 74 |
# Top-level scripts / XML to install |
| 75 |
SCRIPTS = \ |
| 76 |
$(SPEC)/scripts/base_generator.py \ |
| 77 |
$(SPEC)/scripts/cgenerator.py \ |
| 78 |
$(SPEC)/scripts/generator.py \ |
| 79 |
$(SPEC)/scripts/parse_dependency.py \ |
| 80 |
$(SPEC)/scripts/reg.py \ |
| 81 |
$(SPEC)/scripts/stripAPI.py \ |
| 82 |
$(SPEC)/scripts/apiconventions.py \ |
| 83 |
$(SPEC)/scripts/vkconventions.py \ |
| 84 |
$(SPEC)/scripts/vulkan_object.py \ |
| 85 |
$(SPEC)/xml/vk.xml \ |
| 86 |
$(SPEC)/xml/video.xml \ |
| 87 |
$(REGISTRY)/specs/latest/validation/validusage.json |
| 88 |
|
| 89 |
# Scripts in registry/spec_tools to install |
| 90 |
SCRIPT_TOOLS = \ |
| 91 |
$(SPEC)/scripts/spec_tools/conventions.py \ |
| 92 |
$(SPEC)/scripts/spec_tools/util.py |
| 93 |
|
| 94 |
# Profiles to install |
| 95 |
PROFILES = \ |
| 96 |
$(wildcard $(SPEC)/xml/profiles/*) |
| 97 |
|
| 98 |
update-scripts: |
| 99 |
cp $(SCRIPTS) registry/ |
| 100 |
cp $(PROFILES) registry/profiles/ |
| 101 |
cp $(SCRIPT_TOOLS) registry/spec_tools/ |
| 102 |
|
| 103 |
# Once the branch is updated, push it to upstream and create an MR |
| 104 |
# This should be used cautiously after verifying the branch contents are |
| 105 |
# indeed correct and updates. |
| 106 |
# |
| 107 |
# Ideally we could automatically create the github PR. |
| 108 |
# This will require additional software, see e.g. |
| 109 |
# https://medium.com/@ravipatel.it/creating-a-git-pull-request-using-the-command-line-a-detailed-guide-4ef1ea017fe2 |
| 110 |
# https://gist.github.com/devinschumacher/bc66c162d9c6c167952f1943d0e6419c |
| 111 |
# Gitlab supports this via 'git push' options e.g. |
| 112 |
# -o merge_request.create -o merge_request.target=main -o merge_request.remove_source_branch \ |
| 113 |
# -o merge_request.title="Update for Vulkan-Docs 1.4.$(REVISION)" \ |
| 114 |
# -o merge_request.assign=oddhack |
| 115 |
# But for github we must manually create a PR after pushing |
| 116 |
push-branch: revision-check |
| 117 |
git switch $(BRANCH) |
| 118 |
git add -u |
| 119 |
echo "Detect new files and add them. This may not always succeed." |
| 120 |
echo "Adding new files:" `git diff --name-only main` |
| 121 |
git add `git diff --name-only main` |
| 122 |
git commit -m "Update for Vulkan-Docs 1.4.$(REVISION)" |
| 123 |
git push --set-upstream origin $(BRANCH) |
| 124 |
git switch main |
| 125 |
git branch -d $(BRANCH) |
| 126 |
echo "Now create a pull request by going to the URL:" |
| 127 |
echo " https://github.com/KhronosGroup/Vulkan-Headers/pull/new/$(BRANCH)" |
| 128 |
echo "After accepting this PR, continue with:" |
| 129 |
echo " cd $(shell pwd) && make -f Makefile.release REVISION=$(REVISION) tag-branch" |
| 130 |
|
| 131 |
# Tag main for the update after accepting the update PR |
| 132 |
TAG = v1.4.$(REVISION) |
| 133 |
tag-branch: |
| 134 |
git switch main |
| 135 |
git pull |
| 136 |
git tag -a $(TAG) -m "Update for Vulkan-Docs 1.4.$(REVISION)" |
| 137 |
git push origin $(TAG) |
| 138 |
echo "Now continue with Step 12 of the process (update public registry) from the wiki, until more scripting is done" |
| 139 |
|
| 140 |
revision-check: |
| 141 |
@if test $(REVISION) = 999 ; then echo "Must specify explicit REVISION= in make invocation" ; exit 1 ; fi |