Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2018 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 | |
Yifan Hong | 3693fe4 | 2018-03-29 10:06:10 -0700 | [diff] [blame] | 17 | ##### Input Variables: |
| 18 | # LOCAL_MODULE: required. Module name for the build system. |
| 19 | # LOCAL_MODULE_CLASS: optional. Default is ETC. |
| 20 | # LOCAL_MODULE_PATH: optional. Path of output file. Default is $(TARGET_OUT)/etc/vintf. |
| 21 | # LOCAL_MODULE_STEM: optional. Name of output file. Default is $(LOCAL_MODULE). |
| 22 | # LOCAL_SRC_FILES: required. Local source files provided to assemble_vintf |
| 23 | # (command line argument -i). |
| 24 | # LOCAL_GENERATED_SOURCES: optional. Global source files provided to assemble_vintf |
| 25 | # (command line argument -i). |
| 26 | # |
| 27 | # LOCAL_ADD_VBMETA_VERSION: Use AVBTOOL to add avb version to the output matrix |
| 28 | # (corresponds to <avb><vbmeta-version> tag) |
| 29 | # LOCAL_ASSEMBLE_VINTF_ENV_VARS: Add a list of environment variable names from global variables in |
| 30 | # the build system that is lazily evaluated (e.g. PRODUCT_ENFORCE_VINTF_MANIFEST). |
| 31 | # LOCAL_ASSEMBLE_VINTF_ENV_VARS_OVERRIDE: Add a list of environment variables that is local to |
| 32 | # assemble_vintf invocation. Format is "VINTF_ENFORCE_NO_UNUSED_HALS=true". |
| 33 | # LOCAL_ASSEMBLE_VINTF_FLAGS: Add additional command line arguments to assemble_vintf invocation. |
Yifan Hong | a6a1e0b | 2018-04-25 14:36:00 -0700 | [diff] [blame] | 34 | # LOCAL_KERNEL_CONFIG_DATA_PATHS: Paths to search for kernel config requirements. Format for each is |
Steve Muckle | 914a897 | 2018-07-23 17:27:25 -0700 | [diff] [blame] | 35 | # <kernel version x.y.z>:<path that contains android-base*.config>. |
Yifan Hong | 3693fe4 | 2018-03-29 10:06:10 -0700 | [diff] [blame] | 36 | # LOCAL_GEN_FILE_DEPENDENCIES: A list of additional dependencies for the generated file. |
| 37 | |
Yifan Hong | 7831d43 | 2018-03-29 10:51:48 -0700 | [diff] [blame] | 38 | ifndef LOCAL_MODULE |
| 39 | $(error LOCAL_MODULE must be defined.) |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 40 | endif |
| 41 | |
Yifan Hong | 7831d43 | 2018-03-29 10:51:48 -0700 | [diff] [blame] | 42 | ifndef LOCAL_MODULE_STEM |
| 43 | LOCAL_MODULE_STEM := $(LOCAL_MODULE) |
Yifan Hong | fee9ea4 | 2018-03-23 12:03:33 -0700 | [diff] [blame] | 44 | endif |
| 45 | |
| 46 | ifndef LOCAL_MODULE_CLASS |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 47 | LOCAL_MODULE_CLASS := ETC |
Yifan Hong | fee9ea4 | 2018-03-23 12:03:33 -0700 | [diff] [blame] | 48 | endif |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 49 | |
| 50 | ifndef LOCAL_MODULE_PATH |
| 51 | LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/vintf |
| 52 | endif |
| 53 | |
| 54 | GEN := $(local-generated-sources-dir)/$(LOCAL_MODULE_STEM) |
| 55 | |
| 56 | $(GEN): PRIVATE_ENV_VARS := $(LOCAL_ASSEMBLE_VINTF_ENV_VARS) |
| 57 | $(GEN): PRIVATE_FLAGS := $(LOCAL_ASSEMBLE_VINTF_FLAGS) |
| 58 | |
| 59 | $(GEN): $(LOCAL_GEN_FILE_DEPENDENCIES) |
| 60 | |
| 61 | ifeq (true,$(strip $(LOCAL_ADD_VBMETA_VERSION))) |
| 62 | ifeq (true,$(BOARD_AVB_ENABLE)) |
| 63 | $(GEN): $(AVBTOOL) |
| 64 | # INTERNAL_AVB_SYSTEM_SIGNING_ARGS consists of BOARD_AVB_SYSTEM_KEY_PATH and |
| 65 | # BOARD_AVB_SYSTEM_ALGORITHM. We should add the dependency of key path, which |
| 66 | # is a file, here. |
| 67 | $(GEN): $(BOARD_AVB_SYSTEM_KEY_PATH) |
| 68 | # Use deferred assignment (=) instead of immediate assignment (:=). |
| 69 | # Otherwise, cannot get INTERNAL_AVB_SYSTEM_SIGNING_ARGS. |
| 70 | $(GEN): FRAMEWORK_VBMETA_VERSION = $$("$(AVBTOOL)" add_hashtree_footer \ |
| 71 | --print_required_libavb_version \ |
| 72 | $(INTERNAL_AVB_SYSTEM_SIGNING_ARGS) \ |
| 73 | $(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)) |
| 74 | else |
| 75 | $(GEN): FRAMEWORK_VBMETA_VERSION := 0.0 |
| 76 | endif # BOARD_AVB_ENABLE |
| 77 | $(GEN): PRIVATE_ENV_VARS += FRAMEWORK_VBMETA_VERSION |
| 78 | endif # LOCAL_ADD_VBMETA_VERSION |
| 79 | |
Yifan Hong | 53891ac | 2018-08-13 12:33:42 -0700 | [diff] [blame^] | 80 | ifeq (true,$(strip $(LOCAL_ADD_VBMETA_VERSION_OVERRIDE))) |
| 81 | ifneq ($(BOARD_OTA_FRAMEWORK_VBMETA_VERSION_OVERRIDE),) |
| 82 | $(GEN): FRAMEWORK_VBMETA_VERSION_OVERRIDE := $(BOARD_OTA_FRAMEWORK_VBMETA_VERSION_OVERRIDE) |
| 83 | $(GEN): PRIVATE_ENV_VARS += FRAMEWORK_VBMETA_VERSION_OVERRIDE |
| 84 | endif |
| 85 | endif |
| 86 | |
Yifan Hong | a6a1e0b | 2018-04-25 14:36:00 -0700 | [diff] [blame] | 87 | ifneq (,$(strip $(LOCAL_KERNEL_CONFIG_DATA_PATHS))) |
| 88 | $(GEN): PRIVATE_KERNEL_CONFIG_DATA_PATHS := $(LOCAL_KERNEL_CONFIG_DATA_PATHS) |
| 89 | $(GEN): $(foreach pair,$(PRIVATE_KERNEL_CONFIG_DATA_PATHS),\ |
Steve Muckle | 914a897 | 2018-07-23 17:27:25 -0700 | [diff] [blame] | 90 | $(wildcard $(call word-colon,2,$(pair))/android-base*.config)) |
Yifan Hong | a6a1e0b | 2018-04-25 14:36:00 -0700 | [diff] [blame] | 91 | $(GEN): PRIVATE_FLAGS += $(foreach pair,$(PRIVATE_KERNEL_CONFIG_DATA_PATHS),\ |
| 92 | --kernel=$(call word-colon,1,$(pair)):$(call normalize-path-list,\ |
Steve Muckle | 914a897 | 2018-07-23 17:27:25 -0700 | [diff] [blame] | 93 | $(wildcard $(call word-colon,2,$(pair))/android-base*.config))) |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 94 | endif |
| 95 | |
| 96 | my_matrix_src_files := \ |
| 97 | $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) \ |
| 98 | $(LOCAL_GENERATED_SOURCES) |
| 99 | |
Yifan Hong | 3693fe4 | 2018-03-29 10:06:10 -0700 | [diff] [blame] | 100 | $(GEN): PRIVATE_ADDITIONAL_ENV_VARS := $(LOCAL_ASSEMBLE_VINTF_ENV_VARS_OVERRIDE) |
| 101 | |
| 102 | ifneq (,$(strip $(LOCAL_ASSEMBLE_VINTF_ERROR_MESSAGE))) |
| 103 | $(GEN): PRIVATE_COMMAND_TAIL := || (echo $(strip $(LOCAL_ASSEMBLE_VINTF_ERROR_MESSAGE)) && false) |
Yifan Hong | fee9ea4 | 2018-03-23 12:03:33 -0700 | [diff] [blame] | 104 | endif |
| 105 | |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 106 | $(GEN): PRIVATE_SRC_FILES := $(my_matrix_src_files) |
| 107 | $(GEN): $(my_matrix_src_files) $(HOST_OUT_EXECUTABLES)/assemble_vintf |
Yifan Hong | 3693fe4 | 2018-03-29 10:06:10 -0700 | [diff] [blame] | 108 | $(foreach varname,$(PRIVATE_ENV_VARS),\ |
| 109 | $(if $(findstring $(varname),$(PRIVATE_ADDITIONAL_ENV_VARS)),\ |
| 110 | $(error $(varname) should not be overridden by LOCAL_ASSEMBLE_VINTF_ENV_VARS_OVERRIDE.))) |
Yifan Hong | b426af3 | 2018-02-02 12:47:48 -0800 | [diff] [blame] | 111 | $(foreach varname,$(PRIVATE_ENV_VARS),$(varname)="$($(varname))") \ |
Yifan Hong | fee9ea4 | 2018-03-23 12:03:33 -0700 | [diff] [blame] | 112 | $(PRIVATE_ADDITIONAL_ENV_VARS) \ |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 113 | $(HOST_OUT_EXECUTABLES)/assemble_vintf \ |
| 114 | -i $(call normalize-path-list,$(PRIVATE_SRC_FILES)) \ |
| 115 | -o $@ \ |
Yifan Hong | fee9ea4 | 2018-03-23 12:03:33 -0700 | [diff] [blame] | 116 | $(PRIVATE_FLAGS) $(PRIVATE_COMMAND_TAIL) |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 117 | |
| 118 | LOCAL_PREBUILT_MODULE_FILE := $(GEN) |
| 119 | LOCAL_SRC_FILES := |
| 120 | LOCAL_GENERATED_SOURCES := |
| 121 | |
Yifan Hong | a6a1e0b | 2018-04-25 14:36:00 -0700 | [diff] [blame] | 122 | include $(LOCAL_PATH)/clear_vars.mk |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 123 | my_matrix_src_files := |
| 124 | |
| 125 | include $(BUILD_PREBUILT) |