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. |
Yifan Hong | fee037a | 2019-01-22 14:27:50 -0800 | [diff] [blame] | 20 | # LOCAL_MODULE_PATH / LOCAL_MODULE_RELATIVE_PATH: required. (Relative) path of output file. |
| 21 | # If not defined, LOCAL_MODULE_RELATIVE_PATH will be "vintf". |
Yifan Hong | 3693fe4 | 2018-03-29 10:06:10 -0700 | [diff] [blame] | 22 | # LOCAL_MODULE_STEM: optional. Name of output file. Default is $(LOCAL_MODULE). |
| 23 | # LOCAL_SRC_FILES: required. Local source files provided to assemble_vintf |
| 24 | # (command line argument -i). |
| 25 | # LOCAL_GENERATED_SOURCES: optional. Global source files provided to assemble_vintf |
| 26 | # (command line argument -i). |
| 27 | # |
| 28 | # LOCAL_ADD_VBMETA_VERSION: Use AVBTOOL to add avb version to the output matrix |
| 29 | # (corresponds to <avb><vbmeta-version> tag) |
| 30 | # LOCAL_ASSEMBLE_VINTF_ENV_VARS: Add a list of environment variable names from global variables in |
| 31 | # the build system that is lazily evaluated (e.g. PRODUCT_ENFORCE_VINTF_MANIFEST). |
Yifan Hong | 3693fe4 | 2018-03-29 10:06:10 -0700 | [diff] [blame] | 32 | # LOCAL_ASSEMBLE_VINTF_FLAGS: Add additional command line arguments to assemble_vintf invocation. |
Yifan Hong | 3693fe4 | 2018-03-29 10:06:10 -0700 | [diff] [blame] | 33 | # LOCAL_GEN_FILE_DEPENDENCIES: A list of additional dependencies for the generated file. |
| 34 | |
Yifan Hong | 7831d43 | 2018-03-29 10:51:48 -0700 | [diff] [blame] | 35 | ifndef LOCAL_MODULE |
| 36 | $(error LOCAL_MODULE must be defined.) |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 37 | endif |
| 38 | |
Yifan Hong | 7831d43 | 2018-03-29 10:51:48 -0700 | [diff] [blame] | 39 | ifndef LOCAL_MODULE_STEM |
| 40 | LOCAL_MODULE_STEM := $(LOCAL_MODULE) |
Yifan Hong | fee9ea4 | 2018-03-23 12:03:33 -0700 | [diff] [blame] | 41 | endif |
| 42 | |
| 43 | ifndef LOCAL_MODULE_CLASS |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 44 | LOCAL_MODULE_CLASS := ETC |
Yifan Hong | fee9ea4 | 2018-03-23 12:03:33 -0700 | [diff] [blame] | 45 | endif |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 46 | |
| 47 | ifndef LOCAL_MODULE_PATH |
Yifan Hong | fee037a | 2019-01-22 14:27:50 -0800 | [diff] [blame] | 48 | ifndef LOCAL_MODULE_RELATIVE_PATH |
| 49 | $(error Either LOCAL_MODULE_PATH or LOCAL_MODULE_RELATIVE_PATH must be defined.) |
| 50 | endif |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 51 | endif |
| 52 | |
| 53 | GEN := $(local-generated-sources-dir)/$(LOCAL_MODULE_STEM) |
| 54 | |
| 55 | $(GEN): PRIVATE_ENV_VARS := $(LOCAL_ASSEMBLE_VINTF_ENV_VARS) |
| 56 | $(GEN): PRIVATE_FLAGS := $(LOCAL_ASSEMBLE_VINTF_FLAGS) |
| 57 | |
| 58 | $(GEN): $(LOCAL_GEN_FILE_DEPENDENCIES) |
| 59 | |
| 60 | ifeq (true,$(strip $(LOCAL_ADD_VBMETA_VERSION))) |
| 61 | ifeq (true,$(BOARD_AVB_ENABLE)) |
| 62 | $(GEN): $(AVBTOOL) |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 63 | $(GEN): $(BOARD_AVB_SYSTEM_KEY_PATH) |
| 64 | # Use deferred assignment (=) instead of immediate assignment (:=). |
| 65 | # Otherwise, cannot get INTERNAL_AVB_SYSTEM_SIGNING_ARGS. |
| 66 | $(GEN): FRAMEWORK_VBMETA_VERSION = $$("$(AVBTOOL)" add_hashtree_footer \ |
| 67 | --print_required_libavb_version \ |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 68 | $(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)) |
| 69 | else |
| 70 | $(GEN): FRAMEWORK_VBMETA_VERSION := 0.0 |
| 71 | endif # BOARD_AVB_ENABLE |
| 72 | $(GEN): PRIVATE_ENV_VARS += FRAMEWORK_VBMETA_VERSION |
| 73 | endif # LOCAL_ADD_VBMETA_VERSION |
| 74 | |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 75 | my_matrix_src_files := \ |
| 76 | $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) \ |
| 77 | $(LOCAL_GENERATED_SOURCES) |
| 78 | |
| 79 | $(GEN): PRIVATE_SRC_FILES := $(my_matrix_src_files) |
| 80 | $(GEN): $(my_matrix_src_files) $(HOST_OUT_EXECUTABLES)/assemble_vintf |
Yifan Hong | b426af3 | 2018-02-02 12:47:48 -0800 | [diff] [blame] | 81 | $(foreach varname,$(PRIVATE_ENV_VARS),$(varname)="$($(varname))") \ |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 82 | $(HOST_OUT_EXECUTABLES)/assemble_vintf \ |
| 83 | -i $(call normalize-path-list,$(PRIVATE_SRC_FILES)) \ |
| 84 | -o $@ \ |
Wei Li | fd11739 | 2024-08-08 20:38:59 -0700 | [diff] [blame^] | 85 | $(PRIVATE_FLAGS) |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 86 | |
| 87 | LOCAL_PREBUILT_MODULE_FILE := $(GEN) |
| 88 | LOCAL_SRC_FILES := |
| 89 | LOCAL_GENERATED_SOURCES := |
| 90 | |
Yifan Hong | a6a1e0b | 2018-04-25 14:36:00 -0700 | [diff] [blame] | 91 | include $(LOCAL_PATH)/clear_vars.mk |
Yifan Hong | 44c9b2e | 2018-01-23 14:34:41 -0800 | [diff] [blame] | 92 | my_matrix_src_files := |
| 93 | |
| 94 | include $(BUILD_PREBUILT) |