forked from openkylin/platform_build
Merge "Combine soong builds into make builds"
This commit is contained in:
commit
3bfc560cc5
|
@ -525,6 +525,9 @@ ifneq ($(dont_bother),true)
|
|||
# --mindepth=2 makes the prunes not work.
|
||||
subdir_makefiles := \
|
||||
$(shell build/tools/findleaves.py $(FIND_LEAVES_EXCLUDES) $(subdirs) Android.mk)
|
||||
ifeq ($(USE_SOONG),true)
|
||||
subdir_makefiles := $(SOONG_ANDROID_MK) $(subdir_makefiles)
|
||||
endif
|
||||
|
||||
$(foreach mk, $(subdir_makefiles), $(info including $(mk) ...)$(eval include $(mk)))
|
||||
|
||||
|
@ -866,6 +869,9 @@ files: prebuilt \
|
|||
|
||||
.PHONY: checkbuild
|
||||
checkbuild: $(modules_to_check) droid_targets
|
||||
ifeq ($(USE_SOONG),true)
|
||||
checkbuild: checkbuild-soong
|
||||
endif
|
||||
ifeq (true,$(ANDROID_BUILD_EVERYTHING_BY_DEFAULT))
|
||||
droid: checkbuild
|
||||
endif
|
||||
|
|
|
@ -118,21 +118,34 @@ else
|
|||
NINJA_MAKEPARALLEL := $(MAKEPARALLEL) --ninja
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SOONG),true)
|
||||
include $(BUILD_SYSTEM)/soong.mk
|
||||
|
||||
COMBINED_BUILD_NINJA := $(OUT_DIR)/combined$(KATI_NINJA_SUFFIX).ninja
|
||||
|
||||
$(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA) $(SOONG_ANDROID_MK)
|
||||
$(hide) echo "builddir = $(OUT_DIR)" > $(COMBINED_BUILD_NINJA)
|
||||
$(hide) echo "subninja $(SOONG_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA)
|
||||
$(hide) echo "subninja $(KATI_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA)
|
||||
else
|
||||
COMBINED_BUILD_NINJA := $(KATI_BUILD_NINJA)
|
||||
endif
|
||||
|
||||
$(sort $(DEFAULT_GOAL) $(ANDROID_GOALS)) : ninja_wrapper
|
||||
@#empty
|
||||
|
||||
.PHONY: ninja_wrapper
|
||||
ninja_wrapper: $(KATI_BUILD_NINJA) $(MAKEPARALLEL)
|
||||
ninja_wrapper: $(COMBINED_BUILD_NINJA) $(MAKEPARALLEL)
|
||||
@echo Starting build with ninja
|
||||
+$(hide) export NINJA_STATUS="$(NINJA_STATUS)" && source $(KATI_ENV_SH) && $(NINJA_MAKEPARALLEL) $(NINJA) $(NINJA_GOALS) -C $(TOP) -f $(KATI_BUILD_NINJA) $(NINJA_ARGS)
|
||||
+$(hide) export NINJA_STATUS="$(NINJA_STATUS)" && source $(KATI_ENV_SH) && $(NINJA_MAKEPARALLEL) $(NINJA) $(NINJA_GOALS) -C $(TOP) -f $(COMBINED_BUILD_NINJA) $(NINJA_ARGS)
|
||||
|
||||
KATI_FIND_EMULATOR := --use_find_emulator
|
||||
ifeq ($(KATI_EMULATE_FIND),false)
|
||||
KATI_FIND_EMULATOR :=
|
||||
endif
|
||||
$(KATI_BUILD_NINJA): $(KATI) $(MAKEPARALLEL) FORCE
|
||||
$(KATI_BUILD_NINJA): $(KATI) $(MAKEPARALLEL) $(SOONG_ANDROID_MK) FORCE
|
||||
@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja...
|
||||
+$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo $(KATI_FIND_EMULATOR) -f build/core/main.mk $(KATI_GOALS) --gen_all_targets BUILDING_WITH_NINJA=true
|
||||
+$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --no_ignore_dirty=$(SOONG_ANDROID_MK) --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo $(KATI_FIND_EMULATOR) -f build/core/main.mk $(KATI_GOALS) --gen_all_targets BUILDING_WITH_NINJA=true SOONG_ANDROID_MK=$(SOONG_ANDROID_MK)
|
||||
|
||||
KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS)
|
||||
KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
SOONG_OUT_DIR := $(OUT_DIR)/soong
|
||||
SOONG := $(SOONG_OUT_DIR)/soong
|
||||
SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja
|
||||
SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android.mk
|
||||
SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables
|
||||
|
||||
ifeq (,$(filter /%,$(SOONG_OUT_DIR)))
|
||||
SOONG_TOP_RELPATH := $(shell python -c "import os; print os.path.relpath('$(TOP)', '$(SOONG_OUT_DIR)')")
|
||||
else
|
||||
SOONG_TOP_RELPATH := $(realpath $(TOP))
|
||||
endif
|
||||
|
||||
# Bootstrap soong. Run only the first time for clean builds
|
||||
$(SOONG):
|
||||
$(hide) mkdir -p $(dir $@)
|
||||
$(hide) cd $(dir $@) && $(SOONG_TOP_RELPATH)/bootstrap.bash
|
||||
|
||||
# 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 '{'; \
|
||||
echo ' "Device_uses_jemalloc": $(if $(filter dlmalloc,$(MALLOC_IMPL)),false,true),'; \
|
||||
echo ' "Device_uses_dlmalloc": $(if $(filter dlmalloc,$(MALLOC_IMPL)),true,false),'; \
|
||||
echo ' $(if $(BOARD_MALLOC_ALIGNMENT),"Dlmalloc_alignment": $(BOARD_MALLOC_ALIGNMENT)$(comma),)'; \
|
||||
echo ' "Platform_sdk_version": $(PLATFORM_SDK_VERSION),'; \
|
||||
echo ' "Unbundled_build": $(if $(TARGET_BUILD_APPS),true,false),'; \
|
||||
echo ' "Brillo": $(if $(BRILLO),true,false),'; \
|
||||
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)",'; \
|
||||
echo ' "HostSecondaryArch": "$(HOST_2ND_ARCH)"'; \
|
||||
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
|
||||
|
||||
# Build an Android.mk listing all soong outputs as prebuilts
|
||||
$(SOONG_ANDROID_MK): $(SOONG) $(SOONG_VARIABLES) FORCE
|
||||
$(hide) $(SOONG) $(SOONG_BUILD_NINJA) $(NINJA_ARGS)
|
Loading…
Reference in New Issue