1#
2# Copyright (C) 2017 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19BUILD_FRAMEWORK_COMPATIBILITY_MATRIX := $(LOCAL_PATH)/compatibility_matrix.mk
20my_empty_manifest := $(LOCAL_PATH)/manifest.empty.xml
21
22# System Compatibility Matrix (common to all FCM versions)
23
24include $(CLEAR_VARS)
25include $(LOCAL_PATH)/clear_vars.mk
26LOCAL_MODULE := framework_compatibility_matrix.device.xml
27LOCAL_MODULE_STEM := compatibility_matrix.device.xml
28# define LOCAL_MODULE_CLASS for local-generated-sources-dir.
29LOCAL_MODULE_CLASS := ETC
30LOCAL_MODULE_RELATIVE_PATH := vintf
31
32ifndef DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
33LOCAL_SRC_FILES := compatibility_matrix.empty.xml
34else
35
36# DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE specify an absolute path
37LOCAL_GENERATED_SOURCES := $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE)
38
39# Enforce that DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE does not specify required HALs
40# by checking it against an empty manifest. But the empty manifest needs to contain
41# BOARD_SEPOLICY_VERS to be compatible with DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE.
42my_gen_check_manifest := $(local-generated-sources-dir)/manifest.check.xml
43$(my_gen_check_manifest): PRIVATE_SRC_FILE := $(my_empty_manifest)
44$(my_gen_check_manifest): $(my_empty_manifest) $(HOST_OUT_EXECUTABLES)/assemble_vintf
45	BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \
46	VINTF_IGNORE_TARGET_FCM_VERSION=true \
47		$(HOST_OUT_EXECUTABLES)/assemble_vintf -i $(PRIVATE_SRC_FILE) -o $@
48
49LOCAL_GEN_FILE_DEPENDENCIES += $(my_gen_check_manifest)
50LOCAL_ASSEMBLE_VINTF_FLAGS += -c "$(my_gen_check_manifest)"
51
52my_gen_check_manifest :=
53
54endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
55
56LOCAL_ADD_VBMETA_VERSION := true
57LOCAL_ASSEMBLE_VINTF_ENV_VARS := \
58    POLICYVERS \
59    PLATFORM_SEPOLICY_VERSION \
60    PLATFORM_SEPOLICY_COMPAT_VERSIONS
61
62include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
63
64# Product Compatibility Matrix
65
66include $(CLEAR_VARS)
67include $(LOCAL_PATH)/clear_vars.mk
68LOCAL_MODULE := product_compatibility_matrix.xml
69
70ifndef DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
71my_framework_matrix_deps :=
72include $(BUILD_PHONY_PACKAGE)
73else # DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
74
75LOCAL_MODULE_STEM := compatibility_matrix.xml
76LOCAL_PRODUCT_MODULE := true
77LOCAL_MODULE_CLASS := ETC
78LOCAL_MODULE_RELATIVE_PATH := vintf
79
80# DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE specify an absolute path
81LOCAL_GENERATED_SOURCES := $(DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE)
82
83# Enforce that DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE does not specify required HALs
84# by checking it against an empty manifest.
85LOCAL_GEN_FILE_DEPENDENCIES += $(my_empty_manifest)
86LOCAL_ASSEMBLE_VINTF_FLAGS += -c "$(my_empty_manifest)"
87
88my_framework_matrix_deps := $(LOCAL_MODULE)
89
90include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX)
91
92endif # DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
93
94my_system_matrix_deps := \
95    framework_compatibility_matrix.legacy.xml \
96    framework_compatibility_matrix.1.xml \
97    framework_compatibility_matrix.2.xml \
98    framework_compatibility_matrix.3.xml \
99    framework_compatibility_matrix.4.xml \
100    framework_compatibility_matrix.5.xml \
101    framework_compatibility_matrix.device.xml \
102
103my_framework_matrix_deps += \
104    $(my_system_matrix_deps)
105
106# Phony target that installs all system compatibility matrix files
107include $(CLEAR_VARS)
108LOCAL_MODULE := system_compatibility_matrix.xml
109LOCAL_REQUIRED_MODULES := $(my_system_matrix_deps)
110include $(BUILD_PHONY_PACKAGE)
111
112# Phony target that installs all framework compatibility matrix files (system + product)
113include $(CLEAR_VARS)
114LOCAL_MODULE := framework_compatibility_matrix.xml
115LOCAL_REQUIRED_MODULES := $(my_framework_matrix_deps)
116include $(BUILD_PHONY_PACKAGE)
117
118my_system_matrix_deps :=
119my_framework_matrix_deps :=
120my_empty_manifest :=
121BUILD_FRAMEWORK_COMPATIBILITY_MATRIX :=
122