1#
2# Set up product-global definitions and include product-specific rules.
3#
4
5LOCAL_PATH := $(call my-dir)
6
7-include $(TARGET_DEVICE_DIR)/AndroidBoard.mk
8
9# Generate a file that contains various information about the
10# device we're building for.  This file is typically packaged up
11# with everything else.
12#
13# If TARGET_BOARD_INFO_FILE (which can be set in BoardConfig.mk) is
14# defined, it is used, otherwise board-info.txt is looked for in
15# $(TARGET_DEVICE_DIR).
16#
17INSTALLED_ANDROID_INFO_TXT_TARGET := $(PRODUCT_OUT)/android-info.txt
18board_info_txt := $(TARGET_BOARD_INFO_FILE)
19ifndef board_info_txt
20board_info_txt := $(wildcard $(TARGET_DEVICE_DIR)/board-info.txt)
21endif
22$(INSTALLED_ANDROID_INFO_TXT_TARGET): $(board_info_txt) build/make/tools/check_radio_versions.py
23	$(hide) build/make/tools/check_radio_versions.py $< $(BOARD_INFO_CHECK)
24	$(call pretty,"Generated: ($@)")
25ifdef board_info_txt
26	$(hide) grep -v '#' $< > $@
27else
28	$(hide) echo "board=$(TARGET_BOOTLOADER_BOARD_NAME)" > $@
29endif
30
31# Copy compatibility metadata to the device.
32
33# Device Manifest
34ifdef DEVICE_MANIFEST_FILE
35# $(DEVICE_MANIFEST_FILE) can be a list of files
36include $(CLEAR_VARS)
37LOCAL_MODULE        := vendor_manifest.xml
38LOCAL_MODULE_STEM   := manifest.xml
39LOCAL_MODULE_CLASS  := ETC
40LOCAL_MODULE_PATH   := $(TARGET_OUT_VENDOR)/etc/vintf
41
42GEN := $(local-generated-sources-dir)/manifest.xml
43$(GEN): PRIVATE_DEVICE_MANIFEST_FILE := $(DEVICE_MANIFEST_FILE)
44$(GEN): $(DEVICE_MANIFEST_FILE) $(HOST_OUT_EXECUTABLES)/assemble_vintf
45	BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \
46	PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
47	PRODUCT_SHIPPING_API_LEVEL=$(PRODUCT_SHIPPING_API_LEVEL) \
48	$(HOST_OUT_EXECUTABLES)/assemble_vintf -o $@ \
49		-i $(call normalize-path-list,$(PRIVATE_DEVICE_MANIFEST_FILE))
50
51LOCAL_PREBUILT_MODULE_FILE := $(GEN)
52include $(BUILD_PREBUILT)
53endif
54
55# DEVICE_MANIFEST_SKUS: a list of SKUS where DEVICE_MANIFEST_<sku>_FILES is defined.
56ifdef DEVICE_MANIFEST_SKUS
57
58# Install /vendor/etc/vintf/manifest_$(sku).xml
59# $(1): sku
60define _add_device_sku_manifest
61my_fragment_files_var := DEVICE_MANIFEST_$$(call to-upper,$(1))_FILES
62ifndef $$(my_fragment_files_var)
63$$(error $(1) is in DEVICE_MANIFEST_SKUS but $$(my_fragment_files_var) is not defined)
64endif
65my_fragment_files := $$($$(my_fragment_files_var))
66include $$(CLEAR_VARS)
67LOCAL_MODULE := vendor_manifest_$(1).xml
68LOCAL_MODULE_STEM := manifest_$(1).xml
69LOCAL_MODULE_CLASS := ETC
70LOCAL_MODULE_PATH   := $(TARGET_OUT_VENDOR)/etc/vintf
71
72GEN := $$(local-generated-sources-dir)/manifest_$(1).xml
73$$(GEN): PRIVATE_SRC_FILES := $$(my_fragment_files)
74$$(GEN): $$(my_fragment_files) $$(HOST_OUT_EXECUTABLES)/assemble_vintf
75	BOARD_SEPOLICY_VERS=$$(BOARD_SEPOLICY_VERS) \
76	PRODUCT_ENFORCE_VINTF_MANIFEST=$$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
77	PRODUCT_SHIPPING_API_LEVEL=$$(PRODUCT_SHIPPING_API_LEVEL) \
78	$$(HOST_OUT_EXECUTABLES)/assemble_vintf -o $$@ \
79		-i $$(call normalize-path-list,$$(PRIVATE_SRC_FILES))
80
81LOCAL_PREBUILT_MODULE_FILE := $$(GEN)
82include $$(BUILD_PREBUILT)
83my_fragment_files_var :=
84my_fragment_files :=
85endef
86
87$(foreach sku, $(DEVICE_MANIFEST_SKUS), $(eval $(call _add_device_sku_manifest,$(sku))))
88_add_device_sku_manifest :=
89
90endif # DEVICE_MANIFEST_SKUS
91
92# ODM manifest
93ifdef ODM_MANIFEST_FILES
94# ODM_MANIFEST_FILES is a list of files that is combined and installed as the default ODM manifest.
95include $(CLEAR_VARS)
96LOCAL_MODULE := odm_manifest.xml
97LOCAL_MODULE_STEM := manifest.xml
98LOCAL_MODULE_CLASS := ETC
99LOCAL_MODULE_RELATIVE_PATH := vintf
100LOCAL_ODM_MODULE := true
101
102GEN := $(local-generated-sources-dir)/manifest.xml
103$(GEN): PRIVATE_SRC_FILES := $(ODM_MANIFEST_FILES)
104$(GEN): $(ODM_MANIFEST_FILES) $(HOST_OUT_EXECUTABLES)/assemble_vintf
105	# Set VINTF_IGNORE_TARGET_FCM_VERSION to true because it should only be in device manifest.
106	VINTF_IGNORE_TARGET_FCM_VERSION=true \
107	$(HOST_OUT_EXECUTABLES)/assemble_vintf -o $@ \
108		-i $(call normalize-path-list,$(PRIVATE_SRC_FILES))
109
110LOCAL_PREBUILT_MODULE_FILE := $(GEN)
111include $(BUILD_PREBUILT)
112endif # ODM_MANIFEST_FILES
113
114# ODM_MANIFEST_SKUS: a list of SKUS where ODM_MANIFEST_<sku>_FILES are defined.
115ifdef ODM_MANIFEST_SKUS
116
117# Install /odm/etc/vintf/manifest_$(sku).xml
118# $(1): sku
119define _add_odm_sku_manifest
120my_fragment_files_var := ODM_MANIFEST_$$(call to-upper,$(1))_FILES
121ifndef $$(my_fragment_files_var)
122$$(error $(1) is in ODM_MANIFEST_SKUS but $$(my_fragment_files_var) is not defined)
123endif
124my_fragment_files := $$($$(my_fragment_files_var))
125include $$(CLEAR_VARS)
126LOCAL_MODULE := odm_manifest_$(1).xml
127LOCAL_MODULE_STEM := manifest_$(1).xml
128LOCAL_MODULE_CLASS := ETC
129LOCAL_MODULE_RELATIVE_PATH := vintf
130LOCAL_ODM_MODULE := true
131GEN := $$(local-generated-sources-dir)/manifest_$(1).xml
132$$(GEN): PRIVATE_SRC_FILES := $$(my_fragment_files)
133$$(GEN): $$(my_fragment_files) $$(HOST_OUT_EXECUTABLES)/assemble_vintf
134	VINTF_IGNORE_TARGET_FCM_VERSION=true \
135	$$(HOST_OUT_EXECUTABLES)/assemble_vintf -o $$@ \
136		-i $$(call normalize-path-list,$$(PRIVATE_SRC_FILES))
137LOCAL_PREBUILT_MODULE_FILE := $$(GEN)
138include $$(BUILD_PREBUILT)
139my_fragment_files_var :=
140my_fragment_files :=
141endef
142
143$(foreach sku, $(ODM_MANIFEST_SKUS), $(eval $(call _add_odm_sku_manifest,$(sku))))
144_add_odm_sku_manifest :=
145
146endif # ODM_MANIFEST_SKUS
147