Merge "Allow building kati & makeparallel with soong"

am: 77cde9e244

* commit '77cde9e244de9b043793ef528818de0ffea862e1':
  Allow building kati & makeparallel with soong
This commit is contained in:
Dan Willemsen 2016-01-14 02:05:24 +00:00 committed by android-build-merger
commit 766eeb747e
3 changed files with 45 additions and 4 deletions

View file

@ -1,6 +1,15 @@
NINJA ?= prebuilts/ninja/$(HOST_PREBUILT_TAG)/ninja
ifeq ($(USE_SOONG),true)
USE_SOONG_FOR_KATI := true
endif
ifeq ($(USE_SOONG_FOR_KATI),true)
include $(BUILD_SYSTEM)/soong.mk
else
KATI ?= $(HOST_OUT_EXECUTABLES)/ckati KATI ?= $(HOST_OUT_EXECUTABLES)/ckati
MAKEPARALLEL ?= $(HOST_OUT_EXECUTABLES)/makeparallel MAKEPARALLEL ?= $(HOST_OUT_EXECUTABLES)/makeparallel
NINJA ?= prebuilts/ninja/$(HOST_PREBUILT_TAG)/ninja endif
KATI_OUTPUT_PATTERNS := $(OUT_DIR)/build%.ninja $(OUT_DIR)/ninja%.sh KATI_OUTPUT_PATTERNS := $(OUT_DIR)/build%.ninja $(OUT_DIR)/ninja%.sh
@ -119,8 +128,6 @@ NINJA_MAKEPARALLEL := $(MAKEPARALLEL) --ninja
endif endif
ifeq ($(USE_SOONG),true) ifeq ($(USE_SOONG),true)
include $(BUILD_SYSTEM)/soong.mk
COMBINED_BUILD_NINJA := $(OUT_DIR)/combined$(KATI_NINJA_SUFFIX).ninja COMBINED_BUILD_NINJA := $(OUT_DIR)/combined$(KATI_NINJA_SUFFIX).ninja
$(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA) $(SOONG_ANDROID_MK) $(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA) $(SOONG_ANDROID_MK)
@ -147,6 +154,7 @@ $(KATI_BUILD_NINJA): $(KATI) $(MAKEPARALLEL) $(SOONG_ANDROID_MK) FORCE
@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja... @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)/% --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) +$(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)
ifneq ($(USE_SOONG_FOR_KATI),true)
KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS) KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS)
KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS) KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)
# Build static ckati. Unfortunately Mac OS X doesn't officially support static exectuables. # Build static ckati. Unfortunately Mac OS X doesn't officially support static exectuables.
@ -168,6 +176,7 @@ endif
MAKEPARALLEL_INTERMEDIATES_PATH := $(HOST_OUT_INTERMEDIATES)/EXECUTABLES/makeparallel_intermediates MAKEPARALLEL_INTERMEDIATES_PATH := $(HOST_OUT_INTERMEDIATES)/EXECUTABLES/makeparallel_intermediates
MAKEPARALLEL_BIN_PATH := $(HOST_OUT_EXECUTABLES) MAKEPARALLEL_BIN_PATH := $(HOST_OUT_EXECUTABLES)
include build/tools/makeparallel/Makefile include build/tools/makeparallel/Makefile
endif
.PHONY: FORCE .PHONY: FORCE
FORCE: FORCE:

View file

@ -4,6 +4,9 @@ SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja
SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android.mk SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android.mk
SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables
SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make
SOONG_HOST_EXECUTABLES := $(SOONG_OUT_DIR)/host/$(HOST_PREBUILT_TAG)/bin
KATI := $(SOONG_HOST_EXECUTABLES)/ckati
MAKEPARALLEL := $(SOONG_HOST_EXECUTABLES)/makeparallel
ifeq (,$(filter /%,$(SOONG_OUT_DIR))) ifeq (,$(filter /%,$(SOONG_OUT_DIR)))
SOONG_TOP_RELPATH := $(shell python -c "import os; print os.path.relpath('$(TOP)', '$(SOONG_OUT_DIR)')") SOONG_TOP_RELPATH := $(shell python -c "import os; print os.path.relpath('$(TOP)', '$(SOONG_OUT_DIR)')")
@ -57,4 +60,7 @@ $(SOONG_IN_MAKE):
# Build an Android.mk listing all soong outputs as prebuilts # Build an Android.mk listing all soong outputs as prebuilts
$(SOONG_ANDROID_MK): $(SOONG) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE $(SOONG_ANDROID_MK): $(SOONG) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE
$(hide) $(SOONG) $(SOONG_BUILD_NINJA) $(NINJA_ARGS) $(hide) $(SOONG) $(KATI) $(MAKEPARALLEL) $(NINJA_ARGS)
$(KATI): $(SOONG_ANDROID_MK)
$(MAKEPARALLEL): $(SOONG_ANDROID_MK)

View file

@ -0,0 +1,26 @@
// Copyright 2016 Google Inc. All rights reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
cc_binary_host {
name: "makeparallel",
srcs: [
"makeparallel.cpp",
],
cflags: ["-Wall", "-Werror"],
target: {
linux: {
host_ldlibs: ["-lrt", "-lpthread"],
},
},
}