2016-03-12 01:11:25 +01:00
|
|
|
SOONG := $(SOONG_OUT_DIR)/soong
|
2016-03-22 22:44:17 +01:00
|
|
|
SOONG_BOOTSTRAP := $(SOONG_OUT_DIR)/.soong.bootstrap
|
2016-03-12 01:11:25 +01:00
|
|
|
SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja
|
|
|
|
SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make
|
2016-03-29 21:32:16 +02:00
|
|
|
SOONG_MAKEVARS_MK := $(SOONG_OUT_DIR)/make_vars-$(TARGET_PRODUCT).mk
|
2016-03-22 22:44:17 +01:00
|
|
|
SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables
|
2016-05-11 09:23:38 +02:00
|
|
|
SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android-$(TARGET_PRODUCT).mk
|
2016-03-11 00:03:41 +01:00
|
|
|
|
2016-03-22 22:44:17 +01:00
|
|
|
# We need to rebootstrap soong if SOONG_OUT_DIR or the reverse path from
|
|
|
|
# SOONG_OUT_DIR to TOP changes
|
|
|
|
SOONG_NEEDS_REBOOTSTRAP :=
|
|
|
|
ifneq ($(wildcard $(SOONG_BOOTSTRAP)),)
|
|
|
|
ifneq ($(SOONG_OUT_DIR),$(strip $(shell source $(SOONG_BOOTSTRAP); echo $$BUILDDIR)))
|
|
|
|
SOONG_NEEDS_REBOOTSTRAP := FORCE
|
|
|
|
$(warning soong_out_dir changed)
|
|
|
|
endif
|
2016-05-03 00:31:17 +02:00
|
|
|
ifneq ($(strip $(shell build/soong/scripts/reverse_path.py $(SOONG_OUT_DIR))),$(strip $(shell source $(SOONG_BOOTSTRAP); echo $$SRCDIR_FROM_BUILDDIR)))
|
2016-03-22 22:44:17 +01:00
|
|
|
SOONG_NEEDS_REBOOTSTRAP := FORCE
|
|
|
|
$(warning reverse path changed)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Bootstrap soong.
|
|
|
|
$(SOONG_BOOTSTRAP): bootstrap.bash $(SOONG_NEEDS_REBOOTSTRAP)
|
2015-11-09 23:53:36 +01:00
|
|
|
$(hide) mkdir -p $(dir $@)
|
2016-03-22 22:44:17 +01:00
|
|
|
$(hide) BUILDDIR=$(SOONG_OUT_DIR) ./bootstrap.bash
|
2015-11-09 23:53:36 +01:00
|
|
|
|
2016-07-26 05:23:58 +02:00
|
|
|
BINDER32BIT :=
|
|
|
|
ifneq ($(TARGET_USES_64_BIT_BINDER),true)
|
|
|
|
ifneq ($(TARGET_IS_64_BIT),true)
|
|
|
|
BINDER32BIT := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2015-11-09 23:53:36 +01:00
|
|
|
# Create soong.variables with copies of makefile settings. Runs every build,
|
|
|
|
# but only updates soong.variables if it changes
|
|
|
|
SOONG_VARIABLES_TMP := $(SOONG_VARIABLES).$$$$
|
|
|
|
$(SOONG_VARIABLES): FORCE
|
|
|
|
$(hide) mkdir -p $(dir $@)
|
|
|
|
$(hide) (\
|
|
|
|
echo '{'; \
|
2016-05-11 09:23:38 +02:00
|
|
|
echo ' "Make_suffix": "-$(TARGET_PRODUCT)",'; \
|
|
|
|
echo ''; \
|
2015-11-09 23:53:36 +01:00
|
|
|
echo ' "Platform_sdk_version": $(PLATFORM_SDK_VERSION),'; \
|
|
|
|
echo ' "Unbundled_build": $(if $(TARGET_BUILD_APPS),true,false),'; \
|
|
|
|
echo ' "Brillo": $(if $(BRILLO),true,false),'; \
|
2016-03-02 00:21:15 +01:00
|
|
|
echo ' "Malloc_not_svelte": $(if $(filter true,$(MALLOC_SVELTE)),false,true),'; \
|
2016-03-16 19:12:41 +01:00
|
|
|
echo ' "Allow_missing_dependencies": $(if $(TARGET_BUILD_APPS)$(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),true,false),'; \
|
2016-07-07 01:32:01 +02:00
|
|
|
echo ' "SanitizeHost": [$(if $(SANITIZE_HOST),"$(subst $(space),"$(comma)",$(SANITIZE_HOST))")],'; \
|
|
|
|
echo ' "SanitizeDevice": [$(if $(SANITIZE_TARGET),"$(subst $(space),"$(comma)",$(SANITIZE_TARGET))")],'; \
|
2016-05-18 01:40:03 +02:00
|
|
|
echo ' "HostStaticBinaries": $(if $(strip $(BUILD_HOST_static)),true,false),'; \
|
2016-07-13 00:00:46 +02:00
|
|
|
echo ' "Cpusets": $(if $(strip $(ENABLE_CPUSETS)),true,false),'; \
|
|
|
|
echo ' "Schedboost": $(if $(strip $(ENABLE_SCHEDBOOST)),true,false),'; \
|
2016-07-26 05:23:58 +02:00
|
|
|
echo ' "Binder32bit": $(if $(BINDER32BIT),true,false),'; \
|
2016-08-25 00:29:38 +02:00
|
|
|
echo ' "DevicePrefer32BitExecutables": $(if $(filter true,$(TARGET_PREFER_32_BIT_EXECUTABLES)),true,false),'; \
|
|
|
|
echo ' "HostPrefer32BitExecutables": $(if $(filter true,$(HOST_PREFER_32_BIT)),true,false),'; \
|
2015-11-09 23:53:36 +01:00
|
|
|
echo ''; \
|
|
|
|
echo ' "DeviceName": "$(TARGET_DEVICE)",'; \
|
|
|
|
echo ' "DeviceArch": "$(TARGET_ARCH)",'; \
|
|
|
|
echo ' "DeviceArchVariant": "$(TARGET_ARCH_VARIANT)",'; \
|
|
|
|
echo ' "DeviceCpuVariant": "$(TARGET_CPU_VARIANT)",'; \
|
|
|
|
echo ' "DeviceAbi": ["$(TARGET_CPU_ABI)", "$(TARGET_CPU_ABI2)"],'; \
|
|
|
|
echo ' "DeviceUsesClang": $(if $(USE_CLANG_PLATFORM_BUILD),$(USE_CLANG_PLATFORM_BUILD),false),'; \
|
|
|
|
echo ''; \
|
|
|
|
echo ' "DeviceSecondaryArch": "$(TARGET_2ND_ARCH)",'; \
|
|
|
|
echo ' "DeviceSecondaryArchVariant": "$(TARGET_2ND_ARCH_VARIANT)",'; \
|
|
|
|
echo ' "DeviceSecondaryCpuVariant": "$(TARGET_2ND_CPU_VARIANT)",'; \
|
|
|
|
echo ' "DeviceSecondaryAbi": ["$(TARGET_2ND_CPU_ABI)", "$(TARGET_2ND_CPU_ABI2)"],'; \
|
|
|
|
echo ''; \
|
|
|
|
echo ' "HostArch": "$(HOST_ARCH)",'; \
|
2016-02-09 23:55:13 +01:00
|
|
|
echo ' "HostSecondaryArch": "$(HOST_2ND_ARCH)",'; \
|
|
|
|
echo ''; \
|
|
|
|
echo ' "CrossHost": "$(HOST_CROSS_OS)",'; \
|
|
|
|
echo ' "CrossHostArch": "$(HOST_CROSS_ARCH)",'; \
|
2016-05-13 03:03:23 +02:00
|
|
|
echo ' "CrossHostSecondaryArch": "$(HOST_CROSS_2ND_ARCH)",'; \
|
|
|
|
echo ' "Safestack": $(if $(filter true,$(USE_SAFESTACK)),true,false)'; \
|
2015-11-09 23:53:36 +01:00
|
|
|
echo '}') > $(SOONG_VARIABLES_TMP); \
|
|
|
|
if ! cmp -s $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); then \
|
|
|
|
mv $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); \
|
|
|
|
else \
|
|
|
|
rm $(SOONG_VARIABLES_TMP); \
|
|
|
|
fi
|
|
|
|
|
2015-12-11 22:50:00 +01:00
|
|
|
# Tell soong that it is embedded in make
|
|
|
|
$(SOONG_IN_MAKE):
|
|
|
|
$(hide) mkdir -p $(dir $@)
|
|
|
|
$(hide) touch $@
|
|
|
|
|
2016-03-11 00:03:41 +01:00
|
|
|
# Run Soong, this implicitly create an Android.mk listing all soong outputs as
|
|
|
|
# prebuilts.
|
|
|
|
.PHONY: run_soong
|
2016-03-22 22:44:17 +01:00
|
|
|
run_soong: $(SOONG_BOOTSTRAP) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE
|
2016-05-06 01:52:37 +02:00
|
|
|
$(hide) $(SOONG) $(SOONG_BUILD_NINJA) $(NINJA_EXTRA_ARGS)
|