OSDN Git Service

am 1717afbc: am 072bca5b: Add Tag app to eclipse classpath
[android-x86/development.git] / build / tools / windows_sdk.mk
1 # 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.
15 ifneq ($(shell uname),Linux)
16 $(error Linux is required to create a Windows SDK)
17 endif
18 ifeq ($(strip $(shell which i586-mingw32msvc-gcc 2>/dev/null)),)
19 $(error MinGW is required to build a Windows SDK. Please 'apt-get install mingw32')
20 endif
21 ifeq ($(strip $(shell which unix2dos todos 2>/dev/null)),)
22 $(error Need a unix2dos command. Please 'apt-get install tofrodos')
23 endif
24
25 include $(TOPDIR)sdk/build/windows_sdk_tools.mk
26
27 # This is the list of target that we want to generate as
28 # Windows executables.
29 WIN_TARGETS := \
30         aapt adb aidl \
31         etc1tool \
32         dexdump dmtracedump \
33         fastboot \
34         hprof-conv \
35         llvm-rs-cc \
36         prebuilt \
37         sqlite3 \
38         zipalign \
39         $(WIN_SDK_TARGETS)
40
41 # This is the list of *Linux* build tools that we need
42 # in order to be able to make the WIN_TARGETS. They are
43 # build prerequisites.
44 WIN_BUILD_PREREQ := \
45         acp \
46         llvm-rs-cc
47
48
49 # LINUX_SDK_NAME/DIR is set in build/core/Makefile
50 WIN_SDK_NAME  := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(LINUX_SDK_NAME))
51 WIN_SDK_DIR   := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(LINUX_SDK_DIR))
52 WIN_SDK_ZIP   := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip
53
54 # Also dist $(INTERNAL_SDK_TARGET), which is the original linux sdk package.
55 # INTERNAL_SDK_TARGET is defined in build/core/Makefile.
56 $(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP) \
57     $(INTERNAL_SDK_TARGET))
58
59 .PHONY: win_sdk winsdk-tools
60
61 define winsdk-banner
62 $(info )
63 $(info ====== [Windows SDK] $1 ======)
64 $(info )
65 endef
66
67 define winsdk-info
68 $(info LINUX_SDK_NAME: $(LINUX_SDK_NAME))
69 $(info WIN_SDK_NAME  : $(WIN_SDK_NAME))
70 $(info WIN_SDK_DIR   : $(WIN_SDK_DIR))
71 $(info WIN_SDK_ZIP   : $(WIN_SDK_ZIP))
72 endef
73
74 win_sdk: $(WIN_SDK_ZIP)
75         $(call winsdk-banner,Done)
76
77 winsdk-tools: $(WIN_BUILD_PREREQ)
78         $(call winsdk-banner,Build Windows Tools)
79         $(hide) USE_MINGW=1 $(MAKE) PRODUCT-$(TARGET_PRODUCT)-$(strip $(WIN_TARGETS))
80
81 $(WIN_SDK_ZIP): winsdk-tools sdk
82         $(call winsdk-banner,Build $(WIN_SDK_NAME))
83         $(call winsdk-info)
84         $(hide) rm -rf $(WIN_SDK_DIR)
85         $(hide) mkdir -p $(WIN_SDK_DIR)
86         $(hide) cp -rf $(LINUX_SDK_DIR)/$(LINUX_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME)
87         $(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \
88                 $(TOPDIR)development/build/tools/patch_windows_sdk.sh \
89                 $(subst @,-q,$(hide)) \
90                 $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR)
91         $(hide) \
92                 $(TOPDIR)sdk/build/patch_windows_sdk.sh \
93                 $(subst @,-q,$(hide)) \
94                 $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR)
95         $(hide) ( \
96                 cd $(WIN_SDK_DIR) && \
97                 rm -f $(WIN_SDK_NAME).zip && \
98                 zip -rq $(subst @,-q,$(hide)) $(WIN_SDK_NAME).zip $(WIN_SDK_NAME) \
99                 )
100         @echo "Windows SDK generated at $(WIN_SDK_ZIP)"