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)
diff --git a/core/Makefile b/core/Makefile
index 0823995..9cb8c82 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1246,6 +1246,15 @@
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 3eddc13..a4d3154 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -195,7 +195,6 @@
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 @@
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 6d14753..f8a2027 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -68,9 +68,17 @@
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 @@
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_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 @@
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 014c050..f830f03 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -179,6 +179,9 @@
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 @@
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