Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 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 |
Raphael | 1adaa57 | 2011-01-27 13:26:44 -0800 | [diff] [blame] | 21 | ifeq ($(strip $(shell which unix2dos todos 2>/dev/null)),) |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 22 | $(error Need a unix2dos command. Please 'apt-get install tofrodos') |
| 23 | endif |
| 24 | |
| 25 | WIN_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 | |
Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 36 | # MAIN_SDK_NAME/DIR is set in build/core/Makefile |
| 37 | WIN_SDK_NAME := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_NAME)) |
| 38 | WIN_SDK_DIR := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_DIR)) |
| 39 | WIN_SDK_ZIP := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 40 | |
| 41 | $(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP)) |
| 42 | |
| 43 | .PHONY: win_sdk winsdk-tools |
| 44 | |
| 45 | define winsdk-banner |
| 46 | $(info ) |
| 47 | $(info ====== [Windows SDK] $1 ======) |
| 48 | $(info ) |
| 49 | endef |
| 50 | |
| 51 | define winsdk-info |
Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 52 | $(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)) |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 56 | endef |
| 57 | |
| 58 | win_sdk: $(WIN_SDK_ZIP) |
| 59 | $(call winsdk-banner,Done) |
| 60 | |
| 61 | winsdk-tools: acp |
| 62 | $(call winsdk-banner,Build Windows Tools) |
Ying Wang | 1a6a849 | 2011-03-10 18:25:51 -0800 | [diff] [blame] | 63 | $(hide) USE_MINGW=1 USE_CCACHE="" $(MAKE) PRODUCT-$(TARGET_PRODUCT)-$(strip $(WIN_TARGETS)) |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 64 | |
| 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) |
Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 70 | $(hide) cp -rf $(MAIN_SDK_DIR)/$(MAIN_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME) |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 71 | $(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)" |