blob: eb5b53e79109702ecf0207c91fae4bf61a959a50 [file] [log] [blame]
Raphael0e4dd612010-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
14# We can only use this under Linux with the mingw32 package installed.
15ifneq ($(shell uname),Linux)
16$(error Linux is required to create a Windows SDK)
17endif
18ifeq ($(strip $(shell which i586-mingw32msvc-gcc 2>/dev/null)),)
19$(error MinGW is required to build a Windows SDK. Please 'apt-get install mingw32')
20endif
Raphael1adaa572011-01-27 13:26:44 -080021ifeq ($(strip $(shell which unix2dos todos 2>/dev/null)),)
Raphael0e4dd612010-04-16 17:37:25 -070022$(error Need a unix2dos command. Please 'apt-get install tofrodos')
23endif
24
25WIN_TARGETS := \
26 aapt adb aidl \
27 emulator etc1tool \
28 dexdump dmtracedump \
29 fastboot \
30 hprof-conv \
31 mksdcard \
32 prebuilt \
33 sdklauncher sqlite3 \
34 zipalign
35
Raphael922ee892011-02-15 16:08:36 -080036# MAIN_SDK_NAME/DIR is set in build/core/Makefile
37WIN_SDK_NAME := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_NAME))
38WIN_SDK_DIR := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_DIR))
39WIN_SDK_ZIP := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip
Raphael0e4dd612010-04-16 17:37:25 -070040
41$(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP))
42
43.PHONY: win_sdk winsdk-tools
44
45define winsdk-banner
46$(info )
47$(info ====== [Windows SDK] $1 ======)
48$(info )
49endef
50
51define winsdk-info
Raphael922ee892011-02-15 16:08:36 -080052$(info MAIN_SDK_NAME: $(MAIN_SDK_NAME))
53$(info WIN_SDK_NAME : $(WIN_SDK_NAME))
54$(info WIN_SDK_DIR : $(WIN_SDK_DIR))
55$(info WIN_SDK_ZIP : $(WIN_SDK_ZIP))
Raphael0e4dd612010-04-16 17:37:25 -070056endef
57
58win_sdk: $(WIN_SDK_ZIP)
59 $(call winsdk-banner,Done)
60
61winsdk-tools: acp
62 $(call winsdk-banner,Build Windows Tools)
Ying Wang1a6a8492011-03-10 18:25:51 -080063 $(hide) USE_MINGW=1 USE_CCACHE="" $(MAKE) PRODUCT-$(TARGET_PRODUCT)-$(strip $(WIN_TARGETS))
Raphael0e4dd612010-04-16 17:37:25 -070064
65$(WIN_SDK_ZIP): winsdk-tools sdk
66 $(call winsdk-banner,Build $(WIN_SDK_NAME))
67 $(call winsdk-info)
68 $(hide) rm -rf $(WIN_SDK_DIR)
69 $(hide) mkdir -p $(WIN_SDK_DIR)
Raphael922ee892011-02-15 16:08:36 -080070 $(hide) cp -rf $(MAIN_SDK_DIR)/$(MAIN_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME)
Raphael0e4dd612010-04-16 17:37:25 -070071 $(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \
72 $(TOPDIR)development/build/tools/patch_windows_sdk.sh \
73 $(subst @,-q,$(hide)) \
74 $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR)
75 $(hide) ( \
76 cd $(WIN_SDK_DIR) && \
77 rm -f $(WIN_SDK_NAME).zip && \
78 zip -rq $(subst @,-q,$(hide)) $(WIN_SDK_NAME).zip $(WIN_SDK_NAME) \
79 )
80 @echo "Windows SDK generated at $(WIN_SDK_ZIP)"