blob: fea046564b49b6494476aecc0c2dbafffcf16468 [file] [log] [blame]
Dan Willemsen04f53ed2016-11-09 17:22:15 -08001SOONG := $(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
Dan Alberta3afbb92017-03-29 13:58:13 -070016# Converts a list to a JSON list.
17# $1: List separator.
18# $2: List.
19_json_list = [$(if $(2),"$(subst $(1),"$(comma)",$(2))")]
20
21# Converts a space-separated list to a JSON list.
22json_list = $(call _json_list,$(space),$(1))
23
24# Converts a comma-separated list to a JSON list.
25csv_to_json_list = $(call _json_list,$(comma),$(1))
26
Dan Willemsen04f53ed2016-11-09 17:22:15 -080027# Create soong.variables with copies of makefile settings. Runs every build,
28# but only updates soong.variables if it changes
29SOONG_VARIABLES_TMP := $(SOONG_VARIABLES).$$$$
30$(SOONG_VARIABLES): FORCE
31 $(hide) mkdir -p $(dir $@)
32 $(hide) (\
33 echo '{'; \
34 echo ' "Make_suffix": "-$(TARGET_PRODUCT)",'; \
35 echo ''; \
36 echo ' "Platform_sdk_version": $(PLATFORM_SDK_VERSION),'; \
Dan Albertcd38b862017-07-28 12:34:08 -070037 echo ' "Platform_version_active_codenames": $(call csv_to_json_list,$(PLATFORM_VERSION_ALL_CODENAMES)),'; \
38 echo ' "Platform_version_future_codenames": $(call csv_to_json_list,$(PLATFORM_VERSION_FUTURE_CODENAMES)),'; \
Dan Willemsen04f53ed2016-11-09 17:22:15 -080039 echo ' "Unbundled_build": $(if $(TARGET_BUILD_APPS),true,false),'; \
40 echo ' "Brillo": $(if $(BRILLO),true,false),'; \
41 echo ' "Malloc_not_svelte": $(if $(filter true,$(MALLOC_SVELTE)),false,true),'; \
Dan Willemsenb47d4e92017-04-08 00:31:31 -070042 echo ' "Allow_missing_dependencies": $(if $(ALLOW_MISSING_DEPENDENCIES),true,false),'; \
Dan Alberta3afbb92017-03-29 13:58:13 -070043 echo ' "SanitizeHost": $(call json_list,$(SANITIZE_HOST)),'; \
44 echo ' "SanitizeDevice": $(call json_list,$(SANITIZE_TARGET)),'; \
Ivan Lozano4a363732017-06-28 09:11:26 -070045 echo ' "SanitizeDeviceDiag": $(call json_list,$(SANITIZE_TARGET_DIAG)),'; \
Dan Alberta3afbb92017-03-29 13:58:13 -070046 echo ' "SanitizeDeviceArch": $(call json_list,$(SANITIZE_TARGET_ARCH)),'; \
Dan Willemsen04f53ed2016-11-09 17:22:15 -080047 echo ' "HostStaticBinaries": $(if $(strip $(BUILD_HOST_static)),true,false),'; \
Dan Willemsen04f53ed2016-11-09 17:22:15 -080048 echo ' "Binder32bit": $(if $(BINDER32BIT),true,false),'; \
49 echo ' "DevicePrefer32BitExecutables": $(if $(filter true,$(TARGET_PREFER_32_BIT_EXECUTABLES)),true,false),'; \
50 echo ' "UseGoma": $(if $(filter-out false,$(USE_GOMA)),true,false),'; \
51 echo ' "Debuggable": $(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),true,false),'; \
Colin Cross3753e8a2016-12-08 10:05:55 -080052 echo ' "Eng": $(if $(filter eng,$(TARGET_BUILD_VARIANT)),true,false),'; \
Dan Willemsenc0778712016-12-05 17:46:14 -080053 echo ' "VendorPath": "$(TARGET_COPY_OUT_VENDOR)",'; \
Dan Willemsen04f53ed2016-11-09 17:22:15 -080054 echo ''; \
55 echo ' "ClangTidy": $(if $(filter 1 true,$(WITH_TIDY)),true,false),'; \
56 echo ' "TidyChecks": "$(WITH_TIDY_CHECKS)",'; \
57 echo ''; \
Dan Willemsen0f909082017-02-10 00:07:17 -080058 echo ' "NativeCoverage": $(if $(filter true,$(NATIVE_COVERAGE)),true,false),'; \
Dan Alberta3afbb92017-03-29 13:58:13 -070059 echo ' "CoveragePaths": $(call csv_to_json_list,$(COVERAGE_PATHS)),'; \
60 echo ' "CoverageExcludePaths": $(call csv_to_json_list,$(COVERAGE_EXCLUDE_PATHS)),'; \
Dan Willemsen0f909082017-02-10 00:07:17 -080061 echo ''; \
Dan Willemsen04f53ed2016-11-09 17:22:15 -080062 echo ' "DeviceName": "$(TARGET_DEVICE)",'; \
63 echo ' "DeviceArch": "$(TARGET_ARCH)",'; \
64 echo ' "DeviceArchVariant": "$(TARGET_ARCH_VARIANT)",'; \
65 echo ' "DeviceCpuVariant": "$(TARGET_CPU_VARIANT)",'; \
66 echo ' "DeviceAbi": ["$(TARGET_CPU_ABI)", "$(TARGET_CPU_ABI2)"],'; \
67 echo ' "DeviceUsesClang": $(if $(USE_CLANG_PLATFORM_BUILD),$(USE_CLANG_PLATFORM_BUILD),false),'; \
Dan Willemsenbab0fa62016-11-18 14:05:39 -080068 echo ' "DeviceVndkVersion": "$(BOARD_VNDK_VERSION)",'; \
Dan Willemsen04f53ed2016-11-09 17:22:15 -080069 echo ''; \
70 echo ' "DeviceSecondaryArch": "$(TARGET_2ND_ARCH)",'; \
71 echo ' "DeviceSecondaryArchVariant": "$(TARGET_2ND_ARCH_VARIANT)",'; \
72 echo ' "DeviceSecondaryCpuVariant": "$(TARGET_2ND_CPU_VARIANT)",'; \
73 echo ' "DeviceSecondaryAbi": ["$(TARGET_2ND_CPU_ABI)", "$(TARGET_2ND_CPU_ABI2)"],'; \
74 echo ''; \
75 echo ' "HostArch": "$(HOST_ARCH)",'; \
76 echo ' "HostSecondaryArch": "$(HOST_2ND_ARCH)",'; \
77 echo ''; \
78 echo ' "CrossHost": "$(HOST_CROSS_OS)",'; \
79 echo ' "CrossHostArch": "$(HOST_CROSS_ARCH)",'; \
80 echo ' "CrossHostSecondaryArch": "$(HOST_CROSS_2ND_ARCH)",'; \
Hiroshi Yamauchi64594c42016-12-15 16:00:41 -080081 echo ' "Safestack": $(if $(filter true,$(USE_SAFESTACK)),true,false),'; \
Vishwath Mohan445c2852017-01-24 14:06:42 -080082 echo ' "EnableCFI": $(if $(filter false,$(ENABLE_CFI)),false,true),'; \
Ivan Lozano9a82bfd2017-07-13 14:49:12 -070083 echo ' "IntegerOverflowExcludePaths": $(call json_list,$(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS)),'; \
Colin Crossea60db92017-05-02 11:18:40 -070084 echo ' "Device_uses_hwc2": $(if $(filter true,$(TARGET_USES_HWC2)),true,false),'; \
Colin Cross7932f9b2017-05-05 15:22:33 -070085 echo ' "Override_rs_driver": "$(OVERRIDE_RS_DRIVER)",'; \
Steven Moreland2b324692017-05-18 15:26:59 -070086 echo ' "Treble": $(if $(filter true,$(PRODUCT_FULL_TREBLE)),true,false),'; \
Colin Cross2ddbcdf2017-05-25 10:17:49 -070087 echo ' "Pdk": $(if $(filter true,$(TARGET_BUILD_PDK)),true,false),'; \
Hiroshi Yamauchi64594c42016-12-15 16:00:41 -080088 echo ''; \
Hiroshi Yamauchibf6ad342017-01-24 11:08:44 -080089 echo ' "ArtUseReadBarrier": $(if $(filter false,$(PRODUCT_ART_USE_READ_BARRIER)),false,true),'; \
Jack Heda214cd2016-12-17 15:36:32 -080090 echo ''; \
Jiyong Park0c59dab2017-07-03 13:14:52 +090091 echo ' "BtConfigIncludeDir": "$(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)",'; \
92 echo ''; \
93 echo ' "DeviceKernelHeaders": $(call json_list,$(strip $(TARGET_PROJECT_SYSTEM_INCLUDES)))'; \
Dan Willemsen04f53ed2016-11-09 17:22:15 -080094 echo '}') > $(SOONG_VARIABLES_TMP); \
95 if ! cmp -s $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); then \
96 mv $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); \
97 else \
98 rm $(SOONG_VARIABLES_TMP); \
99 fi