Loading core/main.mk +1 −18 Original line number Diff line number Diff line Loading @@ -10,9 +10,6 @@ SHELL := /bin/bash endif ifndef KATI USE_SOONG_UI ?= true endif ifeq ($(USE_SOONG_UI),true) host_prebuilts := linux-x86 ifeq ($(shell uname),Darwin) Loading @@ -27,7 +24,7 @@ run_soong_ui: $(sort $(MAKECMDGOALS)) : run_soong_ui @#empty else # USE_SOONG_UI else # KATI # Absolute path of the present working direcotry. # This overrides the shell variable $PWD, which does not necessarily points to Loading @@ -47,23 +44,10 @@ $(DEFAULT_GOAL): droid_targets .PHONY: droid_targets droid_targets: # Targets that provide quick help on the build system. include $(BUILD_SYSTEM)/help.mk # Set up various standard variables based on configuration # and host information. include $(BUILD_SYSTEM)/config.mk ifndef KATI ifdef USE_NINJA $(warning USE_NINJA is ignored. Ninja is always used.) endif # Mark this is a ninja build. $(shell mkdir -p $(OUT_DIR) && touch $(OUT_DIR)/ninja_build) include build/core/ninja.mk else # KATI ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),) dont_bother := true endif Loading Loading @@ -1149,4 +1133,3 @@ ndk: $(SOONG_OUT_DIR)/ndk.timestamp all_link_types: endif # KATI endif # USE_SOONG_UI core/ninja.mkdeleted 100644 → 0 +0 −103 Original line number Diff line number Diff line include $(BUILD_SYSTEM)/soong.mk # Modifier goals we don't need to pass to Ninja. .PHONY : $(NINJA_EXCLUDE_GOALS) define replace_space_and_slash $(subst /,_,$(subst $(space),_,$(sort $1))) endef KATI_NINJA_SUFFIX := -$(TARGET_PRODUCT) ifneq ($(KATI_GOALS),) KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-$(call replace_space_and_slash,$(KATI_GOALS)) endif ifneq ($(ONE_SHOT_MAKEFILE),) KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmm-$(call replace_space_and_slash,$(ONE_SHOT_MAKEFILE)) endif my_checksum_suffix := my_ninja_suffix_too_long := $(filter 1, $(shell v='$(KATI_NINJA_SUFFIX)' && echo $$(($${$(pound)v} > 64)))) ifneq ($(my_ninja_suffix_too_long),) # Replace the suffix with a checksum if it gets too long. my_checksum_suffix := $(KATI_NINJA_SUFFIX) KATI_NINJA_SUFFIX := -$(word 1, $(shell echo $(my_checksum_suffix) | $(MD5SUM))) endif KATI_BUILD_NINJA := $(OUT_DIR)/build$(KATI_NINJA_SUFFIX).ninja KATI_ENV_SH := $(OUT_DIR)/env$(KATI_NINJA_SUFFIX).sh # Write out a file mapping checksum to the real suffix. ifneq ($(my_checksum_suffix),) my_ninja_suffix_file := $(basename $(KATI_BUILD_NINJA)).suf $(shell mkdir -p $(dir $(my_ninja_suffix_file)) && \ echo $(my_checksum_suffix) > $(my_ninja_suffix_file)) endif ifeq (,$(NINJA_STATUS)) NINJA_STATUS := [%p %f/%t]$(space) endif NINJA_EXTRA_ARGS := ifneq (,$(filter showcommands,$(ORIGINAL_MAKECMDGOALS))) NINJA_EXTRA_ARGS += "-v" endif # Make multiple rules to generate the same target an error instead of # proceeding with undefined behavior. NINJA_EXTRA_ARGS += -w dupbuild=err ifneq ($(filter-out false,$(USE_GOMA)),) KATI_MAKEPARALLEL := $(MAKEPARALLEL) # Ninja runs remote jobs (i.e., commands which contain gomacc) with # this parallelism. Note the parallelism of all other jobs is still # limited by the -j flag passed to GNU make. NINJA_REMOTE_NUM_JOBS ?= 500 NINJA_EXTRA_ARGS += -j$(NINJA_REMOTE_NUM_JOBS) else NINJA_MAKEPARALLEL := $(MAKEPARALLEL) --ninja # We never want Kati to see MAKEFLAGS, as forcefully overriding variables is # terrible. The variables in MAKEFLAGS are still available in the environment, # so if part of the build wants input from the user, it should be explicitly # checking for an environment variable or using ?= # # makeparallel already clears MAKEFLAGS, so it's not necessary in the GOMA case KATI_MAKEPARALLEL := MAKEFLAGS= endif NINJA_ARGS += $(NINJA_EXTRA_ARGS) COMBINED_BUILD_NINJA := $(OUT_DIR)/combined$(KATI_NINJA_SUFFIX).ninja $(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA) FORCE $(hide) echo "builddir = $(OUT_DIR)" > $(COMBINED_BUILD_NINJA) $(hide) echo "include $(KATI_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA) $(hide) echo "include $(SOONG_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA) $(hide) echo "build $(COMBINED_BUILD_NINJA): phony $(SOONG_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA) $(sort $(DEFAULT_GOAL) $(ANDROID_GOALS)) : ninja_wrapper @#empty .PHONY: ninja_wrapper ninja_wrapper: $(COMBINED_BUILD_NINJA) $(MAKEPARALLEL) @echo Starting build with ninja +$(hide) export NINJA_STATUS="$(NINJA_STATUS)" && source $(KATI_ENV_SH) && exec $(NINJA_MAKEPARALLEL) $(NINJA) -d keepdepfile $(NINJA_GOALS) -C $(TOP) -f $(COMBINED_BUILD_NINJA) $(NINJA_ARGS) # Dummy Android.mk and CleanSpec.mk files so that kati won't recurse into the # out directory DUMMY_OUT_MKS := $(OUT_DIR)/Android.mk $(OUT_DIR)/CleanSpec.mk $(DUMMY_OUT_MKS): @mkdir -p $(dir $@) $(hide) echo '# This file prevents findleaves.py from traversing this directory further' >$@ KATI_FIND_EMULATOR := --use_find_emulator ifeq ($(KATI_EMULATE_FIND),false) KATI_FIND_EMULATOR := endif $(KATI_BUILD_NINJA): $(CKATI) $(MAKEPARALLEL) $(DUMMY_OUT_MKS) run_soong FORCE @echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja... +$(hide) $(KATI_MAKEPARALLEL) $(CKATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --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) SOONG_MAKEVARS_MK=$(SOONG_MAKEVARS_MK) .PHONY: FORCE FORCE: core/soong.mkdeleted 100644 → 0 +0 −29 Original line number Diff line number Diff line # 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 ifneq ($(strip $(shell build/soong/scripts/reverse_path.py $(SOONG_OUT_DIR))),$(strip $(shell source $(SOONG_BOOTSTRAP); echo $$SRCDIR_FROM_BUILDDIR))) SOONG_NEEDS_REBOOTSTRAP := FORCE $(warning reverse path changed) endif endif # Bootstrap soong. $(SOONG_BOOTSTRAP): bootstrap.bash $(SOONG_NEEDS_REBOOTSTRAP) $(hide) mkdir -p $(dir $@) $(hide) BUILDDIR=$(SOONG_OUT_DIR) ./bootstrap.bash # Tell soong that it is embedded in make $(SOONG_IN_MAKE): $(hide) mkdir -p $(dir $@) $(hide) touch $@ # Run Soong, this implicitly create an Android.mk listing all soong outputs as # prebuilts. .PHONY: run_soong run_soong: $(SOONG_BOOTSTRAP) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE $(hide) SKIP_NINJA=true $(SOONG) Loading
core/main.mk +1 −18 Original line number Diff line number Diff line Loading @@ -10,9 +10,6 @@ SHELL := /bin/bash endif ifndef KATI USE_SOONG_UI ?= true endif ifeq ($(USE_SOONG_UI),true) host_prebuilts := linux-x86 ifeq ($(shell uname),Darwin) Loading @@ -27,7 +24,7 @@ run_soong_ui: $(sort $(MAKECMDGOALS)) : run_soong_ui @#empty else # USE_SOONG_UI else # KATI # Absolute path of the present working direcotry. # This overrides the shell variable $PWD, which does not necessarily points to Loading @@ -47,23 +44,10 @@ $(DEFAULT_GOAL): droid_targets .PHONY: droid_targets droid_targets: # Targets that provide quick help on the build system. include $(BUILD_SYSTEM)/help.mk # Set up various standard variables based on configuration # and host information. include $(BUILD_SYSTEM)/config.mk ifndef KATI ifdef USE_NINJA $(warning USE_NINJA is ignored. Ninja is always used.) endif # Mark this is a ninja build. $(shell mkdir -p $(OUT_DIR) && touch $(OUT_DIR)/ninja_build) include build/core/ninja.mk else # KATI ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),) dont_bother := true endif Loading Loading @@ -1149,4 +1133,3 @@ ndk: $(SOONG_OUT_DIR)/ndk.timestamp all_link_types: endif # KATI endif # USE_SOONG_UI
core/ninja.mkdeleted 100644 → 0 +0 −103 Original line number Diff line number Diff line include $(BUILD_SYSTEM)/soong.mk # Modifier goals we don't need to pass to Ninja. .PHONY : $(NINJA_EXCLUDE_GOALS) define replace_space_and_slash $(subst /,_,$(subst $(space),_,$(sort $1))) endef KATI_NINJA_SUFFIX := -$(TARGET_PRODUCT) ifneq ($(KATI_GOALS),) KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-$(call replace_space_and_slash,$(KATI_GOALS)) endif ifneq ($(ONE_SHOT_MAKEFILE),) KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmm-$(call replace_space_and_slash,$(ONE_SHOT_MAKEFILE)) endif my_checksum_suffix := my_ninja_suffix_too_long := $(filter 1, $(shell v='$(KATI_NINJA_SUFFIX)' && echo $$(($${$(pound)v} > 64)))) ifneq ($(my_ninja_suffix_too_long),) # Replace the suffix with a checksum if it gets too long. my_checksum_suffix := $(KATI_NINJA_SUFFIX) KATI_NINJA_SUFFIX := -$(word 1, $(shell echo $(my_checksum_suffix) | $(MD5SUM))) endif KATI_BUILD_NINJA := $(OUT_DIR)/build$(KATI_NINJA_SUFFIX).ninja KATI_ENV_SH := $(OUT_DIR)/env$(KATI_NINJA_SUFFIX).sh # Write out a file mapping checksum to the real suffix. ifneq ($(my_checksum_suffix),) my_ninja_suffix_file := $(basename $(KATI_BUILD_NINJA)).suf $(shell mkdir -p $(dir $(my_ninja_suffix_file)) && \ echo $(my_checksum_suffix) > $(my_ninja_suffix_file)) endif ifeq (,$(NINJA_STATUS)) NINJA_STATUS := [%p %f/%t]$(space) endif NINJA_EXTRA_ARGS := ifneq (,$(filter showcommands,$(ORIGINAL_MAKECMDGOALS))) NINJA_EXTRA_ARGS += "-v" endif # Make multiple rules to generate the same target an error instead of # proceeding with undefined behavior. NINJA_EXTRA_ARGS += -w dupbuild=err ifneq ($(filter-out false,$(USE_GOMA)),) KATI_MAKEPARALLEL := $(MAKEPARALLEL) # Ninja runs remote jobs (i.e., commands which contain gomacc) with # this parallelism. Note the parallelism of all other jobs is still # limited by the -j flag passed to GNU make. NINJA_REMOTE_NUM_JOBS ?= 500 NINJA_EXTRA_ARGS += -j$(NINJA_REMOTE_NUM_JOBS) else NINJA_MAKEPARALLEL := $(MAKEPARALLEL) --ninja # We never want Kati to see MAKEFLAGS, as forcefully overriding variables is # terrible. The variables in MAKEFLAGS are still available in the environment, # so if part of the build wants input from the user, it should be explicitly # checking for an environment variable or using ?= # # makeparallel already clears MAKEFLAGS, so it's not necessary in the GOMA case KATI_MAKEPARALLEL := MAKEFLAGS= endif NINJA_ARGS += $(NINJA_EXTRA_ARGS) COMBINED_BUILD_NINJA := $(OUT_DIR)/combined$(KATI_NINJA_SUFFIX).ninja $(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA) FORCE $(hide) echo "builddir = $(OUT_DIR)" > $(COMBINED_BUILD_NINJA) $(hide) echo "include $(KATI_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA) $(hide) echo "include $(SOONG_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA) $(hide) echo "build $(COMBINED_BUILD_NINJA): phony $(SOONG_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA) $(sort $(DEFAULT_GOAL) $(ANDROID_GOALS)) : ninja_wrapper @#empty .PHONY: ninja_wrapper ninja_wrapper: $(COMBINED_BUILD_NINJA) $(MAKEPARALLEL) @echo Starting build with ninja +$(hide) export NINJA_STATUS="$(NINJA_STATUS)" && source $(KATI_ENV_SH) && exec $(NINJA_MAKEPARALLEL) $(NINJA) -d keepdepfile $(NINJA_GOALS) -C $(TOP) -f $(COMBINED_BUILD_NINJA) $(NINJA_ARGS) # Dummy Android.mk and CleanSpec.mk files so that kati won't recurse into the # out directory DUMMY_OUT_MKS := $(OUT_DIR)/Android.mk $(OUT_DIR)/CleanSpec.mk $(DUMMY_OUT_MKS): @mkdir -p $(dir $@) $(hide) echo '# This file prevents findleaves.py from traversing this directory further' >$@ KATI_FIND_EMULATOR := --use_find_emulator ifeq ($(KATI_EMULATE_FIND),false) KATI_FIND_EMULATOR := endif $(KATI_BUILD_NINJA): $(CKATI) $(MAKEPARALLEL) $(DUMMY_OUT_MKS) run_soong FORCE @echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja... +$(hide) $(KATI_MAKEPARALLEL) $(CKATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --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) SOONG_MAKEVARS_MK=$(SOONG_MAKEVARS_MK) .PHONY: FORCE FORCE:
core/soong.mkdeleted 100644 → 0 +0 −29 Original line number Diff line number Diff line # 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 ifneq ($(strip $(shell build/soong/scripts/reverse_path.py $(SOONG_OUT_DIR))),$(strip $(shell source $(SOONG_BOOTSTRAP); echo $$SRCDIR_FROM_BUILDDIR))) SOONG_NEEDS_REBOOTSTRAP := FORCE $(warning reverse path changed) endif endif # Bootstrap soong. $(SOONG_BOOTSTRAP): bootstrap.bash $(SOONG_NEEDS_REBOOTSTRAP) $(hide) mkdir -p $(dir $@) $(hide) BUILDDIR=$(SOONG_OUT_DIR) ./bootstrap.bash # Tell soong that it is embedded in make $(SOONG_IN_MAKE): $(hide) mkdir -p $(dir $@) $(hide) touch $@ # Run Soong, this implicitly create an Android.mk listing all soong outputs as # prebuilts. .PHONY: run_soong run_soong: $(SOONG_BOOTSTRAP) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE $(hide) SKIP_NINJA=true $(SOONG)