Raphael | 16ede62 | 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 Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 21 | ifeq ($(strip $(shell which unix2dos todos 2>/dev/null)),) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 22 | $(error Need a unix2dos command. Please 'apt-get install tofrodos') |
| 23 | endif |
| 24 | |
Raphael | e07f59a | 2011-09-14 21:12:15 -0700 | [diff] [blame] | 25 | # Define WIN_SDK_TARGETS, the list of targets located in topdir/sdk |
| 26 | # and are tools-dependent, not platform-dependent. |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 27 | include $(TOPDIR)sdk/build/windows_sdk_tools.mk |
| 28 | |
Raphael | e07f59a | 2011-09-14 21:12:15 -0700 | [diff] [blame] | 29 | # This is the list of targets that we want to generate as |
| 30 | # Windows executables. All the targets specified here are located in |
| 31 | # the topdir/development directory and are somehow platform-dependent. |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 32 | WIN_TARGETS := \ |
| 33 | aapt adb aidl \ |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 34 | etc1tool \ |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 35 | dexdump dmtracedump \ |
| 36 | fastboot \ |
| 37 | hprof-conv \ |
Raphael | 32d597b | 2011-01-13 16:59:09 -0800 | [diff] [blame] | 38 | llvm-rs-cc \ |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 39 | prebuilt \ |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 40 | sqlite3 \ |
| 41 | zipalign \ |
| 42 | $(WIN_SDK_TARGETS) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 43 | |
Raphael | 32d597b | 2011-01-13 16:59:09 -0800 | [diff] [blame] | 44 | # This is the list of *Linux* build tools that we need |
| 45 | # in order to be able to make the WIN_TARGETS. They are |
| 46 | # build prerequisites. |
| 47 | WIN_BUILD_PREREQ := \ |
| 48 | acp \ |
| 49 | llvm-rs-cc |
| 50 | |
| 51 | |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 52 | # MAIN_SDK_NAME/DIR is set in build/core/Makefile |
| 53 | WIN_SDK_NAME := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_NAME)) |
| 54 | WIN_SDK_DIR := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_DIR)) |
| 55 | WIN_SDK_ZIP := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 56 | |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 57 | $(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP)) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 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 |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 68 | $(info MAIN_SDK_NAME: $(MAIN_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)) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 72 | endef |
| 73 | |
| 74 | win_sdk: $(WIN_SDK_ZIP) |
| 75 | $(call winsdk-banner,Done) |
| 76 | |
Raphael | 32d597b | 2011-01-13 16:59:09 -0800 | [diff] [blame] | 77 | winsdk-tools: $(WIN_BUILD_PREREQ) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 78 | $(call winsdk-banner,Build Windows Tools) |
Ying Wang | b058af0 | 2011-03-11 13:59:34 -0800 | [diff] [blame] | 79 | $(hide) USE_MINGW=1 USE_CCACHE="" $(MAKE) PRODUCT-$(TARGET_PRODUCT)-$(strip $(WIN_TARGETS)) $(if $(hide),,showcommands) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 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) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 86 | $(hide) cp -rf $(MAIN_SDK_DIR)/$(MAIN_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 87 | $(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \ |
Raphael | 0e2de35 | 2011-02-01 13:29:18 -0800 | [diff] [blame] | 88 | $(TOPDIR)development/build/tools/patch_windows_sdk.sh $(subst @,-q,$(hide)) \ |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 89 | $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR) |
Raphael | 0e2de35 | 2011-02-01 13:29:18 -0800 | [diff] [blame] | 90 | $(hide) $(TOPDIR)sdk/build/patch_windows_sdk.sh $(subst @,-q,$(hide)) \ |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 91 | $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 92 | $(hide) ( \ |
| 93 | cd $(WIN_SDK_DIR) && \ |
| 94 | rm -f $(WIN_SDK_NAME).zip && \ |
| 95 | zip -rq $(subst @,-q,$(hide)) $(WIN_SDK_NAME).zip $(WIN_SDK_NAME) \ |
| 96 | ) |
| 97 | @echo "Windows SDK generated at $(WIN_SDK_ZIP)" |