• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2#
3# Copyright (c) 2016-2018 The Khronos Group Inc.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# makeBranch - invoke Makefile with the right options to build with a
18# specific extension or extensions included. The extension currently
19# must be a single argument, but that argument may contain a quoted,
20# space-separated list of extension names.
21#
22# Dependencies on other extensions are automatically added. This
23# script requires features introduced in bash 4.0.
24#
25# Usage: makeBranch extension targets
26
27# Load extension dependencies, generated from vk.xml
28make config/extDependency.sh || exit
29source config/extDependency.sh
30
31extension=$1
32shift
33echo extension is $extension targets are $*
34
35# Determine the set of required extensions based on requested extensions
36declare -A required
37
38# Allow multiple extension names in a single argument
39for name in $extension ; do
40    # Add to the required list
41    required[$name]=1
42    # If it has dependencies, add all of them to the required list
43    if [ ${extensions[$name]+_} ] ; then
44        deps=${extensions[$name]}
45        for dep in $deps ; do
46            required[$dep]=1
47        done
48    fi
49done
50
51# There have been requests for this to be optional.
52make clean_generated
53
54# Something weird in bash quoting requires this two-step process to define
55# EXTENSIONS to make.
56args="${!required[@]}"
57make EXTENSIONS="$args" APITITLE="(with extension $extension)" $*
58