xref: /aosp_15_r20/external/vulkan-headers/Makefile.release (revision 902771965e4c6d39c75c62130a6a330c08b024db)
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/cgenerator.py \
61    $(SPEC)/scripts/generator.py \
62    $(SPEC)/scripts/parse_dependency.py \
63    $(SPEC)/scripts/reg.py \
64    $(SPEC)/scripts/stripAPI.py \
65    $(SPEC)/scripts/apiconventions.py \
66    $(SPEC)/scripts/vkconventions.py \
67    $(SPEC)/xml/vk.xml \
68    $(SPEC)/xml/video.xml \
69    $(REGISTRY)/specs/1.3-extensions/validation/validusage.json
70
71# Scripts in registry/spec_tools to install
72SCRIPT_TOOLS = \
73    $(SPEC)/scripts/spec_tools/conventions.py \
74    $(SPEC)/scripts/spec_tools/util.py
75
76# Profiles to install
77PROFILES = \
78    $(wildcard $(SPEC)/xml/profiles/*)
79
80update-scripts:
81	cp $(SCRIPTS) registry/
82	cp $(PROFILES) registry/profiles/
83	cp $(SCRIPT_TOOLS) registry/spec_tools/
84
85# To ensure updates are caught, old versions of installed files are
86# removed.
87
88# Files in include/ to keep
89HEADERS_KEEP = \
90    include/vulkan/vk_icd.h \
91    include/vulkan/vk_layer.h
92
93remove-files:
94	rm -rf $(filter-out $(HEADERS_KEEP), $(wildcard include/vulkan/*))
95	rm -rf include/vk_video
96	rm -rf registry
97	mkdir include/vk_video registry registry/profiles registry/spec_tools
98
99# Once the branch is updated, push it to upstream
100# This does not actually push it for safety reasons
101push-branch:
102	@echo Verify that all new files are 'git add'ed and obsolete files removed, then:
103	@echo git commit -m \"Update for Vulkan-Docs 1.3.$(REVISION)\"
104	@echo git push --set-upstream origin $(BRANCH)
105	@echo git switch main
106
107version-check:
108	@if test $(REVISION) = 999 ; then echo "Must specify explicit REVISION= in make invocation" ; exit 1 ; fi
109