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 15ifneq ($(shell uname),Linux) 16$(error Linux is required to create a Windows SDK) 17endif 18ifeq ($(strip $(shell which unix2dos todos 2>/dev/null)),) 19$(error Need a unix2dos command. Please 'apt-get install tofrodos') 20endif 21 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. 25include $(TOPDIR)sdk/build/windows_sdk_tools.mk 26 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. 30WIN_TARGETS := \ 31 aapt \ 32 aapt2 \ 33 adb \ 34 aidl \ 35 aprotoc \ 36 bcc_compat \ 37 clang \ 38 etc1tool \ 39 dexdump dmtracedump \ 40 fastboot \ 41 hprof-conv \ 42 libaapt2_jni \ 43 llvm-rs-cc \ 44 sqlite3 \ 45 zipalign \ 46 split-select \ 47 $(WIN_SDK_TARGETS) 48 49WIN_TARGETS := $(foreach t,$(WIN_TARGETS),$(ALL_MODULES.host_cross_$(t).INSTALLED)) 50 51# MAIN_SDK_NAME/DIR is set in build/core/Makefile 52WIN_SDK_NAME := $(subst $(HOST_OS)-$(SDK_HOST_ARCH),windows,$(MAIN_SDK_NAME)) 53WIN_SDK_DIR := $(subst $(HOST_OS)-$(SDK_HOST_ARCH),windows,$(MAIN_SDK_DIR)) 54WIN_SDK_ZIP := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip 55 56$(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP)) 57 58.PHONY: win_sdk winsdk-tools 59 60define winsdk-banner 61$(info ) 62$(info ====== [Windows SDK] $1 ======) 63$(info ) 64endef 65 66define winsdk-info 67$(info MAIN_SDK_NAME: $(MAIN_SDK_NAME)) 68$(info WIN_SDK_NAME : $(WIN_SDK_NAME)) 69$(info WIN_SDK_DIR : $(WIN_SDK_DIR)) 70$(info WIN_SDK_ZIP : $(WIN_SDK_ZIP)) 71endef 72 73win_sdk: $(WIN_SDK_ZIP) 74 $(call winsdk-banner,Done) 75 76winsdk-tools: $(WIN_TARGETS) 77 $(call winsdk-banner,Tools Done) 78 79$(WIN_SDK_ZIP): $(WIN_TARGETS) $(INTERNAL_SDK_TARGET) 80 $(call winsdk-banner,Build $(WIN_SDK_NAME)) 81 $(call winsdk-info) 82 $(hide) rm -rf $(WIN_SDK_DIR) 83 $(hide) mkdir -p $(WIN_SDK_DIR) 84 $(hide) cp -rf $(MAIN_SDK_DIR)/$(MAIN_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME) 85 $(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \ 86 PLATFORM_VERSION=$(PLATFORM_VERSION) \ 87 $(TOPDIR)development/build/tools/patch_windows_sdk.sh $(subst @,-q,$(hide)) \ 88 $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR) 89 $(hide) PLATFORM_VERSION=$(PLATFORM_VERSION) \ 90 $(TOPDIR)sdk/build/patch_windows_sdk.sh $(subst @,-q,$(hide)) \ 91 $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR) 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)" 98