1SOONG_MAKEVARS_MK := $(SOONG_OUT_DIR)/make_vars-$(TARGET_PRODUCT).mk
2SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables
3SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android-$(TARGET_PRODUCT).mk
4
5BINDER32BIT :=
6ifneq ($(TARGET_USES_64_BIT_BINDER),true)
7ifneq ($(TARGET_IS_64_BIT),true)
8BINDER32BIT := true
9endif
10endif
11
12include $(BUILD_SYSTEM)/dex_preopt_config.mk
13
14ifeq ($(WRITE_SOONG_VARIABLES),true)
15
16# Create soong.variables with copies of makefile settings.  Runs every build,
17# but only updates soong.variables if it changes
18$(shell mkdir -p $(dir $(SOONG_VARIABLES)))
19$(call json_start)
20
21$(call add_json_str,  Make_suffix, -$(TARGET_PRODUCT))
22
23$(call add_json_str,  BuildId,                           $(BUILD_ID))
24$(call add_json_str,  BuildNumberFile,                   build_number.txt)
25
26$(call add_json_str,  Platform_version_name,             $(PLATFORM_VERSION))
27$(call add_json_val,  Platform_sdk_version,              $(PLATFORM_SDK_VERSION))
28$(call add_json_str,  Platform_sdk_codename,             $(PLATFORM_VERSION_CODENAME))
29$(call add_json_bool, Platform_sdk_final,                $(filter REL,$(PLATFORM_VERSION_CODENAME)))
30$(call add_json_csv,  Platform_version_active_codenames, $(PLATFORM_VERSION_ALL_CODENAMES))
31$(call add_json_str,  Platform_security_patch,           $(PLATFORM_SECURITY_PATCH))
32$(call add_json_str,  Platform_preview_sdk_version,      $(PLATFORM_PREVIEW_SDK_VERSION))
33$(call add_json_str,  Platform_base_os,                  $(PLATFORM_BASE_OS))
34
35$(call add_json_str,  Platform_min_supported_target_sdk_version, $(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION))
36
37$(call add_json_bool, Allow_missing_dependencies,        $(filter true,$(ALLOW_MISSING_DEPENDENCIES)))
38$(call add_json_bool, Unbundled_build,                   $(TARGET_BUILD_UNBUNDLED))
39$(call add_json_bool, Unbundled_build_apps,              $(TARGET_BUILD_APPS))
40$(call add_json_bool, Always_use_prebuilt_sdks,          $(TARGET_BUILD_USE_PREBUILT_SDKS))
41$(call add_json_bool, Skip_boot_jars_check,              $(SKIP_BOOT_JARS_CHECK))
42
43$(call add_json_bool, Debuggable,                        $(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
44$(call add_json_bool, Eng,                               $(filter eng,$(TARGET_BUILD_VARIANT)))
45
46$(call add_json_str,  DeviceName,                        $(TARGET_DEVICE))
47$(call add_json_str,  DeviceArch,                        $(TARGET_ARCH))
48$(call add_json_str,  DeviceArchVariant,                 $(TARGET_ARCH_VARIANT))
49$(call add_json_str,  DeviceCpuVariant,                  $(TARGET_CPU_VARIANT))
50$(call add_json_list, DeviceAbi,                         $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2))
51
52$(call add_json_str,  DeviceSecondaryArch,               $(TARGET_2ND_ARCH))
53$(call add_json_str,  DeviceSecondaryArchVariant,        $(TARGET_2ND_ARCH_VARIANT))
54$(call add_json_str,  DeviceSecondaryCpuVariant,         $(TARGET_2ND_CPU_VARIANT))
55$(call add_json_list, DeviceSecondaryAbi,                $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2))
56
57$(call add_json_bool, Aml_abis,                          $(if $(filter mainline_sdk,$(TARGET_ARCH_SUITE)),true))
58$(call add_json_bool, Ndk_abis,                          $(if $(filter ndk,         $(TARGET_ARCH_SUITE)),true))
59
60$(call add_json_str,  NativeBridgeArch,                  $(TARGET_NATIVE_BRIDGE_ARCH))
61$(call add_json_str,  NativeBridgeArchVariant,           $(TARGET_NATIVE_BRIDGE_ARCH_VARIANT))
62$(call add_json_str,  NativeBridgeCpuVariant,            $(TARGET_NATIVE_BRIDGE_CPU_VARIANT))
63$(call add_json_list, NativeBridgeAbi,                   $(TARGET_NATIVE_BRIDGE_ABI))
64$(call add_json_str,  NativeBridgeRelativePath,          $(TARGET_NATIVE_BRIDGE_RELATIVE_PATH))
65
66$(call add_json_str,  NativeBridgeSecondaryArch,         $(TARGET_NATIVE_BRIDGE_2ND_ARCH))
67$(call add_json_str,  NativeBridgeSecondaryArchVariant,  $(TARGET_NATIVE_BRIDGE_2ND_ARCH_VARIANT))
68$(call add_json_str,  NativeBridgeSecondaryCpuVariant,   $(TARGET_NATIVE_BRIDGE_2ND_CPU_VARIANT))
69$(call add_json_list, NativeBridgeSecondaryAbi,          $(TARGET_NATIVE_BRIDGE_2ND_ABI))
70$(call add_json_str,  NativeBridgeSecondaryRelativePath, $(TARGET_NATIVE_BRIDGE_2ND_RELATIVE_PATH))
71
72$(call add_json_str,  HostArch,                          $(HOST_ARCH))
73$(call add_json_str,  HostSecondaryArch,                 $(HOST_2ND_ARCH))
74$(call add_json_bool, HostStaticBinaries,                $(BUILD_HOST_static))
75
76$(call add_json_str,  CrossHost,                         $(HOST_CROSS_OS))
77$(call add_json_str,  CrossHostArch,                     $(HOST_CROSS_ARCH))
78$(call add_json_str,  CrossHostSecondaryArch,            $(HOST_CROSS_2ND_ARCH))
79
80$(call add_json_list, DeviceResourceOverlays,            $(DEVICE_PACKAGE_OVERLAYS))
81$(call add_json_list, ProductResourceOverlays,           $(PRODUCT_PACKAGE_OVERLAYS))
82$(call add_json_list, EnforceRROTargets,                 $(PRODUCT_ENFORCE_RRO_TARGETS))
83$(call add_json_list, EnforceRROExcludedOverlays,        $(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS))
84
85$(call add_json_str,  AAPTCharacteristics,               $(TARGET_AAPT_CHARACTERISTICS))
86$(call add_json_list, AAPTConfig,                        $(PRODUCT_AAPT_CONFIG))
87$(call add_json_str,  AAPTPreferredConfig,               $(PRODUCT_AAPT_PREF_CONFIG))
88$(call add_json_list, AAPTPrebuiltDPI,                   $(PRODUCT_AAPT_PREBUILT_DPI))
89
90$(call add_json_str,  DefaultAppCertificate,             $(PRODUCT_DEFAULT_DEV_CERTIFICATE))
91
92$(call add_json_str,  AppsDefaultVersionName,            $(APPS_DEFAULT_VERSION_NAME))
93
94$(call add_json_list, SanitizeHost,                      $(SANITIZE_HOST))
95$(call add_json_list, SanitizeDevice,                    $(SANITIZE_TARGET))
96$(call add_json_list, SanitizeDeviceDiag,                $(SANITIZE_TARGET_DIAG))
97$(call add_json_list, SanitizeDeviceArch,                $(SANITIZE_TARGET_ARCH))
98
99$(call add_json_bool, Safestack,                         $(filter true,$(USE_SAFESTACK)))
100$(call add_json_bool, EnableCFI,                         $(call invert_bool,$(filter false,$(ENABLE_CFI))))
101$(call add_json_list, CFIExcludePaths,                   $(CFI_EXCLUDE_PATHS) $(PRODUCT_CFI_EXCLUDE_PATHS))
102$(call add_json_list, CFIIncludePaths,                   $(CFI_INCLUDE_PATHS) $(PRODUCT_CFI_INCLUDE_PATHS))
103$(call add_json_list, IntegerOverflowExcludePaths,       $(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS))
104
105$(call add_json_list, MemtagHeapExcludePaths,            $(MEMTAG_HEAP_EXCLUDE_PATHS) $(PRODUCT_MEMTAG_HEAP_EXCLUDE_PATHS))
106$(call add_json_list, MemtagHeapAsyncIncludePaths,       $(MEMTAG_HEAP_ASYNC_INCLUDE_PATHS) $(PRODUCT_MEMTAG_HEAP_ASYNC_INCLUDE_PATHS))
107$(call add_json_list, MemtagHeapSyncIncludePaths,        $(MEMTAG_HEAP_SYNC_INCLUDE_PATHS) $(PRODUCT_MEMTAG_HEAP_SYNC_INCLUDE_PATHS))
108
109$(call add_json_bool, DisableScudo,                      $(filter true,$(PRODUCT_DISABLE_SCUDO)))
110
111$(call add_json_bool, ClangTidy,                         $(filter 1 true,$(WITH_TIDY)))
112$(call add_json_str,  TidyChecks,                        $(WITH_TIDY_CHECKS))
113
114$(call add_json_list, JavaCoveragePaths,                 $(JAVA_COVERAGE_PATHS))
115$(call add_json_list, JavaCoverageExcludePaths,          $(JAVA_COVERAGE_EXCLUDE_PATHS))
116
117$(call add_json_bool, GcovCoverage,                      $(filter true,$(NATIVE_COVERAGE)))
118$(call add_json_bool, ClangCoverage,                     $(filter true,$(CLANG_COVERAGE)))
119$(call add_json_list, NativeCoveragePaths,               $(NATIVE_COVERAGE_PATHS))
120$(call add_json_list, NativeCoverageExcludePaths,        $(NATIVE_COVERAGE_EXCLUDE_PATHS))
121
122$(call add_json_bool, SamplingPGO,                       $(filter true,$(SAMPLING_PGO)))
123
124$(call add_json_bool, ArtUseReadBarrier,                 $(call invert_bool,$(filter false,$(PRODUCT_ART_USE_READ_BARRIER))))
125$(call add_json_bool, Binder32bit,                       $(BINDER32BIT))
126$(call add_json_str,  BtConfigIncludeDir,                $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR))
127$(call add_json_list, DeviceKernelHeaders,               $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) $(TARGET_PRODUCT_KERNEL_HEADERS))
128$(call add_json_str,  DeviceVndkVersion,                 $(BOARD_VNDK_VERSION))
129$(call add_json_str,  Platform_vndk_version,             $(PLATFORM_VNDK_VERSION))
130$(call add_json_str,  ProductVndkVersion,                $(PRODUCT_PRODUCT_VNDK_VERSION))
131$(call add_json_list, ExtraVndkVersions,                 $(PRODUCT_EXTRA_VNDK_VERSIONS))
132$(call add_json_list, DeviceSystemSdkVersions,           $(BOARD_SYSTEMSDK_VERSIONS))
133$(call add_json_str,  RecoverySnapshotVersion,           $(RECOVERY_SNAPSHOT_VERSION))
134$(call add_json_list, Platform_systemsdk_versions,       $(PLATFORM_SYSTEMSDK_VERSIONS))
135$(call add_json_bool, Malloc_not_svelte,                 $(call invert_bool,$(filter true,$(MALLOC_SVELTE))))
136$(call add_json_bool, Malloc_zero_contents,              $(call invert_bool,$(filter false,$(MALLOC_ZERO_CONTENTS))))
137$(call add_json_bool, Malloc_pattern_fill_contents,      $(MALLOC_PATTERN_FILL_CONTENTS))
138$(call add_json_str,  Override_rs_driver,                $(OVERRIDE_RS_DRIVER))
139
140$(call add_json_bool, UncompressPrivAppDex,              $(call invert_bool,$(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))))
141$(call add_json_list, ModulesLoadedByPrivilegedModules,  $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))
142
143$(call add_json_list, BootJars,                          $(PRODUCT_BOOT_JARS))
144$(call add_json_list, UpdatableBootJars,                 $(PRODUCT_UPDATABLE_BOOT_JARS))
145
146$(call add_json_bool, VndkUseCoreVariant,                $(TARGET_VNDK_USE_CORE_VARIANT))
147$(call add_json_bool, VndkSnapshotBuildArtifacts,        $(VNDK_SNAPSHOT_BUILD_ARTIFACTS))
148
149$(call add_json_bool, DirectedVendorSnapshot,            $(DIRECTED_VENDOR_SNAPSHOT))
150$(call add_json_map,  VendorSnapshotModules)
151$(foreach module,$(VENDOR_SNAPSHOT_MODULES),\
152  $(call add_json_bool,$(module),true))
153$(call end_json_map)
154
155$(call add_json_bool, DirectedRecoverySnapshot,          $(DIRECTED_RECOVERY_SNAPSHOT))
156$(call add_json_map,  RecoverySnapshotModules)
157$(foreach module,$(RECOVERY_SNAPSHOT_MODULES),\
158  $(call add_json_bool,$(module),true))
159$(call end_json_map)
160
161$(call add_json_list, VendorSnapshotDirsIncluded,        $(VENDOR_SNAPSHOT_DIRS_INCLUDED))
162$(call add_json_list, VendorSnapshotDirsExcluded,        $(VENDOR_SNAPSHOT_DIRS_EXCLUDED))
163$(call add_json_list, RecoverySnapshotDirsIncluded,      $(RECOVERY_SNAPSHOT_DIRS_INCLUDED))
164$(call add_json_list, RecoverySnapshotDirsExcluded,      $(RECOVERY_SNAPSHOT_DIRS_EXCLUDED))
165
166$(call add_json_bool, Treble_linker_namespaces,          $(filter true,$(PRODUCT_TREBLE_LINKER_NAMESPACES)))
167$(call add_json_bool, Enforce_vintf_manifest,            $(filter true,$(PRODUCT_ENFORCE_VINTF_MANIFEST)))
168
169$(call add_json_bool, Uml,                               $(filter true,$(TARGET_USER_MODE_LINUX)))
170$(call add_json_str,  VendorPath,                        $(TARGET_COPY_OUT_VENDOR))
171$(call add_json_str,  OdmPath,                           $(TARGET_COPY_OUT_ODM))
172$(call add_json_str,  VendorDlkmPath,                    $(TARGET_COPY_OUT_VENDOR_DLKM))
173$(call add_json_str,  OdmDlkmPath,                       $(TARGET_COPY_OUT_ODM_DLKM))
174$(call add_json_str,  ProductPath,                       $(TARGET_COPY_OUT_PRODUCT))
175$(call add_json_str,  SystemExtPath,                     $(TARGET_COPY_OUT_SYSTEM_EXT))
176$(call add_json_bool, MinimizeJavaDebugInfo,             $(filter true,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO)))
177
178$(call add_json_bool, UseGoma,                           $(filter-out false,$(USE_GOMA)))
179$(call add_json_bool, UseRBE,                            $(filter-out false,$(USE_RBE)))
180$(call add_json_bool, UseRBEJAVAC,                       $(filter-out false,$(RBE_JAVAC)))
181$(call add_json_bool, UseRBER8,                          $(filter-out false,$(RBE_R8)))
182$(call add_json_bool, UseRBED8,                          $(filter-out false,$(RBE_D8)))
183$(call add_json_bool, Arc,                               $(filter true,$(TARGET_ARC)))
184
185$(call add_json_list, NamespacesToExport,                $(PRODUCT_SOONG_NAMESPACES))
186
187$(call add_json_list, PgoAdditionalProfileDirs,          $(PGO_ADDITIONAL_PROFILE_DIRS))
188
189$(call add_json_list, BoardReqdMaskPolicy,               $(BOARD_REQD_MASK_POLICY))
190$(call add_json_list, BoardVendorSepolicyDirs,           $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_SEPOLICY_DIRS))
191$(call add_json_list, BoardOdmSepolicyDirs,              $(BOARD_ODM_SEPOLICY_DIRS))
192$(call add_json_list, BoardVendorDlkmSepolicyDirs,       $(BOARD_VENDOR_DLKM_SEPOLICY_DIRS))
193$(call add_json_list, BoardOdmDlkmSepolicyDirs,          $(BOARD_ODM_DLKM_SEPOLICY_DIRS))
194# TODO: BOARD_PLAT_* dirs only kept for compatibility reasons. Will be a hard error on API level 31
195$(call add_json_list, SystemExtPublicSepolicyDirs,       $(SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS) $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR))
196$(call add_json_list, SystemExtPrivateSepolicyDirs,      $(SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS) $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR))
197$(call add_json_list, BoardSepolicyM4Defs,               $(BOARD_SEPOLICY_M4DEFS))
198$(call add_json_str,  BoardSepolicyVers,                 $(BOARD_SEPOLICY_VERS))
199
200$(call add_json_str,  PlatformSepolicyVersion,           $(PLATFORM_SEPOLICY_VERSION))
201
202$(call add_json_bool, Flatten_apex,                      $(filter true,$(TARGET_FLATTEN_APEX)))
203$(call add_json_bool, ForceApexSymlinkOptimization,      $(filter true,$(TARGET_FORCE_APEX_SYMLINK_OPTIMIZATION)))
204
205$(call add_json_str,  DexpreoptGlobalConfig,             $(DEX_PREOPT_CONFIG))
206
207$(call add_json_bool, WithDexpreopt,                     $(filter true,$(WITH_DEXPREOPT)))
208
209$(call add_json_list, ManifestPackageNameOverrides,      $(PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES))
210$(call add_json_list, PackageNameOverrides,              $(PRODUCT_PACKAGE_NAME_OVERRIDES))
211$(call add_json_list, CertificateOverrides,              $(PRODUCT_CERTIFICATE_OVERRIDES))
212
213$(call add_json_bool, EnforceSystemCertificate,          $(filter true,$(ENFORCE_SYSTEM_CERTIFICATE)))
214$(call add_json_list, EnforceSystemCertificateAllowList, $(ENFORCE_SYSTEM_CERTIFICATE_ALLOW_LIST))
215
216$(call add_json_list, ProductHiddenAPIStubs,             $(PRODUCT_HIDDENAPI_STUBS))
217$(call add_json_list, ProductHiddenAPIStubsSystem,       $(PRODUCT_HIDDENAPI_STUBS_SYSTEM))
218$(call add_json_list, ProductHiddenAPIStubsTest,         $(PRODUCT_HIDDENAPI_STUBS_TEST))
219
220$(call add_json_list, ProductPublicSepolicyDirs,         $(PRODUCT_PUBLIC_SEPOLICY_DIRS))
221$(call add_json_list, ProductPrivateSepolicyDirs,        $(PRODUCT_PRIVATE_SEPOLICY_DIRS))
222
223$(call add_json_list, TargetFSConfigGen,                 $(TARGET_FS_CONFIG_GEN))
224
225$(call add_json_list, MissingUsesLibraries,              $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES))
226
227$(call add_json_map, VendorVars)
228$(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
229  $(call add_json_map, $(namespace))\
230  $(foreach key,$(SOONG_CONFIG_$(namespace)),\
231    $(call add_json_str,$(key),$(SOONG_CONFIG_$(namespace)_$(key))))\
232  $(call end_json_map))
233$(call end_json_map)
234
235$(call add_json_bool, EnforceProductPartitionInterface,  $(filter true,$(PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE)))
236$(call add_json_str,  DeviceCurrentApiLevelForVendorModules,  $(BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES))
237
238$(call add_json_bool, EnforceInterPartitionJavaSdkLibrary, $(filter true,$(PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY)))
239$(call add_json_list, InterPartitionJavaLibraryAllowList, $(PRODUCT_INTER_PARTITION_JAVA_LIBRARY_ALLOWLIST))
240
241$(call add_json_bool, InstallExtraFlattenedApexes, $(PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES))
242
243$(call add_json_bool, CompressedApex, $(filter true,$(PRODUCT_COMPRESSED_APEX)))
244
245$(call add_json_bool, BoardUsesRecoveryAsBoot, $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
246
247$(call add_json_list, BoardKernelBinaries, $(BOARD_KERNEL_BINARIES))
248$(call add_json_list, BoardKernelModuleInterfaceVersions, $(BOARD_KERNEL_MODULE_INTERFACE_VERSIONS))
249
250$(call add_json_bool, BoardMoveRecoveryResourcesToVendorBoot, $(filter true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT)))
251$(call add_json_str,  PrebuiltHiddenApiDir, $(BOARD_PREBUILT_HIDDENAPI_DIR))
252
253$(call add_json_str,  ShippingApiLevel, $(PRODUCT_SHIPPING_API_LEVEL))
254
255$(call add_json_bool, BuildBrokenEnforceSyspropOwner,     $(filter true,$(BUILD_BROKEN_ENFORCE_SYSPROP_OWNER)))
256$(call add_json_bool, BuildBrokenTrebleSyspropNeverallow, $(filter true,$(BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW)))
257$(call add_json_bool, BuildBrokenVendorPropertyNamespace, $(filter true,$(BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE)))
258
259$(call add_json_bool, BuildDebugfsRestrictionsEnabled, $(filter true,$(PRODUCT_SET_DEBUGFS_RESTRICTIONS)))
260
261$(call add_json_bool, RequiresInsecureExecmemForSwiftshader, $(filter true,$(PRODUCT_REQUIRES_INSECURE_EXECMEM_FOR_SWIFTSHADER)))
262
263$(call add_json_bool, SelinuxIgnoreNeverallows, $(filter true,$(SELINUX_IGNORE_NEVERALLOWS)))
264
265$(call add_json_bool, SepolicySplit, $(filter true,$(PRODUCT_SEPOLICY_SPLIT)))
266
267$(call json_end)
268
269$(file >$(SOONG_VARIABLES).tmp,$(json_contents))
270
271$(shell if ! cmp -s $(SOONG_VARIABLES).tmp $(SOONG_VARIABLES); then \
272	  mv $(SOONG_VARIABLES).tmp $(SOONG_VARIABLES); \
273	else \
274	  rm $(SOONG_VARIABLES).tmp; \
275	fi)
276
277endif # CONFIGURE_SOONG
278