1SOONG := $(SOONG_OUT_DIR)/soong
2SOONG_BOOTSTRAP := $(SOONG_OUT_DIR)/.soong.bootstrap
3SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja
4SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make
5SOONG_MAKEVARS_MK := $(SOONG_OUT_DIR)/make_vars-$(TARGET_PRODUCT).mk
6SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables
7SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android-$(TARGET_PRODUCT).mk
8
9BINDER32BIT :=
10ifneq ($(TARGET_USES_64_BIT_BINDER),true)
11ifneq ($(TARGET_IS_64_BIT),true)
12BINDER32BIT := true
13endif
14endif
15
16# Create soong.variables with copies of makefile settings.  Runs every build,
17# but only updates soong.variables if it changes
18SOONG_VARIABLES_TMP := $(SOONG_VARIABLES).$$$$
19$(SOONG_VARIABLES): FORCE
20	$(hide) mkdir -p $(dir $@)
21	$(hide) (\
22	echo '{'; \
23	echo '    "Make_suffix": "-$(TARGET_PRODUCT)",'; \
24	echo ''; \
25	echo '    "Platform_sdk_version": $(PLATFORM_SDK_VERSION),'; \
26	echo '    "Unbundled_build": $(if $(TARGET_BUILD_APPS),true,false),'; \
27	echo '    "Brillo": $(if $(BRILLO),true,false),'; \
28	echo '    "Malloc_not_svelte": $(if $(filter true,$(MALLOC_SVELTE)),false,true),'; \
29	echo '    "Allow_missing_dependencies": $(if $(TARGET_BUILD_APPS)$(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),true,false),'; \
30	echo '    "SanitizeHost": [$(if $(SANITIZE_HOST),"$(subst $(space),"$(comma)",$(SANITIZE_HOST))")],'; \
31	echo '    "SanitizeDevice": [$(if $(SANITIZE_TARGET),"$(subst $(space),"$(comma)",$(SANITIZE_TARGET))")],'; \
32	echo '    "SanitizeDeviceArch": [$(if $(SANITIZE_TARGET_ARCH),"$(subst $(space),"$(comma)",$(SANITIZE_TARGET_ARCH))")],'; \
33	echo '    "HostStaticBinaries": $(if $(strip $(BUILD_HOST_static)),true,false),'; \
34	echo '    "Binder32bit": $(if $(BINDER32BIT),true,false),'; \
35	echo '    "DevicePrefer32BitExecutables": $(if $(filter true,$(TARGET_PREFER_32_BIT_EXECUTABLES)),true,false),'; \
36	echo '    "UseGoma": $(if $(filter-out false,$(USE_GOMA)),true,false),'; \
37	echo '    "Debuggable": $(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),true,false),'; \
38	echo '    "Eng": $(if $(filter eng,$(TARGET_BUILD_VARIANT)),true,false),'; \
39	echo '    "VendorPath": "$(TARGET_COPY_OUT_VENDOR)",'; \
40	echo ''; \
41	echo '    "ClangTidy": $(if $(filter 1 true,$(WITH_TIDY)),true,false),'; \
42	echo '    "TidyChecks": "$(WITH_TIDY_CHECKS)",'; \
43	echo ''; \
44	echo '    "NativeCoverage": $(if $(filter true,$(NATIVE_COVERAGE)),true,false),'; \
45	echo '    "CoveragePaths": [$(if $(COVERAGE_PATHS),"$(subst $(space),"$(comma)",$(subst $(comma),$(space),$(COVERAGE_PATHS)))")],'; \
46	echo '    "CoverageExcludePaths": [$(if $(COVERAGE_EXCLUDE_PATHS),"$(subst $(space),"$(comma)",$(subst $(comma),$(space),$(COVERAGE_EXCLUDE_PATHS)))")],'; \
47	echo ''; \
48	echo '    "DeviceName": "$(TARGET_DEVICE)",'; \
49	echo '    "DeviceArch": "$(TARGET_ARCH)",'; \
50	echo '    "DeviceArchVariant": "$(TARGET_ARCH_VARIANT)",'; \
51	echo '    "DeviceCpuVariant": "$(TARGET_CPU_VARIANT)",'; \
52	echo '    "DeviceAbi": ["$(TARGET_CPU_ABI)", "$(TARGET_CPU_ABI2)"],'; \
53	echo '    "DeviceUsesClang": $(if $(USE_CLANG_PLATFORM_BUILD),$(USE_CLANG_PLATFORM_BUILD),false),'; \
54	echo '    "DeviceVndkVersion": "$(BOARD_VNDK_VERSION)",'; \
55	echo ''; \
56	echo '    "DeviceSecondaryArch": "$(TARGET_2ND_ARCH)",'; \
57	echo '    "DeviceSecondaryArchVariant": "$(TARGET_2ND_ARCH_VARIANT)",'; \
58	echo '    "DeviceSecondaryCpuVariant": "$(TARGET_2ND_CPU_VARIANT)",'; \
59	echo '    "DeviceSecondaryAbi": ["$(TARGET_2ND_CPU_ABI)", "$(TARGET_2ND_CPU_ABI2)"],'; \
60	echo ''; \
61	echo '    "HostArch": "$(HOST_ARCH)",'; \
62	echo '    "HostSecondaryArch": "$(HOST_2ND_ARCH)",'; \
63	echo ''; \
64	echo '    "CrossHost": "$(HOST_CROSS_OS)",'; \
65	echo '    "CrossHostArch": "$(HOST_CROSS_ARCH)",'; \
66	echo '    "CrossHostSecondaryArch": "$(HOST_CROSS_2ND_ARCH)",'; \
67	echo '    "Safestack": $(if $(filter true,$(USE_SAFESTACK)),true,false),'; \
68	echo '    "EnableCFI": $(if $(filter true,$(ENABLE_CFI)),true,false),'; \
69	echo '    "Treble": $(if $(filter true,$(PRODUCT_FULL_TREBLE)),true,false),'; \
70	echo '    "Override_rs_driver": "$(OVERRIDE_RS_DRIVER)",'; \
71	echo ''; \
72	echo '    "ArtUseReadBarrier": $(if $(filter false,$(PRODUCT_ART_USE_READ_BARRIER)),false,true),'; \
73	echo ''; \
74	echo '    "BtConfigIncludeDir": "$(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)"'; \
75	echo '}') > $(SOONG_VARIABLES_TMP); \
76	if ! cmp -s $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); then \
77	  mv $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); \
78	else \
79	  rm $(SOONG_VARIABLES_TMP); \
80	fi
81