Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 1 | # Makefile to build the SDK repository packages. |
| 2 | |
| 3 | .PHONY: sdk_repo |
| 4 | |
Raphael Moll | 9516dc5 | 2012-02-27 15:18:29 -0800 | [diff] [blame] | 5 | SDK_REPO_DEPS := |
| 6 | SDK_REPO_XML_ARGS := |
| 7 | SDK_EXTRAS_DEPS := |
| 8 | SDK_EXTRAS_XML_ARGS := |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 9 | |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 10 | # Define the name of a package zip file to generate |
| 11 | # $1=OS (e.g. linux-x86, windows, etc) |
| 12 | # $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) |
| 13 | # $3=package to create (e.g. tools, docs, etc.) |
| 14 | # |
| 15 | define sdk-repo-pkg-zip |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 16 | $(dir $(2))/sdk-repo-$(1)-$(3)-$(FILE_NAME_TAG).zip |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 17 | endef |
| 18 | |
| 19 | # Defines the rule to build an SDK repository package by zipping all |
| 20 | # the content of the given directory. |
| 21 | # E.g. given a folder out/host/linux.../sdk/android-eng-sdk/tools |
| 22 | # this generates an sdk-repo-linux-tools that contains tools/* |
| 23 | # |
| 24 | # $1=OS (e.g. linux-x86, windows, etc) |
| 25 | # $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) |
| 26 | # $3=package to create (e.g. tools, docs, etc.) |
| 27 | # |
| 28 | # The rule depends on the SDK zip file, which is defined by $2. |
| 29 | # |
| 30 | define mk-sdk-repo-pkg-1 |
| 31 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) |
| 32 | @echo "Building SDK repository package $(3) from $(notdir $(2))" |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 33 | $(hide) cd $(basename $(2)) && \ |
| 34 | zip -9rq ../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) $(3)/* |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 35 | $(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 36 | SDK_REPO_XML_ARGS += $(3) $(1) \ |
| 37 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 38 | endef |
| 39 | |
| 40 | # Defines the rule to build an SDK repository package when the |
| 41 | # package directory contains a single platform-related inner directory. |
| 42 | # E.g. given a folder out/host/linux.../sdk/android-eng-sdk/samples/android-N |
| 43 | # this generates an sdk-repo-linux-samples that contains android-N/* |
| 44 | # |
| 45 | # $1=OS (e.g. linux-x86, windows, etc) |
| 46 | # $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) |
| 47 | # $3=package to create (e.g. platforms, samples, etc.) |
| 48 | # |
| 49 | # The rule depends on the SDK zip file, which is defined by $2. |
| 50 | # |
| 51 | define mk-sdk-repo-pkg-2 |
| 52 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) |
| 53 | @echo "Building SDK repository package $(3) from $(notdir $(2))" |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 54 | $(hide) cd $(basename $(2))/$(3) && \ |
| 55 | zip -9rq ../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) * |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 56 | $(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 57 | SDK_REPO_XML_ARGS += $(3) $(1) \ |
| 58 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 59 | endef |
| 60 | |
Raphael Moll | 3d308aa | 2011-10-01 23:44:08 -0700 | [diff] [blame] | 61 | # Defines the rule to build an SDK repository package when the |
| 62 | # package directory contains 3 levels from the sdk dir, for example |
| 63 | # to package SDK/extra/android/support or SDK/system-images/android-N/armeabi. |
| 64 | # Because we do not know the intermediary directory name, this only works |
| 65 | # if each directory contains a single sub-directory (e.g. sdk/$4/*/* must be |
| 66 | # unique.) |
| 67 | # |
| 68 | # $1=OS (e.g. linux-x86, windows, etc) |
| 69 | # $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) |
| 70 | # $3=package to create (e.g. system-images, support, etc.) |
| 71 | # $4=the root of directory to package in the sdk (e.g. extra/android). |
| 72 | # this must be a 2-segment path, the last one can be *. |
| 73 | # |
| 74 | # The rule depends on the SDK zip file, which is defined by $2. |
| 75 | # |
| 76 | define mk-sdk-repo-pkg-3 |
| 77 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) |
| 78 | @echo "Building SDK repository package $(3) from $(notdir $(2))" |
| 79 | $(hide) cd $(basename $(2))/$(4) && \ |
| 80 | zip -9rq ../../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) * |
| 81 | $(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
| 82 | SDK_REPO_XML_ARGS += $(3) $(1) \ |
| 83 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
| 84 | endef |
| 85 | |
Raphael Moll | da9eabd | 2011-09-28 11:18:34 -0700 | [diff] [blame] | 86 | # Defines the rule to build an SDK sources package. |
| 87 | # |
| 88 | # $1=OS (e.g. linux-x86, windows, etc) |
| 89 | # $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) |
| 90 | # $3=package to create, must be "sources" |
| 91 | # |
| 92 | define mk-sdk-repo-sources |
Raphael | d79eab5 | 2011-11-15 16:30:14 -0800 | [diff] [blame] | 93 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) $(HOST_OUT)/development/sdk/source_source.properties |
Raphael Moll | da9eabd | 2011-09-28 11:18:34 -0700 | [diff] [blame] | 94 | @echo "Building SDK sources package" |
Raphael Moll | a85a93f | 2012-03-27 10:45:59 -0700 | [diff] [blame] | 95 | $(hide) $(TOPDIR)development/build/tools/mk_sources_zip.py --exec-zip \ |
Raphael | d79eab5 | 2011-11-15 16:30:14 -0800 | [diff] [blame] | 96 | $(HOST_OUT)/development/sdk/source_source.properties \ |
Raphael Moll | da9eabd | 2011-09-28 11:18:34 -0700 | [diff] [blame] | 97 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)) \ |
| 98 | $(TOPDIR). |
| 99 | $(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
| 100 | SDK_REPO_XML_ARGS += $(3) $(1) \ |
| 101 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
| 102 | endef |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 103 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 104 | # ----------------------------------------------------------------- |
Raphael Moll | 9516dc5 | 2012-02-27 15:18:29 -0800 | [diff] [blame] | 105 | # Rules for main host sdk |
| 106 | |
| 107 | ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),) |
| 108 | |
| 109 | # Note that extras are now located in addon.xml, not in repository.xml, |
| 110 | # so we capture all extras first. |
| 111 | $(eval $(call mk-sdk-repo-pkg-3,$(HOST_OS),$(MAIN_SDK_ZIP),support,extras/android)) |
| 112 | SDK_EXTRAS_XML_ARGS := $(SDK_REPO_XML_ARGS) |
| 113 | SDK_REPO_XML_ARGS := |
| 114 | |
| 115 | SDK_EXTRAS_DEPS += \ |
| 116 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),support) |
| 117 | |
| 118 | |
| 119 | $(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),tools)) |
| 120 | $(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools)) |
| 121 | $(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),docs)) |
| 122 | $(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),platforms)) |
| 123 | $(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),samples)) |
| 124 | $(eval $(call mk-sdk-repo-pkg-3,$(HOST_OS),$(MAIN_SDK_ZIP),system-images,system-images/*)) |
| 125 | $(eval $(call mk-sdk-repo-sources,$(HOST_OS),$(MAIN_SDK_ZIP),sources)) |
| 126 | |
| 127 | SDK_REPO_DEPS += \ |
| 128 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),tools) \ |
| 129 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools) \ |
| 130 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),docs) \ |
| 131 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platforms) \ |
| 132 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),samples) \ |
| 133 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),system-images) \ |
| 134 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),sources) |
| 135 | |
| 136 | endif |
| 137 | |
| 138 | # ----------------------------------------------------------------- |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 139 | # Rules for win_sdk |
| 140 | |
| 141 | ifneq ($(WIN_SDK_ZIP),) |
| 142 | |
| 143 | # docs, platforms and samples have nothing OS-dependent right now. |
| 144 | $(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),tools)) |
| 145 | $(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),platform-tools)) |
| 146 | |
| 147 | SDK_REPO_DEPS += \ |
Raphael Moll | 4dedff6 | 2011-09-27 20:17:07 -0700 | [diff] [blame] | 148 | $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),tools) \ |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 149 | $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),platform-tools) |
| 150 | |
| 151 | endif |
| 152 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 153 | # ----------------------------------------------------------------- |
Raphael Moll | 9516dc5 | 2012-02-27 15:18:29 -0800 | [diff] [blame] | 154 | # Pickup the most recent xml schema for repository and add-on |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 155 | |
Raphael Moll | 9516dc5 | 2012-02-27 15:18:29 -0800 | [diff] [blame] | 156 | SDK_REPO_XSD := \ |
| 157 | $(lastword \ |
| 158 | $(wildcard \ |
| 159 | $(TOPDIR)sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-*.xsd \ |
| 160 | )) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 161 | |
Raphael Moll | 9516dc5 | 2012-02-27 15:18:29 -0800 | [diff] [blame] | 162 | SDK_ADDON_XSD := \ |
| 163 | $(lastword \ |
| 164 | $(wildcard \ |
| 165 | $(TOPDIR)sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-*.xsd \ |
| 166 | )) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 167 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 168 | # ----------------------------------------------------------------- |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 169 | # Rules for sdk addon |
| 170 | |
| 171 | ifneq ($(ADDON_SDK_ZIP),) |
| 172 | |
| 173 | # ADDON_SDK_ZIP is defined in build/core/tasks/sdk-addon.sh and is |
| 174 | # already packaged correctly. All we have to do is dist it with |
| 175 | # a different destination name. |
| 176 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 177 | RENAMED_ADDON_ZIP := $(ADDON_SDK_ZIP):$(notdir $(call sdk-repo-pkg-zip,$(HOST_OS),$(ADDON_SDK_ZIP),addon)) |
| 178 | |
| 179 | $(call dist-for-goals, sdk_repo, $(RENAMED_ADDON_ZIP)) |
| 180 | |
| 181 | # Also generate the addon.xml using the latest schema and the renamed addon zip |
| 182 | |
| 183 | SDK_ADDON_XML := $(dir $(ADDON_SDK_ZIP))/addon.xml |
| 184 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 185 | $(SDK_ADDON_XML): $(ADDON_SDK_ZIP) |
| 186 | $(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \ |
| 187 | $(SDK_ADDON_XML) $(SDK_ADDON_XSD) add-on $(HOST_OS) $(RENAMED_ADDON_ZIP) |
| 188 | |
| 189 | $(call dist-for-goals, sdk_repo, $(SDK_ADDON_XML)) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 190 | |
| 191 | endif |
| 192 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 193 | # ----------------------------------------------------------------- |
| 194 | # Rules for the SDK Repository XML |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 195 | |
Raphael Moll | 9516dc5 | 2012-02-27 15:18:29 -0800 | [diff] [blame] | 196 | SDK_REPO_XML := $(HOST_OUT)/sdk/repository.xml |
| 197 | SDK_EXTRAS_XML := $(HOST_OUT)/sdk/repo-extras.xml |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 198 | |
| 199 | ifneq ($(SDK_REPO_XML_ARGS),) |
| 200 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 201 | $(SDK_REPO_XML): $(SDK_REPO_DEPS) |
| 202 | $(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \ |
| 203 | $(SDK_REPO_XML) $(SDK_REPO_XSD) $(SDK_REPO_XML_ARGS) |
| 204 | |
| 205 | $(call dist-for-goals, sdk_repo, $(SDK_REPO_XML)) |
| 206 | |
| 207 | else |
| 208 | |
| 209 | $(SDK_REPO_XML): ; |
| 210 | |
| 211 | endif |
| 212 | |
Raphael Moll | 9516dc5 | 2012-02-27 15:18:29 -0800 | [diff] [blame] | 213 | |
| 214 | ifneq ($(SDK_EXTRAS_XML_ARGS),) |
| 215 | |
| 216 | $(SDK_EXTRAS_XML): $(SDK_EXTRAS_DEPS) |
| 217 | $(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \ |
| 218 | $(SDK_EXTRAS_XML) $(SDK_ADDON_XSD) $(SDK_EXTRAS_XML_ARGS) |
| 219 | |
| 220 | $(call dist-for-goals, sdk_repo, $(SDK_EXTRAS_XML)) |
| 221 | |
| 222 | else |
| 223 | |
| 224 | $(SDK_EXTRAS_XML): ; |
| 225 | |
| 226 | endif |
| 227 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 228 | # ----------------------------------------------------------------- |
| 229 | |
Raphael Moll | 9516dc5 | 2012-02-27 15:18:29 -0800 | [diff] [blame] | 230 | sdk_repo: $(SDK_REPO_DEPS) $(SDK_REPO_XML) $(SDK_EXTRAS_XML) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 231 | @echo "Packing of SDK repository done" |
| 232 | |