blob: afe21c94c96de7a2c82210a29764c4c114dc6abb [file] [log] [blame]
Raphael16ede622010-04-16 17:37:25 -07001# Makefile to build the Windows SDK under linux.
2#
3# This file is included by build/core/Makefile when a PRODUCT-sdk-win_sdk build
4# is requested.
5#
6# Summary of operations:
7# - create a regular Linux SDK
8# - build a few Windows tools
9# - mirror the linux SDK directory and patch it with the Windows tools
10#
11# This way we avoid the headache of building a full SDK in MinGW mode, which is
12# made complicated by the fact the build system does not support cross-compilation.
13
Dan Willemsencb994dd2015-08-13 14:26:32 -070014# We can only use this under Linux
Raphael16ede622010-04-16 17:37:25 -070015ifneq ($(shell uname),Linux)
16$(error Linux is required to create a Windows SDK)
17endif
Raphael Moll1fe58f32010-11-11 15:58:28 -080018ifeq ($(strip $(shell which unix2dos todos 2>/dev/null)),)
Raphael16ede622010-04-16 17:37:25 -070019$(error Need a unix2dos command. Please 'apt-get install tofrodos')
20endif
21
Raphaele07f59a2011-09-14 21:12:15 -070022# This is the list of targets that we want to generate as
23# Windows executables. All the targets specified here are located in
24# the topdir/development directory and are somehow platform-dependent.
Raphael16ede622010-04-16 17:37:25 -070025WIN_TARGETS := \
Adam Lesinski355f9712016-03-10 20:08:15 -080026 aapt \
27 aapt2 \
28 adb \
29 aidl \
Leandro Gracia Gil653fe8e2014-07-28 15:25:41 -070030 aprotoc \
Stephen Hines3f2caae2014-09-29 18:06:39 -070031 bcc_compat \
Stephen Hineseb8b46d2015-06-25 02:54:08 -070032 clang \
Raphael Moll1fe58f32010-11-11 15:58:28 -080033 etc1tool \
Raphael16ede622010-04-16 17:37:25 -070034 dexdump dmtracedump \
35 fastboot \
36 hprof-conv \
Adam Lesinski8bb66e62016-11-08 11:39:47 -080037 libaapt2_jni \
Stephen Hines3f2caae2014-09-29 18:06:39 -070038 llvm-rs-cc \
Raphael Moll1fe58f32010-11-11 15:58:28 -080039 sqlite3 \
40 zipalign \
Dan Willemsen844cfa42018-08-28 00:10:48 -070041 split-select
Stephen Hines3f2caae2014-09-29 18:06:39 -070042
Dan Willemsen349f8912015-08-18 15:38:24 -070043WIN_TARGETS := $(foreach t,$(WIN_TARGETS),$(ALL_MODULES.host_cross_$(t).INSTALLED))
Raphael32d597b2011-01-13 16:59:09 -080044
Raphael2ff496b2011-02-15 16:08:36 -080045# MAIN_SDK_NAME/DIR is set in build/core/Makefile
Ying Wange7db9442014-06-09 15:03:04 -070046WIN_SDK_NAME := $(subst $(HOST_OS)-$(SDK_HOST_ARCH),windows,$(MAIN_SDK_NAME))
47WIN_SDK_DIR := $(subst $(HOST_OS)-$(SDK_HOST_ARCH),windows,$(MAIN_SDK_DIR))
Raphael2ff496b2011-02-15 16:08:36 -080048WIN_SDK_ZIP := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip
Raphael16ede622010-04-16 17:37:25 -070049
Raphael2ff496b2011-02-15 16:08:36 -080050$(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP))
Raphael16ede622010-04-16 17:37:25 -070051
Dan Willemsenb401d6b2017-04-04 17:19:13 -070052# b/36697262 - we want the 64-bit libaapt2_jni and its dependencies
53ifdef HOST_CROSS_2ND_ARCH
54$(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_libaapt2_jni$(HOST_CROSS_2ND_ARCH_MODULE_SUFFIX).BUILT):lib64/libaapt2_jni.dll)
55$(call dist-for-goals, win_sdk, prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/bin/libwinpthread-1.dll:lib64/libwinpthread-1.dll)
56endif
57
Raphael16ede622010-04-16 17:37:25 -070058.PHONY: win_sdk winsdk-tools
59
Raphael16ede622010-04-16 17:37:25 -070060win_sdk: $(WIN_SDK_ZIP)
Raphael16ede622010-04-16 17:37:25 -070061
Dan Willemsen349f8912015-08-18 15:38:24 -070062winsdk-tools: $(WIN_TARGETS)
Raphael16ede622010-04-16 17:37:25 -070063
Dan Willemsen844cfa42018-08-28 00:10:48 -070064$(WIN_SDK_ZIP): $(WIN_TARGETS) $(INTERNAL_SDK_TARGET) $(SOONG_ZIP) \
65 $(HOST_OUT_EXECUTABLES)/atree \
66 development/build/tools/patch_windows_sdk.sh \
67 development/build/sdk-windows-x86.atree
68 @echo Build Windows SDK $(WIN_SDK_NAME)
69 $(hide) rm -rf $(WIN_SDK_DIR) $@
Raphael16ede622010-04-16 17:37:25 -070070 $(hide) mkdir -p $(WIN_SDK_DIR)
Raphael2ff496b2011-02-15 16:08:36 -080071 $(hide) cp -rf $(MAIN_SDK_DIR)/$(MAIN_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME)
Raphael16ede622010-04-16 17:37:25 -070072 $(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \
Raphael Moll9ca69cf2013-02-12 13:48:39 -080073 PLATFORM_VERSION=$(PLATFORM_VERSION) \
Dan Willemsen844cfa42018-08-28 00:10:48 -070074 ATREE_STRIP=$(HOST_STRIP) \
75 development/build/tools/patch_windows_sdk.sh -q \
Raphael16ede622010-04-16 17:37:25 -070076 $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR)
Dan Willemsen844cfa42018-08-28 00:10:48 -070077 $(hide) $(SOONG_ZIP) -d -C $(WIN_SDK_DIR) -D $(WIN_SDK_DIR)/$(WIN_SDK_NAME) -o $@