Dan Willemsen | 04f53ed | 2016-11-09 17:22:15 -0800 | [diff] [blame] | 1 | SOONG := $(SOONG_OUT_DIR)/soong |
| 2 | SOONG_BOOTSTRAP := $(SOONG_OUT_DIR)/.soong.bootstrap |
| 3 | SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja |
| 4 | SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make |
| 5 | SOONG_MAKEVARS_MK := $(SOONG_OUT_DIR)/make_vars-$(TARGET_PRODUCT).mk |
| 6 | SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables |
| 7 | SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android-$(TARGET_PRODUCT).mk |
| 8 | |
| 9 | BINDER32BIT := |
| 10 | ifneq ($(TARGET_USES_64_BIT_BINDER),true) |
| 11 | ifneq ($(TARGET_IS_64_BIT),true) |
| 12 | BINDER32BIT := true |
| 13 | endif |
| 14 | endif |
| 15 | |
Dan Albert | a3afbb9 | 2017-03-29 13:58:13 -0700 | [diff] [blame] | 16 | # 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. |
| 22 | json_list = $(call _json_list,$(space),$(1)) |
| 23 | |
| 24 | # Converts a comma-separated list to a JSON list. |
| 25 | csv_to_json_list = $(call _json_list,$(comma),$(1)) |
| 26 | |
Dan Willemsen | 04f53ed | 2016-11-09 17:22:15 -0800 | [diff] [blame] | 27 | # Create soong.variables with copies of makefile settings. Runs every build, |
| 28 | # but only updates soong.variables if it changes |
| 29 | SOONG_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 Albert | cd38b86 | 2017-07-28 12:34:08 -0700 | [diff] [blame] | 37 | 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 Willemsen | 04f53ed | 2016-11-09 17:22:15 -0800 | [diff] [blame] | 39 | 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 Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 42 | echo ' "Allow_missing_dependencies": $(if $(ALLOW_MISSING_DEPENDENCIES),true,false),'; \ |
Dan Albert | a3afbb9 | 2017-03-29 13:58:13 -0700 | [diff] [blame] | 43 | echo ' "SanitizeHost": $(call json_list,$(SANITIZE_HOST)),'; \ |
| 44 | echo ' "SanitizeDevice": $(call json_list,$(SANITIZE_TARGET)),'; \ |
Ivan Lozano | 4a36373 | 2017-06-28 09:11:26 -0700 | [diff] [blame] | 45 | echo ' "SanitizeDeviceDiag": $(call json_list,$(SANITIZE_TARGET_DIAG)),'; \ |
Dan Albert | a3afbb9 | 2017-03-29 13:58:13 -0700 | [diff] [blame] | 46 | echo ' "SanitizeDeviceArch": $(call json_list,$(SANITIZE_TARGET_ARCH)),'; \ |
Dan Willemsen | 04f53ed | 2016-11-09 17:22:15 -0800 | [diff] [blame] | 47 | echo ' "HostStaticBinaries": $(if $(strip $(BUILD_HOST_static)),true,false),'; \ |
Dan Willemsen | 04f53ed | 2016-11-09 17:22:15 -0800 | [diff] [blame] | 48 | 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 Cross | 3753e8a | 2016-12-08 10:05:55 -0800 | [diff] [blame] | 52 | echo ' "Eng": $(if $(filter eng,$(TARGET_BUILD_VARIANT)),true,false),'; \ |
Dan Willemsen | c077871 | 2016-12-05 17:46:14 -0800 | [diff] [blame] | 53 | echo ' "VendorPath": "$(TARGET_COPY_OUT_VENDOR)",'; \ |
Dan Willemsen | 04f53ed | 2016-11-09 17:22:15 -0800 | [diff] [blame] | 54 | echo ''; \ |
| 55 | echo ' "ClangTidy": $(if $(filter 1 true,$(WITH_TIDY)),true,false),'; \ |
| 56 | echo ' "TidyChecks": "$(WITH_TIDY_CHECKS)",'; \ |
| 57 | echo ''; \ |
Dan Willemsen | 0f90908 | 2017-02-10 00:07:17 -0800 | [diff] [blame] | 58 | echo ' "NativeCoverage": $(if $(filter true,$(NATIVE_COVERAGE)),true,false),'; \ |
Dan Albert | a3afbb9 | 2017-03-29 13:58:13 -0700 | [diff] [blame] | 59 | echo ' "CoveragePaths": $(call csv_to_json_list,$(COVERAGE_PATHS)),'; \ |
| 60 | echo ' "CoverageExcludePaths": $(call csv_to_json_list,$(COVERAGE_EXCLUDE_PATHS)),'; \ |
Dan Willemsen | 0f90908 | 2017-02-10 00:07:17 -0800 | [diff] [blame] | 61 | echo ''; \ |
Dan Willemsen | 04f53ed | 2016-11-09 17:22:15 -0800 | [diff] [blame] | 62 | 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 Willemsen | bab0fa6 | 2016-11-18 14:05:39 -0800 | [diff] [blame] | 68 | echo ' "DeviceVndkVersion": "$(BOARD_VNDK_VERSION)",'; \ |
Dan Willemsen | 04f53ed | 2016-11-09 17:22:15 -0800 | [diff] [blame] | 69 | 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 Yamauchi | 64594c4 | 2016-12-15 16:00:41 -0800 | [diff] [blame] | 81 | echo ' "Safestack": $(if $(filter true,$(USE_SAFESTACK)),true,false),'; \ |
Vishwath Mohan | 445c285 | 2017-01-24 14:06:42 -0800 | [diff] [blame] | 82 | echo ' "EnableCFI": $(if $(filter false,$(ENABLE_CFI)),false,true),'; \ |
Ivan Lozano | 9a82bfd | 2017-07-13 14:49:12 -0700 | [diff] [blame] | 83 | echo ' "IntegerOverflowExcludePaths": $(call json_list,$(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS)),'; \ |
Colin Cross | ea60db9 | 2017-05-02 11:18:40 -0700 | [diff] [blame] | 84 | echo ' "Device_uses_hwc2": $(if $(filter true,$(TARGET_USES_HWC2)),true,false),'; \ |
Colin Cross | 7932f9b | 2017-05-05 15:22:33 -0700 | [diff] [blame] | 85 | echo ' "Override_rs_driver": "$(OVERRIDE_RS_DRIVER)",'; \ |
Steven Moreland | 2b32469 | 2017-05-18 15:26:59 -0700 | [diff] [blame] | 86 | echo ' "Treble": $(if $(filter true,$(PRODUCT_FULL_TREBLE)),true,false),'; \ |
Colin Cross | 2ddbcdf | 2017-05-25 10:17:49 -0700 | [diff] [blame] | 87 | echo ' "Pdk": $(if $(filter true,$(TARGET_BUILD_PDK)),true,false),'; \ |
Hiroshi Yamauchi | 64594c4 | 2016-12-15 16:00:41 -0800 | [diff] [blame] | 88 | echo ''; \ |
Hiroshi Yamauchi | bf6ad34 | 2017-01-24 11:08:44 -0800 | [diff] [blame] | 89 | echo ' "ArtUseReadBarrier": $(if $(filter false,$(PRODUCT_ART_USE_READ_BARRIER)),false,true),'; \ |
Jack He | da214cd | 2016-12-17 15:36:32 -0800 | [diff] [blame] | 90 | echo ''; \ |
Jiyong Park | 0c59dab | 2017-07-03 13:14:52 +0900 | [diff] [blame] | 91 | echo ' "BtConfigIncludeDir": "$(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)",'; \ |
| 92 | echo ''; \ |
| 93 | echo ' "DeviceKernelHeaders": $(call json_list,$(strip $(TARGET_PROJECT_SYSTEM_INCLUDES)))'; \ |
Dan Willemsen | 04f53ed | 2016-11-09 17:22:15 -0800 | [diff] [blame] | 94 | 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 |