development
Revision | 2ff496b8a14f3f2c68cd5a4d71d3f50a892b4811 (tree) |
---|---|
Zeit | 2011-02-17 13:25:43 |
Autor | Raphael <raphael@goog...> |
Commiter | Raphael |
Build SDK repository.
When the build is invoked with the fake target "sdk_repo" and
a main target of sdk, win_sdk or sdk_addon, we now create
packages in DIST_DIR that can directly be used to populate the
SDK Repository.
This is quite close to how we actually distribute the SDK.
Change-Id: I01c729eff4dbc1eccbc7c5b1869f329363f1ce07
@@ -0,0 +1,106 @@ | ||
1 | +# Makefile to build the SDK repository packages. | |
2 | + | |
3 | +.PHONY: sdk_repo | |
4 | + | |
5 | +# Define the name of a package zip file to generate | |
6 | +# $1=OS (e.g. linux-x86, windows, etc) | |
7 | +# $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) | |
8 | +# $3=package to create (e.g. tools, docs, etc.) | |
9 | +# | |
10 | +define sdk-repo-pkg-zip | |
11 | +$(dir $(2))/sdk-repo-$(1)-$(3).zip | |
12 | +endef | |
13 | + | |
14 | +# Defines the rule to build an SDK repository package by zipping all | |
15 | +# the content of the given directory. | |
16 | +# E.g. given a folder out/host/linux.../sdk/android-eng-sdk/tools | |
17 | +# this generates an sdk-repo-linux-tools that contains tools/* | |
18 | +# | |
19 | +# $1=OS (e.g. linux-x86, windows, etc) | |
20 | +# $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) | |
21 | +# $3=package to create (e.g. tools, docs, etc.) | |
22 | +# | |
23 | +# The rule depends on the SDK zip file, which is defined by $2. | |
24 | +# | |
25 | +define mk-sdk-repo-pkg-1 | |
26 | +$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) | |
27 | + @echo "Building SDK repository package $(3) from $(notdir $(2))" | |
28 | + $(hide) cd $(dir $(2)) && \ | |
29 | + zip -9rq ../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) \ | |
30 | + $(basename $(2))/* | |
31 | +$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) | |
32 | +endef | |
33 | + | |
34 | +# Defines the rule to build an SDK repository package when the | |
35 | +# package directory contains a single platform-related inner directory. | |
36 | +# E.g. given a folder out/host/linux.../sdk/android-eng-sdk/samples/android-N | |
37 | +# this generates an sdk-repo-linux-samples that contains android-N/* | |
38 | +# | |
39 | +# $1=OS (e.g. linux-x86, windows, etc) | |
40 | +# $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) | |
41 | +# $3=package to create (e.g. platforms, samples, etc.) | |
42 | +# | |
43 | +# The rule depends on the SDK zip file, which is defined by $2. | |
44 | +# | |
45 | +define mk-sdk-repo-pkg-2 | |
46 | +$(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) | |
47 | + @echo "Building SDK repository package $(3) from $(notdir $(2))" | |
48 | + $(hide) cd $(dir $(2))/$(3) && \ | |
49 | + zip -9rq ../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) \ | |
50 | + $(basename $(2))/* | |
51 | +$(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) | |
52 | +endef | |
53 | + | |
54 | + | |
55 | +SDK_REPO_DEPS := | |
56 | + | |
57 | +# Rules for win_sdk | |
58 | + | |
59 | +ifneq ($(WIN_SDK_ZIP),) | |
60 | + | |
61 | +# docs, platforms and samples have nothing OS-dependent right now. | |
62 | +$(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),tools)) | |
63 | +$(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),platform-tools)) | |
64 | + | |
65 | +SDK_REPO_DEPS += \ | |
66 | + $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),tools) \ | |
67 | + $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),platform-tools) | |
68 | + | |
69 | +endif | |
70 | + | |
71 | +# Rules for main host sdk | |
72 | + | |
73 | +ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),) | |
74 | + | |
75 | +$(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),tools)) | |
76 | +$(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools)) | |
77 | +$(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),docs)) | |
78 | +$(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),platforms)) | |
79 | +$(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),samples)) | |
80 | + | |
81 | +SDK_REPO_DEPS += \ | |
82 | + $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),tools) \ | |
83 | + $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools) \ | |
84 | + $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),docs) \ | |
85 | + $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platforms) \ | |
86 | + $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),samples) \ | |
87 | + | |
88 | +endif | |
89 | + | |
90 | +# Rules for sdk addon | |
91 | + | |
92 | +ifneq ($(ADDON_SDK_ZIP),) | |
93 | + | |
94 | +# ADDON_SDK_ZIP is defined in build/core/tasks/sdk-addon.sh and is | |
95 | +# already packaged correctly. All we have to do is dist it with | |
96 | +# a different destination name. | |
97 | + | |
98 | +$(call dist-for-goals, sdk_repo, \ | |
99 | + $(ADDON_SDK_ZIP):$(notdir $(call sdk-repo-pkg-zip,$(HOST_OS),$(ADDON_SDK_ZIP),addon))) | |
100 | + | |
101 | +endif | |
102 | + | |
103 | + | |
104 | +sdk_repo: $(SDK_REPO_DEPS) | |
105 | + @echo "Packing of SDK repository done" | |
106 | + |
@@ -46,15 +46,12 @@ WIN_BUILD_PREREQ := \ | ||
46 | 46 | llvm-rs-cc |
47 | 47 | |
48 | 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 | |
49 | +# MAIN_SDK_NAME/DIR is set in build/core/Makefile | |
50 | +WIN_SDK_NAME := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_NAME)) | |
51 | +WIN_SDK_DIR := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(MAIN_SDK_DIR)) | |
52 | +WIN_SDK_ZIP := $(WIN_SDK_DIR)/$(WIN_SDK_NAME).zip | |
53 | 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)) | |
54 | +$(call dist-for-goals, win_sdk, $(WIN_SDK_ZIP)) | |
58 | 55 | |
59 | 56 | .PHONY: win_sdk winsdk-tools |
60 | 57 |
@@ -65,10 +62,10 @@ $(info ) | ||
65 | 62 | endef |
66 | 63 | |
67 | 64 | 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)) | |
65 | +$(info MAIN_SDK_NAME: $(MAIN_SDK_NAME)) | |
66 | +$(info WIN_SDK_NAME : $(WIN_SDK_NAME)) | |
67 | +$(info WIN_SDK_DIR : $(WIN_SDK_DIR)) | |
68 | +$(info WIN_SDK_ZIP : $(WIN_SDK_ZIP)) | |
72 | 69 | endef |
73 | 70 | |
74 | 71 | win_sdk: $(WIN_SDK_ZIP) |
@@ -83,7 +80,7 @@ $(WIN_SDK_ZIP): winsdk-tools sdk | ||
83 | 80 | $(call winsdk-info) |
84 | 81 | $(hide) rm -rf $(WIN_SDK_DIR) |
85 | 82 | $(hide) mkdir -p $(WIN_SDK_DIR) |
86 | - $(hide) cp -rf $(LINUX_SDK_DIR)/$(LINUX_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME) | |
83 | + $(hide) cp -rf $(MAIN_SDK_DIR)/$(MAIN_SDK_NAME) $(WIN_SDK_DIR)/$(WIN_SDK_NAME) | |
87 | 84 | $(hide) USB_DRIVER_HOOK=$(USB_DRIVER_HOOK) \ |
88 | 85 | $(TOPDIR)development/build/tools/patch_windows_sdk.sh $(subst @,-q,$(hide)) \ |
89 | 86 | $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR) |