1# Copyright 2024 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 8SHELL = /bin/bash 9 10REVISION = 999 11 12# Location of other repository clones 13GIT = .. 14SPEC = $(GIT)/Vulkan-Docs 15HPP = $(GIT)/Vulkan-Hpp 16REGISTRY = $(GIT)/registry/vulkan 17 18update: version-check create-branch update-files push-branch 19 20# Working branch for the update, and a test if it exists 21BRANCH = update-$(REVISION) 22 23# Switch to new branch which will contain the update 24create-branch: version-check 25 git switch -q main 26 git pull -q 27 # If branch already exists, do nothing 28 @if test `git branch -l $(BRANCH) | wc -l` == 1 ; then \ 29 echo "Branch $(BRANCH) already exists" ; \ 30 git switch $(BRANCH) ; \ 31 else \ 32 echo "Creating branch $(BRANCH)" ; \ 33 git switch -c $(BRANCH) ; \ 34 fi 35 36# Update headers and scripts in the new branch 37update-files: remove-files update-headers update-scripts 38 39# Vulkan SC Vulkan-Hpp headers not published in the Vulkan-Headers repository 40SCHPPFILES = \ 41 include/vulkan/vulkansc.hpp \ 42 include/vulkan/vulkansc.cppm \ 43 include/vulkan/vulkansc_*.hpp 44 45update-headers: 46 if test ! -d $(SPEC)/gen/include/ ; then \ 47 echo "No C header file source directory $(SPEC)/gen/include" ; \ 48 exit 1 ; \ 49 fi 50 if test ! -d $(HPP)/vulkan ; then \ 51 echo "No C++ header file source directory $(HPP)/vulkan" ; \ 52 exit 1 ; \ 53 fi 54 cp -r $(SPEC)/gen/include/* include/ 55 cp -r $(HPP)/vulkan/* include/vulkan/ 56 rm -f $(SCHPPFILES) 57 58# Top-level scripts / XML to install 59SCRIPTS = \ 60 $(SPEC)/scripts/base_generator.py \ 61 $(SPEC)/scripts/cgenerator.py \ 62 $(SPEC)/scripts/generator.py \ 63 $(SPEC)/scripts/parse_dependency.py \ 64 $(SPEC)/scripts/reg.py \ 65 $(SPEC)/scripts/stripAPI.py \ 66 $(SPEC)/scripts/apiconventions.py \ 67 $(SPEC)/scripts/vkconventions.py \ 68 $(SPEC)/scripts/vulkan_object.py \ 69 $(SPEC)/xml/vk.xml \ 70 $(SPEC)/xml/video.xml \ 71 $(REGISTRY)/specs/latest/validation/validusage.json 72 73# Scripts in registry/spec_tools to install 74SCRIPT_TOOLS = \ 75 $(SPEC)/scripts/spec_tools/conventions.py \ 76 $(SPEC)/scripts/spec_tools/util.py 77 78# Profiles to install 79PROFILES = \ 80 $(wildcard $(SPEC)/xml/profiles/*) 81 82update-scripts: 83 cp $(SCRIPTS) registry/ 84 cp $(PROFILES) registry/profiles/ 85 cp $(SCRIPT_TOOLS) registry/spec_tools/ 86 87# To ensure updates are caught, old versions of installed files are 88# removed. 89 90# Files in include/ to keep 91HEADERS_KEEP = \ 92 include/vulkan/vk_icd.h \ 93 include/vulkan/vk_layer.h 94 95remove-files: 96 rm -rf $(filter-out $(HEADERS_KEEP), $(wildcard include/vulkan/*)) 97 rm -rf include/vk_video 98 rm -rf registry 99 mkdir include/vk_video registry registry/profiles registry/spec_tools 100 101# Once the branch is updated, push it to upstream 102# This does not actually push it for safety reasons 103push-branch: 104 @echo Verify that all new files are 'git add'ed and obsolete files removed, then: 105 @echo git commit -m \"Update for Vulkan-Docs 1.3.$(REVISION)\" 106 @echo git push --set-upstream origin $(BRANCH) 107 @echo git switch main 108 109version-check: 110 @if test $(REVISION) = 999 ; then echo "Must specify explicit REVISION= in make invocation" ; exit 1 ; fi 111