blob: 28ac714e84569f77b82a5736b7ebd04589f84267 [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
Raphael Moll3fb225f2012-04-23 13:15:56 -070022# Define WIN_SDK_TARGETS (the list of targets located in topdir/sdk)
23# and the WIN_SDK_BUILD_PREREQ (the list of build prerequisites)
24# that are tools-dependent and not platform-dependent.
Raphael Moll1fe58f32010-11-11 15:58:28 -080025include $(TOPDIR)sdk/build/windows_sdk_tools.mk
26
Raphaele07f59a2011-09-14 21:12:15 -070027# This is the list of targets that we want to generate as
28# Windows executables. All the targets specified here are located in
29# the topdir/development directory and are somehow platform-dependent.
Raphael16ede622010-04-16 17:37:25 -070030WIN_TARGETS := \
Adam Lesinski355f9712016-03-10 20:08:15 -080031 aapt \
32 aapt2 \
33 adb \
34 aidl \
Leandro Gracia Gil653fe8e2014-07-28 15:25:41 -070035 aprotoc \
Stephen Hines3f2caae2014-09-29 18:06:39 -070036 bcc_compat \
Stephen Hineseb8b46d2015-06-25 02:54:08 -070037 clang \
Raphael Moll1fe58f32010-11-11 15:58:28 -080038 etc1tool \
Raphael16ede622010-04-16 17:37:25 -070039 dexdump dmtracedump \
40 fastboot \
41 hprof-conv \
Adam Lesinski8bb66e62016-11-08 11:39:47 -080042 libaapt2_jni \
Stephen Hines3f2caae2014-09-29 18:06:39 -070043 llvm-rs-cc \
Raphael Moll1fe58f32010-11-11 15:58:28 -080044 sqlite3 \
45 zipalign \
Adam Lesinskid155da92014-11-04 14:10:51 -080046 split-select \
Raphael Moll1fe58f32010-11-11 15:58:28 -080047 $(WIN_SDK_TARGETS)
Stephen Hines3f2caae2014-09-29 18:06:39 -070048
Dan Willemsen349f8912015-08-18 15:38:24 -070049WIN_TARGETS := $(foreach t,$(WIN_TARGETS),$(ALL_MODULES.host_cross_$(t).INSTALLED))
Raphael32d597b2011-01-13 16:59:09 -080050
Raphael2ff496b2011-02-15 16:08:36 -080051# MAIN_SDK_NAME/DIR is set in build/core/Makefile
Ying Wange7db9442014-06-09 15:03:04 -070052WIN_SDK_NAME := $(subst $(HOST_OS)-$(SDK_HOST_ARCH),windows,$(MAIN_SDK_NAME))
53WIN_SDK_DIR := $(subst $(HOST_OS)-$(SDK_HOST_ARCH),windows,$(MAIN_SDK_DIR))
Raphael2ff496b2011-02-15 16:08:36 -080054WIN_SDK_ZIP := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip
Raphael16ede622010-04-16 17:37:25 -070055
Raphael2ff496b2011-02-15 16:08:36 -080056$(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP))
Raphael16ede622010-04-16 17:37:25 -070057
Dan Willemsenb401d6b2017-04-04 17:19:13 -070058# b/36697262 - we want the 64-bit libaapt2_jni and its dependencies
59ifdef HOST_CROSS_2ND_ARCH
60$(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_libaapt2_jni$(HOST_CROSS_2ND_ARCH_MODULE_SUFFIX).BUILT):lib64/libaapt2_jni.dll)
61$(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)
62endif
63
Raphael16ede622010-04-16 17:37:25 -070064.PHONY: win_sdk winsdk-tools
65
66define winsdk-banner
67$(info )
68$(info ====== [Windows SDK] $1 ======)
69$(info )
70endef
71
72define winsdk-info
Raphael2ff496b2011-02-15 16:08:36 -080073$(info MAIN_SDK_NAME: $(MAIN_SDK_NAME))
74$(info WIN_SDK_NAME : $(WIN_SDK_NAME))
75$(info WIN_SDK_DIR : $(WIN_SDK_DIR))
76$(info WIN_SDK_ZIP : $(WIN_SDK_ZIP))
Raphael16ede622010-04-16 17:37:25 -070077endef
78
79win_sdk: $(WIN_SDK_ZIP)
80 $(call winsdk-banner,Done)
81
Dan Willemsen349f8912015-08-18 15:38:24 -070082winsdk-tools: $(WIN_TARGETS)
83 $(call winsdk-banner,Tools Done)
Raphael16ede622010-04-16 17:37:25 -070084
Dan Willemsen349f8912015-08-18 15:38:24 -070085$(WIN_SDK_ZIP): $(WIN_TARGETS) $(INTERNAL_SDK_TARGET)
Raphael16ede622010-04-16 17:37:25 -070086 $(call winsdk-banner,Build $(WIN_SDK_NAME))
87 $(call winsdk-info)
88 $(hide) rm -rf $(WIN_SDK_DIR)
89 $(hide) mkdir -p $(WIN_SDK_DIR)
Raphael2ff496b2011-02-15 16:08:36 -080090 $(hide) cp -rf $(MAIN_SDK_DIR)/$(MAIN_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME)
Raphael16ede622010-04-16 17:37:25 -070091 $(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \
Raphael Moll9ca69cf2013-02-12 13:48:39 -080092 PLATFORM_VERSION=$(PLATFORM_VERSION) \
Raphael0e2de352011-02-01 13:29:18 -080093 $(TOPDIR)development/build/tools/patch_windows_sdk.sh $(subst @,-q,$(hide)) \
Raphael16ede622010-04-16 17:37:25 -070094 $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR)
Raphael Moll9ca69cf2013-02-12 13:48:39 -080095 $(hide) PLATFORM_VERSION=$(PLATFORM_VERSION) \
96 $(TOPDIR)sdk/build/patch_windows_sdk.sh $(subst @,-q,$(hide)) \
Raphael Moll1fe58f32010-11-11 15:58:28 -080097 $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR)
Raphael16ede622010-04-16 17:37:25 -070098 $(hide) ( \
99 cd $(WIN_SDK_DIR) && \
100 rm -f $(WIN_SDK_NAME).zip && \
101 zip -rq $(subst @,-q,$(hide)) $(WIN_SDK_NAME).zip $(WIN_SDK_NAME) \
102 )
103 @echo "Windows SDK generated at $(WIN_SDK_ZIP)"