From 9ca1628e3f565607e1fdef71b570d3ddb5ec09df Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 16 Apr 2010 17:50:09 -0700 Subject: [PATCH] Support building Windows SDK under Linux. - envsetup.mk & config.mk: we define a new BUILD_OS and a minimal set of things like BUILD_OUT to be able to use some local tools when doing cross-compilation. This allows us to use the Linux version of ACP when cross-compiling the tools to Windows. - Makfile: include windows_sdk.mk when needed to build a Windows SDK. - main.mk: support a win_sdk target (e.g. PRODUCT-sdk-win_sdk) (Merge master Change I9d08d0df) --- core/Makefile | 9 +++++++++ core/config.mk | 4 +++- core/envsetup.mk | 14 ++++++++++++++ core/main.mk | 4 ++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/core/Makefile b/core/Makefile index 082399508..9cb8c82a6 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1246,6 +1246,15 @@ $(INTERNAL_SDK_TARGET): $(deps) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \ ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 ) + +# Is a Windows SDK requested? If so, we need some definitions from here +# in order to find the Linux SDK used to create the Windows one. +ifneq ($(filter win_sdk,$(MAKECMDGOALS)),) +LINUX_SDK_NAME := $(sdk_name) +LINUX_SDK_DIR := $(sdk_dir) +include $(TOPDIR)development/build/tools/windows_sdk.mk +endif + endif # !simulator # ----------------------------------------------------------------- diff --git a/core/config.mk b/core/config.mk index 3eddc139d..a4d3154f0 100644 --- a/core/config.mk +++ b/core/config.mk @@ -195,7 +195,6 @@ LEX:= flex YACC:= bison -d DOXYGEN:= doxygen AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX) -ACP := $(HOST_OUT_EXECUTABLES)/acp$(HOST_EXECUTABLE_SUFFIX) AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX) ICUDATA := $(HOST_OUT_EXECUTABLES)/icudata$(HOST_EXECUTABLE_SUFFIX) SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) @@ -214,6 +213,9 @@ JARJAR := java -jar $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar PROGUARD := external/proguard/bin/proguard.sh JAVATAGS := build/tools/java-event-log-tags.py +# ACP is always for the build OS, not for the host OS +ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX) + # dx is java behind a shell script; no .exe necessary. DX := $(HOST_OUT_EXECUTABLES)/dx KCM := $(HOST_OUT_EXECUTABLES)/kcm$(HOST_EXECUTABLE_SUFFIX) diff --git a/core/envsetup.mk b/core/envsetup.mk index 6d14753c1..f8a202745 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -68,9 +68,17 @@ endif ifneq (,$(findstring CYGWIN,$(UNAME))) HOST_OS := windows endif + +# BUILD_OS is the real host doing the build. +BUILD_OS := $(HOST_OS) + +# Under Linux, if USE_MINGW is set, we change HOST_OS to Windows to build the +# Windows SDK. Only a subset of tools and SDK will manage to build properly. +ifeq ($(HOST_OS),linux) ifneq ($(USE_MINGW),) HOST_OS := windows endif +endif ifeq ($(HOST_OS),) $(error Unable to determine HOST_OS from uname -sm: $(UNAME)!) @@ -86,6 +94,8 @@ ifneq (,$(findstring Power,$(UNAME))) HOST_ARCH := ppc endif +BUILD_ARCH := $(HOST_ARCH) + ifeq ($(HOST_ARCH),) $(error Unable to determine HOST_ARCH from uname -sm: $(UNAME)!) endif @@ -168,6 +178,8 @@ HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_ARCH) HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_ARCH) HOST_OUT := $(HOST_OUT_$(HOST_BUILD_TYPE)) +BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(BUILD_ARCH) + ifeq ($(TARGET_SIMULATOR),true) # Any arch- or os-specific parts of the simulator (everything # under product/) are actually host-dependent. @@ -185,6 +197,8 @@ PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_DEVICE) OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs +BUILD_OUT_EXECUTABLES:= $(BUILD_OUT)/bin + HOST_OUT_EXECUTABLES:= $(HOST_OUT)/bin HOST_OUT_SHARED_LIBRARIES:= $(HOST_OUT)/lib HOST_OUT_JAVA_LIBRARIES:= $(HOST_OUT)/framework diff --git a/core/main.mk b/core/main.mk index 014c0501e..f830f03c1 100644 --- a/core/main.mk +++ b/core/main.mk @@ -179,6 +179,9 @@ is_sdk_build := ifneq ($(filter sdk,$(MAKECMDGOALS)),) is_sdk_build := true endif +ifneq ($(filter win_sdk,$(MAKECMDGOALS)),) +is_sdk_build := true +endif ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),) is_sdk_build := true endif @@ -254,6 +257,7 @@ ifdef is_sdk_build ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1) $(error The 'sdk' target may not be specified with any other targets) endif + # TODO: this should be eng I think. Since the sdk is built from the eng # variant. tags_to_install := user debug eng -- 2.11.0