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 | |
Dan Willemsen | cb994dd | 2015-08-13 14:26:32 -0700 | [diff] [blame] | 14 | # We can only use this under Linux |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 15 | ifneq ($(shell uname),Linux) |
| 16 | $(error Linux is required to create a Windows SDK) |
| 17 | endif |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 18 | ifeq ($(strip $(shell which unix2dos todos 2>/dev/null)),) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 19 | $(error Need a unix2dos command. Please 'apt-get install tofrodos') |
| 20 | endif |
| 21 | |
Raphael Moll | 3fb225f | 2012-04-23 13:15:56 -0700 | [diff] [blame] | 22 | # 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 Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 25 | include $(TOPDIR)sdk/build/windows_sdk_tools.mk |
| 26 | |
Raphael | e07f59a | 2011-09-14 21:12:15 -0700 | [diff] [blame] | 27 | # 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. |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 30 | WIN_TARGETS := \ |
Adam Lesinski | 355f971 | 2016-03-10 20:08:15 -0800 | [diff] [blame] | 31 | aapt \ |
| 32 | aapt2 \ |
| 33 | adb \ |
| 34 | aidl \ |
Leandro Gracia Gil | 653fe8e | 2014-07-28 15:25:41 -0700 | [diff] [blame] | 35 | aprotoc \ |
Stephen Hines | 3f2caae | 2014-09-29 18:06:39 -0700 | [diff] [blame] | 36 | bcc_compat \ |
Stephen Hines | eb8b46d | 2015-06-25 02:54:08 -0700 | [diff] [blame] | 37 | clang \ |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 38 | etc1tool \ |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 39 | dexdump dmtracedump \ |
| 40 | fastboot \ |
| 41 | hprof-conv \ |
Adam Lesinski | 8bb66e6 | 2016-11-08 11:39:47 -0800 | [diff] [blame] | 42 | libaapt2_jni \ |
Stephen Hines | 3f2caae | 2014-09-29 18:06:39 -0700 | [diff] [blame] | 43 | llvm-rs-cc \ |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 44 | sqlite3 \ |
| 45 | zipalign \ |
Adam Lesinski | d155da9 | 2014-11-04 14:10:51 -0800 | [diff] [blame] | 46 | split-select \ |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 47 | $(WIN_SDK_TARGETS) |
Stephen Hines | 3f2caae | 2014-09-29 18:06:39 -0700 | [diff] [blame] | 48 | |
Dan Willemsen | 349f891 | 2015-08-18 15:38:24 -0700 | [diff] [blame] | 49 | WIN_TARGETS := $(foreach t,$(WIN_TARGETS),$(ALL_MODULES.host_cross_$(t).INSTALLED)) |
Raphael | 32d597b | 2011-01-13 16:59:09 -0800 | [diff] [blame] | 50 | |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 51 | # MAIN_SDK_NAME/DIR is set in build/core/Makefile |
Ying Wang | e7db944 | 2014-06-09 15:03:04 -0700 | [diff] [blame] | 52 | WIN_SDK_NAME := $(subst $(HOST_OS)-$(SDK_HOST_ARCH),windows,$(MAIN_SDK_NAME)) |
| 53 | WIN_SDK_DIR := $(subst $(HOST_OS)-$(SDK_HOST_ARCH),windows,$(MAIN_SDK_DIR)) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 54 | WIN_SDK_ZIP := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 55 | |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 56 | $(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP)) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 57 | |
Dan Willemsen | b401d6b | 2017-04-04 17:19:13 -0700 | [diff] [blame] | 58 | # b/36697262 - we want the 64-bit libaapt2_jni and its dependencies |
| 59 | ifdef 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) |
| 62 | endif |
| 63 | |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 64 | .PHONY: win_sdk winsdk-tools |
| 65 | |
| 66 | define winsdk-banner |
| 67 | $(info ) |
| 68 | $(info ====== [Windows SDK] $1 ======) |
| 69 | $(info ) |
| 70 | endef |
| 71 | |
| 72 | define winsdk-info |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 73 | $(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)) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 77 | endef |
| 78 | |
| 79 | win_sdk: $(WIN_SDK_ZIP) |
| 80 | $(call winsdk-banner,Done) |
| 81 | |
Dan Willemsen | 349f891 | 2015-08-18 15:38:24 -0700 | [diff] [blame] | 82 | winsdk-tools: $(WIN_TARGETS) |
| 83 | $(call winsdk-banner,Tools Done) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 84 | |
Dan Willemsen | 349f891 | 2015-08-18 15:38:24 -0700 | [diff] [blame] | 85 | $(WIN_SDK_ZIP): $(WIN_TARGETS) $(INTERNAL_SDK_TARGET) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 86 | $(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) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 90 | $(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] | 91 | $(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \ |
Raphael Moll | 9ca69cf | 2013-02-12 13:48:39 -0800 | [diff] [blame] | 92 | PLATFORM_VERSION=$(PLATFORM_VERSION) \ |
Raphael | 0e2de35 | 2011-02-01 13:29:18 -0800 | [diff] [blame] | 93 | $(TOPDIR)development/build/tools/patch_windows_sdk.sh $(subst @,-q,$(hide)) \ |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 94 | $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR) |
Raphael Moll | 9ca69cf | 2013-02-12 13:48:39 -0800 | [diff] [blame] | 95 | $(hide) PLATFORM_VERSION=$(PLATFORM_VERSION) \ |
| 96 | $(TOPDIR)sdk/build/patch_windows_sdk.sh $(subst @,-q,$(hide)) \ |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame] | 97 | $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR) |
Raphael | 16ede62 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 98 | $(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)" |